Skip to Content
0
Jul 07, 2006 at 12:22 PM

mb1b batchinput

42 Views

Hi,

Below, you can see the batch input that runs with tcode MB1B and that i need to move the stock of project between wbs's. Generally it works but with a selection of target wbs, problem occurs.

I'll be grateful to your help,

Many thanks

DATA : BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

DATA : MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

DATA : I(2) type N,

WMATNR LIKE MSEG-MATNR,

  • WMENGE LIKE MSEG-MENGE,

WCHARG LIKE MSEG-CHARG,

WMATNR_TEXT(14) TYPE C,

WMENGE_TEXT(15) TYPE C,

WCHARG_TEXT(14) TYPE C.

START-OF-SELECTION.

PERFORM MB1B_415Q_BATCHINPUT.

FORM MB1B_415Q_BATCHINPUT.

DATA : MODE.

CLEAR BDCDATA. REFRESH BDCDATA.

CLEAR MESSTAB. REFRESH MESSTAB.

PERFORM BDC_APPEND USING 'X' 'SAPMM07M' '0400'.

PERFORM BDC_APPEND USING '' 'BDC_OKCODE' '/00'.

PERFORM BDC_APPEND USING '' 'MKPF-BLDAT' '05.06.2006'.

PERFORM BDC_APPEND USING '' 'MKPF-BUDAT' '06.06.2006'.

PERFORM BDC_APPEND USING '' 'RM07M-BWARTWA' '415'.

PERFORM BDC_APPEND USING '' 'RM07M-SOBKZ' 'Q'.

PERFORM BDC_APPEND USING '' 'RM07M-WERKS' '1001'.

PERFORM BDC_APPEND USING '' 'RM07M-LGORT' '1000'.

*****************************

PERFORM BDC_APPEND USING 'X' 'SAPMM07M' '0421'.

PERFORM BDC_APPEND USING '' 'BDC_OKCODE' '/00'.

PERFORM BDC_APPEND USING '' 'MSEGK-UMLGO' '1000'.

  • PERFORM BDC_APPEND USING '' 'COBL-GSBER' '1000'.

PERFORM BDC_APPEND USING '' 'MSEGK-MAT_PSPNR' 'P1' ."B1B_415Q_2-MAT_PSPNR.

CLEAR I.

I = I + 1.

WMATNR = '1014295'.

CONDENSE WMATNR NO-GAPS.

CLEAR : WMENGE_TEXT , WMATNR_TEXT,WCHARG_TEXT.

CONCATENATE 'MSEG-MATNR(' I ')' INTO WMATNR_TEXT.

PERFORM BDC_APPEND USING '' WMATNR_TEXT WMATNR.

CONCATENATE 'MSEG-ERFMG(' I ')' INTO WMENGE_TEXT.

PERFORM BDC_APPEND USING '' WMENGE_TEXT '5'.

PERFORM BDC_APPEND USING 'X' 'SAPLKACB' '0002'.

PERFORM BDC_APPEND USING '' 'BDC_OKCODE' '=ENTE'.

PERFORM BDC_APPEND USING '' 'COBL-GSBER' '100'.

PERFORM BDC_APPEND USING 'X' 'SAPMM07M' '0410'.

PERFORM BDC_APPEND USING '' 'MSEG-PS_PSP_PNR' 'P3'."MB1B_415Q-PS_PSP_PNR.

  • PERFORM BDC_APPEND USING '' 'DKACB-FMORE' 'X'.

PERFORM BDC_APPEND USING 'X' 'SAPLKACB' '0002'.

PERFORM BDC_APPEND USING '' 'BDC_OKCODE' '=ENTE'.

PERFORM BDC_APPEND USING '' 'COBL-GSBER' '100'.

MODE = 'A'.

CALL TRANSACTION 'MB1B' USING BDCDATA

MODE MODE

UPDATE 'S'

MESSAGES INTO messtab.

ENDFORM. "MB1B_415Q_BATCHINPUT

FORM BDC_APPEND USING VALUE(P_0001)

VALUE(P_0002)

VALUE(P_0003).

CLEAR BDCDATA.

IF P_0001 = 'X'.

BDCDATA-PROGRAM = P_0002.

BDCDATA-DYNPRO = P_0003.

BDCDATA-DYNBEGIN = 'X'.

ELSE.

BDCDATA-FNAM = P_0002.

BDCDATA-FVAL = P_0003.

ENDIF.

APPEND BDCDATA.

ENDFORM.