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 Error

Former Member
0 Likes
903

Dear,

i've created a BDC program to update time management status IT0007 from 7 to 1 , i got all employees number i want into table and looped at this table into work-area then wrote my BDC Code , the problem is when i run the session from sm35 it always retreive the first employee number only and do infinite loop of modify and update, Here/'s the Code:

LOOP AT it_employee INTO wa_employee.

PERFORM bdc_dynpro USING 'SAPMP50A' '1000'.

PERFORM bdc_field USING 'RP50G-PERNR'

wa_employee-pernr.

PERFORM bdc_field USING 'RP50G-TIMR6'

'X'.

PERFORM bdc_field USING 'BDC_CURSOR'

'RP50G-CHOIC'.

PERFORM bdc_field USING 'RP50G-CHOIC'

'0007'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=MOD'.

PERFORM bdc_dynpro USING 'MP000700' '2000'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=UPD'.

PERFORM bdc_field USING 'BDC_CURSOR'

'P0007-ZTERF'.

PERFORM bdc_field USING 'P0007-BEGDA'

begda.

PERFORM bdc_field USING 'P0007-ENDDA'

endda.

PERFORM bdc_field USING 'P0007-ZTERF' '1'.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'PA30'

TABLES

DYNPROTAB = it_bdcdata

EXCEPTIONS

INTERNAL_ERROR = 1

NOT_OPEN = 2

QUEUE_ERROR = 3

TCODE_INVALID = 4

PRINTING_INVALID = 5

POSTING_INVALID = 6

OTHERS = 7.

clear it_bdcdata.

ENDLOOP.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
837

After the loop that you have given, check the entries in the table it_bdcdata if it has all the employee numbers against the field.

If it_bdcdata is a table with header line, clear the entire table. Refresh it_bdcdata.

Cheers,

Sujay

6 REPLIES 6
Read only

Former Member
0 Likes
837

Hi,

The code looks ok. Try setting breakpoint to check IT_BDCDATA at each loop. Everytime BDC runs, check the SY-SUBRC value. If its 1001, there is a data related issue. Debug how each screen gets updated with what values.

Hope this helps. Regards, Liz

Read only

Former Member
0 Likes
837

Hi

As yo have cleared it_bdcdata similarly clear your work area before endloop and then try.

Read only

Former Member
0 Likes
837

Still update the transaction with the first entry and never go to the second one :S

Read only

0 Likes
837

Hi

can you please tell me how you have defined you internal table.

Please try this:

TABLES

DYNPROTAB = it_bdcdata[]

I am sure you have defined your internal table it_employee as a table without header line, and using the work area.

Also you are selecting your infotype as 0007 by default/hardcoded.

I think the problem is with your internal table.

please check its declaration part.

Thanks

Lalit Gupta

Read only

Former Member
0 Likes
838

After the loop that you have given, check the entries in the table it_bdcdata if it has all the employee numbers against the field.

If it_bdcdata is a table with header line, clear the entire table. Refresh it_bdcdata.

Cheers,

Sujay

Read only

0 Likes
837

Thanks Sujay Venkatesw... Now Working

Regards,