Skip to Content
author's profile photo Former Member
Former Member

Calling Subscreens

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2005 at 01:39 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2005 at 01:39 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Sasi,

      Yes, I was wanting to call the subscreen dynamically and the soltion from Max to set a variable for the subscreen to be called in PAI solves my problem.

      Thanks all for your helpful ideas.

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2005 at 01:41 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 26, 2005 at 01:55 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.