Application Development 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: 

Hi frnds,

Former Member
0 Kudos

Hi,

I have to do BDC. In that BDC i need to handle table control. In that table control I had 10 rows of difftrent Wage types of HR. I dnot know how to handle table control in BDC.

In First column I have Wage type 5000 and column three Basic salary 30000 and like that i have so many wage types 9004 and 9006. please help me how to do that.

Thanking u a lot.

Sirisha.

2 REPLIES 2

Former Member
0 Kudos

Hi Sirisha,

Refer the link:

http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

The concept is easy: it has to indicate the index of the table control in the field name, so if you have to populate the first record of table control:

BDC-FIELDNAME = <FIELDNAME>(01).

If you fill the second row:

BDC-FIELDNAME = <FIELDNAME>(02).

and so....

Now the problem is usually on how many records you have to load, because u can fill only the rows of table control available in the screen, If you have more records than it can be displayed yuo have to simulate the command to go next page.

The number of recod can be displayed can depend on pc resolution and many program haven't command to go to next page (in this case it could be impossible create a BDC program9.

A way to create a bdc program resolution indipendent is to work on the first and second row.

- Place the first hit in the first row of bdc;

- Place the second insert in the second row of bdc;

- Place the last hit to the top of table control;

- Place the next hit in the second row;

- Place the last hit to the top of table control;

- Place the next hit in the second row;

- .... and so

For more info: Search in SDN with TABLE CONTROL IN BDC.

Will get a lot of related links.

Reward points if this Helps.

Manish

Former Member
0 Kudos

You will basically need to have a variable to hold the index value (of type sy-tabix), and based on the number of lines u nhave to insert in the table control, you will have to increase the index counter to determine the line number into which you will enter the new entry.

Check out these links for code examples

http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

https://www.sdn.sap.com/irj/sdn/forumsearch

heres an example

*--- Local variables

DATA: lv_cnt(2) TYPE n, " to hold field count

lv_field(40), " to hold field names

lv_limit(2) TYPE n VALUE '09'. " max lines in a table control

*--- Looping at it_example to populate grid values into the table control

LOOP AT it_example.

*--- Incrementing the field counter at every loop

lv_cnt = lv_cnt + 1.

*--- Populating the pack code

CLEAR lv_field.

CONCATENATE 'J_3ABOMD-J_3AKORDXL(' lv_cnt ')' INTO lv_field.

PERFORM bdc_field USING lv_field it_example-packcode.

*--- Populating the Grid size

CLEAR lv_field.

CONCATENATE 'J_3ABOMD-J_3AKORDX(' lv_cnt ')' INTO lv_field.

PERFORM bdc_field USING lv_field it_example-gridsize.

*--- Populating the Quantity

CLEAR lv_field.

CONCATENATE 'J_3ABOMD-MENGE(' lv_cnt ')' INTO lv_field.

PERFORM bdc_field USING lv_field it_example-quantity.

*--- Checking if the table control display limit is crossed. If crossed

*--- page down is clicked

IF lv_cnt = 9..

PERFORM bdc_field USING 'BDC_OKCODE' '=P+'.

PERFORM bdc_dynpro USING 'SAPLJ3AC' '2000'.

*---

CLEAR lv_cnt.

  • LV_CNT = LV_CNT + 2.

  • LV_LIMIT = LV_LIMIT + LV_LIMIT.

ENDIF.

ENDLOOP.