2007 Aug 17 3:02 PM
Hi friends,
I am creating the batch using the transaction MSC1. And the following code I have written to create the batch
SHIFT P_MATNR LEFT DELETING LEADING '0'.
PERFORM BDCDYNPRO USING 'SAPMM03S' '0105'.
PERFORM BDCDATEN USING 'BDC_OKCODE' '/00'.
PERFORM BDCDATEN USING 'RM03S-MATNR' P_MATNR.
PERFORM BDCDATEN USING 'RM03S-WERKS' P_WERKS.
PERFORM BDCDATEN USING 'RM03S-CHARG' P_CHARG.
PERFORM BDCDATEN USING 'RM03S-LGORT' X_LGORT.
PERFORM BDCDATEN USING 'RM03S-REF_MATNR' SPACE.
PERFORM BDCDATEN USING 'RM03S-REF_WERKS' SPACE.
PERFORM BDCDATEN USING 'RM03S-REF_CHARG' SPACE.
PERFORM BDCDYNPRO USING 'SAPMM03S' '0200'.
PERFORM BDCDATEN USING 'BDC_OKCODE' '=BU'.
shift p_matnr right deleting trailing space.
translate p_matnr using ' 0'.
SELECT SINGLE * FROM MBEW WHERE MATNR = P_MATNR
AND BWKEY = P_WERKS
AND BWTAR NE SPACE.
IF SY-SUBRC EQ 0.
CLEAR X_BWTAR.
SPLIT P_CHARG AT '/' INTO X_ZNPORD X_ZNPLOT.
SELECT SINGLE * FROM ZV1FPL WHERE ZNPORD = X_ZNPORD
AND ZNPLOT = X_ZNPLOT.
IF SY-SUBRC EQ 0 and ( zv1fpl-zprwerks = 'RG' or
zv1fpl-werks = 'DY' or zv1fpl-werks = 'RO' ) .
CONCATENATE 'PP_' ZV1FPL-ZPRWERKS INTO X_BWTAR.
ELSE.
X_BWTAR = 'PP_IMPT'.
ENDIF.
PERFORM BDCDATEN USING 'MCHA-BWTAR' X_BWTAR.
ENDIF.
CALL TRANSACTION 'MSC1' USING BDCDATA MODE XMODE
MESSAGES INTO MESSTAB.
IF SY-SUBRC NE 0.
MESSAGE E241(ZZ) WITH 'Call Transaction ''MSC1'' failed !'
RAISING FUNCTION_FAILED.
ENDIF.
Suppose if I run the transaction in mode N the sy-subrc value is becoming 1001 if I run the same in mode A batch is creating properly. Why it is happening like this I want to create the batch even If I run in back ground.
Please tell me how to rectify the problem to create the batch in mode N also.
Thanks a lot to all.
2007 Aug 17 3:09 PM
When you run in mode 'A', you are processing in the foreground. Therefore you are bypassing any screen failures by pressing the enter key yourself.
Run in mode 'E', this will stop the session on the screen that has the error.
2007 Aug 17 3:14 PM
Hi,
Try with
CALL TRANSACTION 'MSC1' USING BDCDATA MODE 'E' UPDATE 'S'
MESSAGES INTO MESSTAB.
a®