2007 Feb 09 7:59 AM
Hi experts,
I have a problem with the using of BDC (batch input).
I created a "executable" BDC program and want to use it in my own program. I can view my entries in a table control and have a button to push the data from "it_input" with the BDC perform instructions into the R/3.
MODULE pai_0100 INPUT.
IF sy-ucomm = 'BACK' OR
sy-ucomm = 'EXIT' OR
sy-ucomm = 'CANCEL'.
LEAVE PROGRAM.
ELSE.
DATA: l_date TYPE sy-datum.
include bdcrecx1.
perform open_group.
LOOP AT it_input.
perform bdc_dynpro using 'SAPMM07M' '0400'.
perform bdc_field using 'BDC_CURSOR'
'MKPF-BLDAT'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MKPF-BLDAT'
l_date.
perform bdc_field using 'MKPF-BUDAT'
l_date.
perform bdc_field using 'RM07M-BWARTWA'
bwart.
perform bdc_field using 'RM07M-WERKS'
werks.
perform bdc_field using 'RM07M-LGORT'
lgort.
perform bdc_field using 'XFULL'
'X'.
perform bdc_field using 'RM07M-WVERS2'
'X'.
perform bdc_dynpro using 'SAPMM07M' '0421'.
perform bdc_field using 'BDC_CURSOR'
'MSEG-CHARG(01)'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'MSEG-MATNR(01)'
it_input-matnr.
perform bdc_field using 'MSEG-ERFMG(01)'
it_input-erfmg.
perform bdc_field using 'DKACB-FMORE'
'X'.
perform bdc_dynpro using 'SAPLKACB' '0002'.
perform bdc_field using 'BDC_CURSOR'
'COBL-KOSTL'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_field using 'COBL-KOSTL'
kostl.
perform bdc_dynpro using 'SAPLKACB' '0002'.
perform bdc_field using 'BDC_CURSOR'
'COBL-KOSTL'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_field using 'COBL-KOSTL'
kostl.
perform bdc_transaction using 'MB1A'.
ENDLOOP.
perform close_group.
ENDIF.
ENDMODULE.
But I get an error: "before statement AT, the IF statement has to be closed with ENDIF."
That means I cannot put my BDC into the IF-statement where I ask which button is pressed. The AT statement determine in the "include".
IF sy-ucomm = 'BACK' OR
sy-ucomm = 'EXIT' OR
sy-ucomm = 'CANCEL'.
LEAVE PROGRAM.
ELSE.
DATA: l_date TYPE sy-datum.
include bdcrecx1.Has anybody an idea? Do I have to put my BDC into an new REPORT, and call this report with SUBMIT? But then I have to pass the complete it_input table and some variables...
Regards,
Steffen
2007 Feb 09 8:05 AM
use include before calling module pai. hopefully this should work.
Reward me if it works.
Hi,
You will have to place the Include bdcrecx1 statement at the top of ur program.
regards,
Mahesh
2007 Feb 09 8:05 AM
use include before calling module pai. hopefully this should work.
Reward me if it works.
2007 Feb 09 8:06 AM
2007 Feb 09 8:07 AM
hi,
put your includes in your module-pool (Rahmenprogramm)
A.
Message was edited by:
Andreas Mann
2007 Feb 09 8:08 AM
Dear Steffen,
It might be because ome restriction in PAI Module. Use form-perform instead.
It should be like this:
MODULE pai_0100 INPUT.
IF sy-ucomm = 'BACK' OR
sy-ucomm = 'EXIT' OR
sy-ucomm = 'CANCEL'.
LEAVE PROGRAM.
ELSE.
PERFORM form_mybdc.
ENDIF.
ENDMODULE.
Then in some F01 programs, create the form
FORM form_mybdc.
DATA: l_date TYPE sy-datum.
include bdcrecx1.
perform open_group.
LOOP AT it_input.
perform bdc_dynpro using 'SAPMM07M' '0400'.
perform bdc_field using 'BDC_CURSOR'
... etc.
ENDLOOP.
perform close_group.
ENDFORM.
Hope this help ...
Regards,
Dian
2007 Feb 09 8:14 AM
Hi,
You will have to place the Include bdcrecx1 statement at the top of ur program.
regards,
Mahesh
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |