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: 

Multiple ALV and layout change

Former Member
0 Kudos

In a report, I call FM REUSE_ALV_LIST_DISPLAY multiple times to output the data. This logic is include in a form FRM_OUTPUT.

After I run the program, result1 will be displayd. Now I want to change layout, I have added a button to select the fields that we want to display. After selected, I call the form FRM_OUTPUT again with changed field catalog. Then result2 will be displayed.

Now I have a problem when we click the BACK botton, the result1 will be showed up. What's we expected is the selection screen of the program.

Can any one help me? Thanks in advance!

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

I suppose you call the FORM in the USER_COMMAND form of the ALV, so after some clicks you get a stack like

- main

- form FRM_OUTPUT

- ALV

- form FRM_OUTPUT

- ALV

- etc.

so when you press back you get back to previous ALV

Don't call the form in the USER_COMMAND, but exit from ALV filling rs_selfield-exit and passing the r_ucomm ok code (and otgher informations required) to variable(s) of the main program, there execute again a FRM_OUTPUT when ALV memory is freed. (if you only set exit but call FRM_OUTPUT from inside ALV, that will work, but you will get every ALV stacked in memory, so less performances)

Regards,

Raymond

6 REPLIES 6

Former Member
0 Kudos

Hi,

Define the screen number of your selection screen as 100 (or any number between 0 and 999).

SELECTION-SCREEN BEGIN OF SCREEN 100.

<code>

SELECTION-SCREEN END OF SCREEN 100.

Now when BACK is clicked, code the following.

CALL SCREEN 100.

Hope this helps.

Thanks,

Harini

raymond_giuseppi
Active Contributor
0 Kudos

I suppose you call the FORM in the USER_COMMAND form of the ALV, so after some clicks you get a stack like

- main

- form FRM_OUTPUT

- ALV

- form FRM_OUTPUT

- ALV

- etc.

so when you press back you get back to previous ALV

Don't call the form in the USER_COMMAND, but exit from ALV filling rs_selfield-exit and passing the r_ucomm ok code (and otgher informations required) to variable(s) of the main program, there execute again a FRM_OUTPUT when ALV memory is freed. (if you only set exit but call FRM_OUTPUT from inside ALV, that will work, but you will get every ALV stacked in memory, so less performances)

Regards,

Raymond

0 Kudos

Thanks for your reply.

Should I fill rs_selfield-exit every time I call FM REUSE_ALV_LIST_DISPLAY?

Where should I execute again a FRM_OUTPUT ?

0 Kudos

I suggested something like

main

DO
  perform FRM_OUTPUT
  if g_ucomm NE yourcode. EXIT. ENDIF.
ENDDO

form FRM_OUTPUT

execute selection
CALL ALV

form USER_COMMAND

if r_ucomm EQ yourcode
  move r_ucomm  to g_ucomm.
  rs_selfield-exit = 'X'.
else.
  clear g_ucomm.
endif.

Regards,

Raymond

0 Kudos

Thank you very very much.

Would you please explain me the following code?

form USER_COMMAND
if r_ucomm EQ yourcode
  move r_ucomm  to g_ucomm.
  rs_selfield-exit = 'X'.
else.
  clear g_ucomm.
endif.

0 Kudos
if r_ucomm EQ yourcode. " when user click a "refresh" or "change selection" icon
  move r_ucomm  to g_ucomm. " store the volatile code to a global variable of main program
  rs_selfield-exit = 'X'. " inform ALV to end, program will continue after CALL FUNCTION or equivalent
else. " else
  clear g_ucomm. " clear the global code, so main program wont react when standard exit (F3, F12)
endif.

Regards,

Raymond