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 session method and table control

Former Member
0 Likes
624

hi guys,

iam doing BDC,but iam stuck in one point please suggest me how to proceed further.

in table control of bdc i have three records.

i have to check an particulat field like WA_ITAB_COBRB_NEW-LETJA is not empty then i need to do BDC for that particular row.

now the same check for the second row and if any data exits in that field i need to skip that particular row for recording that means i need to increment tmpnum = tmpnum+1.

iam doing bdc for ko02 t.code.

and for planned settlement version copy from 01 to 02 and so.

the below is my code.

but i think it is not accurate please suggest me .

thanks in advance.

LOOP AT ITAB_TEMP_VERSN2

WHERE OBJNR = TMPOBJNR AND VERSN = XVERSN1.

CLEAR: FLAG.

tmpnum = sy-tabix .

case: tmpnum.

when '1'.

READ TABLE ITAB_COBRB_NEW INTO WA_ITAB_COBRB_NEW with key urzuo = '097'.

if sy-subrc eq 0 and WA_ITAB_COBRB_NEW-LETJA <> '0000'.

FLAG = 'Y'.

endif.

when '2'.

READ TABLE ITAB_COBRB_NEW INTO WA_ITAB_COBRB_NEW with key urzuo = '095'.

if sy-subrc eq 0 and WA_ITAB_COBRB_NEW-LETJA <> '0000'.

FLAG = 'Y'.

endif.

when '3'.

READ TABLE ITAB_COBRB_NEW INTO WA_ITAB_COBRB_NEW with key urzuo = '094'.

if sy-subrc eq 0 and WA_ITAB_COBRB_NEW-LETJA <> '0000'.

FLAG = 'Y'.

endif.

endcase.

IF FLAG = 'Y'.

TMPFIELDNUM = TMPFIELDNUM + 1.

ELSE.

TMPFIELDNUM = TMPFIELDNUM + 1.

CLEAR: TMPBDCFIELD.

CONCATENATE 'DKOBR-EMPGE(' TMPFIELDNUM ')' INTO TMPBDCFIELD.

PERFORM BDC_FIELD USING TMPBDCFIELD ITAB_TEMP_VERSN2-KOSTL.

endif.

thnaks in advance and waiting for solution.

3 REPLIES 3
Read only

former_member188594
Active Participant
0 Likes
537

Hi Aruna kumar,

You can very well handle the table controls in BDC session method using line index ,

Line index indicates which line of Table control is to be use for BDC transaction,

Ex -

perform bdc_field using 'RC29K-AUSKZ(01)'

indicates 1st line of table control is going to be used for transaction which is Line index of Table Control

Reward points if useful.

Regards,

Sekhar

Read only

Former Member
0 Likes
537

Hello Aruna,

Even your logic is a little funny, everything seems to be fine except the counting of the field TMPFIELDNUM.

Your block

IF FLAG = 'Y'.
TMPFIELDNUM = TMPFIELDNUM + 1.
ELSE.
TMPFIELDNUM = TMPFIELDNUM + 1.
CLEAR: TMPBDCFIELD.
CONCATENATE 'DKOBR-EMPGE(' TMPFIELDNUM ')' INTO TMPBDCFIELD.
PERFORM BDC_FIELD USING TMPBDCFIELD ITAB_TEMP_VERSN2-KOSTL.
endif.

Should be replaced by

IF FLAG is initial..
  TMPFIELDNUM = TMPFIELDNUM + 1.
  CLEAR: TMPBDCFIELD.
  CONCATENATE 'DKOBR-EMPGE(' TMPFIELDNUM ')' INTO TMPBDCFIELD.
  PERFORM BDC_FIELD USING TMPBDCFIELD ITAB_TEMP_VERSN2-KOSTL.
endif.

The statement if sy-subrc eq 0 and WA_ITAB_COBRB_NEW-LETJA '0000'. will cause a syntax error (= '0000').

Is the second parameter of the PERFORM also a table field? If YES, then there has to be an index appended as well.

Have success,

Heinz

Read only

Former Member
0 Likes
537

Thank you i have solved it.i only found out solution.