Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

MBGMCR03 (DC_STOCKCHNG_IN) shows wrong message in Status 53

Hi all,

We successfully processed the MBGMCR03 (DC_STOCKCHNG_IN) IDoc.

Yet, in Status Record 53 the message "BAPI CREATEFROMDATA has been called successfully" has been shown, while we expected a message like "Document xxxxxxxxxx posted". In which "xxxxxxxxxx" is the number of the Article Document involved.

Does anyone knows how this issue can be solved (preferably without using a Z version of this IDoc)?

I'm looking forward to any suggestions.

Thanks in advance!

Tags:
Former Member
replied

Hi Rob

Please find attached a sample code for the wrapper function module. It should have the same signature as any inbound IDoc processing function module.

The main idea is to replace the message from the existing B1(501) to another more relevant message. I used existing message N1ME(259) that states "Material document & & posted". The messages are in the IDOC_STATUS table whilst the material document & year is in the RETURN_VARIABLES table.

If you go with this approach, do note that you will need to have a custom process code for this function module, and use this new custom process code in your partner profile.

If you don't want to have a custom process code, another alternative would be to put the message modification logic as an implicit enhancement in function module IDOC_INPUT_MBGMCR. That choice is entirely yours.

FUNCTION z_idoc_input_mbgmcr.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     REFERENCE(INPUT_METHOD) TYPE  BDWFAP_PAR-INPUTMETHD

*"     REFERENCE(MASS_PROCESSING) TYPE  BDWFAP_PAR-MASS_PROC

*"  EXPORTING

*"     REFERENCE(WORKFLOW_RESULT) TYPE  BDWF_PARAM-RESULT

*"     REFERENCE(APPLICATION_VARIABLE) TYPE  BDWF_PARAM-APPL_VAR

*"     REFERENCE(IN_UPDATE_TASK) TYPE  BDWFAP_PAR-UPDATETASK

*"     REFERENCE(CALL_TRANSACTION_DONE) TYPE  BDWFAP_PAR-CALLTRANS

*"  TABLES

*"      IDOC_CONTRL STRUCTURE  EDIDC

*"      IDOC_DATA STRUCTURE  EDIDD

*"      IDOC_STATUS STRUCTURE  BDIDOCSTAT

*"      RETURN_VARIABLES STRUCTURE  BDWFRETVAR

*"      SERIALIZATION_INFO STRUCTURE  BDI_SER

*"  EXCEPTIONS

*"      WRONG_FUNCTION_CALLED

*"----------------------------------------------------------------------

   FIELD-SYMBOLS:

     <status>  LIKE LINE OF idoc_status[],

     <ret_var> LIKE LINE OF return_variables[].

   CALL FUNCTION 'IDOC_INPUT_MBGMCR'

     EXPORTING

       input_method          = input_method

       mass_processing       = mass_processing

     IMPORTING

       workflow_result       = workflow_result

       application_variable  = application_variable

       in_update_task        = in_update_task

       call_transaction_done = call_transaction_done

     TABLES

       idoc_contrl           = idoc_contrl

       idoc_data             = idoc_data

       idoc_status           = idoc_status

       return_variables      = return_variables

       serialization_info    = serialization_info

     EXCEPTIONS

       wrong_function_called = 1.

   IF sy-subrc = 0.

*   Abort - rollback

     READ TABLE idoc_status[] TRANSPORTING NO FIELDS

                              WITH KEY msgty = 'A'.

     IF sy-subrc = 0.

       CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

     ELSE.

*   Success

       LOOP AT idoc_status ASSIGNING <status>.

         IF ( <status>-msgid = 'B1' AND <status>-msgno = '501' ). "BAPI & has been called successfully

*         Get the MatDoc and year

           READ TABLE return_variables[] ASSIGNING <ret_var>

                                         WITH KEY wf_param = 'Appl_Objects'.

           IF sy-subrc = 0.

*           N1ME(259) - Material document & & posted

             <status>-msgid = 'N1ME'.

             <status>-msgno = '259'.

             <status>-msgv1 = <ret_var>-doc_number+00. "Material No

             <status>-msgv2 = <ret_var>-doc_number+10. "Year

           ENDIF.

           EXIT.

         ENDIF.

       ENDLOOP.

     ENDIF.

   ELSEIF sy-subrc = 1.

     RAISE wrong_function_called.

   ENDIF.

ENDFUNCTION.

Rgds

Eng Swee

1 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question