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 capture multiple(Random) records of an ALV output report?

Former Member
0 Kudos

Hi Friends,

1) I have an output in Grid format(using reuse_alv_grid_displlay). I have 3 push buttons on the menu bar(for ex.. Approve, reject and forward). The user will select multiple lines on the ALV output and hits either one of these push buttons. My question is how do I capture the multiple selected output lines.

2) This question has been asked before..and I tried to implement the answer. The problem I am facing is ..I need a function key to say that everytime I select a line(single click)..it should modify the internal tabel with CHECK = 'X'.

Any help is kindly appreciated.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

If you should have in your output table a field for MARK, the system'll set this field for every selected fields.

DATA: BEGIN OF T_OUTPUT,

FIELD1,....

...........

FIELDN,

MARK,

END OF T_OUTPUT

Before calling ALV GRID

You have to indicate tne name of field for selection:

gt_layout-box_fieldname = 'MARK'.

gt_layout-box_tabname = 'T_OUTPUT'.

So in your user command

LOOP AT T_OUTPUT WHERE MARK = 'X'.

ENDLOOP.

Max

3 REPLIES 3

laxmanakumar_appana
Active Contributor
0 Kudos

Hi ,

Use this ALV Method to capture selected lines.

CALL METHOD alvgrid->get_selected_rows

IMPORTING

et_row_no = X_rows.

Laxman

former_member188685
Active Contributor
0 Kudos

Hi,

you can do this in two ways , one is using checkbox .

for that you will need to have one character field in your internal table. and then populate fieldcatalog and do it. or else you can do with the help of BOXfield of char 1 ,specify in layout , here if you want to select multiple lines then you need to take help of CTRL key in the key board and mark it.

and selection lines you can identify once user press the button , you need to handle it user_command.

in user_command event you need to loop at itab for check = 'X'. and capture lines you have selected.

Regards

vijay

Former Member
0 Kudos

Hi

If you should have in your output table a field for MARK, the system'll set this field for every selected fields.

DATA: BEGIN OF T_OUTPUT,

FIELD1,....

...........

FIELDN,

MARK,

END OF T_OUTPUT

Before calling ALV GRID

You have to indicate tne name of field for selection:

gt_layout-box_fieldname = 'MARK'.

gt_layout-box_tabname = 'T_OUTPUT'.

So in your user command

LOOP AT T_OUTPUT WHERE MARK = 'X'.

ENDLOOP.

Max