on 09-26-2005 2:34 PM
Hi All,
I am trying to call a subscreen conditionally. Since 'Call Subscreen' is a Screen command, I cannot use it within the PBO module. But I cannot put a IF or CASE statement in the screen flow logic. I am sure there is a way to solve this problem but doesn't seem to recall now.
Any help is greatly appreciated from fellow ABAPers.
Thanks,
Chandrika
You should use a module to decide which subscreen to call
PROCESS PBO
MODULE INIT_SUBSCREEN.
CALL SUBSCREEN SUBARE INCLUDING V_PROG V_DYNNR.
MODULE INIT_SUBSCREEN.
IF .....
V_PROG =
V_DYNNR = .....
ELSE.
ENFIF.
ENDMODULE.
If you main screen has a subarea, you have always to call a subscreen, so you can only decide which subscreen, but you have to call: (perhaps you can call an empty subscreen).
Max
Message was edited by: max bianchi
Message was edited by: max bianchi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Chandrika,
you can solve this problem by using a helper variable for the subscreen's dynpro number and possibly a second helper variable for the subscreens repid.
Example:
Dynpro 100 has a subscreen area called SUBAREA. In it, you want to call either subscreen 110 or 120, depending on whether global variable GS_SWITCH is 'A' or 'B'.
The solution, briefly, is this:
In a dialog module called during PBO of dynpro 100 you fill a variable for the subscreen number depending on the value of GS_SWITCH. Then this helper variable is used in the CALL SUBSCREEN command.
I've spiced it up with some sample code.
The global data declaration in your dynpro's function group's top include serves to define the helper variable which will contain the number and report name of the subscreen to include dynamically at run-time.
data:
begin of gs_subcreen,
dynnr type sy-dynnr,
repid type sy-repid,
end of gs_subscreen.
The flow logic of dynpro 100 calls a dialog module in which the helper variable is filled. Then it calls the subscreen dynamically, using the values of the helper variable.
process before output.
module pbo_0100.
call subscreen subarea including
gs_subscreen-repid
gs_subscreen-dynnr.
process after input.
call subscreen subarea.
module pai_0100.
The code snippled for module PBO_0100 shows how to fill your helper variable:
module pbo_0100 output.
set pf-status ...
set titlebar ...
case gs_switch.
when 'A'.
gs_subscreen-dynnr = '0110'.
gs_subscreen-repid = sy-repid.
when 'B'.
gs_subscreen-dynnr = '0120'.
gs_subscreen-repid = cv_some_other_repid.
when others.
* Make sure dynnr and repid are always complete.
endcase.
endmodule.
I hope this helps, and if it doesn't, feel free to ask!
Cheers,
Thorsten Franz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chandrika,
below is a demo programme this may help you.
SELECTION-SCREEN BEGIN OF SCREEN 1100 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-010.
PARAMETERS: p1(10) TYPE c,
p2(10) TYPE c,
p3(10) TYPE c.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN END OF SCREEN 1100.
SELECTION-SCREEN BEGIN OF SCREEN 1200 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-020.
PARAMETERS: q1(10) TYPE c OBLIGATORY,
q2(10) TYPE c OBLIGATORY,
q3(10) TYPE c OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF SCREEN 1200.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA: number(4) TYPE n VALUE '1100'.
START-OF-SELECTION.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'BUTTON1'.
number = 1100.
WHEN 'BUTTON2'.
number = 1200.
ENDCASE.
ENDMODULE.
AT SELECTION-SCREEN.
MESSAGE S888(sabapdocu) WITH text-030 sy-dynnr.
below links might help you.
http://help.sap.com/saphelp_erp2004/helpdata/en/9f/dbabfe35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_46c/helpdata/en/10/e7dbde82ba11d295a40000e8353423/content.htm
http://www.sapgenie.com/abap/code/abap19.htm
reward points for helpfull answers and close the thread if your question is solved.
regards,
venu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
process before output.
call subscreen : g_change_resource including sy-repid '9002'.
process after input.
call subscreen : g_change_resource .
the above one is for calling subscreen, do you want to call the subscreen as per some condition dynamically ?
sasi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.