Application Development 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: 

Problem With Error Message In Module Pool

Former Member
0 Kudos
3,961

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

Former Member
0 Kudos
1,008

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

Former Member
0 Kudos
1,008

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

0 Kudos
1,008

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?

0 Kudos
1,008

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

0 Kudos
1,008

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.

Former Member
0 Kudos
1,008

Keep your standard field also in the CHAIN END CHAIN command

0 Kudos
1,008

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.

0 Kudos
1,008

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

0 Kudos
1,008

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.

0 Kudos
1,008

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.

0 Kudos
1,008

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.

0 Kudos
1,008

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.

0 Kudos
1,008

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

0 Kudos
1,008

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.

0 Kudos
1,008

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

0 Kudos
1,008

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.

0 Kudos
1,008

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.

Former Member
0 Kudos
1,008

Hi,

How about using this in your error message.

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

Jake.

0 Kudos
1,008

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.

Former Member
0 Kudos
1,008

Solved the Problem by myself.

Thank You all For Helping.

former_member205144
Active Participant
0 Kudos
1,008

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

Regards

Lavanya

0 Kudos
1,008

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