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

Get selected row in a table control

Former Member
0 Likes
7,655

What is the best approach to get a selected row, all fields, in a table control? I see this done in various transactions in MM but do not see how to do this in documentation.

Thanks

5 REPLIES 5
Read only

ferry_lianto
Active Contributor
0 Likes
2,660

Hi Ben,

Welcome to SDN.

Please check demo program DEMO_DYNPRO_TABLE_CONTROL_1.

Hope this will help.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
2,660

first you shall specify a variable(e.g:flg_sel) for table control attribute "w/SelColumn" .

second ,you shall judge whether flg_sel = 'X' in you source code ,when flg_sel ='X' ,indicate that row was selected .

Read only

former_member186741
Active Contributor
0 Likes
2,660

in the screen flow logic you need something like this:

LOOP AT t_partner.

MODULE get_selected_line.

MODULE process_partner.

ENDLOOP.

PAI module get_selected_line :

MODULE get_selected_line INPUT.

  • only get cursor position once....as it's constant within each loop

IF sy-stepl EQ 1.

CLEAR wv_cursor_0120.

GET CURSOR LINE wv_cursor_0120.

IF wv_cursor_0120 = 0.

wv_cursor_0120 = 1.

ENDIF.

  • convert the relative line of the screen to the actual line number in the table

wv_absolute_line = wv_cursor_0120 + tc_partner-top_line - 1.

ENDIF.

ENDMODULE. " GET_SELECTED_LINE INPUT

module process_partner needs to be something like this:

MODULE process_partner INPUT.

  • only process the selected line

CHECK sy-stepl = wv_cursor_0120.

CASE ok_code.

endcase.

endmodule.

Read only

Former Member
0 Likes
2,660

U will have data in internal table for the table control...Along with this u need a FLAG field in the internal table which reflects to as w/selection line in table control..Here, in table control, u can select 1 or more line items based on properties selected for TC....Once selected and on press of any key, the internal table gets triggered and based on the flag = 'X', u can do further processing.

Read only

Former Member
0 Likes
2,660

Hi

Check this program-

SAPLSETB

LSETBF01

Below is the name of the perform of the above mentioned program

where u can get the code for Select all pushbutton.

FORM - Lift_Shift_Handler

When 'MARK'.

Hope this helps,

Regds,

Seema.