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: 

selection screen problem

Former Member
0 Kudos

Hi all,

I have some problem with selection screen.

My selection screen looks like below.

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

PARAMETERS : c1 TYPE c AS CHECKBOX,

c2 TYPE c AS CHECKBOX.

SELECTION-SCREEN END OF BLOCK b1.

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

SELECT-OPTIONS : s_vbeln FOR vbak-vbeln oblidgatory.

SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.

SELECT-OPTIONS : s_fkart FOR vbrk-fkart obligatory

SELECTION-SCREEN END OF BLOCK b3.

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

PARAMETERS : p_rlgrap TYPE rlgrap-filename. SELECTION-SCREEN END OF BLOCK b4.

my requirement is if user selects c1 check box he will pass only block B2 values(s_vbeln) and if selects c2 check box will pass only block b3 values only and block b4 is common for both check boxes .

I know i can do this by using screen structure.

but as my both parameters are obligatory i am facing problem by doing so .(my both parameters must be obligatory and no error messages issued in my program as it runs in back ground means no message class and no validations required for my selection screen.)

can any one help me in this.

all answers are rewardfull.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

First remove the 'OBLIGATORY' for both the variables S_VBELN and S_FKART.

Now you can apply same action of obligatory in the program as follows which satisfies your check box conditions also.

AT SELECTION-SCREEN on field <your field1>.

If C1 = 'X' AND S_VBELN-low is initial.

EXIT. (If background)

or

MEssage E("XXXX') (if foreground).

endif.

AT SELECTION-SCREEN on field <your field2>.

If C2 = 'X' AND S_FKART-low is initial.

EXIT. (If background)

or

MEssage E("XXXX') (if foreground).

endif.

This solves ur problem.

5 REPLIES 5

Former Member
0 Kudos

Hi,

First remove the 'OBLIGATORY' for both the variables S_VBELN and S_FKART.

Now you can apply same action of obligatory in the program as follows which satisfies your check box conditions also.

AT SELECTION-SCREEN on field <your field1>.

If C1 = 'X' AND S_VBELN-low is initial.

EXIT. (If background)

or

MEssage E("XXXX') (if foreground).

endif.

AT SELECTION-SCREEN on field <your field2>.

If C2 = 'X' AND S_FKART-low is initial.

EXIT. (If background)

or

MEssage E("XXXX') (if foreground).

endif.

This solves ur problem.

Former Member
0 Kudos

Hi Gopal,

As you said, you have to use the screen structure to achieve this. Initially you should not mention the s_vblen or s_fkart as obligatory, instead you should change them in the runtime by looping the screen structure and making the parameter 'required' as 1.

Refer the sap demo program demo_dynpro_modify_screen for reference.

Regards,

Trikanth

Former Member
0 Kudos

Hi, you can look into this thread, it almost matches your requirement,

try to avoid using Obligatory fields, instead validate them in the code, go through the above thread, you will find some good code snippets to follow.

former_member212653
Active Contributor
0 Kudos

You can't make them obligatory, you have to validate them in your code...

Check out this code:



*&---------------------------------------------------------------------*
*& Report  ZTEST_SDN
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ztest_sdn.
DATA:wa_sbook TYPE sbook.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS :
c1 TYPE c AS CHECKBOX USER-COMMAND flag,
c2 TYPE c AS CHECKBOX USER-COMMAND flag.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002 .
SELECT-OPTIONS : s_carrid FOR wa_sbook-carrid." OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b2.


SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
SELECT-OPTIONS : s_connid FOR wa_sbook-connid." OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b3.

SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.
PARAMETERS : p_rlgrap TYPE localfile.
SELECTION-SCREEN END OF BLOCK b4.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

    IF c1 = 'X' AND c2 = space.
      IF screen-name = '%B003007_BLOCK_1000' OR
         screen-name = '%_S_CONNID_%_APP_%-TEXT' OR
         screen-name = '%_S_CONNID_%_APP_%-OPTI_PUSH' OR
         screen-name = 'S_CONNID-LOW' OR
         screen-name = '%_S_CONNID_%_APP_%-TO_TEXT' OR
         screen-name = 'S_CONNID-HIGH' OR
         screen-name = '%_S_CONNID_%_APP_%-VALU_PUSH'
         .
        screen-active = '0'.
      ENDIF.
    ENDIF.
    IF c2 = 'X' AND c1 = space.
      IF screen-name = '%B002004_BLOCK_1000' OR
       screen-name = '%_S_CARRID_%_APP_%-TEXT' OR
       screen-name = '%_S_CARRID_%_APP_%-OPTI_PUSH' OR
       screen-name = 'S_CARRID-LOW' OR
       screen-name = '%_S_CARRID_%_APP_%-TO_TEXT' OR
       screen-name = 'S_CARRID-HIGH' OR
       screen-name = '%_S_CARRID_%_APP_%-VALU_PUSH'
       .
        screen-active = '0'.
      ENDIF.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.

AT SELECTION-SCREEN.
  IF sy-ucomm = space OR
     sy-ucomm = 'ONLI' OR
     sy-ucomm = 'PRIN' OR
     sy-ucomm = 'SJOB' OR
     sy-ucomm = 'SPOS' OR
     sy-ucomm = '' .

    IF c1 = 'X' AND c2 = space AND s_carrid IS INITIAL.
      MESSAGE e001(00) WITH 'S_CARRID is initial'.
    ENDIF.
    IF c1 = space AND c2 = 'X' AND s_connid IS INITIAL.
      MESSAGE e001(00) WITH 'S_CONNID is initial'.
    ENDIF.
    IF c1 = space AND c2 = space.
      MESSAGE e001(00) WITH 'Checkbox not checked'.
    ENDIF.
  ENDIF.

START-OF-SELECTION.

END-OF-SELECTION.

http://abap-explorer.blogspot.com/

Former Member
0 Kudos

probelm solved