05-06-2010 3:11 PM
I wish to use LIST_FROM_MEMORY to exchange parameter calling a program with a selection screen (it's the better system I found).
So I have a Zprogram with this code:
SUBMIT zconnect VIA SELECTION-SCREEN
EXPORTING LIST TO MEMORY AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = list_tab
EXCEPTIONS
not_found = 1
OTHERS = 2.
The "zconnect" program is a simple report with a selection screen e four "write", one for each parameter I put in.
When I put the values and click the "clock" to execute, I get my four values written and I can't go over, I'can't continue my caller program.
How have I do to get the values written in the memory, and not (if it is possible) on the screen?
I found several examples to get the list, but no one to put it.
Thanks for the help.
(I'm doing this because I can't declare a screen in a global class, so I'm trying other ways)
05-06-2010 9:55 PM
I'm not sure to understand: you just want to call a selection screen from a global class and get the entered values? Simply define a routine that exports the entered values, and you call it from your global class.
05-06-2010 4:42 PM
Hi,
When you submit via selection screen, control comes back to selection screen. Just press back button. You can continue to source program. But if you don't want this kind of option then create same selection screen as your submitted program in your source program. Check below sample code.
TABLES: lfa1, lfb1.
SELECT-OPTIONS: so_lifnr FOR lfa1-lifnr MATCHCODE OBJECT kred,
so_bukrs FOR lfb1-bukrs NO INTERVALS NO-EXTENSION.
DATA list_tab TYPE TABLE OF abaplist.
SUBMIT zmdm_xx_vendor_report WITH so_lifnr[] IN so_lifnr[]
WITH so_bukrs[] IN so_bukrs[]
EXPORTING LIST TO MEMORY AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = list_tab
EXCEPTIONS
not_found = 1
OTHERS = 2.
Thanks,
Vinod.
05-06-2010 4:50 PM
> But if you don't want this kind of option then create same selection screen as your submitted program in your source program.
My source program is a global class: I can't create a screen, or a selection-screen, in that source.
I created a zreport only to get a screen for my global class.
05-06-2010 9:55 PM
I'm not sure to understand: you just want to call a selection screen from a global class and get the entered values? Simply define a routine that exports the entered values, and you call it from your global class.
05-07-2010 7:38 AM
> Simply define a routine that exports the entered values, and you call it from your global class
Can you give me a simple example?
05-07-2010 9:44 AM
REPORT ZREPORT.
PARAMETERS param1 TYPE string.
PARAMETERS param2 TYPE string.
FORM selscr CHANGING e_param1 TYPE string e_param2 TYPE string.
CALL SELECTION-SCREEN 1000.
e_param1 = param1.
e_param2 = param2.
ENDFORM.
In the method:
DATA l_param1 TYPE string.
DATA l_param2 TYPE string.
PERFORM selscr IN PROGRAM zreport CHANGING l_param1 l_param2.
05-07-2010 11:15 AM
>In the method:
>>PERFORM selscr IN PROGRAM zreport CHANGING l_param1 l_param2.
It would be perfect, but I'm getting the following error:
Program "Zprogram=======================CP" tried to use screen 1000.
The screen does not exist.
I have four parameters and if I watch the program by se38 / se80, I can reach the screen 1000 by double click.
Is there something missing?
You are very kind: thank you for the help!
05-07-2010 12:15 PM
Well, 1000 is the default screen, it probably doesn't work with it. Then, just define a specific selection screen 1010:
SELECTION-SCREEN BEGIN OF SCREEN 1010.
PARAMETERS ...
SELECTION-SCREEN END OF SCREEN 1010.
...
...
CALL SELECTION-SCREEN 1010.
...
05-07-2010 12:42 PM
I have just done:
> SELECTION-SCREEN BEGIN OF SCREEN 1010.
> PARAMETERS ...
> SELECTION-SCREEN END OF SCREEN 1010.
> ...
> ..
> CALL SELECTION-SCREEN 1010.
Now my zprogram is:
SELECTION-SCREEN BEGIN OF SCREEN 1010.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK login WITH FRAME TITLE text-000.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (32) text-ser.
PARAMETERS: p_server(20) TYPE C.
SELECTION-SCREEN END OF LINE.
......
......
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (32) text-pwd.
PARAMETERS: p_pwd(20) TYPE C LOWER CASE.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK login.
SELECTION-SCREEN END OF SCREEN 1010.
FORM selscr
CHANGING
e_server TYPE String
e_dbase TYPE String
e_userid TYPE String
e_pwd TYPE String.
CALL SELECTION-SCREEN 1010.
e_server = p_server.
e_dbase = p_dbase.
e_userid = p_userid.
e_pwd = p_pwd.
ENDFORM.
And now my error is almost equal (1010 instead 1000):
Program "Zprogram=======================CP" tried to use screen 1010.
The screen does not exist.
By a double-click in the editor I can see the screen 1010, of course.
By debug i can arrive until "CALL SELECTION-SCREEN 1010" and after that, the error arrives.
Perhaps the problem would be able to be the previous screens.
I have:
Zreportmain/"SelectionScreen" -> Zreportmain/"AlvGridScreen" -> ZglobalClass -> ZreportLogin/"SelectionScreen1010"
Is it possible?
05-07-2010 3:02 PM
I remember this funny behavior (I guess it's a standard bug). That was already discussed in the forum. The only way to make it work is to define the selection-screen in a function group instead of a report.
FUNCTION-POOL zzz.
PARAMETERS param1 TYPE string.
PARAMETERS param2 TYPE string.
FORM selscr CHANGING e_param1 TYPE string e_param2 TYPE string.
CALL SELECTION-SCREEN 1000.
e_param1 = param1.
e_param2 = param2.
ENDFORM.
In the calling program, function module or class method, do that:
DATA l_param1 TYPE string.
DATA l_param2 TYPE string.
PERFORM selscr IN PROGRAM saplzzz CHANGING l_param1 l_param2.
Edited by: Sandra Rossi on May 7, 2010 4:09 PM
05-10-2010 9:45 AM
> I remember this funny behavior (I guess it's a standard bug).
"Standard bug": I like this fantastic oxymoron!!!
From http://en.wikipedia.org/wiki/Software_bug :
"A software bug is the common term used to describe an error, flaw, mistake, failure, or fault in a computer program or system that produces an incorrect or unexpected result".
If the result is "unexpected", it can't be standard.
> That was already discussed in the forum. The only way to make it work is to define the selection-screen in a function group instead of a report.
That's all right!
The function-pool works excellently.
Thank you very much: your help has been precious.