Selection Screen validation for date
Hi,
I have a date in Select option s_budat which is a mandatory field
The Criteria for validation is
1) The start date should not be older than current date minus 8 weeks. Otherwise error message should appear:
EN: Start date is older than 8 weeks
2)The end date should not be more than one week ahead of date-from. Otherwise error message should appear:
EN: Selection period is more than 1 week
please help me to solve this
regards
Avi
data : date1 like sy-datum,
date2 like sy-datum.
CALL FUNCTION 'HRWPC_BL_DATES_WEEK_INTERVAL'
EXPORTING
DATUM = sy-datum
WEEK_PST = 8
WEEK_FTR = 0
START_SUNDAY =
IMPORTING
BEGDA = tdate
ENDDA = tdate1
EXCEPTIONS
INVALID_VALUES = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
if s_date-low lt tdate.
message.
endif.
CALL FUNCTION 'HRWPC_BL_DATES_WEEK_INTERVAL'
EXPORTING
DATUM = s_date-low
WEEK_PST = 0
WEEK_FTR = 1
START_SUNDAY =
IMPORTING
BEGDA = tdate
ENDDA = tdate1
EXCEPTIONS
INVALID_VALUES = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
if s_date-high gt tdate1.
message.
endif.
regards
shiba dutta
Similar Messages
-
Selection Screen Validation for Character
Hi All
My query is regarding the selection screen validation for character.
I am using a Select-option: S_ORDER FOR VBAK-VBELN OBLIGATORY.
and S_order should be only having the numeric field.
Please help how to validate it for character field.Hi,
Do as below :
at selection-screen.
if not s_order[] is initial.
if s_order-low CA 'ABCDEF.............Z'.
message 'Enter only numerics only' type 'E'.
endif.
"similarly for s_order-high also.
endif.
Thanks,
Sriram Ponna. -
Selection screen validation for batch
This is my scenario:
If program is executed in background, plant (in selection screen) is not mandatory.
If program is executed directly, plant (in selection screen) needs to be filled (mandatory).
I tried using sy-batch and coding at the AT SELECTION-SCREEN portion for validation but it seems that sy-batch is only populated after START-OF-SELECTION.
How do i code it so that if user does not execute program in background, it will prompt an error message and prompt user to fill the plant field in the selection screen?HI,
use sy-batch in start-of-selection. not in at selection-screen.
start-of-selection.
if sy-batch = ' X' . (If it runs in background)
Then raise message.
endif.
This will work.
Reward If helpful. -
Needed selection screen validation for all entries in the range
Hi all,
I'm using the below code for Material validation in selection-screen.
SELECT SINGLE MATNR FROM MARC INTO MARC-MATNR
WHERE MATNR IN S_MATNR.
IF sy-subrc NE 0.
MESSAGE e000(su) WITH text-035. "Invalid Material Number
ENDIF.
This validation is working only for one record in the range.
If I give multiple material numbers in the range having a record which doesn't exist in MARC, its not throwing the error.
Seems like loop should be placed at s_matnr. Is that correct procedure or any pointers on the same would be of great help.
Regards,
Vamsee Priya.Hi priya
Use this way,
REFRESH IT_LIPS. CLEAR IT_LIPS.
SELECT VBELN
POSNR
MATNR
WERKS
LFIMG
ARKTX
VGBEL
VGPOS
BWART
FROM LIPS INTO TABLE IT_LIPS
WHERE PSTYV IN
('ZZTC', 'ZTAD', 'ZMVN', 'ZCVA', 'ZCVB', 'ZCVC') AND "ASR 18721
WERKS IN ('1140', '1143', '1149').
IF IT_LIPS[] IS INITIAL.
MESSAGE E000 WITH TEXT-005.
endif.
revert back if you need any help..
Help us to help you, Manas -
A process is required to trigger an employe's master datat from sap to EWA( some other system) for any of rthe below actions.
NEW HIRE
TERMINATION
FMLA PAID LOA
NON-FMLA PAID LOA
FMLA UNPAID LOA
RETURN FORM LEAVE
REHIRE
CHANGE OF POSITION
STATUS CHANGE
EXPATRIATION
I AM NOT SURE WHAT SHOULD BE MY SELECTION SCREEN CRITERIA.Hi Anil,
One option can be to write a custom program for this.
Schedule it as a job at the end of the day.
Consider all the required actions that were run on that day & the data that was changed.
The changed data can then be sent to legacy as per your requirement as a daily interface file.
I think you shud have a look at the standard utility program RPUAUD00 , which logs the infotype changes or might be you can think of adding the change indicator includes from the std program to your custom program & write the custom interface.
Well i already see some good ideas placed in the above posts but i think this
can be one option as well so thought of putting this to you.
Hope this helps.
Kindly reward in case useful.
Regards & Thanks,
Darshan Mulmule -
Hi Experts,
Please can any one give me the details ..
1)What is the actual use of selection screen validation?
2) When we use Selection-screen validation?
3)If we are not written the selection-screen validation is there any effect?
I know how to write the validation for a selection screen. But why i am asking above questions is I am very new to ABAP .My Functionl people also new to ABAP. They told me one report.I asked me what are the validation for selection screen . At that time they told there is no validation.
Thats the reason to ask above questions..
please tell me the details..
Thanks In Advance..
Thanks and Regards
Siri..Abhi,
Selection Screen Validation are used for correct input processing.
Selection screen elements are used further in select queries to fetch data. if user enters some wrong input
we will unnecessarily hit the data base with wrong values and select will fail , hence validation of the input
will avoid unnecessary data base hit.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 27, 2008 12:26 PM -
Selection screen validation - facing an issue
Hi All,
I am facing an issue while doing validations on selections screen of a report program.
On selecting a checkbox, a field related to that should become mandatory.
But if I do the validation in selection screen events,
for the first time also, when I select the check box, it is displaying error message saying no data in mandatory field.
So I am doing the validation in start-of-selection event.
Is there any work around for this?
Please help me in this regard.Hi
maybe you could try coding the validations at selection-screen.
Also remove OBLIIGATORY syntax in selection screen coding.
check the value in your check box and make the required field mandatory there.
at selection-screen.
if chk_val = 'X'.
if s_mblnr[] is initial.
if s_ebeln[] is initial.
if s_matnr is initial or s_budat is initial.
message e000(fb) with 'Enter at least a PO and material number/GR date!'.
endif.
endif.
endif.
else.
endif.
regards
Isaac Prince
Edited by: prince isaac on Nov 9, 2010 11:45 AM -
Problem in AT selection screen validation
Hi,
I am having problem in AT SELECTION SCREEN Validation.
I have 2 radiobutton and 6 parameter. if i click first radio button all the 6 radiobutton should enable and take the user input, that is working fine for me.
if i click second radiobutton , out of 6 , 3 parameter should disable and remaining 3 should enable. thats also working fine.
My problem is program has written the validation for this 3 parameter in the AT SELECTION SCREEN.
For first radioutton all the validation working fine, for second validation as soon as i press the radiobutton it will display error message. Based on 2 parameter user is filling value for 3 rd parameter.
I want the same validation to be done for second radio button after user pressing enter.
PARAMETER: p_single RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND f1,
p_multi RADIOBUTTON GROUP rad1.
PARAMETERS: s_pwwrk LIKE plaf-pwwrk.
PARAMETERS: p_lgort LIKE plaf-lgort.
PARAMETERS: p_kostl LIKE cobl-kostl.
here is my code:
AT SELECTION SCREEN.
CLEAR t001w.
CLEAR t001k.
CLEAR marv.
SELECT SINGLE * FROM t001w WHERE werks EQ s_pwwrk.
IF sy-subrc NE 0.
MESSAGE e999 WITH 'Plant' s_pwwrk 'does not exist'.
ELSE.
SELECT SINGLE * FROM t001k WHERE bwkey EQ t001w-bwkey.
SELECT SINGLE * FROM marv WHERE bukrs EQ t001k-bukrs.
IF p_budat0(4) NE marv-lfgja OR p_budat4(2) NE marv-lfmon
IF marv-xruem IS NOT INITIAL.
IF p_budat0(4) NE marv-vmgja OR p_budat4(2) NE marv-vmmon.
MESSAGE e999 WITH p_budat4(2) p_budat0(4)
'is closed.
Please try again.'.
ENDIF.
ELSE.
MESSAGE e999 WITH p_budat4(2) p_budat0(4)
'is closed.
Please try again.'.
ENDIF.
ENDIF.
ENDIF.For your Case ,
If i understand clearly,You can do the validation when you want on AT SELECTION SCREEN ON WP_FIELD.
If you say your validation to be done only for Selection of Second Radio Button, then..
AT SELECTION SCREEN.
if p_multi eq 'X'. "<- Make Validation to be done only if user select Second Button
CLEAR t001w.
CLEAR t001k.
CLEAR marv.
SELECT SINGLE * FROM t001w WHERE werks EQ s_pwwrk.
IF sy-subrc NE 0.
MESSAGE e999 WITH 'Plant' s_pwwrk 'does not exist'.
ELSE.
SELECT SINGLE * FROM t001k WHERE bwkey EQ t001w-bwkey.
SELECT SINGLE * FROM marv WHERE bukrs EQ t001k-bukrs.
IF p_budat+0(4) NE marv-lfgja OR p_budat+4(2) NE marv-lfmon
IF marv-xruem IS NOT INITIAL.
IF p_budat+0(4) NE marv-vmgja OR p_budat+4(2) NE marv-vmmon.
MESSAGE e999 WITH p_budat+4(2) p_budat+0(4)
'is closed.
Please try again.'.
ENDIF.
ELSE.
MESSAGE e999 WITH p_budat+4(2) p_budat+0(4)
'is closed.
Please try again.'.
ENDIF.
ENDIF.
ENDIF.
endif. -
Problem in selection screen validation.
Hi All,
I am having the following in the selection screen:
PARAMETERS : p_r1 RADIOBUTTON GROUP grp DEFAULT 'X' USER-COMMAND dlvy,
p_r2 RADIOBUTTON GROUP grp .
SELECTION-SCREEN BEGIN OF BLOCK b1 with frame title text-001.
SELECT-OPTIONS: s_vbeln FOR lips-vbeln MODIF ID dly.
SELECT-OPTIONS: s_lfart FOR likp-lfart OBLIGATORY MODIF ID dly.
SELECT-OPTIONS: s_vstel FOR likp-vstel MODIF ID dly.
SELECT-OPTIONS: s_matnr FOR lips-matnr MODIF ID dly.
SELECT-OPTIONS: s_wadat FOR likp-wadat OBLIGATORY MODIF ID dly.
SELECT-OPTIONS: s_wbsta FOR vbup-wbsta MODIF ID dly.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 with frame title text-002.
SELECT-OPTIONS: s1_matnr FOR lips-matnr MODIF ID mat.
SELECT-OPTIONS: s_extwg FOR mara-extwg MODIF ID mat.
SELECT-OPTIONS: s_werks FOR marc-werks MODIF ID mat.
SELECTION-SCREEN END OF BLOCK b2.
If I choose Radio Button 1, only option 1 should be triggered,
If I choose Radio Button 2, only option 2 should be triggered,
For this I have:
AT SELECTION-SCREEN OUTPUT.
IF p_r1 = 'X'.
blk_hide = 'MAT'.
blk_show = 'DLY'.
ELSE.
blk_hide = 'DLY'.
blk_show = 'MAT'.
ENDIF.
LOOP AT SCREEN.
IF screen-group1 = blk_hide.
screen-active = 0.
ELSE.
IF screen-group1 = blk_show.
screen-active = 1.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
Now I need to validate the selection Screen, I am facing issue in doing selection screen validation:
Can any one help me in how to go about this?
Thanks,
Debrup.pls. replace the AT SELECTION-SCREEN OUTPUT event with this one:
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
CASE 'X'.
WHEN p_r1.
CASE screen-group1.
WHEN 'DLY'.
screen-active = '1'.
WHEN 'MAT'.
screen-active = '0'.
ENDCASE.
WHEN p_r2.
CASE screen-group1.
WHEN 'DLY'.
screen-active = '0'.
WHEN 'MAT'.
screen-active = '1'.
ENDCASE.
ENDCASE.
MODIFY SCREEN.
ENDLOOP. -
How to can we do selection-screen modification for LDB?
Hi All,
I have custom field in my selection-screen of LDB PNP.
Can you people please let me know how can I put the selection-screen modificaiton For ex:
i have created
parameters a as checbox.
select-options: p_btrtl for p0001-btrtl no-intervals.
now If the check box is selected then p_btrtl we can enter values or esle If check box is not selected then p_btrtl will be grayed out, ( I.e. SCREEN-INPUT = 0)
This is simple from ABAP without LDB. But with LDB can we achieve?????????????
Satish
Edited by: Satish Vasireddy on Jun 23, 2010 4:05 PMyou can use the following logic for the additional selection validation. I have done by using PNP LDB. Ex : I have done for one of the field in IT0377.
SELECT-OPTIONS: s_bplan FOR p0377-bplan.
*& Form check_selection_0377
This subroutine is used to check the selection screen
FORM check_selection_0377.
LOOP AT p0377 WHERE pltyp IN s_bplan
AND levl1 IN s_lti
AND begda LE pn-endda
AND endda GE pn-begda.
CALL FUNCTION 'HR_CHECK_AUTHORITY_INFTY'
EXPORTING
tclas = 'A'
pernr = pernr-pernr
infty = p0377-infty
subty = p0377-subty
begda = pn-begda
endda = pn-endda
level = 'R'
EXCEPTIONS
no_authorization = 1
internal_error = 2
OTHERS = 3.
IF NOT sy-subrc IS INITIAL.
DELETE p0377.
ENDIF.
ENDLOOP.
selection not found and no value selected
IF sy-subrc NE 0.
READ TABLE s_bplan.
IF sy-subrc EQ 0.
REJECT.
ENDIF.
READ TABLE s_lti.
IF sy-subrc EQ 0.
REJECT.
ENDIF.
ENDIF.
ENDFORM. " check_selection_0377
Regards,
Preetham -
How to display the selection screen fields for selected checkboxes
Hi all,
I have 7 checkboxes, for each check box we have some seletion screen fields.if i select first check box,i want to display first slection screen fields only.
and if we select more than one check box how to display the selection screen fields for selected check boxes,please help me this
Thanks
sriman.hi,
Try this code
report z_13317_sdn2.
tables : mara, marc, dd03l.
parameters : p_chk1 as checkbox user-command ABC,
p_chk2 as checkbox user-command PQR,
p_chk3 as checkbox user-command XYZ.
select-options : s_matnr for mara-matnr modif id A,
s_ersda for mara-ersda modif id A,
s_werks for marc-werks modif id B,
s_lvorm for marc-lvorm modif id B,
s_tab for dd03l-tabname modif id C.
data: v_chk1,
v_chk2,
v_chk3.
at selection-screen output.
loop at screen.
if screen-group1 = 'A' or
screen-group1 = 'B' or
screen-group1 = 'C'.
screen-input = 0.
modify screen.
endif.
endloop.
loop at screen.
if v_chk1 = 'X'.
if screen-group1 = 'A'.
screen-input = 1.
modify screen.
endif.
endif.
if v_chk2 = 'X'.
if screen-group1 = 'B'.
screen-input = 1.
modify screen.
endif.
endif.
if v_chk3 = 'X'.
if screen-group1 = 'C'.
screen-input = 1.
modify screen.
endif.
endif.
endloop.
at selection-screen.
if sy-ucomm = 'ABC'.
if v_chk1 = ' '.
v_chk1 = 'X'.
else.
v_chk1 = ' '.
endif.
endif.
if sy-ucomm = 'PQR'.
if v_chk2 = ' '.
v_chk2 = 'X'.
else.
v_chk2 = ' '.
endif.
endif.
if sy-ucomm = 'XYZ'.
if v_chk3 = ' '.
v_chk3 = 'X'.
else.
v_chk3 = ' '.
endif.
endif.
Regards,
Sailaja. -
Data validation for Date Field in Web Dynpro ABAP
Hi ,
In my WDA i want to perform data validation for date filed. (i.e. While creating a new record i have to check the Start Date should be always lesser than End Date.)
If u ll enter the wrong date it should validate the Date and throw an error message.
Please Reply soon its urgent.
Thanks,
DeepikaHi,
First read the two attributes start date and end date.
Then write the following condition.
IF item_start_date > item_end_date.
Error message.
Endif.
For pop up error message you need to use Create_window method of the Interface if_wd_window.
Thanks. -
Raising Exception in Selection screen validation
Hi All,
I am doing a selection screen validation in BI report using the CMOD. If my validation fails i need to raise a error message instead showing the report. How can i perform that. How should i handle this using abap.
Thanks in advance
PremHi,
But this does not stop the execution of the report, the error message which i have given is been displayed in the report top and still the report gets executed.
Please suggest how to stop the report execution and to stay on the same selelction screen page.
Thanks
Prem -
Selection screen variant for report
Hi,
Can we restrict the selection screen variants for reports by user? For example my report is ZREPORT. Different users can save variants for the report. When they choose a variant for executing the report, they would like to see only the variants they created.
By default SAP lists all variants created (irrespective of who created).
Thanks
AnilHi,
If you want the other users doesn't want to execute (Not see) other variant..you can check if that user has created the variant in the AT SELECTION-SCREEN event..
By checking VARI-VARIANT against the table VARID and check if sy-uname <> VARID-ENAME.
Thanks,
naren -
Validation For Date,String and Date in a reports Region
Apex 4
Good day to all apex users How do I validate a apex_item.text if the value is string the user can only input a string value if it is number then the user can input numbers only and if it is a date the user can only input a date values?APEX_ITEMS are not part of the default apex gui... In fact they are just functions which returns html.
You can however do some stuff with the attributes parameters. You can find some cool stuff over here: Re: Validation For Date,String and Date in a reports Region
If you want apex validation you need to create a page validation and loop over your apex_items with apex_application.g_f0x
Br,
Nico
Maybe you are looking for
-
I don't want to use a Hotmail account to do this. Is it possible? The licence is for 5 PC's but seems to have no sync ability.
-
ITunes quits when I refresh podcasts with iPod touch connected
If I click the "refresh podcast" button in iTunes (version 11.3.1.2) while my iPod touch (32G capacity currently with 4.5G available; still running iOS 5.1.1) is connected, iTunes quits. If the iPod is not connected, the refresh runs just fine; any a
-
In FAX & Print of PO attachment not coming
Hi all, We have designed our own PO Smartform. Whatever doc we are attaching in SC for vendor is going in the email with PO. But when sending the PO by FAX or by Print media, the attachment is not coming. Any idea how to achieve this. Regards, Smita
-
Getting connected...
Hey, i just recieved my iBook today and am having difficulty getting online. For my desktop PC i have a Speedtouch USB DSL modem and i wish to take this from my desktop and use it to connect my iBook to the internet. How do i go about doing this? Im
-
How to shade parts of this picture CS5
I have a layout of office space and saved as a jpeg. I would like to shade the areas of camera views that are based on a 50 degree angle. Can this be done. thanks Mike