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: 

programming the BACK button from a list

Former Member
0 Kudos

Hi,

I have a program that utilizes a selection-screen, a customized screen, and a list (leave to list-processing) respectively. What i want to know is how to enable the back buttom from the list to immediately go to the selection-screen instead of the customized screen (which comes before the list).

at user-command doesn't seem to work... any advice is welcome. Thanks!

7 REPLIES 7

Former Member
0 Kudos

HI winnie

try using LEAVE TO SCREEN 0.

REGARDS

KISHORE

Former Member
0 Kudos

Hi Winnie,

As you say that the Selection-Screen is a costomized one, there should be a <b>PF-STATUS</b> for that Screen. A statement like '<b>SET PF-STATUS 'xxx</b>'.

Double click on the '<b>xxx</b>'. You will see a Maintain Status of xxx Interface .... screen.

there must be 3 options on the screen.

1.Menu Bar

2.Application Toolbar

3.Function Keys

Expand <b>'Function Keys</b>' option. You will find the '<b>BACK</b>' icon in between many icons. Write a Function Code in the Text Box immediately above the icon. Also type the same Function Code and the text you need to display near which ever Shortcut key you wish in the 'Recommended Function Key Settings' area. Now <b>SAVE</b> it and <b>Activate</b> it.

Go back to the program and write a small logic in your program after the list gets displayed as follows.

<b>CASE SY-UCOMM.

WHEN 'BACK'.

SET SCREEN '1000'.

LEAVE SCREEN.

ENDCASE.</b>

Where <b>BACK</b> is your Function Code you mentioned in the <b>Maintain Status of xxx Interface ....</b> screen and <b>1000</b> is the number of your Selection Screen.

Hope this helps you.

Regards,

Vaitheeswaran

Former Member
0 Kudos

hi winnie,

this documentation may solve your problem..

<b>To pass control from the dialog processor to the list processor, you must include the following statement in one of the dialog modules:</b>

<b>LEAVE TO LIST-PROCESSING [AND RETURN TO SCREEN <nnnn>].</b>

You can include this statement in either the PBO or the PAI event. Its effect is to start the list processor and display the basic list after the PAI processing of the current screen. The basic list contains any list output from all PBO and PAI modules that have been executed up to that point.

If detail lists are defined in the corresponding event blocks of the ABAP program (AT LINE-SELECTION, AT USER-COMMAND), user actions on the basic list will lead to the detail list, and further interaction will lead to further list levels.

You can leave list processing in two ways:

By leaving the basic list using the Back, Exit, or Cancel function.

By using the following statement during list processing:

<b>LEAVE LIST-PROCESSING.</b>

In both cases, control returns from the list processor to the dialog processor. Each time this occurs, the entire list system is initialized. Any subsequent list output statements in PBO and PAI modules apply to an empty basic list.

By default, the dialog processor returns to the PBO processing of the screen from which the list processor was called. The optional addition AND RETURN TO SCREEN allows you to specify a different screen in the current screen sequence at whose PBO event you want to resume processing. In particular, the statement

<b>LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.</b>

can be used to end the current screen sequence and return to the point from which it had originally been called.

<b>

Recommended Procedure</b>

If you want to display lists during screen processing, you should create a separate screen for each list system that you want to call. This screen encapsulates the creation and display of the basic list. It can then be called from anywhere in the program using CALL SCREEN.

The actual screen mask of this screen can remain empty. You do not need any PAI modules, and only a single PBO module. In the PBO module, you define the basic list of the list system and call the list processor.

First, use the

<b>LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.</b>

statement to call the list display at the end of the screen, and to ensure that, after leaving the list, you return to the point from which the screen was called.

Next, set a GUI status for the list; for example, the default list status SPACE or a list status of your own.

Use one of the following statements to ensure that the empty screen is not displayed:

<b>SUPPRESS DIALOG.</b>

or

LEAVE SCREEN. Instead, the list is displayed immediately at the end of the screen.

Now define the entire basic list, and place any necessary data in the HIDE area.

If you want to process user actions on the list, you need to define the relevant event blocks in your ABAP program. If you want to call more than one independent list system in the program, you must ensure that you can tell them apart in the list event processing. You cannot do this using SY-DYNNR, since the container screen for a list is always number 120. Instead, you could assign a different GUI status to each list, and distinguish between the list systems using the value of SY-PFKEY, or you could place some unique information in the HIDE area of each list system.

Example

REPORT demo_leave_to_list_processing .

TABLES sdyn_conn.

DATA: wa_spfli TYPE spfli,

flightdate TYPE sflight-fldate.

CALL SCREEN 100.

MODULE status_0100 OUTPUT.

SET PF-STATUS 'SCREEN_100'.

ENDMODULE.

MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE user_command_0100.

CALL SCREEN 500.

SET SCREEN 100.

ENDMODULE.

MODULE call_list_500 OUTPUT.

LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.

SET PF-STATUS space.

SUPPRESS DIALOG.

SELECT carrid connid cityfrom cityto

FROM spfli

INTO CORRESPONDING FIELDS OF wa_spfli

WHERE carrid = sdyn_conn-carrid.

WRITE: / wa_spfli-carrid, wa_spfli-connid,

wa_spfli-cityfrom, wa_spfli-cityto.

HIDE: wa_spfli-carrid, wa_spfli-connid.

ENDSELECT.

CLEAR: wa_spfli-carrid.

ENDMODULE.

TOP-OF-PAGE.

WRITE text-001 COLOR COL_HEADING.

ULINE.

TOP-OF-PAGE DURING LINE-SELECTION.

WRITE sy-lisel COLOR COL_HEADING.

ULINE.

AT LINE-SELECTION.

CHECK not wa_spfli-carrid is initial.

SELECT fldate

FROM sflight

INTO flightdate

WHERE carrid = wa_spfli-carrid AND

connid = wa_spfli-connid.

WRITE / flightdate.

ENDSELECT.

CLEAR: wa_spfli-carrid.

This example switches to list processing during the screen processing for screen 100. Screen 100 has a single input field - the component CARRID from the ABAP Dictionary structure SDYN_CONN.

Do contact me if you have any problem

and do reward the points if you think this documentation is of your help to you.

Thanks and regards,

kunal.

mandar_shete
Active Participant
0 Kudos

Hi,

Try..

Set SY-LSIND = 0 and then Leave to Screen 0.

Former Member
0 Kudos

Hi winnie,

1. Things won't work if we do normal things.

2. The important things are :

a) New PF-STATUS is required , say 'ABCD'.

b) Handle user_commmand

3. First of all, from Function group SALV,

copy the STANDARD gui status to your program,

from SE80, by right clicking.

4. come to your program.

start-of-selection.

SET PF-STATUS 'ABCD'.

5. Double click ABCD and activate the gui status.

6. In gui status,

in those green buttons and yellow buton,

write BACK1 in both.

ie. buttons with fcode BACK1.

Save and activate.

6. AT USER-COMMAND.

IF sy-ucomm = 'BACK1'.

DATA : answer TYPE c.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = 'Do You Want To Exit ?'

text_question = 'Do You Want To Exit ?'

IMPORTING

answer = answer

EXCEPTIONS

text_not_found = 1

OTHERS = 2.

IF answer = '1'.

SET USER-COMMAND 'BACK'.

ENDIF.

ENDIF.

This will solve your problem.

I tried at my end, it works fantastic.

regards,

amit m.

former_member188685
Active Contributor
0 Kudos

Hi,

Set the fcode for BACK and handle it in user command.

it will work.

after leave to list processing

before writing the list set the pf-status.

and handle it in user command.

at user-command.
case sy-ucomm.
when 'BACK'.
set screen 1000.
leave screen.

endcase.

Regards

Vijay

0 Kudos

yes what vijay coded gives u result what u want

beacuse selection screens default screen number is 1000