Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem With Error Message In Module Pool

Former Member
0 Likes
7,886

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.

22 REPLIES 22
Read only

Former Member
0 Likes
4,933

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

Read only

Former Member
0 Likes
4,933

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

Read only

0 Likes
4,933

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?

Read only

0 Likes
4,933

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

Read only

0 Likes
4,933

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.

Read only

Former Member
0 Likes
4,933

Keep your standard field also in the CHAIN END CHAIN command

Read only

0 Likes
4,933

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.

Read only

0 Likes
4,933

Then in that can you try giving a Information message and leave the program flow after that. Then all fields will remain editable.

Read only

0 Likes
4,933

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.

Read only

0 Likes
4,933

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.

Read only

0 Likes
4,933

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.

Read only

0 Likes
4,933

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.

Read only

0 Likes
4,933

Is it a custom Parameter ID? Where are you setting the value?

Read only

0 Likes
4,933

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.

Read only

0 Likes
4,933

I solved it by myself but the solution you have provided seems knowledgeable. Could you please explain what this does.

Read only

0 Likes
4,933

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.

Read only

0 Likes
4,933

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.

Read only

Former Member
0 Likes
4,933

Hi,

How about using this in your error message.

MESSAGE 'your error message' TYPE 'S' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.

Jake.

Read only

0 Likes
4,933

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.

Read only

Former Member
0 Likes
4,933

Solved the Problem by myself.

Thank You all For Helping.

Read only

Former Member
0 Likes
4,933

Can you please explain how you solved this ? I am facing same issue in AS01.

Regards

Lavanya

Read only

0 Likes
4,933

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