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: 

Weird selection-screen behaviour when returning from an ALV-list display

BaerbelWinkler
Active Contributor
0 Kudos

Hi All!

I'm mystified by some weird selection-screen behaviour having to do with the SCREEN-fields ACTIVE and INVISIBLE.

I defined a run-of the mill selection-screen which includes a radiobutton-group with two options each of which has selecton-options to go with it. Depending on which of the two radiobuttons is active, one or the other sets of select-options should be visible and available for input:

"Selection via goods receipt
PARAMETERS: p_gr RADIOBUTTON GROUP rbg USER-COMMAND uc1.

SELECT-OPTIONS: s_lifnr FOR mseg-lifnr MODIF ID gr,
s_matnr FOR mseg-matnr MODIF ID gr,
s_bwart FOR mseg-bwart MODIF ID gr,
s_ebeln FOR mseg-ebeln MODIF ID gr.

SELECTION-SCREEN SKIP 1.

"Selection via invoices
PARAMETERS: p_ir RADIOBUTTON GROUP rbg.

SELECT-OPTIONS: s_belnr FOR rbkp-belnr MODIF ID ir ,
s_rbstat FOR rbkp-rbstat MODIF ID ir.

In AT SELECTION-SCREEN OUTPUT I have the logic to determine which select-options should be visible (copied from another program where this is working as it should):

AT SELECTION-SCREEN OUTPUT.

"Display or hide select-options dependent on main path for selection
CASE abap_true.

WHEN p_gr.
"Selection via goods receipt (MSEG/MKPF) --> hide invoice selection
LOOP AT SCREEN.
IF screen-group1 EQ 'IR'. "EC NOTEXT
screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.

WHEN p_ir.
"Selection via invoice (RSEG/RBKP) --> hide goods receipt selection
LOOP AT SCREEN.
IF screen-group1 EQ 'GR'. "EC NOTEXT
screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.

WHEN OTHERS.
ENDCASE.

Executing the program from SE38 works fine, with the GR-group of select-options getting displayed and the IR-group suppressed (apart from the radiobutton itself):

Grabbing a variant for the IR-selection makes the selection-screen look like this as expected:

When I then run the report and return from ALV-listing, it looks like this:

==> two select-options have gone missing.

In debugging I can see that the log for P_IR in AT SELECTION-SCREEN OUTPUT is executed and that the field SCREEN-INVISIBLE is set to '1'. Just setting SCREEN-ACTIVE to '1' doesn't change anything. Toggling between the two radiobuttons makes the fields appear again, though.

Not sure what I'm missing here. It's most likely something stupid, I'm not thinking of!

I'm working in a NW750 EHP8 SP25 system. This new program uses CL_SALV_TABLE to create the ALV-listing while the old program, where the selection-screen handling is working fine, uses the old function module REUSE_ALV_GRID_DISPLAY. I sure hope that this doesn't make a difference to the selection-screen's (mis)behaviour!

Thanks for any suggestions of what I can check!

Cheers

Bärbel

1 ACCEPTED SOLUTION

BaerbelWinkler
Active Contributor

Thanks for all your input! I finally figured out what it was:

To begin with, I didn't have the "DEFAULT 'X'" addition for P_GR even though this was picked as the default as it's the first parameter in the radiobutton group. However, upon first displaying the selection-screen and because the default wasn't explicitely set, still showed the select-options for P_IR. Which is why I added a loop through SCREEN to switch ACTIVE off for P_IR select-options in INITIALIZATION. What I hadn't realized: that event gets executed upon returning from the ALV-Display and not just when the program is started the very first time.

Adding the DEFAULT 'X' and deleting this then unnecessary SCREEN logic from INITALIZATION made the rest of the program work as it should.

So, bottom line: my hunch was correct in that it most certainly turned out to be something stupid, I wasn't not thinking off!

Documenting this here so that others running into the same or a similar issue find something.

Thanks again sandra.rossi, frdric.girod, stanislaslemaire and chaouki.akir for helping me figuring this out!

Cheers

Bärbel

11 REPLIES 11

Sandra_Rossi
Active Contributor
0 Kudos

For a radiobutton group, always indicate DEFAULT 'X' or abap_true on one of the buttons, otherwise they will be all blank (unfortunately).

BaerbelWinkler
Active Contributor

sandra.rossi

Thanks for commenting, Sandra!

However, even if I add the Default 'X' to P_GR in the definition, the behaviour doesn't change. While in debugging earlier I did see that P_IR was still set to 'X' when returning from the ALV-list. When selecting P_GR and returning from the ALV-list, the associated select-options remained visible. It's just not working when P_IR is used. Really weird ...

Sandra_Rossi
Active Contributor
0 Kudos

If you do a little program which contains only the code above + a minimal CL_SALV_TABLE, I guess it works as expected. So there's something else, but I can't say what.

Via the debugger, you could check the value of the system table SCREEN right before the screen is displayed. This way you can check whether it's some ABAP code (or screen variant or whatever) which changes SCREEN or if it's a SAP GUI or basis/kernel bug.

FredericGirod
Active Contributor

Do you have little bit more code, specialy the PAI PBO of the ALV ? When I tried a simple test it works.

TABLES mseg.
TABLES rbkp.
"Selection via goods receipt
PARAMETERS: p_gr RADIOBUTTON GROUP rbg USER-COMMAND uc1 DEFAULT 'X'.
SELECT-OPTIONS: s_lifnr FOR mseg-lifnr MODIF ID gr,
s_matnr FOR mseg-matnr MODIF ID gr,
s_bwart FOR mseg-bwart MODIF ID gr,
s_ebeln FOR mseg-ebeln MODIF ID gr.
SELECTION-SCREEN SKIP 1.
"Selection via invoices
PARAMETERS: p_ir RADIOBUTTON GROUP rbg.
SELECT-OPTIONS: s_belnr FOR rbkp-belnr MODIF ID ir ,
s_rbstat FOR rbkp-rbstat MODIF ID ir.



AT SELECTION-SCREEN OUTPUT.
"Display or hide select-options dependent on main path for selection
CASE abap_true.
WHEN p_gr.
"Selection via goods receipt (MSEG/MKPF) --> hide invoice selection
LOOP AT SCREEN.
IF screen-group1 EQ 'IR'. "EC NOTEXT
screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
WHEN p_ir.
"Selection via invoice (RSEG/RBKP) --> hide goods receipt selection
LOOP AT SCREEN.
IF screen-group1 EQ 'GR'. "EC NOTEXT
screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
WHEN OTHERS.
ENDCASE.



START-OF-SELECTION.
call transaction 'FB01'.
ENd-OF-SELECTION.

stanislaslemaire
Participant

Hello,
I confirm that with a small simple test program, there are no worries.

Tested on SAP system 750, with EHP8, SAPGui version 750.
And ALV display be use of CL_SALV_TABLE, called in END-OF-SELECTION event...

  TRY.
   cl_salv_table=>factory( IMPORTING  r_salv_table = lr_table
                            CHANGING   t_table  = gt_data[] ).
  CATCH cx_salv_msg INTO lo_exception.
      MESSAGE lo_exception TYPE 'I'.
  ENDTRY.
  lr_table->display( ).

BaerbelWinkler
Active Contributor
0 Kudos

Thanks All, for your comments!

frdric.girod

Hi Fred!

What exactly would you like to see with regards to " PAI PBO of the ALV"? This is a simple report program based on a template I created for myself and which I routinely use. It uses local classes and methods, so I don't have specific PAI/PBO logic for the ALV in it.

It's the first time that I've run into this kind of issue but I don't remember if I already used this type of selection-screen logic in combination with CL_SALV_TABLE or if this is the first time.

sandra.rossi

Hi Sandra!

I already checked the value of the system table SCREEN in debugging, but it's a bit cumbersome as I don't seem to have a means to see the full table in one go (is there one?), so need to display individual lines while in the loop logic. It's easy to miss something relevant that way obviously.

stanislaslemaire

Hi Stanislas!

I have the method call from where CL_SALV_TABLE is called in START-OF-SELECTION as in many other programs I've written with this template. Could having it in END-OF-SELECTION make a difference?

Cheers

Bärbel

stanislaslemaire
Participant
0 Kudos

For me, no difference if SALV called in START-OF-SELECTION.
I think, as suggested by Frederic, some piece of code exist in your development, in SALV event of other part...

FredericGirod
Active Contributor
0 Kudos

my idea was about the exit command : LEAVE TO SCREEN ... CALL SCREEN ...

chaouki_akir
Contributor
0 Kudos

If you comment all the code in event START-OF-SELECTION (<=> don't display SALV), does the problem still occur ?

BaerbelWinkler
Active Contributor

Thanks for all your input! I finally figured out what it was:

To begin with, I didn't have the "DEFAULT 'X'" addition for P_GR even though this was picked as the default as it's the first parameter in the radiobutton group. However, upon first displaying the selection-screen and because the default wasn't explicitely set, still showed the select-options for P_IR. Which is why I added a loop through SCREEN to switch ACTIVE off for P_IR select-options in INITIALIZATION. What I hadn't realized: that event gets executed upon returning from the ALV-Display and not just when the program is started the very first time.

Adding the DEFAULT 'X' and deleting this then unnecessary SCREEN logic from INITALIZATION made the rest of the program work as it should.

So, bottom line: my hunch was correct in that it most certainly turned out to be something stupid, I wasn't not thinking off!

Documenting this here so that others running into the same or a similar issue find something.

Thanks again sandra.rossi, frdric.girod, stanislaslemaire and chaouki.akir for helping me figuring this out!

Cheers

Bärbel

Sandra_Rossi
Active Contributor

Debugger tools > Special Tools > Screen Analysis: