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

Help with Selection Screen

former_member207873
Participant
0 Likes
1,351

Hi Experts,

I have two selection screen blocks in my selection screen.

1) TB1 - which contains a list box

2) TB2 - which contains parameters and select options.

Initially both TB1 and TB2 are active for user entry. If the values entered into the selection screen block TB2 do not result in any ouput, an error is throwing.  I need the selection blocks TB2 as well as TB1 active after error throwing. But what happens now is , only TB1 is getting activated and TB2 is not shown on the selection screen. So what code i have to write after the internal table is initial so as to enable both the selection blocks.

     IF IT_FINOVR IS INITIAL.


-------------------> ?

     MESSAGE 'No Data Exists for the Input' TYPE 'S' DISPLAY LIKE 'E'.

   ENDIF.

13 REPLIES 13
Read only

FredericGirod
Active Contributor
0 Likes
1,310

Hi,

did you speak about the LOOP AT SCREEN ?   have a look to the examples of transaction BIBS.

regards

Fred

Read only

Former Member
0 Likes
1,310

Hi,

Please check in your logic where a 'LOOP at SCREEN' would be used in your PAI part. In LOOP at screen you do such enabling/disabling/making invisible etc. You can check in debug mode and make SCREEN-ACTIVE or SCREEN-INVISIBLE and modify your screen.

for eg:

loop at screen.

IF SCREEN-GROUP2 = 'ABC'.

screen-invisible = 0.

screen-input = 1.

screen-active = 1.

modify screen.

ENDIF.

ENDLOOP.

Regards,

DN.

Read only

Former Member
0 Likes
1,310

Share your code please..

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,310

Hi

I believe you are doing your validation in AT selection screen on block... that is why only one block is active. In order to keep both active simply use AT selection screen event.

Nabheet

Read only

0 Likes
1,310

Hi Nabheet,

After using the AT SELECTION SCREEN event still the problem persists. My scenario is like when one item from list box (Block TB1 ) is selected, TB2 is being displayed. After which I enter data in TB2. If  no data exists, then  an error has to be thrown with the TB1 and TB2 blocks active. After writing the code in the AT SELECTION SCREEN event when the TB2 block is getting displayed after selecting TB1, the error is popping up.

BR.

Read only

0 Likes
1,310

This is because PAI is triggered. Do one thing in aT selection screen put a check if sy-ucomm eq 'ONLI'. It means it will work when you press execute.. I believe it will solve your problem. Validation only at execute

Read only

0 Likes
1,310

The code for enabling and disabling the second block on selecting value in drop box must be given in the at selection screen output event.

You need to write the error message in  the beginning of start of selection.

start-of-selection.

* get data.

     IF IT_FINOVR IS INITIAL.

       MESSAGE 'No Data Exists for the Input' TYPE 'I'.

       leave list-processing.

      ENDIF.

Read only

0 Likes
1,310

Hi Nabheet,

     Let me explain you in detail. I have one List Box ( Block - TB1) which is having three list values. As per the list values selected three other blocks are getting displayed(TB2, TB3 and TB4) (Exclusively ie when one is selected the other wont show.) But the the list box itself will be displayed what ever the selection is made. So what I am doing is that in when the report is shown initially only the list box is being shown. For that I have written in initialization event the code (TB1 active, TB2, TB3, TB4 inactive)

Then as per the selection the TB2, TB3 or  TB4 gets active or inactive.

                                  When data is entered in either TB2, TB3 or TB4, if no data is found it has to throw error with the corresponding TB(1, 2 or 3 ) active.  I wrote the code in AT SELECTION SCREEN event with the sy-ucomm. But still it is showing only TB1 active and the rest inactive.

Read only

0 Likes
1,310

You must have coded it in AT selection screen output the logic to hide/unhide. Do one thing put a breakpoint there and check what happens there when you execute and it shows error message

I believe you have not put in any statement after message like call trsaction leave to list processing etc.

share you code

Nabheet

Read only

0 Likes
1,310

Check this code.

TYPE-POOLS: vrm.
DATA: ok_code LIKE sy-ucomm.

PARAMETERS p_drop AS LISTBOX VISIBLE LENGTH 10 USER-COMMAND list.
PARAMETERS p_par1 TYPE c MODIF ID MD1.
PARAMETERS p_par2 TYPE c MODIF ID MD1.
PARAMETERS p_par3 TYPE c MODIF ID MD1.

AT SELECTION-SCREEN.
   ok_code = sy-ucomm.


AT SELECTION-SCREEN OUTPUT"Define screen setting and actions here.



   perform fill_dropdown.

  if  p_drop IS INITIAL.
       LOOP AT SCREEN.
         IF screen-group1 = 'MD1'.
           screen-invisible = 1.
           screen-input = 0.
           MODIFY SCREEN.
         ENDIF.
       ENDLOOP .
    elseIF p_drop = '1'.
       LOOP AT SCREEN.
         IF screen-name CS 'P_PAR1'.
           screen-invisible = 0.
           screen-input = 1.
           MODIFY SCREEN.
          endif.
            IF screen-name CS 'P_PAR2' or screen-name CS 'P_PAR3'.
             screen-invisible = 1.
             screen-input = 0.
             MODIFY SCREEN.
         ENDIF.
       ENDLOOP .
     ELSEIF p_drop = '2'.
       LOOP AT SCREEN.
         IF screen-name CS 'P_PAR2'.
           screen-invisible = 0.
           screen-input = 1.
           MODIFY SCREEN.
               ENDIF.
         IF screen-name CS 'P_PAR1' or screen-name CS 'P_PAR3'.
           screen-invisible = 1.
           screen-input = 0.
           MODIFY SCREEN.
         endif.
       ENDLOOP .
      ELSEIF p_drop = '3'.
       LOOP AT SCREEN.
         IF screen-name CS 'P_PAR3'.
           screen-invisible = 0.
           screen-input = 1.
           MODIFY SCREEN.
               ENDIF.
         IF screen-name CS 'P_PAR1' or screen-name CS 'P_PAR2'.
           screen-invisible = 1.
           screen-input = 0.
           MODIFY SCREEN.
         endif.
       ENDLOOP .

     ENDIF.
*  ENDIF.

START-OF-SELECTION.               "Give error message here.

* Get data with the inputed values.

* if lt_table is initial.
   MESSAGE 'No data exists for inputted values' TYPE 'I'.
   LEAVE LIST-PROCESSING.
*endif.

form fill_dropdown.
    DATA : name TYPE vrm_id,
   list TYPE vrm_values,
   value TYPE vrm_value.
   name = 'P_DROP'. " Name should be in UPPER CASE

   value-key = '1'.
   value-text = 'Text 1'.
   APPEND value TO list.
   value-key = '2'.
   value-text = 'Text 2'.
   APPEND value TO list.
     value-key = '3'.
   value-text = 'Text 3'.
   APPEND value TO list.

   CALL FUNCTION 'VRM_SET_VALUES'
     EXPORTING
       id              = name
       values          = list
     EXCEPTIONS
       id_illegal_name = 0
       OTHERS          = 0.
endform.

Read only

Former Member
0 Likes
1,310

     IF IT_FINOVR IS INITIAL.


      MESSAGE 'No Data Exists for the Input' TYPE 'I'.

     leave list-processing.

     ENDIF.

Read only

Former Member
0 Likes
1,310

Hi,

please use the below code. Maybe you will find it useful.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS : p_char TYPE char04 AS LISTBOX VISIBLE LENGTH 10 USER-COMMAND usr.

SELECT-OPTIONS : s_w for sy-datum .

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-004.

PARAMETERS : p_car TYPE c USER-COMMAND usr1.

SELECT-OPTIONS : s_w1 for sy-datum.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN.

If sy-ucomm ne 'USR' and sy-ucomm ne 'USR1'.

   If s_w is INITIAL.

     Set CURSOR field 'S_W-LOW'.

     MESSAGE 'ERROR' TYPE 'E'.

   ENDIF.

  If s_w1 is INITIAL.

     Set CURSOR field 'S_W1-LOW'.

     MESSAGE 'ERROR1' TYPE 'E'.

   ENDIF.

ENDIF.

START-OF-SELECTION.

  WRITE : 'Hello'.


Read only

Former Member
0 Likes
1,310

Hi,

Write the message in the following way, second block wont get disabled.

IF IT_FINOVR IS INITIAL.

     MESSAGE 'No Data Exists for the Input' TYPE 'S' .

ENDIF.