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: 

how to handle table controls in BDC programs and explain me with sampleprog

Former Member
0 Kudos
1,778

how to handle table controls in BDC programs and explain me with sampleprogram,and let me know how to give reward points as im very new to this forum,. Thanks,

Abap Doubts.

1 ACCEPTED SOLUTION

former_member69765
Contributor
0 Kudos
236

Regarding Table comtrols in BDC...

Normally all the screns with table controls will have buttons to add(Insert) a Row, Delete a Row etc..

After adding data to 1st Row (it will have index 1)... press that insert button so a new Row is inserted again at 1st row..so this will have index 1.

So in this way you can hard code the index to one.

The advantage is that if there are many rows then you will not have to keep a track of how many rows are inserted and when to press the page down button.

I am giving a small example.... Just copy paste this example and run it in all mode...

Run it in all mode so that you can see what I am trying to do...

Note : this is an relatively easy method.. not the only method to do...

**********************************************

report ZTEST_BDC

no standard page heading line-size 255.

include bdcrecx1.

start-of-selection.

perform open_group.

perform bdc_dynpro using 'SAPMSRD0' '0102'.

perform bdc_field using 'BDC_CURSOR'

'RSRD1-DDTYPE'.

perform bdc_field using 'BDC_OKCODE'

'=CHANGE_RADIO'.

perform bdc_field using 'RSRD1-TBMA'

''.

perform bdc_field using 'RSRD1-TBMA_VAL'

'EKPO'.

perform bdc_field using 'RSRD1-DDTYPE'

'X'.

perform bdc_dynpro using 'SAPMSRD0' '0102'.

perform bdc_field using 'BDC_CURSOR'

'RSRD1-DDTYPE_VAL'.

perform bdc_field using 'BDC_OKCODE'

'=ADD'.

perform bdc_field using 'RSRD1-TBMA_VAL'

'EKPO'.

perform bdc_field using 'RSRD1-DDTYPE'

'X'.

perform bdc_field using 'RSRD1-DDTYPE_VAL'

'ztest_Str'.

perform bdc_dynpro using 'SAPLSED1' '0100'.

perform bdc_field using 'BDC_CURSOR'

'D_100-STRU'.

perform bdc_field using 'BDC_OKCODE'

'=GOON'.

perform bdc_field using 'D_100-DTEL'

''.

perform bdc_field using 'D_100-STRU'

'X'.

perform bdc_dynpro using 'SAPLSD41' '2100'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'DD02D-DDTEXT'

'test'.

perform bdc_field using 'BDC_CURSOR'

'DD03P_D-FIELDNAME(01)'.

perform bdc_field using 'DD03P_D-FIELDNAME(01)'

'bukrs'.

perform bdc_field using 'DD03P_D-ROLLNAME(01)'

'bukrs'.

perform bdc_dynpro using 'SAPLSD41' '2100'.

perform bdc_field using 'BDC_OKCODE'

'=WB_LINE_INSERT'.

perform bdc_field using 'DD02D-DDTEXT'

'test'.

perform bdc_field using 'BDC_CURSOR'

'DD03P_D-FIELDNAME(01)'.

perform bdc_dynpro using 'SAPLSD41' '2100'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'DD02D-DDTEXT'

'test'.

perform bdc_field using 'BDC_CURSOR'

'DD03P_D-ROLLNAME(01)'.

perform bdc_field using 'DD03P_D-FIELDNAME(01)'

'kostl'.

perform bdc_field using 'DD03P_D-ROLLNAME(01)'

'kostl'.

perform bdc_dynpro using 'SAPLSD41' '2100'.

perform bdc_field using 'BDC_OKCODE'

'=WB_LINE_INSERT'.

perform bdc_field using 'DD02D-DDTEXT'

'test'.

perform bdc_field using 'BDC_CURSOR'

'DD03P_D-FIELDNAME(01)'.

perform bdc_dynpro using 'SAPLSD41' '2100'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'DD02D-DDTEXT'

'test'.

perform bdc_field using 'BDC_CURSOR'

'DD03P_D-ROLLNAME(01)'.

perform bdc_field using 'DD03P_D-FIELDNAME(01)'

'wrbtr'.

perform bdc_field using 'DD03P_D-ROLLNAME(01)'

'wrbtr'.

perform bdc_dynpro using 'SAPLSD41' '2100'.

perform bdc_field using 'BDC_OKCODE'

'=WB_SAVE'.

perform bdc_field using 'DD02D-DDTEXT'

'test'.

perform bdc_field using 'BDC_CURSOR'

'DD03P_D-ROLLNAME(01)'.

perform bdc_dynpro using 'SAPLSTRD' '0100'.

perform bdc_field using 'BDC_CURSOR'

'KO007-L_DEVCLASS'.

perform bdc_field using 'BDC_OKCODE'

'=TEMP'.

perform bdc_field using 'KO007-L_AUTHOR'

'VARUN'.

perform bdc_dynpro using 'SAPLSD41' '2100'.

perform bdc_field using 'BDC_OKCODE'

'/EWB_CANCEL'.

perform bdc_dynpro using 'SAPMSRD0' '0102'.

perform bdc_field using 'BDC_OKCODE'

'/EABR'.

perform bdc_field using 'BDC_CURSOR'

'RSRD1-DDTYPE_VAL'.

perform bdc_transaction using 'SE11'.

perform close_group.

****************************************************

I hope this helps.....

Please mark points if it helps..

2 REPLIES 2

former_member69765
Contributor
0 Kudos
237

Regarding Table comtrols in BDC...

Normally all the screns with table controls will have buttons to add(Insert) a Row, Delete a Row etc..

After adding data to 1st Row (it will have index 1)... press that insert button so a new Row is inserted again at 1st row..so this will have index 1.

So in this way you can hard code the index to one.

The advantage is that if there are many rows then you will not have to keep a track of how many rows are inserted and when to press the page down button.

I am giving a small example.... Just copy paste this example and run it in all mode...

Run it in all mode so that you can see what I am trying to do...

Note : this is an relatively easy method.. not the only method to do...

**********************************************

report ZTEST_BDC

no standard page heading line-size 255.

include bdcrecx1.

start-of-selection.

perform open_group.

perform bdc_dynpro using 'SAPMSRD0' '0102'.

perform bdc_field using 'BDC_CURSOR'

'RSRD1-DDTYPE'.

perform bdc_field using 'BDC_OKCODE'

'=CHANGE_RADIO'.

perform bdc_field using 'RSRD1-TBMA'

''.

perform bdc_field using 'RSRD1-TBMA_VAL'

'EKPO'.

perform bdc_field using 'RSRD1-DDTYPE'

'X'.

perform bdc_dynpro using 'SAPMSRD0' '0102'.

perform bdc_field using 'BDC_CURSOR'

'RSRD1-DDTYPE_VAL'.

perform bdc_field using 'BDC_OKCODE'

'=ADD'.

perform bdc_field using 'RSRD1-TBMA_VAL'

'EKPO'.

perform bdc_field using 'RSRD1-DDTYPE'

'X'.

perform bdc_field using 'RSRD1-DDTYPE_VAL'

'ztest_Str'.

perform bdc_dynpro using 'SAPLSED1' '0100'.

perform bdc_field using 'BDC_CURSOR'

'D_100-STRU'.

perform bdc_field using 'BDC_OKCODE'

'=GOON'.

perform bdc_field using 'D_100-DTEL'

''.

perform bdc_field using 'D_100-STRU'

'X'.

perform bdc_dynpro using 'SAPLSD41' '2100'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'DD02D-DDTEXT'

'test'.

perform bdc_field using 'BDC_CURSOR'

'DD03P_D-FIELDNAME(01)'.

perform bdc_field using 'DD03P_D-FIELDNAME(01)'

'bukrs'.

perform bdc_field using 'DD03P_D-ROLLNAME(01)'

'bukrs'.

perform bdc_dynpro using 'SAPLSD41' '2100'.

perform bdc_field using 'BDC_OKCODE'

'=WB_LINE_INSERT'.

perform bdc_field using 'DD02D-DDTEXT'

'test'.

perform bdc_field using 'BDC_CURSOR'

'DD03P_D-FIELDNAME(01)'.

perform bdc_dynpro using 'SAPLSD41' '2100'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'DD02D-DDTEXT'

'test'.

perform bdc_field using 'BDC_CURSOR'

'DD03P_D-ROLLNAME(01)'.

perform bdc_field using 'DD03P_D-FIELDNAME(01)'

'kostl'.

perform bdc_field using 'DD03P_D-ROLLNAME(01)'

'kostl'.

perform bdc_dynpro using 'SAPLSD41' '2100'.

perform bdc_field using 'BDC_OKCODE'

'=WB_LINE_INSERT'.

perform bdc_field using 'DD02D-DDTEXT'

'test'.

perform bdc_field using 'BDC_CURSOR'

'DD03P_D-FIELDNAME(01)'.

perform bdc_dynpro using 'SAPLSD41' '2100'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'DD02D-DDTEXT'

'test'.

perform bdc_field using 'BDC_CURSOR'

'DD03P_D-ROLLNAME(01)'.

perform bdc_field using 'DD03P_D-FIELDNAME(01)'

'wrbtr'.

perform bdc_field using 'DD03P_D-ROLLNAME(01)'

'wrbtr'.

perform bdc_dynpro using 'SAPLSD41' '2100'.

perform bdc_field using 'BDC_OKCODE'

'=WB_SAVE'.

perform bdc_field using 'DD02D-DDTEXT'

'test'.

perform bdc_field using 'BDC_CURSOR'

'DD03P_D-ROLLNAME(01)'.

perform bdc_dynpro using 'SAPLSTRD' '0100'.

perform bdc_field using 'BDC_CURSOR'

'KO007-L_DEVCLASS'.

perform bdc_field using 'BDC_OKCODE'

'=TEMP'.

perform bdc_field using 'KO007-L_AUTHOR'

'VARUN'.

perform bdc_dynpro using 'SAPLSD41' '2100'.

perform bdc_field using 'BDC_OKCODE'

'/EWB_CANCEL'.

perform bdc_dynpro using 'SAPMSRD0' '0102'.

perform bdc_field using 'BDC_OKCODE'

'/EABR'.

perform bdc_field using 'BDC_CURSOR'

'RSRD1-DDTYPE_VAL'.

perform bdc_transaction using 'SE11'.

perform close_group.

****************************************************

I hope this helps.....

Please mark points if it helps..

Former Member
0 Kudos
236

HI,

Refer the link:

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

The concept is easy: it has to indicat 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

Message was edited by:

Manish Kumar

Message was edited by:

Manish Kumar