Code: Alles auswählen.
* Batchinputdata of single transaction
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
*begin_method z_dispodummywerte_vorbelegen changing container.
DATA: material LIKE mara-matnr,
plant LIKE marc-werks,
lager LIKE marc-lgpro.
*swc_get_element container 'Material' material.
*swc_get_element container 'Plant' plant.
*NUR zum TEST
plant = '0020'.
material = '77006912'.
*NUR zum TEST
*Einstieg
PERFORM bdc_dynpro USING 'SAPLMGMM' '0060'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMMG1-MATNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
*-->Material
PERFORM bdc_field USING 'RMMG1-MATNR'
material.
*<--Material
PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(09)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(06)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(07)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(08)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(09)'
'X'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0080'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMMG1-LGORT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
*-->Werk und Lager zuordnen
PERFORM bdc_field USING 'RMMG1-WERKS'
plant.
*<--Werk und Lager zuordnen
IF plant EQ '0020'.
PERFORM bdc_field USING 'RMMG1-LGORT'
'WS01'.
ELSEIF plant EQ '0010'.
PERFORM bdc_field USING 'RMMG1-LGORT'
'DS01'.
ENDIF.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ZU06'.
*Sicht: DISPOSITION 1
PERFORM bdc_field USING 'MARC-DISGR'
'0001'.
PERFORM bdc_field USING 'MARC-DISMM'
'PD'.
PERFORM bdc_field USING 'MARC-DISPO'
'998'.
IF plant EQ '0020'.
PERFORM bdc_field USING 'MARC-DISLS'
'ZY'.
ELSEIF plant EQ '0010'.
PERFORM bdc_field USING 'MARC-DISLS'
'ZA'.
ENDIF.
PERFORM bdc_field USING 'MARC-MMSTA'
'GF'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4300'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BABA'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
*Sicht: DISPOSITION 2
IF plant EQ '0020'.
PERFORM bdc_field USING 'MARC-LGPRO'
'WS01'.
PERFORM bdc_field USING 'MARC-LGFSB'
'WS01'.
ELSEIF plant EQ '0010'.
PERFORM bdc_field USING 'MARC-LGPRO'
'DS01'.
PERFORM bdc_field USING 'MARC-LGFSB'
'DS01'.
ENDIF.
PERFORM bdc_field USING 'MARC-RGEKZ'
'2'.
PERFORM bdc_field USING 'MARC-PLIFZ'
'360'.
PERFORM bdc_field USING 'MARC-WEBAZ'
'2'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SP15'.
PERFORM bdc_field USING 'MARC-PERKZ'
'M'.
PERFORM bdc_field USING 'MARC-MTVFP'
'02'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
*Sicht: DISPOSITION 4
PERFORM bdc_field USING 'MARC-SBDKZ'
'2'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=YES'.
*perform bdc_transaction using 'MM02'.
CALL TRANSACTION 'MM02' USING bdcdata MODE 'N' UPDATE 'S'.
*----------------------------------------------------------------
* Start new screen *
*----------------------------------------------------------------
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
*----------------------------------------------------------------
* Insert field *
*----------------------------------------------------------------
FORM BDC_FIELD USING FNAM FVAL.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDFORM.