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 Table Control

Former Member
0 Likes
1,159

Hello All,

I have to perform BDC for HR infotype 0077 using transaction PB30. I have to change the personal data related to Race category. The race category is a table control with 2 columns (First Column – Check box and Second Column – Race Category) and 5 visible fields on first page. I have to click on the 6th checkbox and for this I need to do a page down.

I have coded this in the program but somehow the page down does not work. I read the posting related to table control page down but could not understand.

Please help as this is an issue I need to fix ASAP.

Here’s my piece of code:

  • Initial PB30 screen

perform bdc_dynpro using 'X' 'SAPMP50A' '4000'.

perform bdc_dynpro using ' ' 'RPAPP-APLNO' i_load-aplno.

perform bdc_dynpro using ' ' 'BDC_CURSOR' 'RP50G-CHOIC'.

perform bdc_dynpro using ' ' 'RP50G-CHOIC' '0077'.

perform bdc_dynpro using ' ' 'BDC_OKCODE' '=INS'.

  • 0077 - Additional Personal Data

perform bdc_dynpro using 'X' 'MP007700' '2010'.

if not ( i_load-rac01 is initial ).

concatenate 'IT_ITAB-MARK(' i_load-rac01+1(1) ')' into l_field.

perform bdc_dynpro using ' ' l_field 'X'. .

endif.

perform bdc_dynpro using 'X' 'MP007700' '2010'.

perform bdc_dynpro using ' ' 'BDC_OKCODE' '=UPD'.

perform bdc_dynpro using 'X' 'MP007700' '2010'.

perform bdc_dynpro using ' ' 'BDC_OKCODE' '=ENTE'.

9 REPLIES 9
Read only

Former Member
0 Likes
1,120

Hi Check the below link.

Table control in BDC

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

or

Check the example below..

See The below code for Purchase order change ,it is BDC program and it handles Table control.

report zpochange.

data : i_error like bdcmsgcoll occurs 0 with header line.

data : i_bdcdata like bdcdata occurs 0 with header line.

tables : ekko, ekpo.

data :c1(10) value 'ME22',

c2(1) value ',',c3(10).

data : var1(20). " LIKE EKKO-EBELN.

data : var2 like ekko-ebeln.

data : begin of i_ekko occurs 0,

header(2),

ebeln like ekko-ebeln,

end of i_ekko.

data : begin of i_ekpo occurs 0,

item(2),

ebeln like ekpo-ebeln,

ebelp like ekpo-ebelp,

menge(10), " LIKE EKPO-MENGE,

end of i_ekpo.

data : v like ekpo-ebelp.

data: begin of itab occurs 0,

text(300),

end of itab.

parameters: p_file like ibipparms-path.

*PARAMETERS: PONUMBER LIKE EKPO-EBELN.

at selection-screen on value-request for p_file.

call function 'F4_FILENAME'

exporting

program_name = syst-cprog

dynpro_number = syst-dynnr

  • FIELD_NAME = ' '

importing

file_name = p_file

.

start-of-selection.

*SELECT EBELN FROM EKKO INTO TABLE I_EKKO WHERE EBELN = PONUMBER.

*

  • SELECT EBELN EBELP MENGE FROM EKPO INTO TABLE I_EKPO WHERE EBELN

*= PONUMBER.

*

perform get_data.

*LOOP AT ITAB.

  • WRITE 😕 ITAB.

  • ENDLOOP.

loop at itab.

var1 = itab-text+0(1).

if var1 = 'H'.

*I_EKKO-EBELN = ITAB-TEXT.

split itab at c2 into i_ekko-header

i_ekko-ebeln.

  • SPLIT ITAB AT ',' INTO I_EKKO-EBELN.

    • " I_EKPO-EBELP

    • " I_EKPO-MENGE

    • " var1.

append i_ekko.

else.

split itab at c2 into i_ekpo-item

i_ekpo-ebeln

i_ekpo-ebelp

i_ekpo-menge.

append i_ekpo.

endif.

*var2 = i_ekpo-ebeln.

  • MOVE VAR1 TO I_EKPO-EBELN.

  • MOVE VAR1 TO I_EKKO-EBELN.

  • APPEND: I_EKPO.

*if not var1 is initial.

  • split var1 at ',' into i_ekpo-ebelp

  • i_ekpo-menge.

  • i_ekpo-ebeln = var2.

  • append i_ekpo.

*endif.

endloop.

loop at i_ekpo.

write 😕 i_ekpo.

endloop.

*

loop at i_ekko.

perform fill_data. " TABLES I_EKPO.

endloop.

  • LOOP AT I_EKPO.

  • WRITE 😕 I_EKPO.

  • ENDLOOP.

*&----


*& Form GET_DATA

*&----


  • text

*----


  • --> p1 text

  • <-- p2 text

*----


*LOOP AT I_ERROR.

  • WRITE 😕 I_ERROR.

  • ENDLOOP.

*

form get_data.

call function 'WS_UPLOAD'

exporting

codepage = ' '

filename = p_file

filetype = 'ASC'

headlen = ' '

line_exit = ' '

trunclen = ' '

user_form = ' '

user_prog = ' '

dat_d_format = ' '

  • IMPORTING

  • FILELENGTH =

tables

data_tab = itab

exceptions

conversion_error = 1

file_open_error = 2

file_read_error = 3

invalid_type = 4

no_batch = 5

unknown_error = 6

invalid_table_width = 7

gui_refuse_filetransfer = 8

customer_error = 9

others = 10

.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. " GET_DATA

*&----


*& Form FILL_DATA

*&----


  • text

*----


  • -->P_I_EKPO text

*----


form fill_data. " tables i_ekpo .

perform bdcscreen using 'SAPMM06E' '0105'.

perform bdcfield using 'RM06E-BSTNR' i_ekko-ebeln.

perform bdcfield using 'BDC_OKCODE' '/00'.

loop at i_ekpo where ebeln = i_ekko-ebeln.

  • V = I_EKPO-EBELP.

perform bdcscreen using 'SAPMM06E' 0120.

perform bdcfield using 'BDC_CURSOR' 'RM06E-EBELP'.

perform bdcfield using 'RM06E-EBELP' i_ekpo-ebelp.

perform bdcfield using 'BDC_OKCODE' '/00'.

perform bdcscreen using 'SAPMM06E' 0120.

perform bdcfield using 'BDC_CURSOR' 'EKPO-MENGE(01)'.

perform bdcfield using 'RM06E-EBELP' i_ekpo-ebelp.

perform bdcfield using 'EKPO-MENGE(01)' i_ekpo-menge.

perform bdcfield using 'BDC_OKCODE' '/00'.

*PERFORM BDCSCREEN USING 'SAPMM06E' 0120.

*

*PERFORM BDCFIELD USING 'BDC_CURSOR' 'RMO6E-EBELP'.

*

*CLEAR V.

endloop.

perform bdcfield using 'BDC_OKCODE' '=BU'.

call transaction c1 using i_bdcdata mode 'A'

messages into i_error.

refresh i_bdcdata.

endform. " FILL_DATA

*&----


*& Form BDCSCREEN

*&----


  • text

*----


  • -->P_0140 text

  • -->P_0120 text

*----


form bdcscreen using p_program p_screen.

i_bdcdata-program = p_program.

i_bdcdata-dynpro = p_screen.

i_bdcdata-dynbegin = 'X'.

append i_bdcdata.

clear i_bdcdata.

endform. " BDCSCREEN

*&----


*& Form BDCFIELD

*&----


  • text

*----


  • -->P_0145 text

  • -->P_I_EKPO_EBELN text

*----


form bdcfield using fnam fval.

i_bdcdata-fnam = fnam.

i_bdcdata-fval = fval.

append i_bdcdata.

clear i_bdcdata.

endform. " BDCFIELD

need ur reward points

Regards

Ravi

Read only

0 Likes
1,120

Hi ,

I have checked the link for table control and thats not much of help or I did not understand. Did you check my code? Am I missing some thing ?

Read only

0 Likes
1,120

Hi

You are concatenating wrong table.

Use TTABL instead of it_tab..

Actually you need to pass the table name on the screen 2010 of the module pool program of IT0077.

This should solve the problem.

Regards

Navneet

Read only

0 Likes
1,120

Hi Navneet,

Thanks for your quick reply. I tried using TTABL- but did not work. What is IT0077, I did not find any program with that name.

I know that I have to change the 6th record. Is there any other way.

Please help...

Thanks,

Read only

Former Member
0 Likes
1,120

Hi

I am sorry...please ignore my previous post.

perform bdc_dynpro using 'X' 'MP007700' '2010'.

perform bdc_dynpro using ' ' 'BDC_OKCODE' '=P+'.

This will take you to the next page in table control.

Now you can select the first row and this point to the 6th row of the table.

Regards

Navneet

Read only

0 Likes
1,120

Hi Navneet,

I tried P+ but instead of scrolling vertical it scrolls horizontal.

Thanks.

Read only

0 Likes
1,120

Hi

Just checked that screen, the element LTEXT horitonally scrollable. Thats' the reason it is not scrolling down.

If you know that it is the 6th row, then hardcode it to IT_ITAB-MARK(06) as the field.

Regards,

Navneet

Read only

0 Likes
1,120

Hi Navneet,

I tried hardcoding but its not working. Neither does it go to next page nor does it select the checkbox.

Can you think of something else with this code.

Read only

0 Likes
1,120

Hi,

Did you find a solution to this problem?

Thanks

V.V.