REPORT ZVVF_MR48_CHALLAN .
*---------------------------------------------------------------------*
* *
* MODULE : Material Management *
* *
*---------------------------------------------------------------------*
* Objective : Challan/Annexure for movement of Inputs *
* *
* Program : Update Tables ( ) Download Data ( ) Outputs List (X)*
* Technical Specs No : VVF_TS01_MM048_R_CHALLAN_V1.0 *
* *
* Date Created : *
* Author : *
* Location : *
* LDB : *
* *
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
* Tables *
*---------------------------------------------------------------------*
TABLES :MSEG, "Document Segment Material: Item Data
MARA, "Material Master
ADRC. "Addresses (Business Address Services)
*----------------------------------------------------------------------*
* INTERNAL TABLES: Begin with IT_ *
*----------------------------------------------------------------------*
DATA: IT_MSEG TYPE STANDARD TABLE OF MSEG INITIAL SIZE 1,
IT_SUPP_PLNT TYPE STANDARD TABLE OF ADRC WITH HEADER LINE,
IT_PRO_PLNT TYPE STANDARD TABLE OF ADRC WITH HEADER LINE.
*----------------------------------------------------------------------*
* STRUCTURES : Begin with WA_ *
*----------------------------------------------------------------------*
DATA: WA_MSEG TYPE MSEG.
*----------------------------------------------------------------------*
* DATA : Begin with W_ *
*----------------------------------------------------------------------*
DATA: W_FORMNAME TYPE TDSFNAME,
W_ADRNR TYPE ADRNR,
W_MAKTX LIKE MAKT-MAKTX,
W_J_1IEXRN TYPE J_1IEXRN,
W_J_1IEXRG TYPE J_1IEXRG,
W_J_1IEXDI TYPE J_1IEXDI,
W_J_1IEXCO TYPE J_1IEXCO,
W_J_1ICHID TYPE J_1ICHID,
W_BUDAT TYPE BUDAT,
W_QUANTITY(17) TYPE C,
W_J_1IVALASS TYPE J_1IVALASS,
W_ASSVAL(16) TYPE C.
*----------------------------------------------------------------------*
* SELECT-OPTIONS: Begin with SO_ *
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK CHALLAN WITH FRAME TITLE TEXT-001.
PARAMETERS: PR_MBLNR TYPE MSEG-MBLNR OBLIGATORY, "No. of Mat. Document
PR_SUPLT TYPE MSEG-WERKS OBLIGATORY,"SUPPLIER PLANT
PR_PRPLT TYPE MSEG-WERKS OBLIGATORY."PROCESSING PLANT
SELECTION-SCREEN END OF BLOCK CHALLAN.
*----------------------------------------------------------------------*
* START-OF-SELECTION *
*----------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM F001_FETCH_DATA.
*---------------------------------------------------------------------*
* END-OF-SELECTION *
*---------------------------------------------------------------------*
END-OF-SELECTION.
*---------------------------------------------------------------------*
* CALL TO FUNCTION-MODULE *
*---------------------------------------------------------------------*
IF WA_MSEG IS NOT INITIAL.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZVVF_ML_48_CHALLAN'
IMPORTING
FM_NAME = W_FORMNAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC = 0.
CALL FUNCTION W_FORMNAME
EXPORTING
W_BUDAT = W_BUDAT
W_MAKTX = W_MAKTX
W_J_1IEXRN = W_J_1IEXRN
W_J_1IEXRG = W_J_1IEXRG
W_J_1IEXDI = W_J_1IEXDI
W_J_1IEXCO = W_J_1IEXCO
W_J_1ICHID = W_J_1ICHID
W_ASSVAL = W_ASSVAL
WA_MSEG = WA_MSEG
W_QUANTITY = W_QUANTITY
TABLES
* IT_MSEG = IT_MSEG
IT_SUPP_PLNT = IT_SUPP_PLNT
IT_PRO_PLNT = IT_PRO_PLNT
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
ENDIF.
ELSE.
MESSAGE E133(ZMM).
ENDIF.
*&---------------------------------------------------------------------*
*& Form F001_FETCH_DATA
*&---------------------------------------------------------------------*
FORM F001_FETCH_DATA .
* GET DOCUMENT DATA FROM MSEG
SELECT SINGLE *
FROM MSEG
INTO CORRESPONDING FIELDS OF WA_MSEG
WHERE MBLNR = PR_MBLNR.
W_QUANTITY = WA_MSEG-MENGE.
* GET POSTING DATE OF DOCUMENT FROM MKPF
SELECT SINGLE BUDAT
FROM MKPF
INTO W_BUDAT
WHERE MBLNR = WA_MSEG-MBLNR.
* GET MATERIAL DESCRIPTION
SELECT SINGLE MAKTX
FROM MAKT
INTO W_MAKTX
WHERE MATNR = WA_MSEG-MATNR.
* GET RANGE DIVISION & COMMISSIONERATE
SELECT SINGLE J_1IEXRN J_1IEXRG J_1IEXDI J_1IEXCO
INTO (W_J_1IEXRN,W_J_1IEXRG,W_J_1IEXDI,W_J_1IEXCO)
FROM J_1IMOCOMP
WHERE WERKS = PR_SUPLT.
* GET CHAPTER-ID FOR MATERIAL & SUPP PLANT
SELECT SINGLE J_1ICHID
FROM J_1IMTCHID
INTO W_J_1ICHID
WHERE MATNR = WA_MSEG-MATNR AND WERKS = PR_SUPLT.
* GET ASSESSABLE VALUE
SELECT SINGLE J_1IVALASS
FROM J_1IASSVAL
INTO W_J_1IVALASS
WHERE J_1IMATNR = WA_MSEG-MATNR AND J_1IWERKS = PR_SUPLT.
W_J_1IVALASS = W_J_1IVALASS * WA_MSEG-MENGE.
W_ASSVAL = W_J_1IVALASS.
CLEAR W_ADRNR.
* GET SUPPLIER PLANT
SELECT SINGLE ADRNR
FROM T001W
INTO W_ADRNR
WHERE WERKS = PR_SUPLT.
SELECT SINGLE *
FROM ADRC
INTO CORRESPONDING FIELDS OF IT_SUPP_PLNT
WHERE ADDRNUMBER = W_ADRNR.
CLEAR W_ADRNR.
* GET PROCESSING PLANT
SELECT SINGLE ADRNR
FROM T001W
INTO W_ADRNR
WHERE WERKS = PR_PRPLT.
SELECT SINGLE *
FROM ADRC
INTO CORRESPONDING FIELDS OF IT_PRO_PLNT
WHERE ADDRNUMBER = W_ADRNR.
ENDFORM. " F001_FETCH_DATA
No comments:
Post a Comment