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

Return to ALV from function module

guido_bertoldi
Discoverer
0 Likes
1,430

Hi to all,

I'm new in this forum. My name is Guido and I'm working with Abap from 6 months ago and I whish to greet all of you. Now I have a problem that I try to explain simply. I have created a report with 2 screens: the first one is a selction screen and the second one is an ALV.

In the ALV I have added a button "Details" and on pressing it a new screen is opened. This screen is "created" in a function module developed by me.

All works fine but there is a problem: I'm not able to return from the screen of the function module to the ALV(second screen of my report). I try to use "Leave to transaction" or "Submit" calls but in all cases the screen displayed is the selection screen(first screen of my report).

Note also that the selction screen has some obligatory fields so I can't use the "Leave to tansaction..AND SKIP FIRST SCREEN" or "Call tansaction..AND SKIP FIRST SCREEN" call.

There is a way to solve this problem? Any suggestion?

Thanks in advance for the help!

8 REPLIES 8
Read only

Former Member
0 Likes
1,173

Hi,

this looks like you have forgotten to create an Intercae and a Status in SE41 for your function pool to leave the screen with EXIT-Commands.

At PBO you have to set a status with SET PF-STATUS and at PAI you need a module for leaving the screen. Define EXIT-Commands e.g. for BACK, CANCEL and ABORT ...

Regards,

Klaus

Read only

0 Likes
1,173

I have created a PAI and a PBO for all my screen. In the PAI of the screen created with the function module I use for the Back button the commands(calls) that I have indicated in my first message but the problem remains.

Read only

0 Likes
1,173

And how do you work on your exit button code.

E.g.


IF OKCODE EQ 'BACK'.
  LEAVE TO SCREEN 0.
ENDIF:

How did you define the OKCODE field on your fm screen?

PLease check that you have defined one in SE51 and that you process your exit code.

Regards,

Klaus

Read only

0 Likes
1,173

From the documentation for LEAVE TO SCREEN:

>This statement must not be used when handling events of the Control Framework.

Rob

Read only

0 Likes
1,173

Hi Rob,

this is not within the control framework, it's a screen called outside of it belonging to a function group! The screen must be closed to go back to ALV!

Edited by: Klaus Babl on Feb 28, 2011 7:04 AM

Read only

0 Likes
1,173

Hi Klaus,

I haven't define an exit code in the screen of the fm. I use a global data called WA_OK_CODE defined in the top included of the function group. The code used for the exit is the next one.

WA_OK_CODE = SY-UCOMM.

CASE WA_OK_CODE.

WHEN 'BACK'.

SET SCREEN 0.

LEAVE SCREEN.

Read only

MarcinPciak
Active Contributor
0 Likes
1,173

One thing I don't catch here. You said you have two screens - one selection screen and another with ALV. Then you said that you have added details buton which trigger new screen. So how many screen do you really have. Where is the ALV placed - is it selection screen?

If so than whenever you return from FG screen your program ends and shows initial screen which is selection screen.

You need something like

"selection screen

...

call screen 100. "next screen also set as 100

"pbo screen 100

ALV here

"pai screen 100

call function ....

"in function

call screen 200 with ALV details

"pai screen 200

LEAVE TO SCREEN 0.

Doing it like that you will get the processing back to ALV.

Regards

Marcin

Read only

guido_bertoldi
Discoverer
0 Likes
1,173

I have resolved the problem by myself. I use the following "workaround":

I create a "dummy" program in which I call the function modules with the Details screen. In the "real" program from the ALV screen I use the "call transaction <dummy program>" and all works fine.

Thanks to all for the answers.