‎2008 Aug 19 11:44 AM
hi all,
this my selection screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_ebeln FOR ekko-ebeln,
s_lifnr FOR ekko-lifnr,
s_bedat FOR ekko-bedat OBLIGATORY,
s_bukrs FOR ekko-bukrs OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
if i enter EBELN in selection screen, bedat shoulnot be mandatory.
if EBELN field is blank BEDAT should be mandatory..
how to do tat,please help me out
Regards
Suprith
‎2008 Aug 19 12:23 PM
Hi,
you need to use Loop at screen and make the fields required based on the condition you require.
at selection-screen output.
loop at screen.
screen-required = '0' .
case screen-name.
when 's_bedat'.
if s_ebeln is initial.
screen-required = '1'.
endif.
endcase.
endloop.
also please check the following link by RIch Heilman.
https://forums.sdn.sap.com/click.jspa?searchID=15318538&messageID=1706668
Regards,
Raj.
‎2008 Aug 19 11:49 AM
Hi,
Suprith has written-
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_ebeln FOR ekko-ebeln,
s_lifnr FOR ekko-lifnr,
s_bedat FOR ekko-bedat OBLIGATORY,
s_bukrs FOR ekko-bukrs OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
if i enter EBELN in selection screen, bedat shoulnot be mandatory.
if EBELN field is blank BEDAT should be mandatory..
Try this way-
If you put OBLIGATORY then Validation will not work.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_ebeln FOR ekko-ebeln,
s_lifnr FOR ekko-lifnr,
s_bedat FOR ekko-bedat,
s_bukrs FOR ekko-bukrs .
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN.
if S_EBELN[] is Initial and s_bedat in not Initial.
Message 'Bedat field should not be blank' type 'E'.
Endif.Regards,
sujit
‎2008 Aug 19 11:52 AM
Hi Surpeet,
The best option is to make the fields non-mandatory first...
First let the user execute with data on the selection screen and then check it through coding
Once we have the user entering the data and executing
if ebeln is initial.
if bedat is initial.
message 'please enter either bedat or ebeln' type 'I'.
exit.
endif.
endif.
in this case if user enters either one of the fields message wont come and you have the intended result
Pls check this,it will work
Regards
Byju
‎2008 Aug 19 11:52 AM
TABLES: SSCRFIELDS. " Fields on selection screens
Form to Validate data specified on Selection Screen
CHECK SSCRFIELDS-UCOMM EQ 'ONLI'.
PERFORM SELECTIONSCREEN_VALIDATIONS.
In this perform check whether EBELN is passed, then check whether BEDAT is passed or empty and don't trigger any message.
if EBELN is not passed check whether BEDAT has a value and if there exists no value, trigger a message.
Form looks as below...
FORM SELECTIONSCREEN_VALIDATIONS .
IF P_PCUPLD = C_PC_SELECTED.
IF SY-BATCH EQ C_PC_SELECTED.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E001(ZZ) WITH TEXT-014.
" File cannot be upload from presentation server when execute in
" Batch Mode.
ENDIF.
ENDFORM. " SELECTIONSCREEN_VALIDATIONS
‎2008 Aug 19 12:08 PM
hi
try this code
At selection-screen output.
if s_ebeln[] is initial.
loop at screen.
if screen-name = 'S_BEDAT-LOW'.
screen-REQUIRED = 1.
endif.
modify screen.
endloop.
else.
loop at screen.
if screen-name = 'S_BEDAT-LOW'.
screen-REQUIRED = 0.
endif.
modify screen.
endloop.
endif.
‎2008 Aug 19 12:14 PM
Hi,
Check the following code:
tables: ekko.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_ebeln FOR ekko-ebeln,
s_lifnr FOR ekko-lifnr,
s_bedat FOR ekko-bedat, "OBLIGATORY,
s_bukrs FOR ekko-bukrs OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
At selection-screen.
if s_ebeln is initial and s_bedat is initial.
message i000(0) with 'You must enter value in Bedat field'.
endif.
Regards,
Bhaskar
‎2008 Aug 19 12:15 PM
hi,
if u put OBLIGATORY here, then u can not get what u want.
i think u could code like this:
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_ebeln FOR ekko-ebeln,
s_lifnr FOR ekko-lifnr,
s_bedat FOR ekko-bedat ,
s_bukrs FOR ekko-bukrs .
SELECTION-SCREEN END OF BLOCK b1.
and in the "at selection-screen" event, check the input (notice that this is not the abap code):
if (EBELN is empty and BEDAT is empty)
here goes the logic
‎2008 Aug 19 12:23 PM
Hi,
you need to use Loop at screen and make the fields required based on the condition you require.
at selection-screen output.
loop at screen.
screen-required = '0' .
case screen-name.
when 's_bedat'.
if s_ebeln is initial.
screen-required = '1'.
endif.
endcase.
endloop.
also please check the following link by RIch Heilman.
https://forums.sdn.sap.com/click.jspa?searchID=15318538&messageID=1706668
Regards,
Raj.