2012 Apr 23 6:19 AM
Hi All,
I know this question has been asked many a times and I have read almost all of them but my problem is different.
I want to display an Error Message in Module Pool when a standard field is empty depending on my custom field's value. The problem is it comes with Exit button. I want it to be able to come back to the same screen and allow the user to enter a value but I want to make it mandatory for the user to fill that field if the value of the Custom Field is Yes and not make it mandatory if it is No.
I tried to apply a Validation but i am not getting the Value of the Custom Field there. I tried with Parameter ID but it goes to the Validation first then to the module pool so i am getting the last value passed and not the present one.
I tried using Display like "E" but it permits the user to move on to next tab and not fill it.
Thanks & Regards,
Chandni Sharma.
2012 Apr 23 6:32 AM
Hi Chandni,
To get the current values in the screen use,
field_value-fieldname = 'YOUR CUSTOM FIELD NAME'.
APPEND field_value TO dynpro_values.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = dynpro_values.
.
The table dynpro_values will have the current value for the custom field.
Thanks,
Shambu
2012 Apr 23 6:32 AM
Hi
Define it in PBO block.
perform Screen_input_Check.
In screen_input_CHECK Define If screen-field name = 'YES' And standard field is initial.
Message 'Please Enter Standard Field' type 'E'.
Regards
Ajit
2012 Apr 23 6:40 AM
Hi Ajit,
I tried that but then all the fields are coming input-disabled. Actually I am trying to make a standard field mandatory based on the value of my custom field. when I did this only my custom field is coming input-enabled but the standard field is input disabled. I think the possible reason might be that I have used chain endchain for my custom field. Is it possible to do that with standard field?
2012 Apr 23 6:49 AM
Hi chandni,
yes this is possible with standard field.one more thing plz conform that You have provide OK_CODE in element list of screen.
regards
Ajit
2012 Apr 23 6:51 AM
I can not do that it is a standard field and I am putting this validation on AS01. If i include the field ANLZ-PERNR in the chain endchain, it displays an error message that the Input/Output Field 'ANLZ-PENR' not defined.
2012 Apr 23 6:42 AM
Keep your standard field also in the CHAIN END CHAIN command
2012 Apr 23 6:48 AM
I can not do that it is a standard field and I am putting this validation on AS01. If i include the field ANLZ-PERNR in the chain endchain, it displays an error message that the Input/Output Field 'ANLZ-PENR' not defined.
2012 Apr 23 6:58 AM
Then in that can you try giving a Information message and leave the program flow after that. Then all fields will remain editable.
2012 Apr 23 7:07 AM
In that case if the user navigates to the next tab it can, but my situation is i have to make it mandatory for the user to enter a value in that field.
2012 Apr 23 7:07 AM
The problem of using Chain Endchain on your custom field is that it will disable other fields.
You can display the error as a information message either while doing a SAVE or when the user is trying to click on the next tab. Do this in the PAI.
2012 Apr 23 7:13 AM
Yes, you need to stop the program flow after the Information message, same as LEAVE LIST-PROCESSING in Reports.
Use Leave statement to stop the flow.
2012 Apr 23 9:42 AM
I am trying to use validation to achieve it but the problem I am facing is i have given parameter id t my custom field, created an entry in TPARA and i have checked SET PARAMTER and GET PARAMETER in module pool layout. But I am not getting the value in the Validation. Please help.
2012 Apr 23 10:17 AM
Is it a custom Parameter ID? Where are you setting the value?
2012 Apr 23 10:29 AM
Hi Chandni ,
use below code
include mm_messages_mac. "useful macros for message handling
if <condition>
mmpur_message_forced 'E' 'ME' '083' text-001 '' '' ''. " in text-001 add your custom mesage .
endif .
just use above code
regards
Deepak.
2012 Apr 23 12:30 PM
I solved it by myself but the solution you have provided seems knowledgeable. Could you please explain what this does.
2012 Apr 23 12:33 PM
The Parameter ID is custom, I have set the Parameter ID in the layout editor by giving Parameter ID in the attributes of that Field, the mistake I was doing was in the Declaration of variable in which I was passing the value of the Parameter ID, it had to be a char type variable.
Thanks for your help.
2012 Apr 23 12:43 PM
Dear Chandni ,
When you are doing Validation for any field which should again prompt for INput field
then it will act as ERROR TYPe ..but it again allow to enter value .
validation error message will also be customized in TEXT-0001 text elements .
it will not go into NON editable field .
There is also no need to make it Mandatory by Properties ... still can validate
regards
Deepak.
2012 Apr 23 11:02 AM
Hi,
How about using this in your error message.
MESSAGE 'your error message' TYPE 'S' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
Jake.
2012 Apr 23 12:29 PM
This did not work, i had already tried it. Please read the Requirement, I have to make it mandatory field that is why can not use this since this allows the user to navigate to other page without entering the value.
2012 Apr 23 12:41 PM
2013 Dec 05 6:58 AM
Can you please explain how you solved this ? I am facing same issue in AS01.
Regards
Lavanya
2013 Dec 09 9:28 AM
Hello Lavanya,
You must have found the exit where you have to put your code. As much as I remember, to achieve this validation I fetched the value of that field ANLZ-PERNR using Parameter ID assigned to it and according to my field's value, I was able to put a validation on that field. Revert in case you need more help.
Regards,
Chandni Sharma