Skip to Content
author's profile photo Former Member
Former Member


Hello everybody,

I am a SAP developper and I have to find a way to supply a WMS with infos on goods movements made in SAP for transfer movements posted with MB1B.

I would like to use SAP standard objects as much as possible and I was told that there is a way to issue standard idocs like WMMBXY from the user exit MB_CF001.

An example of coding is supposed to be given in the documentation of the img activity, but i cannot find it.

Does anybody know about how to do this?

Thank you for helping...

Julien Boffet

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Jun 22, 2004 at 09:46 AM

    If you go to transaction SMOD and supply the exit name MB_CF001 you can then click on the documenation button and receive the following:

    The user exit MB_CF001 includes a function module that is called up

    immediately before the COMMIT WORK when a goods movement is posted.

    All the material document data is passed on to this function module from

    the following tables:

    o MKPF (Material document header)

    o MSEG (Material document items)

    o VM07M (Update data)

    This data can be passed on to other programs.


    The user exit does not write any data to the material document, that is,

    it is not possible to change material document data before the update

    posting takes place.

    If the enhancement MB_CF001 (component: Function module

    EXIT_SAPLMBMB_001 with Include ZXMBCU01) is implemented incorrectly an

    inconsistency may occur between documents and stocks as well as between

    material documents and accounting documents. Such inconsistencies can be

    caused by the following elements in the user exit, for example:


    o Remote function call (CALL FUNCTION .. DESTINATION)

    o Separate updates on the document or stock tables (for example, an

    update on table MBEW, MARD, MSEG)

    o Unlocking data (for example, through DEQUEUE_ALL)

    The enhancement MB_CF001 is called in the update function module

    MB_POST_DOCUMENT. If a COMMIT WORK or a Remote Function Call are set in

    the enhancement, a complete ROLL BACK is not possible in the case of an

    update termination since data is already written until the COMMIT or the

    remote function call in the database. Consequently an asynchronous

    status (for example, a material document without accounting document),

    which can only be repaired with considerable effort, can result.

    The enhancement MB_CF001 is not suited for customer-specific updates on

    the stock tables since such updates can destroy the standard inventory

    update if they are not programmed incrementally (see Note 6899) or do

    not take the material blocks into account.

    An unlocking of data (for example using DEQUEUE_ALL) is also a very high

    priority since the data to be updated is no longer protected against

    external updates and inconsistencies can result from parallel updates.

    Before you activate an enhancement, carefully check that the user exit

    does not contain a high priority source code positions.

    If data inconsistencies already occurred in your system, which can be

    traced back to the user exits, remove the high priority source code

    positions immediately before they cause further inconsistencies.


    The following example illustrates how you can use this user exit if you

    have a link to an external system. All the goods movements of a

    particular movement type are passed on to an external system via IDOC

    using the ALE link. An existing IDOC structure is used. In addition to

    the following coding, you must also specify a destination and a partner

    link for the output in the ALE Customizing section.

    • INCLUDE ZXMBCU01/ (Create the Include by activating the

    • user-exit with transaction /nCMOD)


    ""Local interface:

    *" TABLES





    data: p_varia like t327a-varia. "helper, of no use here

    data: flg_continue_work type c value 0.

    loop at xmseg.

    if xmseg-bwart = 501.

    flg_continue_work = 1.


    delete xmseg.



    check flg_continue_work = 1.

    tables: edidd, edidc, e1mbxyh, e1mbxyi.

    data: begin of comm_idoc_control occurs 10.

    include structure edidc.

    data: end of comm_idoc_control.


    • Data send to ALE


    *........Giving data to ALE-interface..............................

    call function 'L_IDOC_HEADER_CREATE'


    i_mestyp = 'WMMBXY'

    i_mescod = p_varia

    i_idoctp = 'WMMBID01'

    i_rcvprn = 'P30CLNT003'.

    *........Prepare 1.Segment............................................

    clear edidd.

    loop at xmkpf.

    move-corresponding xmkpf to e1mbxyh.

    move sy-tcode to e1mbxyh-tcode.

    move e1mbxyh to edidd-sdata.


    call function 'L_IDOC_SEGMENT_CREATE'


    i_segnam = 'E1MBXYH'

    i_sdata = edidd-sdata.

    *........Prepare Itemdata .............................................

    loop at xmseg.

    clear edidd.

    move-corresponding xmseg to e1mbxyi.

    move e1mbxyi to edidd-sdata.

    call function 'L_IDOC_SEGMENT_CREATE'


    i_segnam = 'E1MBXYI'

    i_sdata = edidd-sdata.


    *.......Send IDOC ............................................

    call function 'L_IDOC_SEND'


    t_comm_idoc = comm_idoc_control


    error_distribute_idoc = 01.

    if sy-subrc ne 0.

    message id sy-msgid type 'A' number sy-msgno

    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Thomas,

      Thank you so much for this!!!

      Indeed it is exactly the bit of documentation I was looking for. It is stange though because I tried again on my system, and I do not have the example of ALE implementation for this userexit using SMOD nor using SPRO. I tried in French English and German and I only get the documentation until "positions immediately before they cause further inconsistencies".

      Well anyway many thanks again, it solves my problem greatly !!!


Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.