Application Development 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: 

reg. dynamic selection screen

Former Member
0 Kudos

Hi Friends,

Am currently facing an issue with dynamic selection-screen.

parameters: p1,

p2.

selection-screen begin of block b1.

paramters: p3 type c obligatoty.

selection-screen end of block b1.

selection-screen begin of block b1.

paramters: p3 type c obligatoty.

selection-screen end of block b1.

my requirement is when i select p1 block b1 should be enabled and

when i select p2 block b2 should be enabled.

am unable to do this since parameters p3 ,p4 are obligatory...................but if parameters p3,p4 are not obligatory am able to achieve this..

help me out with this issue if parameters p3,p4 are obligatory

-John

14 REPLIES 14

valter_oliveira
Active Contributor
0 Kudos

For that you cannot use statement OBLIGATORY. You can, in beggining of START-OF-SELECTION, for example (or AT SELECTION-SCREEN, if sy-ucomm EQ 'ONLI' , i.e, F8) insert a statement like this:


AT SELECTION-SCREEN.
  CHECK sy-ucomm EQ 'ONLI'.
  IF p1 EQ 'X' and p3 IS INITIAL.
  * error message ...
  ENDIF.

OR


START-OF-SELECTION.
  IF p1 EQ 'X' and p3 IS INITIAL.
  * info message ...
    EXIT.
  ENDIF.

Regards,

Valter Oliveira.

Former Member
0 Kudos

Hi John,

I code it so that the obligatory check is made manually rather than using the obligatory statement.

To do this use the following.

tables: sscrfields.


at selection-screen.

* Ensure the parameter button hasn't just been pressed
   check sscrfields-ucomm ne 'B1' .   
   check sscrfields-ucomm ne 'B2' .

* Check for mandatory fields
if p1 = 'X' and p3 is initial.
  message e600(fr) with 'Please enter P3'.
endif.

if p2 = 'X' and p4 is initial.
  message e600(fr) with 'Please enter P4'.
endif.

Regards,

Darren

0 Kudos

Darren,

Thanks for ur response.

But sory ur logic is not responding.

-John

0 Kudos

Did you read what I wrote?

0 Kudos

Hi,

Paste all of this logic in as an example...

report  zseltest.

tables: kna1, vbak, sscrfields.


parameters: p_one radiobutton group rad1 default 'X' user-command opt,
            p_two radiobutton group rad1.

selection-screen begin of block b01 with frame title text-t01.
select-options: s_f1 for kna1-ktokd modif id b1,
                s_f2 for vbak-audat modif id b1.
selection-screen end of block b01.

selection-screen begin of block b02 with frame title text-t02.
select-options: s_f3 for kna1-ktokd modif id b2,
                s_f4 for vbak-audat modif id b2.
selection-screen end of block b02.


at selection-screen output.

  loop at screen.

    if ( p_one is initial and screen-group1 = 'B1' ).
      screen-active = '0'.
      modify screen.
    endif.

    if ( p_two is initial and screen-group1 = 'B2' ).
      screen-active = '0'.
      modify screen.
    endif.
  endloop.

at selection-screen.

* Ensure the parameter button hasn't just been pressed
   check sscrfields-ucomm ne 'OPT' .

* Check for mandatory fields
if p_one = 'X' and s_f1[] is initial.
  message e600(fr) with 'Please enter S_F1'.
endif.

if p_two = 'X' and s_f3[] is initial.
  message e600(fr) with 'Please enter P4'.
endif.

Regards,

Darren

0 Kudos

Hi Valter,

I read ur logic,,,but even its not working .

Thanks.

-John

0 Kudos

Hi Darren,

I pasted ur logic as an example program..but its not evven not working.

Thanks

-John

0 Kudos

Hi again.

I always post the idea, not the complete code. Now this is the complete code.


AT SELECTION-SCREEN.

  CHECK sy-ucomm EQ 'ONLI'.
  IF p1 EQ 'X' and p3 IS INITIAL.
    MESSAGE 'Please fill field p3' TYPE 'E'.
  ENDIF.
  IF p2 EQ 'X' and p4 IS INITIAL.
    MESSAGE 'Please fill field p4' TYPE 'E'.
  ENDIF.

OR


START-OF-SELECTION.

  IF p1 EQ 'X' and p3 IS INITIAL.
    MESSAGE 'Please fill field p3' TYPE 'I'.
    EXIT.
  ENDIF.

  IF p2 EQ 'X' and p4 IS INITIAL.
    MESSAGE 'Please fill field p4' TYPE 'I'.
    EXIT.
  ENDIF.

This will surely work. If not, tell me what's happening in debug with values of p1, p2, sy-ucomm (after F8).

Regards,

Valter Oliveira.

0 Kudos

Hi Valter..

Thanks for ur valuable code....i have taken ur idea which u posted earlier as a complete code,,the idea/code is not working

ill tel u my requirement once again.

parameters: p1 radiobutton group g1 default 'X' user-commad user,

p2 radiobutton group g1.

SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE text-t01.

parameters: p3 type knb1-bukrs obligatory modif id b1.

SELECT-OPTIONS: s_f1 FOR kna1-ktokd MODIF ID b1,

s_f2 FOR vbak-audat MODIF ID b1.

SELECTION-SCREEN END OF BLOCK b01.

SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-t02.

parameters: p4 type knb1-bukrs obligatory modif id b2.

SELECT-OPTIONS: s_f3 FOR kna1-ktokd MODIF ID b2,

s_f4 FOR vbak-audat MODIF ID b2.

SELECTION-SCREEN END OF BLOCK b02.

when i select parameter p1 block b1 should be enabled and b2 should be disabled.........and when i select parameter p2 block b2 should be enabled and b1 should be disabled.

NOW if i dont make parameters p3 and p4 as obligatory ,,the code works fine ........BUT if i make p3,p4 as obligatory the code is not working..

Thanks

-John

0 Kudos

Ok, I really missunderstood your requirement. So, do not use obligatory, use what I wrote (for example with event START-OF-SELECTION) to make fields as required programatically ...

and .... (to enable/disable fields)


AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.
  CASE screen-group1.
    WHEN 'B1'.
      IF p1 EQ 'X'.
        screen-active = '1'.
      ELSE.
        screen-active = '0'.
      ENDIF.
      MODIFY screen.
    WHEN 'B2'.
      IF p1 EQ 'X'.
        screen-active = '0'.
      ELSE.
        screen-active = '1'.
      ENDIF.
      MODIFY screen.
    WHEN OTHERS.
  ENDCASE.
ENDLOOP.

Regards,

Valter Oliveira.

0 Kudos

Give the parameter P3 and P4 their own modif ID.

parameters: p3 type knb1-bukrs obligatory modif id r1.
parameters: p4 type knb1-bukrs obligatory modif id r2.

AT SELECTION-SCREEN OUTPUT.
 
LOOP AT SCREEN.
  CASE screen-group1.
    WHEN 'B1' or 'R1'.
      IF p1 EQ 'X'.
        screen-active = 1.
        if screen-group1 eq 'R1'.
           screen-required = 1.
        endif.
      ELSE.
        screen-active = 0.
        if screen-group1 eq 'R1'.
            screen-required = 0.
        endif.
      ENDIF.
      MODIFY screen.

    WHEN 'B2'or 'R2'.
      IF p1 EQ 'X'.
        screen-active = 0.
        if screen-group1 eq 'R2'.
          screen-required = 0.
        endif.
      ELSE.
        screen-active = '1'.
        if screen-group1 eq 'R2'.
           screen-required = 1.
         endif.
      ENDIF.

      MODIFY screen.

    WHEN OTHERS.

  ENDCASE.

ENDLOOP.

Former Member
0 Kudos

May be in your loop at screen you can check if the parameter that is obligatory is fill in or not and if it is not fill in trigger error message

thus no need to use obligstory

Former Member
0 Kudos

Hi,

Don't put the Parameters obligatory in the declaration itself.

And validate the corresponding field in at selection-screen output.

U know that when p1 is selected then p3 will come,

and when p2 is selected then p4 will come.

So write in At sel-scr output as :

if p1 ia not initial.

and p3 is initial.

message 'Please enter the field P3' type 'E'.

endif.

if p2 ia not initial.

and p4 is initial.

message 'Please enter the field P3' type 'E'.

endif.

Try it ,

and it will work.

Former Member
0 Kudos

answered