cancel
Showing results for 
Search instead for 
Did you mean: 

To Generate msg if mandatory field is not filled

Former Member
0 Kudos

Hi Experts,

I want to display msg if mandatory field is not filled , for that i called

CALL METHOD L_MESSAGE_MANAGER->REPORT_ATTRIBUTE_ERROR_MESSAGE

EXPORTING

MESSAGE_TEXT = ' PLEASE FILL ALL MANDATORY FIELD '

ELEMENT = ELEM_GENRAL

ATTRIBUTE_NAME = F_NAME

But i am getting error that F_NAME is not an attribute name but it is attribute name only

What i should do , Please Help

Accepted Solutions (0)

Answers (4)

Answers (4)

mh97
Contributor
0 Kudos

Hi Neeraj,

Meera is correct but means the quote marks are missing on your attribute name.

You have:

CALL METHOD L_MESSAGE_MANAGER->REPORT_ATTRIBUTE_ERROR_MESSAGE

EXPORTING

MESSAGE_TEXT = ' PLEASE FILL ALL MANDATORY FIELD '

ELEMENT = ELEM_GENRAL

ATTRIBUTE_NAME = F_NAME

Should be:


CALL METHOD L_MESSAGE_MANAGER->REPORT_ATTRIBUTE_ERROR_MESSAGE 
         EXPORTING
              MESSAGE_TEXT = ' PLEASE FILL ALL MANDATORY FIELD '
              ELEMENT = ELEM_GENRAL
              ATTRIBUTE_NAME =  'F_NAME'.

Former Member
0 Kudos

Hi

I think you are talking about attribute in the context not attribute of a class. If this is the case, You can not pass it directly to a method. Use code wizard to generate the code automatically for this attribute(with READ option). Then use the data object declared by this code as ur F_NAME. Leme know if u have any concerns in this.

Cheers

Gaurav

Former Member
0 Kudos

Hi Neeraj,

Remove Required property of that inputfield make it NORMAL.

For example your input field is INPUT...

if input is initial.

* report message
          CALL METHOD lo_message_manager->REPORT_ATTRIBUTE_ERROR_MESSAGE
            EXPORTING
              MESSAGE_TEXT   = 'Pick Quantity Should not be 0... '
              ELEMENT        =  wa_temp // element
              ATTRIBUTE_NAME = 'PICK_QTY'.   // Attribute name( name used in context )

endif.

If you not fill input it will raise error message by hilighting the input field.

Cheers,

Kris.

former_member463524
Contributor
0 Kudos

Hi Neeraj,

In your code you missed the codes for attribute name,

CALL METHOD L_MESSAGE_MANAGER->REPORT_ATTRIBUTE_ERROR_MESSAGE

EXPORTING

MESSAGE_TEXT = ' PLEASE FILL ALL MANDATORY FIELD '

ELEMENT = ELEM_GENRAL

ATTRIBUTE_NAME = F_NAME -


> 'F_NAME'

Regards,

Meera

former_member199125
Active Contributor
0 Kudos

Hi..

You can just validate like normal field.

If attribute value is initial,

then raise an error message ( report_error_message) , it stops processing the further statements.

I dnt have knowledge on report_Attribute_error_message, but just analyze like

ELEMENT = ELEM_GENRAL

ATTRIBUTE_NAME = 'F_NAME'

here elem_general is element of "n_name"? (n_name is node name under which F_NAME attribute is there)

Regards

Srinivas