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: 

Printing error Messages of FM

Former Member
0 Kudos

Hi Techies ,

         i have a Function module , and it has tables 'e_t_messages' parameter and it is giving all the error messages .

i want to print all the error messages by looping that table , can you please help me in printing those messages .

my code is :

CALL FUNCTION 'RSNDI_MD_ATTRIBUTES_UPDATE'

     EXPORTING

         i_iobjnm           =   'ZC_REWUI'

         i_activate_md   =   rs_c_true

         i_db_commit    =   abap_true

     IMPORTING

         e_subrc           =  lv_rc

     TABLES

         i_t_attribute     = l_t_attributes

         i_t_data           = l_t_data

         e_t_messages = l_t_messages .



IF lv_rc <> 0 .

LOOP at l_t_messages into l_s_messages .

    write : '??????????????????????'   .

END LOOP.

ENDIF.

i expect answer as my updated code .

update my code and fill in .

Thanks and Kind Regards,

Praveen Bindla..

1 ACCEPTED SOLUTION

former_member196651
Contributor
0 Kudos

Hi Praveen,

Then you can move forward with the code that I had written.

LOOP at l_t_messages into l_s_messages .

    write : l_s_messages-MSGTXTP  .

END LOOP.

Regards,

Abijith

6 REPLIES 6

former_member196651
Contributor
0 Kudos

Hi Praveen,

You can try to achieve this as follows:

CALL FUNCTION 'RSNDI_MD_ATTRIBUTES_UPDATE'

     EXPORTING

         i_iobjnm           =   'ZC_REWUI'

         i_activate_md   =   rs_c_true

         i_db_commit    =   abap_true

     IMPORTING

         e_subrc           =  lv_rc

     TABLES

         i_t_attribute     = l_t_attributes

         i_t_data           = l_t_data

         e_t_messages = l_t_messages .



IF lv_rc <> 0 .

LOOP at l_t_messages into l_s_messages .

    write : l_s_messages-MSGTXTP  .

END LOOP.

ENDIF.

Please put a break point at the loop an check whether the field MSGTXTP is containing message with all the parameters.

Regards,

Abijith

former_member196651
Contributor
0 Kudos

Hi Praveen,

If you are not getting a full message text in the MSGTXTP field, then you can make use of the function module RPY_MESSAGE_COMPOSE to prepare the message. In this FM you need to pass the message class, message no and the message parameters and it will return the full message.

Regards,

Abijith

Mohamed_Mukhtar
Active Contributor
0 Kudos

Hello Praveen,

Use FM FORMAT_MESSAGE


LOOP AT it_message.

    CALL FUNCTION 'FORMAT_MESSAGE'

      EXPORTING

        id        = it_message-msgid

        lang      = it_message-msgspra

        no        = it_message-msgnr

        v1        = it_message-msgv1

        v2        = it_message-msgv2

      IMPORTING

        msg       = v_msg

      EXCEPTIONS

        not_found = 1

        OTHERS    = 2.

write 😕 V_smg.

ENDLOOP.

0 Kudos

Hello Chandra and Always,

both RPY_MESSAGE_COMPOSE  and 'FORMAT_MESSAGE'  getting the same message as it was contained in the variable   l_s_messages-MSGTXTP .

former_member196651
Contributor
0 Kudos

Hi Praveen,

Then you can move forward with the code that I had written.

LOOP at l_t_messages into l_s_messages .

    write : l_s_messages-MSGTXTP  .

END LOOP.

Regards,

Abijith

0 Kudos

Ya Thanks chandra .

i already did mine , but forgot to give u correct answer .