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: 

MEASUREM_DOCUM_RFC_SINGLE_001 message log

Former Member
0 Kudos

Hi All,

          How do I create an error/ message log out from this function module?

Best Regards,

Charlie

4 REPLIES 4

Former Member
0 Kudos

Hi Charlie,



IF sy-subrc <> 0.

       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4

            INTO lv_message.

       ls_bapiret-id = sy-msgid.

       ls_bapiret-type = sy-msgty.

       ls_bapiret-number = sy-msgno.

       ls_bapiret-message_v1 = sy-msgv1.

       ls_bapiret-message_v2 = sy-msgv2.

       ls_bapiret-message_v3 = sy-msgv3.

       ls_bapiret-message_v4 = sy-msgv4.

       ls_bapiret-message = lv_message.

       APPEND ls_bapiret TO et_return.

     ELSE.

       APPEND ls_measurem_doc_output TO et_mdocm.

     ENDIF.

Kind Regards

Bert

0 Kudos

Hi Bert,

     Is this code also applicable for function modules?

Thanks,

Charlie

0 Kudos

yes

0 Kudos

Hi Charlie,

The function module  MEASUREM_DOCUM_RFC_SINGLE_001 is returning some exceptions.
You can easily check if there is an exception and create a log table.

CALL FUNCTION 'MEASUREM_DOCUM_RFC_SINGLE_001'.

EXPORTING

.....

EXCEPTIONS

       no_authority          = 1

       point_not_found       = 2

       index_not_unique      = 3

       type_not_found        = 4

      .......

IF sy-subrc <> 0.

       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4

            INTO lv_message.

       ls_bapiret-id = sy-msgid.

       ls_bapiret-type = sy-msgty.

       ls_bapiret-number = sy-msgno.

       ls_bapiret-message_v1 = sy-msgv1.

       ls_bapiret-message_v2 = sy-msgv2.

       ls_bapiret-message_v3 = sy-msgv3.

       ls_bapiret-message_v4 = sy-msgv4.

       ls_bapiret-message = lv_message.

       APPEND ls_bapiret TO et_return.

     ELSE.

       APPEND ls_measurem_doc_output TO et_mdocm.

     ENDIF.


Kr.
Bert