‎2009 Jan 02 5:59 AM
Hi All,
I am trying to develop a check at selection screen which is having two select options,
S_PRODH and S_MATNR, the requirement is i need to check that both of them are not initial
also if one is entered the user should not be able to enter the other one, If he/she enters any value on the other field it should show an error messsage.
My current code is like this.
AT SELECTION-SCREEN.
IF S_MATNR IS INITIAL AND S_PRODH is initial.
MESSAGE e001(z9) WITH TEXT-005.
ELSE.
IF S_MATNR IS NOT INITIAL AND S_PRODH is not initial.
MESSAGE I001(z9) WITH TEXT-005.
gv_stop = 'X'.
STOP.
ENDIF.
ENDIF.
And after END-OF-SELECTION
IF gv_stop IS INITIAL.
perform output_data.
ENDIF.
Please help me on this,
Regards,
Tapodipta Khan
‎2009 Jan 02 6:19 AM
Hi Tapo,
Display the mesaage like this..
CONSTANTS: c_error TYPE char1 VALUE 'E'.
MESSAGE s001(z9) DISPLAY LIKE c_error.
Regards,
Sayak..
‎2009 Jan 02 6:02 AM
Modify this line " IF S_MATNR IS NOT INITIAL AND S_PRODH is not initial. "
as " IF NOT S_MATNR IS INITIAL AND
( NOT S_PRODH is initial ).
Hope this helps,
Rajat
‎2009 Jan 02 6:07 AM
‎2009 Jan 02 6:05 AM
Hi,
It seems there is some confusion in the requirement.
the requirement is i need to check that both of them are not initial
also if one is entered the user should not be able to enter the other one, If he/she enters any value on the other field it should show an error messsage.
U r telling both should not be initial and if u enter one value u should not enter other. So it is
contradictory. Please check the requirement correctly and get back.
Thanks,
Vinod.
‎2009 Jan 02 6:06 AM
Hi,
Actually it is displaying the Error message but creates another problem, if i am trying to delete
any of the ranges given, either matnr or prodh then it is again showing the error message.
Regards,
Tapodipta
‎2009 Jan 02 6:07 AM
hi,
Try this way..
AT SELECTION-SCREEN.
IF S_MATNR IS INITIAL AND S_PRODH is initial.
MESSAGE E001(z9) WITH TEXT-005.
ELSEIF S_MATNR IS NOT INITIAL AND S_PRODH is not initial.
MESSAGE E001(z9) WITH TEXT-005.
ENDIF.Don't give the Inforamtion Message and instead give the Error Message so the processing get's stoped and selection screen will be displayed..
Edited by: avinash kodarapu on Jan 2, 2009 11:38 AM
‎2009 Jan 02 6:07 AM
Hi
AT SELECTION-SCREEN.
IF S_MATNR IS INITIAL AND S_PRODH is initial.
MESSAGE e001(z9) WITH TEXT-005.
ENDIF.
If s_matnr is not initial and S_PRODH is initial.
Loop at screen.
if screen-name = S_PRODH .
screen-active = 0.
screen-input = 0.
endif.
modify screen.
endloop.
elseif s_matnr is initial and S_PRODH is not initial.
Loop at screen.
if screen-name = S_matnr .
screen-active = 0.
screen-input = 0.
endif.
modify screen.
endloop.
endif.
this will not allow user to enter rathher than an error message.
hope it slves.
Reg
Ramya
‎2009 Jan 02 6:08 AM
Hi Vinod,
The requirement is like that only, if your'e entering S_MATNR then S_PRODH should be blank
or disabled, and if you are entering S_PRODH then S_MATNR should be blank or disabled, or instead of disabling it they need one Error message.
Regards,
Tapodipta
‎2009 Jan 02 6:11 AM
Hi,
I think ur requirement is, at a time either S_PRODH is not initial or S_MATNR is not initial, then only ur code should be executed.
if it is the requirement ur code will work.
‎2009 Jan 02 6:19 AM
Hi Tapo,
Display the mesaage like this..
CONSTANTS: c_error TYPE char1 VALUE 'E'.
MESSAGE s001(z9) DISPLAY LIKE c_error.
Regards,
Sayak..
‎2009 Jan 02 6:25 AM
Hi guys,
Nothin helped actually i have already tried with all of these possibilities,
but when i am displaying the error message as both of them are filled. After that
i should be able to clear the selection-screen values, both S_MATNR and S_PRODH,
that is where i am getting stuck.
Regards,
Tapodipta.
‎2009 Jan 02 6:30 AM
Hi Tapodipta Khan,
Use this way, its working:-
TABLES : aufk.
SELECT-OPTIONS : s_aufnr FOR aufk-aufnr,
s_objnr FOR aufk-objnr.
AT SELECTION-SCREEN.
IF ( NOT s_aufnr IS INITIAL ) AND ( NOT s_objnr IS INITIAL ).
MESSAGE e000(zmsg_wo). "zmsg_wo is message class
ELSEIF ( s_aufnr IS INITIAL ) AND ( s_objnr IS INITIAL ).
MESSAGE e001(zmsg_wo).
ELSE.
*your code
ENDIF.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
‎2009 Jan 02 6:31 AM
Thanks Sayak , your solution solved the problem.
Regards,
Tapodipta
‎2009 Jan 02 6:39 AM
Hi,
Try like this:
tables: mara, vbap.
select-options: s_matnr for mara-matnr,
s_prodh for vbap-prodh.
at selection-screen.
*break-point.
if ( ( s_matnr is initial ) and ( s_prodh is initial ) ).
message e000(01) with 'Must enter value in any field.'.
elseif ( not s_matnr is initial ) and ( s_prodh is initial ).
message i000(02) with 'You entered value in matnr field.'.
elseif ( s_matnr is initial ) and ( not s_prodh is initial ).
message i000(03) with 'You entered value in prodh field.'.
endif.
start-of-selection.
write:/ 'Value you entered in s_matnr is:', s_matnr-low,
/ 'Value you entered in s_prodh is:', s_prodh-low.
Regards,
Bhaskar