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: 

BDC with table control

Former Member
0 Kudos

I am doing BDC recording with transaction XK01,I have recorded some sample entries for the vendor(lifnr) and the bank details as well.here the bank details have to be given in 'table control'.remember here the visible number of rows in the table control are 5.if i am giving 5 different rows of bank details in flat file the BDC program is running with out any problem.but if i am giving more tahn 5 entries of bank details for single vendor only first 5 entries are getting updated.the reason i am feeling is the table control has to be scrolled down for the other entries of bank details.

please can any of the SDN users will help me to resolve this issue.

Regards,

Ubedulla khan.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Welcome to SDN!!!!!!!!

Look at the link on BDC Table control........

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

https://www.sdn.sap.com/irj/sdn/advancedsearch?querystring=bdc table control&searchpluginname=sd

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

Look at the Example code for scroll.......

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

loop at pitab where seq_ind = 'X'.

refresh: bdcdata.

clear: bdcdata, date, lno.

read table itab with key pernr = pitab-pernr.

perform bdc_dynpro using 'SAPMZDMR_DEVICE_MASTER_RECORD'

'0100'.

perform bdc_field using 'BDC_CURSOR'

'W_PERNR'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'W_PERNR'

pitab-pernr.

lno = itab-seqnr + 1. " Calculating NEXT/New Line

  • page = lno div 12.

page = itab-seqnr div 12. " Calculating PAGE No

  • loop at valid_it where pernr = pitab-pernr.

loop at valid_it where pernr = pitab-pernr and

seqnr = ''.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = valid_it-ctrdur

importing

output = valid_it-ctrdur.

read table itab with key pernr = valid_it-pernr

seqnr = valid_it-seqnr.

if valid_it-seqnr = ''.

if lno < 12.

page = 0.

endif.

do page times. " Table control Pagedown

perform bdc_dynpro using 'SAPMZDMR_DEVICE_MASTER_RECORD'

'0110'.

perform bdc_field using 'BDC_OKCODE'

'PGDOWN'.

enddo.

lno = lno mod 12. "Calculating Line No

if lno = 0.

lno = 12.

endif.

perform bdc_dynpro using 'SAPMZDMR_DEVICE_MASTER_RECORD'

'0110'.

perform bdc_field using 'BDC_OKCODE'

'=ENTER'.

  • ************

perform index using 'ZFDMR_RECORDS-DVCTYPE' lno

changing fval.

perform bdc_field using fval valid_it-dvctyp.

  • ***********

perform index using 'ZFDMR_RECORDS-PROVIDER' lno

changing fval.

perform bdc_field using fval valid_it-provider.

  • ***********

perform index using 'ZFDMR_RECORDS-PHONENO' lno

changing fval.

perform bdc_field using fval valid_it-phno.

  • ***********

perform index using 'ZFDMR_RECORDS-REFNO' lno

changing fval.

perform bdc_field using fval valid_it-refno.

  • ************

perform index using 'ZFDMR_RECORDS-CCTNO' lno

changing fval.

perform bdc_field using fval valid_it-cctno.

  • ************

perform index using 'ZFDMR_RECORDS-ACTDT' lno

changing fval.

clear: date, dt.

date = valid_it-actdt.

  • concatenate date4(2) '/' date6(2) '/' date+0(4) into dt.

write date to dt.

perform bdc_field using fval dt.

  • ************

perform index using 'ZFDMR_RECORDS-CTRDUR' lno

changing fval.

perform bdc_field using fval valid_it-ctrdur.

  • ************

perform index using 'ZFDMR_RECORDS-DEPLDT' lno

changing fval.

clear: date, dt.

date = valid_it-depldt.

  • concatenate date4(2) '/' date6(2) '/' date+0(4) into dt.

write date to dt.

perform bdc_field using fval dt.

if lno = 12.

do 1 times. " Table Control NEXT Page

perform bdc_dynpro using 'SAPMZDMR_DEVICE_MASTER_RECORD'

'0110'.

perform bdc_field using 'BDC_OKCODE'

'PGDOWN'.

enddo.

endif.

lno = lno + 1. " Line No Increment

page = 0.

endif.

clear: valid_it, itab.

endloop.

if not bdcdata[] is initial.

perform bdc_dynpro using

'SAPMZDMR_DEVICE_MASTER_RECORD' '0110'.

perform bdc_field using 'BDC_OKCODE'

'=SAVE'.

call function 'BDC_INSERT'

exporting

tcode = c_tcode

tables

dynprotab = bdcdata

exceptions

internal_error = 01

not_open = 02

queue_error = 03.

  • TCODE_INVALID = 04.

if sy-subrc ne 0.

case sy-subrc.

when 01.

message e000 with text-e10.

exit.

when 02.

message e000 with text-e11.

exit.

when 03.

message e000 with text-e05.

exit.

when others.

message e000 with text-e12 sy-subrc.

exit.

endcase.

endif.

endif.

clear pitab.

endloop.

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

In the above example I have 12 lines in my Table control which will be visible.

In this you will also find that after 12 lines are filled the page of T-control will automatically down for further records.

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

Thanks.

If this helps you reward with points.

Message was edited by: KDeepak

Message was edited by: KDeepak

8 REPLIES 8

Former Member
0 Kudos

Hi,

Welcome to SDN!!!!!!!!

Look at the link on BDC Table control........

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

https://www.sdn.sap.com/irj/sdn/advancedsearch?querystring=bdc table control&searchpluginname=sd

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

Look at the Example code for scroll.......

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

loop at pitab where seq_ind = 'X'.

refresh: bdcdata.

clear: bdcdata, date, lno.

read table itab with key pernr = pitab-pernr.

perform bdc_dynpro using 'SAPMZDMR_DEVICE_MASTER_RECORD'

'0100'.

perform bdc_field using 'BDC_CURSOR'

'W_PERNR'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'W_PERNR'

pitab-pernr.

lno = itab-seqnr + 1. " Calculating NEXT/New Line

  • page = lno div 12.

page = itab-seqnr div 12. " Calculating PAGE No

  • loop at valid_it where pernr = pitab-pernr.

loop at valid_it where pernr = pitab-pernr and

seqnr = ''.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = valid_it-ctrdur

importing

output = valid_it-ctrdur.

read table itab with key pernr = valid_it-pernr

seqnr = valid_it-seqnr.

if valid_it-seqnr = ''.

if lno < 12.

page = 0.

endif.

do page times. " Table control Pagedown

perform bdc_dynpro using 'SAPMZDMR_DEVICE_MASTER_RECORD'

'0110'.

perform bdc_field using 'BDC_OKCODE'

'PGDOWN'.

enddo.

lno = lno mod 12. "Calculating Line No

if lno = 0.

lno = 12.

endif.

perform bdc_dynpro using 'SAPMZDMR_DEVICE_MASTER_RECORD'

'0110'.

perform bdc_field using 'BDC_OKCODE'

'=ENTER'.

  • ************

perform index using 'ZFDMR_RECORDS-DVCTYPE' lno

changing fval.

perform bdc_field using fval valid_it-dvctyp.

  • ***********

perform index using 'ZFDMR_RECORDS-PROVIDER' lno

changing fval.

perform bdc_field using fval valid_it-provider.

  • ***********

perform index using 'ZFDMR_RECORDS-PHONENO' lno

changing fval.

perform bdc_field using fval valid_it-phno.

  • ***********

perform index using 'ZFDMR_RECORDS-REFNO' lno

changing fval.

perform bdc_field using fval valid_it-refno.

  • ************

perform index using 'ZFDMR_RECORDS-CCTNO' lno

changing fval.

perform bdc_field using fval valid_it-cctno.

  • ************

perform index using 'ZFDMR_RECORDS-ACTDT' lno

changing fval.

clear: date, dt.

date = valid_it-actdt.

  • concatenate date4(2) '/' date6(2) '/' date+0(4) into dt.

write date to dt.

perform bdc_field using fval dt.

  • ************

perform index using 'ZFDMR_RECORDS-CTRDUR' lno

changing fval.

perform bdc_field using fval valid_it-ctrdur.

  • ************

perform index using 'ZFDMR_RECORDS-DEPLDT' lno

changing fval.

clear: date, dt.

date = valid_it-depldt.

  • concatenate date4(2) '/' date6(2) '/' date+0(4) into dt.

write date to dt.

perform bdc_field using fval dt.

if lno = 12.

do 1 times. " Table Control NEXT Page

perform bdc_dynpro using 'SAPMZDMR_DEVICE_MASTER_RECORD'

'0110'.

perform bdc_field using 'BDC_OKCODE'

'PGDOWN'.

enddo.

endif.

lno = lno + 1. " Line No Increment

page = 0.

endif.

clear: valid_it, itab.

endloop.

if not bdcdata[] is initial.

perform bdc_dynpro using

'SAPMZDMR_DEVICE_MASTER_RECORD' '0110'.

perform bdc_field using 'BDC_OKCODE'

'=SAVE'.

call function 'BDC_INSERT'

exporting

tcode = c_tcode

tables

dynprotab = bdcdata

exceptions

internal_error = 01

not_open = 02

queue_error = 03.

  • TCODE_INVALID = 04.

if sy-subrc ne 0.

case sy-subrc.

when 01.

message e000 with text-e10.

exit.

when 02.

message e000 with text-e11.

exit.

when 03.

message e000 with text-e05.

exit.

when others.

message e000 with text-e12 sy-subrc.

exit.

endcase.

endif.

endif.

clear pitab.

endloop.

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

In the above example I have 12 lines in my Table control which will be visible.

In this you will also find that after 12 lines are filled the page of T-control will automatically down for further records.

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

Thanks.

If this helps you reward with points.

Message was edited by: KDeepak

Message was edited by: KDeepak

Former Member
0 Kudos

Hi ubedulla,

Welcome to SDN.

1. yes, u are right, only first 5 will get updated.

2. We have to simulate the SCROLL UP

event so that,

the next set of rows appear.

regards,

amit m.

0 Kudos

Dear Amit,

As you said, we need to simulate the scrollup event.

But i don't know the procedure.can you give out the answer in more detail.

0 Kudos

Hi

As I just said in my previous answer I believe you can't do it.

I'm using release 4.7 and the icons for scrolling are disables.

Max

0 Kudos

Dear Max,

I am also using 4.7.

but I am not clear how to handle more numer of entries in table control, comapring to the visible number of entries in table control screen.

Ubedulla

0 Kudos

Hi again,

1. first you have to do recording

in sm35 and record the transaction.

2. from there, u may be able

to get the fcode on scrolling event.

3. or goto tranasction,

just before scrolling down,

put /h (for debugging mode on)

and then press scroll down.

4. Now u will come in debugging screen,

there see the value of sy-ucomm.

regards,

amit m.

0 Kudos

Hi

A trick is to use the scrolling command.

For example, suppose a table control shows 3 lines and you need to insert 10 records.

- 1) you insert the first 3 records;

- 2) You place last record you have inserted to the top of table control: so now you have only two lines avaible for inserting.

- 3) Insert the 4 and 5 record in the second and third lines and then You place last record you have inserted to the top of table control;

- 4) Insert the 6 and 7 record in the second and third lines and then You place last record you have inserted to the top of table control and so....

I think the best thing is to insert only one record for every step. In this way your bdc won't depend on resolution.

1) Insert the first record into first line of tc;

2) Insert the second record into second line of tc;

3) Place the last record to the top: now the second line si available for inserting;

4) Insert the third record into second line of tc;

5) Place the last record to the top and so....

In this way the second line is always available for insertin of new record.

But you can do it only if trx has the functionality for scrolling (page up) or to place a line to the top.

Max

Former Member
0 Kudos

Hi

The number of rows you can elaborate depends on resolution, so you need to simulate the functionality for scrolling.

But I'm in front of that trx and I can't find it, so it should be better you can use an alternative tools to load the customer data. For example BI std RFBIDE00

Max