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

ALV to Selection Screen problem

Former Member
0 Likes
3,232

Hi experts,

I have a report with two selection screens. The default one is 1000 and upon execution I am navigating to 9000 using CALL SELECTION-SCREEN. From here I am calling an ALV using REUSE functionality while in START-OF-SELECTION. But whenever I press back button from the ALV, I am taken to selection screen 1000 and not to 9000 as desired.

I have tried LEAVE TO SCREEN 0 and LEAVE LIST PROCESSING in callback user command also but the program is skipping the second selection screen and jumping to the first one from the ALV.

Please share your knowledge on this. Can you think of a standard report which has a similar functionality that I can use as a reference?

Thanks in advance.

16 REPLIES 16
Read only

Former Member
0 Likes
2,827

Hi,

I think you are calling the selection screen within the start -of - selection. never call a screen inside the start of selection.

Try to call it after the end of selection.

start of selection.

fetch the data.

end of selection.

call the screen based upon the logic.

All the best.

aahbha

Read only

0 Likes
2,827

Hi,

Thanks for your responses,

I was calling the screens at AT SELECTION-SCREEN event. I tried calling it at END-OF-SELECTION as per your suggestion also but then after calling the 9000 screen and executing, only the AT SELECTION-SCREEN of 9000 and no START-OF-SELECTION is getting triggered. Control is then returning back after the CALL SELECTION SCREEN 9000( END-OF-SELECTION event) and starting all over with initialization event and 1000 screen. This time ALV did not get triggered since START OF SELECTION was not executed for 9000.

What I noticed is that, even if I call different selection screens, the moment the control enters the START-OF-SELECTION block, the sy-dynnr value changes to 1000. And START-OF-SELECTION is getting triggered only once even there is a multiple screen sequence.

And I have tried LEAVE TO SCREEN 0 and adding exit logic to the ALV back button but they are all taking it back to screen 1000.

Read only

0 Likes
2,827

Hi Shinjan,

Follow this procedure:

Use object oriented concept. Generate ALV by using SET_TABLE_FOR_FIRST_DISPLAY method.

Create two screen. One is Secondary Selection Screen. And the other one is for Custom container of ALV.

Simply use LEAVE TO SCREEN 0, which takes you to previous screen always.

Check this simple code:

data: p_date2 type dats.
data: itab type standard table of zpr_profit_elect.

parameter: p_date type dats.

start-of-selection.

call screen 2000.
*&---------------------------------------------------------------------*
*&      Module  STATUS_2000  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module status_2000 output.
  set pf-status 'TEST'.
*  SET TITLEBAR 'xxx'.

endmodule.                 " STATUS_2000  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_2000  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module user_command_2000 input.
 if sy-ucomm = 'BACK'.
   leave to screen 0.
 elseif sy-ucomm = 'EXE'.
   call screen 3000.
 endif.
endmodule.                 " USER_COMMAND_2000  INPUT
*&---------------------------------------------------------------------*
*&      Module  STATUS_3000  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module status_3000 output.
  set pf-status 'TEST1'.

endmodule.                 " STATUS_3000  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_2000  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module user_command_3000 input.
 if sy-ucomm = 'BACK'.
   leave to screen 0.
 endif.
endmodule.                 " USER_COMMAND_3000  INPUT

Let us know if your requirement is to use REUSE ALV only or if you need any inputs on SET_TABLE_FOR_FIRST_DISPLAY method.

Thanks,

Naveen Inuganti

Read only

0 Likes
2,827

Thanks for the response.

I am sure this should work. But my requirement is to use REUSE ALV only because my list is an editable hierarchical list, which cannot be achieved using SALV or GRID or anything else :(.

Can anyone think of any standard program that leads to a list display after two selection screens? I could try and see how that is handled.

Thanks again for the inputs.

Read only

Former Member
0 Likes
2,827

Hiii...

U have to write logic on 'back' button which is present in application toolbar... by using PF status...

Check this link..

Hope this will solve your probelm.

Regards,

Jhings

Read only

Former Member
0 Likes
2,827

Hi

When calling the screen 9000 use


CALL SCREEN 9000

at custom PF Status in back button


LEAVE TO SCREEN 0.

--

Raul Natu

Read only

Former Member
0 Likes
2,827

Hi Shinjan,

Use leave to screen 9000.

Regards,

Simi A M

Read only

Former Member
0 Likes
2,827

Hi,

Do not use Leave to Screen 0 or Leave to list processing. Instead, call the screen again.

Check this link.

http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba83d35c111d1829f0000e829fbfe/content.htm

Regards,

Ernesto

Read only

rathishr_nair
Explorer
0 Likes
2,827

Hi Shinjan,

Create a PF Status of your own and assign Function Type 'E' to Back, Exit and Cancel buttons. Now in the Call Back User Command Subroutine write the following logic.

CALL SELECTION-SCREEN 9000.

LEAVE TO SCREEN 0.

I have tested this and it is working.

Thanks and Regards,

Rathish R Nair

Read only

Former Member
0 Likes
2,827

try change the GUI STATUS of "BACK" to "BK" (BACK will be the default of sap standard)

and at user command of REUSE ALV add :

if sy-ucomm = 'BK'.

CALL SCREEN 9000.

endif.

if cant, try "LEAVE TO SCREEN 9000".

<points begging removed by moderator>

Edited by: Sendy Kosada on Mar 14, 2011 4:01 PM

Edited by: Thomas Zloch on Mar 14, 2011 4:29 PM

Read only

0 Likes
2,827

Thanks friends. I have done these too.

The problem here is that 9000 is not a normal screen. It is a SELECTION SCREEN. Which is why LEAVE TO SCREEN and CALL SCREEN is going to DUMP.

And, if I do a CALL SELECTION SCREEN 9000, then I am getting what is required i.e. 9000 is coming. But on execution of it, it is going to screen 1000 and not the ALV.

This is the flow of control. Please read this.

1. SELECTION SCREEN 1000 (sy-dynnr 1000 )

1.1 User Presses Execute.

1.2 -> AT SELECTION SCREEN

1.3 -


> call selection screen 9000

2. SELECTION SCREEN 9000 ( sy-dynnr 9000 )

2.1 user enters data and press execute

2.2 -> AT SELECTION SCREEN ( for 9000, some check happens )

3 -> START-OF-SELECTION ( sy-dynnr mysteriously changes to 1000 )

3.1 -


> ALV is displayed.

3.1.1 ALV SCREEN (sy-dynnr 1000 )

3.1.2 user presses BACK ( new Fcode assigned with type 'E')

3.1.3 -> USER COMMAND CALL BACK ROUTINE

3.1.4---> CALL SELECTION-SCREEN 9000.

(new screen cycle starts )

4. SELECTION SCREEN 9000 ( sy-dynnr 9000 )

4.1 user enters data and press execute

4.2 -> AT SELECTION SCREEN ( for 9000, some check happens )

control goes back to step 3.1.4 ( no START OF SELECTION )

since there is no step after 3.1.4, initialization starts and screen 1000 gets called implicitly

I am back at step 1 after user interaction step 4.1 :'(.

This way now I am going back to 1st selection screen from second one after pressing F8.

Read only

0 Likes
2,827

Hi,

How did you define your second screen 9000? Try putting 9000 as Next Screen on the Screen Attributes.

Regards,

Ernesto

Read only

0 Likes
2,827

Hi Shinjan,

Take help of another TRANSACTION CODE or program for first selection-screen.

Ex:

Create one program with Selection Screen1 and SUBMIT PROGRAM2 in start-of-selection of this first program.

PROGRAM2 will contains Selection SCreen2 and expected output.

Here, one issue I found is we are not coming back to Selection screen1 from selection screen2, instead of that we are going to SE38 or initial screen.

But Selection-screen2 to output screen looping is not having any issues. I haven't spend much time on it.. check it once from your side too.

Thanks,

Naveen Inuganti

Read only

0 Likes
2,827

Ernesto,

This is how I am creating screen 9000.

SELECTION-SCREEN BEGIN OF SCREEN 9000 TITLE text-014 AS WINDOW.

  • parameter/select option declaration

  • parameter/select option declaration

  • parameter/select option declaration

SELECTION-SCREEN END OF SCREEN 9000.

I do not know how setting the next screen will help but that is not an option either since I have multiple secondary screens viz, 9000, 9010 and 9020 and depending upon the action on screen 1000, control can branch to any secondary selection screen.

Naveen,

And as for your solution, this should work I think. May be I can avoid the issue you are facing by using SUBMIT and RETURN. Will test and get back.

Thanks.

Edited by: Shinjan on Mar 14, 2011 10:06 PM

Read only

0 Likes
2,827

Hi Shinjan,

Create a PF Status of your own and change the Function of Back button from 'BACK' to something else. And in the Call Back User Command write the below logic.

Call Selection Screen 9000.

Leave to Screen 0.

The Call Selection Screen statement will call the Selection Screen you have created and the Leave to Screen 0 will ensure that when you press back from Screen 9000, it will take you to the first Selection Screen. If you don't give that, when you press back from the Screen 9000, it will take you to the ALV display.

Thanks and Regards,

Rathish R Nair

Read only

Former Member
0 Likes
2,827

Hii...

I understand your requirement and.. As per my knowledge this is not possible to acheive via selection screens...

The reason is.. selection screen processing and list processing both are different..

You can move.. from 1 selection screen to another in selection screens and can move from one list processing to another..

but once selection screen processing is done.. u cant come back to the middle of the selection screen..

It will start from the beginning..

But.. it is possible in module pool screens..

Regards,

Jhings.