Skip to Content
0
Former Member
Feb 22, 2009 at 05:14 PM

How to store message from FM into a string

1369 Views

Hi Experts,

i am using 'POSTAL_CODE_CHECK' for postal code validation. how can i store the message from the FM in a string.

Example : when i execute the 'POSTAL_CODE_CHECK' FM in Se37 with county 'US' and worng postal code its display message like ' Postal code must have the length 5 or 10 '

so how can i capture above message into string? becaz i want display it later.

REPORT ZTESTFM.

CALL FUNCTION 'POSTAL_CODE_CHECK'

EXPORTING

country = 'US'

postal_code = '605150'

region = ''

IMPORTING

ev_postal_code = l_codepostal

EXCEPTIONS

not_valid = 1

others = 2.

IF sy-subrc EQ 1.

  • MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno

  • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

WRITE: /'OWN Message :POSTAL CODE NOT VALID'.

else.

WRITE: /'OWN Message :POSTAL CODE VALID'.

ENDIF.