Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BDC (at new)

Former Member
0 Likes
735

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.

1 ACCEPTED SOLUTION
Read only

alejandro_bindi
Active Contributor
0 Likes
688

Inside the AT statements that is the normal behaviour.

Refer to , there i ve posted some alternatives for using the data inside the AT, and got some explanations of this behaviour.

Regards

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.

5 REPLIES 5
Read only

Former Member
0 Likes
688

Change to

loop at t_tab.

at new bktxt.

READ TABLE T_TAB INDEX SY-TABIX.

perform bdc_dynpro using 'SAPMF05A' '0100'.

Read only

Former Member
0 Likes
688

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

Read only

alejandro_bindi
Active Contributor
0 Likes
689

Inside the AT statements that is the normal behaviour.

Refer to , there i ve posted some alternatives for using the data inside the AT, and got some explanations of this behaviour.

Regards

Read only

Former Member
0 Likes
688

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

Read only

Former Member
0 Likes
688

Thanks for everbody who replied me. I checked the links and gave me a good explanation about this problem.