‎2008 Aug 23 3:34 AM
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.
‎2008 Aug 23 5:59 AM
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.
‎2008 Aug 23 5:59 AM
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.
‎2008 Aug 23 6:01 AM
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
‎2008 Aug 23 6:29 AM
‎2008 Aug 23 6:39 AM
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.
‎2008 Sep 23 4:28 AM