Skip to Content
0

ALV select row "copy" and "paste" into next alv

Jun 09, 2017 at 07:47 AM

41

avatar image

Hi Community,

since 2 days i've been stuck at this. I looked in other communities but i just cant figure it out. I'm doing my internship so im not that experienced. I have created an ALV with 'reuse alv grid display'. And created another Selection-Screen which opens another ALV. Now i just want to copy a row from the 1st ALV and pass it to the selection screen which opens another ALV. In the 1st ALV i just want to copy the MATNR pass it to my selection screen.

FORM alv_output.

DATA: lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_layout TYPE slis_layout_alv.
DATA: ls_keyinfo TYPE slis_keyinfo_alv.
DATA: ls_variant TYPE disvariant.
DATA: lt_event TYPE slis_t_event.

ls_variant-report = sy-repid.


* ALV-Layout
PERFORM create_layout CHANGING ls_layout.

* ALV Feldliste
PERFORM create_fieldcat CHANGING lt_fieldcat.

* ALV Events
PERFORM alv_event CHANGING lt_event.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
* CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = gc_pgmname
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'FCODE_ACTION'

i_structure_name = 'ZLOCK_DISPLAY'
i_save = 'A'
is_variant = ls_variant
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_events = lt_event
* IT_EVENT_EXIT =
TABLES
t_outtab = gt_list
EXCEPTIONS
program_error = 1
OTHERS = 2.

ENDFORM. " alv_output


than i tried to work with an event handler but it doesnt work cause its not an object ?!?! ( i dont know if im right with this)



And i also tried this method

FORM cb_alv_user_command1
USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.

IF r_ucomm = 'History'.
READ TABLE gt_list into sel_row
INDEX rs_SELFIELD-TABINDEX.
o_matnr = sel_row-matnr.
ENDIF.

ENDFORM.

But if I debug it, there is now row selected.



Thank you for your help!

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Chintu adi Jun 09, 2017 at 07:56 AM
0

Hello,

in you user_command form you can submit your report by passing the values of current ALV into selection screen parameters.

check the below code.

FORM cb_alv_user_command1 USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.

IF r_ucomm = 'History'.
READ TABLE gt_list INTO sel_row INDEX rs_SELFIELD-TABINDEX.
o_matnr = sel_row-matnr.

SUBMIT <REPORT-2 NAME> WITH <SELECT-OPTION> IN o_matnr

( WITH <PARAMTER> EQ o_matnr )<<< depends on what you are having on selection screen.

VIA SELECTION SCREEN AND RETURN.

endif.

ENDFORM.

thank you!!

Show 1 Share
10 |10000 characters needed characters left characters exceeded

and if you want to display second ALV skip RETURN.

0