2007 Sep 12 1:23 PM
Hi experts,
look at the code below.
I have a problem with BCD. I want to make a transaction at every new referencre (BKTXT). When I loop on the table t_tab, and the program execution reach first time the at new bktxt statement, the header of the table t_tab shows that everything after the field bktxt shown as asterix (*), however the fields are correct in the table. The header isn't correct.... By this reason the Batch doc will be not correct in sm35.
I hope u understand what my problem is. Do you have any idea how to solve the case?
perform open_group.
loop at t_tab.
at new bktxt.
perform bdc_dynpro using 'SAPMF05A' '0100'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BKPF-BLDAT'
l_bldat.
perform bdc_field using 'BKPF-BLART'
t_tab-blart.
perform bdc_field using 'BKPF-BUKRS'
t_tab-bukrs.
perform bdc_field using 'BKPF-BUDAT'
l_bldat.
perform bdc_field using 'BKPF-MONAT'
t_tab-monat.
perform bdc_field using 'BKPF-WAERS'
t_tab-waers.
perform bdc_field using 'BKPF-XBLNR'
t_tab-xblnr.
perform bdc_field using 'BKPF-BKTXT'
t_tab-bktxt.
perform bdc_field using 'RF05A-NEWBS'
t_tab-newb1.
perform bdc_field using 'RF05A-NEWKO'
t_tab-newc1.
endat.
perform bdc_dynpro using 'SAPMF05A' '0300'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BSEG-WRBTR'
t_tab-wrbt1.
perform bdc_field using 'BSEG-VALUT'
l_bldat.
perform bdc_field using 'RF05A-NEWBS'
t_tab-newb2.
perform bdc_field using 'RF05A-NEWKO'
t_tab-newc2.
perform bdc_field using 'DKACB-FMORE'
'X'.
perform bdc_dynpro using 'SAPLKACB' '0002'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_dynpro using 'SAPMF05A' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'BSEG-WRBTR'
t_tab-wrbt2.
perform bdc_field using 'BSEG-VALUT'
l_bldat.
perform bdc_field using 'DKACB-FMORE'
'X'.
perform bdc_dynpro using 'SAPLKACB' '0002'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
*perform bdc_transaction using 'FB01'.
at new bktxt.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'FB01'
TABLES
DYNPROTAB = BDCTAB.
REFRESH BDCTAB.
endat.
endloop.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
endform.
2007 Sep 12 1:33 PM
Hi experts,
look at the code below.
I have a problem with BCD. I want to make a transaction at every new referencre (BKTXT). When I loop on the table t_tab, and the program execution reach first time the at new bktxt statement, the header of the table t_tab shows that everything after the field bktxt shown as asterix (*), however the fields are correct in the table. The header isn't correct.... By this reason the Batch doc will be not correct in sm35.
I hope u understand what my problem is. Do you have any idea how to solve the case?
perform open_group.
loop at t_tab.
at new bktxt.
perform bdc_dynpro using 'SAPMF05A' '0100'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BKPF-BLDAT'
l_bldat.
perform bdc_field using 'BKPF-BLART'
t_tab-blart.
perform bdc_field using 'BKPF-BUKRS'
t_tab-bukrs.
perform bdc_field using 'BKPF-BUDAT'
l_bldat.
perform bdc_field using 'BKPF-MONAT'
t_tab-monat.
perform bdc_field using 'BKPF-WAERS'
t_tab-waers.
perform bdc_field using 'BKPF-XBLNR'
t_tab-xblnr.
perform bdc_field using 'BKPF-BKTXT'
t_tab-bktxt.
perform bdc_field using 'RF05A-NEWBS'
t_tab-newb1.
perform bdc_field using 'RF05A-NEWKO'
t_tab-newc1.
endat.
perform bdc_dynpro using 'SAPMF05A' '0300'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BSEG-WRBTR'
t_tab-wrbt1.
perform bdc_field using 'BSEG-VALUT'
l_bldat.
perform bdc_field using 'RF05A-NEWBS'
t_tab-newb2.
perform bdc_field using 'RF05A-NEWKO'
t_tab-newc2.
perform bdc_field using 'DKACB-FMORE'
'X'.
perform bdc_dynpro using 'SAPLKACB' '0002'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_dynpro using 'SAPMF05A' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'BSEG-WRBTR'
t_tab-wrbt2.
perform bdc_field using 'BSEG-VALUT'
l_bldat.
perform bdc_field using 'DKACB-FMORE'
'X'.
perform bdc_dynpro using 'SAPLKACB' '0002'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
*perform bdc_transaction using 'FB01'.
at new bktxt.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'FB01'
TABLES
DYNPROTAB = BDCTAB.
REFRESH BDCTAB.
endat.
endloop.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
endform.
2007 Sep 12 1:24 PM
Change to
loop at t_tab.
at new bktxt.
READ TABLE T_TAB INDEX SY-TABIX.
perform bdc_dynpro using 'SAPMF05A' '0100'.
2007 Sep 12 1:32 PM
u need to write read statement with sy-tabix after the at new control statement .......so that u can overcome the astricks .....
other way is u can use [onchange of]
reward points if helpful
2007 Sep 12 1:33 PM
2007 Sep 12 1:45 PM
It is different behaviour with in control break statements. Declare a wa with the same structure and assign the values to wa, and use the same with in at new and endat. whenever loop changes wa values will be changed too.
On change of is one more option.
Regards,
Subbu
2007 Sep 12 1:59 PM
Thanks for everbody who replied me. I checked the links and gave me a good explanation about this problem.