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

At selection-screen output

Former Member
0 Likes
949

Hi Friends,

I have a selection screen like below.

PARAMETER: NUMBER(2) OBLIGATORY.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETER: SEGTYP TYPE IDOCSYN-SEGTYP MODIF ID ID,
                       FIELD    TYPE DFIES-FIELDNAME MODIF ID ID,
                       VAL(255) MODIF ID ID.

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN OUTPUT.

  IF P_NUMBER EQ ' '.

    LOOP AT SCREEN.
      CHECK SCREEN-GROUP1 = 'ID'.
      SCREEN-INPUT = 0.
      SCREEN-ACTIVE = 0.
      SCREEN-REQUIRED = 1.
      MODIFY SCREEN.
    ENDLOOP.

  ENDIF.

So, here when I enter a number 1 in my NUMBER field, the BLOCK B1 is getting displayed one time which is correct. But, when I enter number 2 in my NUMBER field, I need to display the BLOCK B1 2 times, if 3, display BLOCK B1 3 times and so on...... how do I need to display the same BLOCK multiple times based on the number entered? I haven't done this scenario before. Please let me know how to achieve this.

Thanks,

Nani

Hi Friends,

I have a selection screen like below.

PARAMETER: NUMBER(2) OBLIGATORY.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETER: SEGTYP TYPE IDOCSYN-SEGTYP MODIF ID ID,
                       FIELD    TYPE DFIES-FIELDNAME MODIF ID ID,
                       VAL(255) MODIF ID ID.

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN OUTPUT.

  IF P_NUMBER EQ ' '.

    LOOP AT SCREEN.
      CHECK SCREEN-GROUP1 = 'ID'.
      SCREEN-INPUT = 0.
      SCREEN-ACTIVE = 0.
      SCREEN-REQUIRED = 1.
      MODIFY SCREEN.
    ENDLOOP.

  ENDIF.

So, here when I enter a number 1 in my NUMBER field, the BLOCK B1 is getting displayed one time which is correct. But, when I enter number 2 in my NUMBER field, I need to display the BLOCK B1 2 times, if 3, display BLOCK B1 3 times and so on...... how do I need to display the same BLOCK multiple times based on the number entered? I haven't done this scenario before. Please let me know how to achieve this.

Thanks,

Nani

5 REPLIES 5
Read only

amy_king
Active Contributor
0 Likes
843

Hi Nani,

One problem with displaying block B1 more than once is that parameters SEGTYP, FIELD and VAL will have already been declared in the first instance of the block. You will need some way to uniquely name the selection-screen components.

One possible solution could be to statically define the selection-screen with as many blocks as you expect to need-- hopefully parameter p_number has some expected maximum value. For example...

SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETER: SEGTYP_1 TYPE IDOCSYN-SEGTYP MODIF ID ID,
                       FIELD
_1    TYPE DFIES-FIELDNAME MODIF ID ID,
                       VAL
_1(255) MODIF ID ID.

SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN BEGIN OF BLOCK B2.
PARAMETER: SEGTYP_2 TYPE IDOCSYN-SEGTYP MODIF ID ID,
                       FIELD
_2    TYPE DFIES-FIELDNAME MODIF ID ID,
                       VAL
_2(255) MODIF ID ID.

SELECTION-SCREEN END OF BLOCK B2.

...etc...

SELECTION-SCREEN BEGIN OF BLOCK B10.
PARAMETER: SEGTYP_
10 TYPE IDOCSYN-SEGTYP MODIF ID ID,
                       FIELD
_10    TYPE DFIES-FIELDNAME MODIF ID ID,
                       VAL
_10(255) MODIF ID ID.

SELECTION-SCREEN END OF BLOCK B10.

Then in event SELECTION-SCREEN OUTPUT, you could LOOP AT SCREEN and hide the blocks you don't need (using screen-invisible) based on the value of parameter p_number.

Cheers,

Amy

Read only

Former Member
0 Likes
843

Hi Amy,

Thanks for the reply. I cannot declare 99 blocks if the number entered is 99 on my selection scree. I some how need to achieve this dynamically at run time only. Is there any other way, to achieve this functionality?

Waiting for other replies too.

Thanks,

Nani

Read only

RaymondGiuseppi
Active Contributor
0 Likes
843

AFAIK, it is not possible with SELECTION-SCREEN, but why wont you display a small ALV input-able below the SELECTION-SCREEN using a docking container (use search tool at scn for samples) just add NUMBER initial lines to the internal table before displaying the grid (ore remove some records if NUMBER is reduced) . You should also memorize the internal table in a NO-DISPLAY parameter so it can be saved with selection variant.

Regards,

Raymond

Read only

0 Likes
843

Hi Raymond,

Thanks for the reply. Just went through some documentation about the docking control online. Looks like this does not suit my requirement. From my understanding, docking control is used to display ALV GRID/LIST and selection parameters in same screen. But, my requirement is to add parameters based on the number given at my selection screen.

Please correct me if I am going wrong here. Is there any other way to achieve this?

Thanks,

Nani

Read only

0 Likes
843

None that I think, else there is Amy solution, but managing 99 parameters group (DO VARYING..) can be "heavy" and SELECT-OPTIONS can only manage simple fields and not structures.

What I suggested was to have a hidden parameter (or select-option) with NO-DISPLAY and manage it in an ALV grid behind SELECTION-SCREEN. in PBO (AT SELECTION-SCREEN OUTPUT) copy the hidden parameter to the displayed internal table, if more data in hidden parameter than NUMBER, only copy NUMBER records, else if less add some initial lines. In PAI (AT SELECTION-SCREEN) copy the internal table data (check changed) back to hidden parameter.

Regards,

Raymond