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

Dynamic Screen layout

Former Member
0 Likes
1,287

Hi all,

I have to display fields dynamically based on certain conditions,so i started with grouping certain fields in several subscreens like this.

-


subscreen A

-


-


subscreen B

-


-


subscreen C

-


Now if for certain type of conditions i'll be displaying subscreen A and subscreen C next to that ,like subscreen C should move up to the palce of subscreen B and subscreen B will not be displayed.(so all combination of the three screens,without

any empty space inbetwen them).Wondering how to go abut that.

Is there screen flow command which calls subscreen conditionally based on 'IF' conditions and how to move screens/fields up from its original locations.

Thanks in advance,

dan.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
935

You can do conditions in screen flow, but you can assign the subscreens dynamically by passing a variable instead of the literal screen number. So you in condition, you would be assigning the subscreen numbers that you want to the first to subscreen areas and leaving the last one empty, or assigning a dummy subscreen.

Regards,

RIch Heilman

6 REPLIES 6
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
936

You can do conditions in screen flow, but you can assign the subscreens dynamically by passing a variable instead of the literal screen number. So you in condition, you would be assigning the subscreen numbers that you want to the first to subscreen areas and leaving the last one empty, or assigning a dummy subscreen.

Regards,

RIch Heilman

Read only

0 Likes
935

Thanks for you response.

what syntax should i use if you are saying "you can do conditions in screen flow,"

so in screen flow if i call subscreen 1 and 3 in two separate statements ,will subscreen 3 will take the coordinates of subscreen 2.

Thanks,

dan.

Read only

0 Likes
935

I'm sorry Dan, when typing, your fingers sometimes do the exact opposite of what your mind is thinking.

I meant, you CAN NOT do conditions with the screen flow. So you condition will need to be inside a module of the PBO, where you can then set the subscreen numbers into variables and use these variables within your screen flow logic.

Regards,

RIch Heilman

Read only

0 Likes
935

Ok Dan, I've spent the last view minutes putting together an example, which works quite well. Here is the main program code.



REPORT zrich_001.

DATA: v_suba TYPE sy-dynnr.
DATA: v_subb TYPE sy-dynnr.
DATA: v_subc TYPE sy-dynnr.

PARAMETERS: p_suba AS CHECKBOX.
PARAMETERS: p_subb AS CHECKBOX.
PARAMETERS: p_subc AS CHECKBOX.

CALL SCREEN 100.


*&---------------------------------------------------------------------*
*&      Module  PBO  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE pbo OUTPUT.

*set pf-status 'Main'.

  IF p_suba = 'X'.
    v_suba = '0101'.
  ENDIF.

  IF p_subb = 'X'.
    IF v_suba IS INITIAL.
      v_suba = '0102'.
    ELSE.
      v_subb = '0102'.
    ENDIF.
  ENDIF.

  IF p_subc = 'X'.
    IF v_suba IS INITIAL.
      v_suba = '0103'.
    ELSEIF v_subb IS INITIAL.
      v_subb = '0103'.
    ELSE.
      v_subc = '0103'.
    ENDIF.
  ENDIF.

  IF v_suba IS INITIAL.
    v_suba = '9999'.
  ENDIF.
  IF v_subb IS INITIAL.
    v_subb = '9999'.
  ENDIF.
  IF v_subc IS INITIAL.
    v_subc = '9999'.
  ENDIF.

ENDMODULE.                 " PBO  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  pai  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE pai INPUT.

  CASE sy-ucomm.
    WHEN 'BACK'.
      LEAVE PROGRAM.
  ENDCASE.

ENDMODULE.                 " pai  INPUT

Of course, you can put your own gui status and other stuff in here, but you get the idea. Here is the screen flow logic of screen 100.



PROCESS BEFORE OUTPUT.
  MODULE pbo.
  CALL SUBSCREEN subsa INCLUDING sy-repid v_suba.
  CALL SUBSCREEN subsb INCLUDING sy-repid v_subb.
  CALL SUBSCREEN subsc INCLUDING sy-repid v_subc.



PROCESS AFTER INPUT.
  MODULE pai.
  CALL SUBSCREEN subsa .
  CALL SUBSCREEN subsb .
  CALL SUBSCREEN subsc .


Now on screen 100, there are three subscreen areas, called SUBSA, SUBSB, SUBSC. Also in this program there are three subscreen dynpros, called 101, 102, and 103. So all this will need to be created to make this example work.

Now you can see in the PBO, that I am dynamically assigning the subscreen numbers to the subscreen area variables depending on what you select on the selection screen. Also, it is important to assign a dummy subscreen(with nothing in it) to any subscreen area which has not been assigned a real subscreen. So you see that I am assigning subscreen 9999 for this.

Hope this helps.

Regards,

Rich Heilman

Read only

0 Likes
935

By the way, for this example, I just put a text label in each subscreen, like "Subscreen A" so that I could see which subscreens where being embeded.

Regards,

Rich Heilman

Read only

0 Likes
935

Thanks Rich! . It should solve my issue .I'll be trying this now.

Dan