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: 

MBGMCR03 (DC_STOCKCHNG_IN) shows wrong message in Status 53

Former Member
0 Kudos

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!

1 ACCEPTED SOLUTION

engswee
Active Contributor
0 Kudos

Hi Rob

Unfortunately, AFAIK, that is the standard behavior of the IDoc. In the past, we have implemented a custom process code, which uses a custom function module to process this IDoc.

That custom function module could either be a modified copy of IDOC_INPUT_MBGMCR or a wrapper around IDOC_INPUT_MBGMCR. In this function module, you can then tweak the output message in the IDoc status return table.

If all you want is just to find the associated document, you can branch to the document by using the relationship link functionality in the IDoc monitor screen.

Rgds

Eng Swee

6 REPLIES 6

engswee
Active Contributor
0 Kudos

Hi Rob

Unfortunately, AFAIK, that is the standard behavior of the IDoc. In the past, we have implemented a custom process code, which uses a custom function module to process this IDoc.

That custom function module could either be a modified copy of IDOC_INPUT_MBGMCR or a wrapper around IDOC_INPUT_MBGMCR. In this function module, you can then tweak the output message in the IDoc status return table.

If all you want is just to find the associated document, you can branch to the document by using the relationship link functionality in the IDoc monitor screen.

Rgds

Eng Swee

Former Member
0 Kudos

Hi Eng Swee,

Thank you for your very quick reply and useful answer.

We really want a correct to be shown in status 53. Therefore we are curious to answers on the following questions:

How exactly can you realize a wrapper round IDOC_INPUT_MBGMCR03?

And how can you tweak the output message in the IDoc status return table? And how can this table be accessed?

Could you please also provide an answer on those questions?

Thanks in advance.

Kind regards,

Rob

engswee
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Eng Swee,


Thanks a lot!

I'm convinced that this information is very useful for our ABAP Consultant.

Kind regards,

Rob

engswee
Active Contributor
0 Kudos

Hi Rob

Glad to hear that! Hope this resolves your issue.

Rgds

Eng Swee

Former Member
0 Kudos

Hi Eng Swee,

I hope it will. I'll let you know.

Regards,

Rob