Function module for Outbound Delivery

Dear ABAPers,
Can anyone tell me the Function module for Out bound Delivery.
Thanks & Regards,
Ashok.

Hi,
Check this BAPI:
BAPI_OUTB_DELIVERY_CREATE_SLS.
Hope it is helps.
Regards,
T.D.M.

Similar Messages

  • Function Module for Changing delivery date

    Hi Friends ,
        I am held up with a scenario of changing the delivery date while creating purchase order. Could you please suggest any function module to change the delivery date in purchase order if it is less than 5 days.
    With Regards ,
    Sudhir S
    Moderator message: please do some own research before asking.
    Edited by: Thomas Zloch on Feb 21, 2011 11:45 AM

    Hi praveen for u r requirement there is no need of any FM
    Try this code
    parameters:
      p_date like sy-datum,
      p_no type i.
    data:
      w_date like sy-datum.
    w_date = p_date - p_no.
    write: / w_date .
    it is enogh for u r requirement
    plzz reward if it is usefull...
    for any further quiries my mail id is [email protected]
    plzz dont forget to reward

  • Function Module for Outbound process code

    Hi,
    I have a scenario in which i have to send MBGMCR02 Idoc from SAP to XI.
    I created a new Outbound process code and now I have to code the function module that populates data into the segments.
    Does anyone have sample code for this, i.e code to put in the finction module of an outbound process code?

    hi...
    please find the below code.
    *& Report  ZPROGRAM11
    REPORT  ZPROGRAM11.
    tables : likp,vbuk,vbfa,ibin,vbap,vbak,kna1.
    types : begin of iy_tab,
             vbeln type vbfa-vbeln,
            vbelv type vbfa-vbelv,
           posnv type vbfa-posnv,
           end of iy_tab.
    types : begin of iy_tab1,
    vbeln type vbuk-vbeln,
    wbstk type vbuk-wbstk,
    end of iy_tab1.
    types : begin of iy_tab2,
    vbeln type vbak-vbeln,
    kunnr type vbak-kunnr,
    vkorg type vbak-vkorg,
    vtweg type vbak-vtweg,
    spart type vbak-spart,
    end of iy_tab2.
    data : i_ibase type ib_ibase.
    data : i_kunnr type vbak-kunnr.
    data : it_tab type table of iy_tab with header line,
      it_tab1 type standard table of iy_tab1 ,
      wa_tab1 type iy_tab1,
      it_tab2 type standard table of iy_tab2 ,
      wa_tab2 type iy_tab2.
    data : t_edidd type standard table of edidd .
    data : t_edidc type  edidc.
    data : t_edidc1 type standard table of edidc .
    data : wa type edidd.
    data : wa1 type e1edl20.
    data : wa2 type zibase.
    data : wa3 type e1edl32.
    data : wa4 type e1edl44.
    data : wa5 type e1edl37.
    data : wa6 type e1edl28.
    data : wa7 type e1edl30.
    data : wa8 type e1edl24.
    data : wa9 type e1adrm1.
    data : begin of it_tab3 occurs 10,
           vbeln type iy_tab-vbelv,
           posnr type iy_tab-posnv,
           i_ibase type ib_ibase,
           end of it_tab3.
      types :    begin of iy_tab4 ,
            valfr type ibin-valfr,
            ibase type ibin-ibase,
           amount type ibin-amount,
           unit type ibin-unit,
           end of iy_tab4.
           data : it_tab4 type standard table of iy_tab4,
                  wa_tab4 type iy_tab4.
      data : begin of it_tab5 occurs 10,
             vbeln type vbfa-vbelv,
             posnr type vbfa-posnv,
             ibase type ibib-ibase,
             valfr type ibin-valfr,
             amount type ibin-amount,
             unit type ibin-unit,
             matnr type vbap-matnr,
             kunnr type vbak-kunnr,
             vkorg type vbak-vkorg,
             vtweg type vbak-vtweg,
             spart type vbak-spart,
             name1 type kna1-name1,
             end of it_tab5.
          types : begin of iy_tab6,
                 vbeln type vbap-vbeln,
                 posnr type vbap-posnr,
                 matnr type vbap-matnr,
                end of iy_tab6.
          data : it_tab6 type standard table of iy_tab6,
                 wa_tab6 type iy_tab6.
    types : begin of iy_tab7,
            kunnr type kna1-kunnr,
            name1 type kna1-name1,
            end of iy_tab7.
    data: it_tab7 type standard table of iy_tab7,
          wa_tab7 type iy_tab7.
          data : wa_table type ytable1.
    selection-screen: begin of block b1 with frame title text-t00.
    parameters: p_vbeln type vbfa-vbeln.
    selection-screen: end of block b1.
    start-of-selection.
      select vbeln vbelv posnv  from vbfa into table it_tab
      where vbeln = p_vbeln.
      if sy-subrc eq 0.
            loop at it_tab.
        select vbeln wbstk from vbuk into table it_tab1
          for all entries in it_tab
        where vbeln = it_tab-vbeln.
            endloop.
      endif.
      loop at it_tab1 into wa_tab1.
        if wa_tab1-wbstk = 'C'.
          loop at it_tab.
            call function 'IBSD_CREATE_IBASE'
              exporting
                i_vbeln                     = it_tab-vbelv
                i_posnr                     = it_tab-posnv
                i_as_sold                   = '0'
                i_as_build                  = '0'
                i_capid                     = '0'
              I_CHANGE                    = ' '
               i_commit                    = 'X'
              I_COMMIT_WAIT               = ' '
             importing
               e_ibase                     = i_ibase
             exceptions
               order_not_found             = 1
               position_not_found          = 2
               nothing_to_do               = 3
               too_much_to_do              = 4
               missing_authorization       = 5
               foreign_lock                = 6
               others                      = 7
            if sy-subrc <> 0.
              message id sy-msgid type sy-msgty number sy-msgno
                      with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            else.
              move it_tab-vbelv to it_tab3-vbeln.
              move it_tab-posnv to it_tab3-posnr.
              move i_ibase to it_tab3-i_ibase.
              append it_tab3.
              if sy-subrc eq 0.
               select valfr ibase  amount unit from ibin into table it_tab4
                  for all entries in it_tab3
                  where ibase = it_tab3-i_ibase.
                 if sy-subrc eq 0.
                   select vbeln posnr matnr from vbap into table it_tab6
                     for all entries in it_tab3
                     where vbeln = it_tab3-vbeln and posnr = it_tab3-posnr .
                     if sy-subrc eq 0.
              select vbeln  kunnr vkorg vtweg spart from vbak into table it_tab2
                for all entries in it_tab
                  where vbeln = it_tab-vbelv.
              sort it_tab2 by vbeln.
              delete adjacent duplicates from it_tab2 comparing all fields.
             if sy-subrc <> 0.
               select kunnr name1 from kna1 into table it_tab7
                 for all ENTRIES IN it_tab2
                 where kunnr = it_tab2-kunnr.
                 endif.
               endif.
               endif.
               endif.
               endif.
          endloop.
        else.
          exit.
       if sy-subrc eq 0.
       endif.
        endif.
      endloop.
      loop at it_tab3.
        move it_tab3-vbeln to it_tab5-vbeln.
        move it_tab3-posnr to it_tab5-posnr.
        move it_tab3-i_ibase to it_tab5-ibase.
        if sy-subrc eq 0.
          read table it_tab4 into wa_tab4 with key ibase = it_tab3-i_ibase.
          move wa_tab4-valfr to it_tab5-valfr.
          move wa_tab4-amount to it_tab5-amount.
          move wa_tab4-unit to it_tab5-unit.
          if sy-subrc eq 0.
            read table it_tab6 into wa_tab6 with key  vbeln = it_tab3-vbeln posnr = it_tab3-posnr.
            move wa_tab6-matnr to it_tab5-matnr.
            if sy-subrc eq 0.
              read table it_tab2 into wa_tab2 with key vbeln = it_tab3-vbeln.
              move wa_tab2-kunnr to it_tab5-kunnr.
              move wa_tab2-vkorg to it_tab5-vkorg.
              move wa_tab2-vtweg to it_tab5-vtweg.
              move wa_tab2-spart to it_tab5-spart.
              if sy-subrc eq 0.
                read table it_tab7 into wa_tab7 with key kunnr = wa_tab2-kunnr.
                move wa_tab7-name1 to it_tab5-name1.
                append it_tab5.
                endif.
              endif.
          endif.
          endif.
         append it_tab5.
          endloop.
        loop at it_tab5.
          move it_tab5-vbeln to wa_table-vbeln.
           move it_tab5-kunnr to wa_table-kunnr.
            move it_tab5-vbeln to wa_table-vbeln.
             move it_tab5-ibase to wa_table-ibase.
              move it_tab5-matnr to wa_table-matnr.
               move it_tab5-valfr to wa_table-valfr.
                move it_tab5-unit to wa_table-unit.
                 move it_tab5-amount to wa_table-amount.
                  move it_tab5-vkorg to wa_table-vkorg.
                   move it_tab5-vtweg to wa_table-vtweg.
                    move it_tab5-spart to wa_table-spart.
                    move it_tab5-name1 to wa_table-name1.
                    insert ytable1 from wa_table.
                    endloop.
    *INSERT ytable1 FROM TABLE it_tab5.
        loop at it_tab5.
        wa1-vbeln = it_tab-vbeln.
        wa1-vkorg = it_tab5-vkorg.
        wa-segnam = 'E1EDL20'.
        wa-sdata = wa1.
        wa-hlevel = 2.
        append wa to t_edidd.
      loop at it_tab3.
        wa2-i_ibase = it_tab5-ibase.
        wa2-i_qty = it_tab5-amount.
        wa2-i_dat = it_tab5-valfr.
        wa-segnam = 'ZIBASE'.
        wa-sdata = wa2.
        wa-hlevel = 3.
        append wa to t_edidd.
               endloop.
    wa9-name1 = it_tab5-name1.
    wa-segnam = 'E1ADRM1'.
    wa-sdata = wa9.
    wa-hlevel = 3.
    append wa to t_edidd.
        wa-segnam = 'E1EDL28'.
        wa-sdata = wa6.
        wa-hlevel = 3.
        append wa to t_edidd.
        wa-segnam = 'E1EDL30'.
        wa-sdata = wa7.
        wa-hlevel = 4.
        append wa to t_edidd.
        wa3-kunnr = it_tab5-kunnr.
        wa-segnam = 'E1EDL32'.
        wa-sdata = wa3.
        wa-hlevel = 5.
        append wa to t_edidd.
        wa8-meins = it_tab5-unit.
        wa8-vtweg = it_tab5-vtweg.
        wa8-spart = it_tab5-spart.
        wa-segnam = 'E1EDL24'.
        wa-sdata = wa8.
        wa-hlevel = 3.
       append wa to t_edidd.
        wa-segnam = 'E1EDL37'.
        wa-sdata = wa5.
        wa-hlevel = 3.
        append wa to t_edidd.
        wa4-vbeln  = it_tab5-vbeln.
        wa4-posnr = it_tab5-posnr.
        wa4-matnr = it_tab5-matnr.
        wa-segnam = 'E1EDL44'.
        wa-sdata = wa4.
        wa-hlevel = 4.
        append wa to t_edidd.
        endloop.
        t_edidc-mandt = sy-mandt.
        t_edidc-direct = '1'.
        t_edidc-rcvpor = 'A000000062'.
        t_edidc-rcvprt = 'LS'.
        t_edidc-rcvprn = 'O2C_ASSET'.
    t_edidc-rcvpfc = 'LS'.
        t_edidc-sndpor = 'SAPSIT'.
        t_edidc-sndprt = 'LS'.
        t_edidc-sndprn = 'T90CLNT090'.
    t_edidc-sndpfc = 'LS'.
        t_edidc-mestyp = 'DELVRY'.
        t_edidc-idoctp = 'DELVRY03'.
    *t_edidc-rcvpfc = 'LS'.
    t_edidc-sndpfc = 'LS'.
        t_edidc-cimtyp = 'ZDELVRY03'.
        append t_edidc to t_edidc1.
        call function 'MASTER_IDOC_DISTRIBUTE'
                                   exporting
                                     master_idoc_control                  = t_edidc
                                 OBJ_TYPE                             = ''
                                 CHNUM                                = ''
                                   tables
                                     communication_idoc_control           = t_edidc1
                                     master_idoc_data                     = t_edidd
                                  exceptions
                                    error_in_idoc_control                = 1
                                    error_writing_idoc_status            = 2
                                    error_in_idoc_data                   = 3
                                    sending_logical_system_unknown       = 4
                                    others                               = 5
        if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          else.
          CALL FUNCTION 'DB_COMMIT'
          CALL FUNCTION 'DEQUEUE_ALL'
          EXPORTING
            _SYNCHRON       = ' '
          COMMIT WORK.
        endif.
         endloop.

  • Function module for OUtbound DESADV01

    Hi,
    Can anyone tell me which function module to be used for OUtbound DESADV01 which i will be using for ASN. In addition to this, please let me know which procesisng code will be used.
    Can anyone please share the code for writting a funciion module in case I have to write custom FM.
    Regards
    Rinku
    Message was edited by:
            Rinku Malik

    Hi,
    Create a new function group from se37.
    From the menu Goto --> Function group --> create group
    Copy the function module IDOC_OUTPUT_DESADV01 into ZIDOC_OUTPUT_DESADV01 function module. Add your code in the function module.
    create a new Z Process code ZSD05 in we41 tcode and attach the function module
    ZIDOC_OUTPUT_DESADV01 to the process code.
    In tcode we57 attach the function module to the idoc type and message type.
    Regards
    Arun

  • Packing using function modules in outbound delivery

    Hi All,
             I am creating a outbound delivery using BDC. I am trying to Create HUs, Pack and assign serial numbers. I wish to do it using standard FMs.
    Please advise.
    Step # 1. I was able to create HUs using BAPI_HU_CREATE .
                   I was not sure on the HU_EXID_TYPE though. I created with
                                 'F' -No. rnge obj. HU_VEKP external interval - SSCC18 before GI.
    Step #2  I assigned the HU to my Outbound delivery by updating VPOBJKEY and VPOBJ field of VEKP table. QUERY.
                    This also successful. I am now able to see the HU attached to the Outbound delivery.:)
    Step #3  But I am not sure how to do the packing/ Assign Serial numbers.  Need help?
                         I am working with FM WS_DELIVERY_UPDATE...... Pls advice.
                           Not sure on the values that I need to pass. Please help!
    Thanks!

    hi sridhar,
    i have the same requirement as yours....
    but i m facing some problems with it....can u please share u r solution ?
    thanks and regards,
    Omkar

  • BAPI or function module for creating outbound delivery agains STO

    Hi,
    Is there any function module or BAPI to create an outboud delivery against STO?  Appreciated if anybody tells what are all the mandatory fields to pass.
    Thanks and Regards,
    Suresh

    Hi,
    Pls check the BAPIs,
    BAPI_OUTB_DELIVERY_CONFIRM_DEC BAPI for Outbound Delivery Confirmation from a Decentralized System
    BAPI_OUTB_DELIVERY_SPLIT_DEC   BAPI for Subsequent Outbound-Delivery Split from a Decentralized Syste
    Regards,
    Renjith Michael.

  • Function module for assigning a HU to delivery

    Function module for assigning a HU in HU managed location to a delivery ??

    Hello,
    In FuGrp HU_BASIC_BAPIS               Basic BAPIs for Hus
    with F’tn BAPI_HU_CREATE  Create handling unit with items
    this creates HU's NOT yet assigned.
    After F'tn BAPI_TRANSACTION_COMMIT
    You can assign the HU via
    F'tn BAPI_HU_CHANGE_HEADER
    using the BAPIHUHEADER fields: PACK_MAT_OBJECT & PACK_MAT_OBJ_KEY.
    Dirk

  • Function Module for Posting the Delivery Doument

    Dear Experts,
            Could you please send me the Function Module for Posting the Delivery Doument.
    Thanks & Regards,
    Ashok.

    Hi,
    What do you mean by POSTING the delivery document?
    Are you mentioning the creation of Goods Issue?

  • Function module for Delivery and billing based on sales order

    Hi Friends
    I am developing an object which has to create the sales order, delivery for that sales order and billing for it at the same time.
    I have tried for few function modules to create the delivery and billing but I am not able to achieve.
    Would you please help me by providing the correct function modules for these 2 activities?
    Thanks
    Praveen

    Hi Nikhil
    Thanks for reply,
    i am creating the sales order using the BAPI "BAPI_SALESORDER_CREATEFROMDAT1" only, but the billing document bapi
    "BAPI_BILLINGDOC_CREATE" is for online creation, it will call the t-code 'VF01'.
    I need to create the billing document with out calling the t-code like using bapi for sales order. Please suggest me if there are function modules to achieve this.
    Thanks
    Praveen

  • What is outbound function module for IDoc type INFRECMASS01

    Hi,
    What is outbound function module for IDoc type INFRECMASS01? This is for purchasing info record.
    Thanks
    Kamal

    Hi Kamal,
    Have you looked standard program <b>RBDSEINF</b> or transaction code <b>ME18</b>?
    This program will call function module <b>MASTERIDOC_CREATE_REQ_INFREC</b> to generate purchasing info record IDoc.
    Hope this will help.
    Regards,
    Ferry Lianto
    Please reward points if helpful.

  • Outbound function module for IDOC WMMBID02

    Hi,
    Do we have any outbound function module for basic IDOC type WMMBID02 (Stock movements from ext. systems) which has message type WMMBXY.
    I searched with hot keys OUTBOUND_WMMBXY in SE37 but unable to find a standard FM. My task is to extend that FM by a user-exit so as to populate my extended IDOC which is of basic type WMMBID02.
    Any help would be greatly appreciated.
    Regards,
    Harsh

    Hi Kamal,
    Have you looked standard program <b>RBDSEINF</b> or transaction code <b>ME18</b>?
    This program will call function module <b>MASTERIDOC_CREATE_REQ_INFREC</b> to generate purchasing info record IDoc.
    Hope this will help.
    Regards,
    Ferry Lianto
    Please reward points if helpful.

  • Sample Outbound Function Module for IDocs

    Hello All,
    Does anyone have sample code for an outbound function module for an IDoc - they created themselves. Custom or extended? Weblogs, sample code will be useful
    ty, dd
    Message was edited by:
            Demi Douglas

    Hi,
      Check this program:
    REPORT  zmatmas_idoc.
    INCLUDE zmatmas_idoc_top.
    INCLUDE zmatmas_idoc_selscreen.
    INCLUDE zmatmas_idoc_formroutine.
    START OF SELECTION
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM create_idoc.
      PERFORM distribute_idoc.
    TABLES
    TABLES: mara.
    Structures
    *Header
    TYPES: BEGIN OF gs_h_mara,
           matnr TYPE mara-matnr,
           ersda TYPE mara-ersda,
           ernam TYPE mara-ernam,
           laeda TYPE mara-laeda,
           aenam TYPE mara-aenam,
           pstat TYPE mara-pstat,
           END OF gs_h_mara.
    *Item
    TYPES: BEGIN OF gs_i_makt,
           spras TYPE makt-spras,
           maktx TYPE makt-maktx,
           maktg TYPE makt-maktg,
           matnr TYPE makt-matnr,
           END OF gs_i_makt.
    TYPES: BEGIN OF gs_i_mbew,
           lvorm TYPE mbew-lvorm,
           lbkum TYPE mbew-lbkum,
           salk3 TYPE mbew-salk3,
           vprsv TYPE mbew-vprsv,
           verpr TYPE mbew-verpr,
           stprs TYPE mbew-stprs,
           peinh TYPE mbew-peinh,
           matnr TYPE mbew-matnr,
           END OF gs_i_mbew.
    TYPES: BEGIN OF gs_i_mvke,
           vkorg TYPE mvke-vkorg,
           vtweg TYPE mvke-vtweg,
           lvorm TYPE mvke-lvorm,
           versg TYPE mvke-versg,
           bonus TYPE mvke-bonus,
           provg TYPE mvke-provg,
           matnr TYPE mvke-matnr,
           END OF gs_i_mvke.
    TYPES: BEGIN OF gs_i_mlan,
           aland TYPE mlan-aland,
           taxm1 TYPE mlan-taxm1,
           taxm2 TYPE mlan-taxm2,
           taxm3 TYPE mlan-taxm3,
           taxm4 TYPE mlan-taxm4,
           matnr TYPE mlan-matnr,
           END OF gs_i_mlan.
    *Segment & control record
    DATA:  gs_segment_h  LIKE zmara_h,
           gs_segment_i1 LIKE zmakt_i,
           gs_segment_i2 LIKE zmbew_i,
           gs_segment_i3 LIKE zmvke_i,
           gs_segment_i4 LIKE zmlan_i,
           gs_control_rec LIKE edidc.
    Internal Table and work area
    *Header & Item
    DATA: gt_h_mara TYPE STANDARD TABLE OF gs_h_mara,
          gt_i_makt TYPE STANDARD TABLE OF gs_i_makt,
          gt_i_mbew TYPE STANDARD TABLE OF gs_i_mbew,
          gt_i_mvke TYPE STANDARD TABLE OF gs_i_mvke,
          gt_i_mlan TYPE STANDARD TABLE OF gs_i_mlan.
    DATA: gw_h_mara TYPE gs_h_mara,
          gw_i_makt TYPE gs_i_makt,
          gw_i_mbew TYPE gs_i_mbew,
          gw_i_mvke TYPE gs_i_mvke,
          gw_i_mlan TYPE gs_i_mlan.
    *EDIDD & EDIDC
    DATA: gt_edidc LIKE TABLE OF edidc WITH HEADER LINE,
          gt_edidd LIKE TABLE OF edidd WITH HEADER LINE.
    SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    SELECT-OPTIONS: s_matnr FOR mara-matnr OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    *&  Include           ZMATMAS_IDOC_FORMROUTINE
    *&      Form  get_data
    FORM get_data .
      SELECT matnr ersda ernam laeda aenam pstat
      FROM mara
      INTO TABLE gt_h_mara
      WHERE matnr IN s_matnr.
      IF sy-subrc <> 0.
        MESSAGE e003(zkaren_msgclass).
      No data found according to the selection criteria
      ENDIF.
      IF gt_h_mara IS NOT INITIAL.
        SELECT spras maktx maktg matnr
        INTO TABLE gt_i_makt
        FROM makt
        FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
        SELECT lvorm lbkum salk3 vprsv verpr stprs peinh matnr
        INTO TABLE gt_i_mbew
        FROM mbew
        FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
        SELECT vkorg vtweg lvorm versg bonus provg matnr
        INTO TABLE gt_i_mvke
        FROM mvke
        FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
        SELECT aland taxm1 taxm2 taxm3 taxm4 matnr
        INTO TABLE gt_i_mlan
        FROM mlan
        FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
      ENDIF.
    ENDFORM.                    " get_data
    *&      Form  create_idoc
    FORM create_idoc .
    *Control data
      gs_control_rec-mestyp = 'ZKAR_MATMAS_MSG_TYPE'.       "Message type
      gs_control_rec-idoctp = 'ZKAR_MATMAS'.                "IDoc
      gs_control_rec-rcvprt = 'LS'.                         "Partner type of receiver
      gs_control_rec-rcvprn = 'T90CLNT810'.                 "Partner number of receiver
      LOOP AT gt_h_mara INTO gw_h_mara .
    *Header data.
        gs_segment_h-matnr = gw_h_mara-matnr.
        gs_segment_h-ersda = gw_h_mara-ersda.
        gs_segment_h-ernam = gw_h_mara-ernam.
        gs_segment_h-laeda = gw_h_mara-laeda.
        gs_segment_h-aenam = gw_h_mara-aenam.
        gs_segment_h-pstat = gw_h_mara-pstat.
    *Header segment
        gt_edidd-segnam = 'ZMARA_H'.
        gt_edidd-sdata = gs_segment_h.
        MOVE gt_edidd-sdata TO gs_segment_h.
        APPEND gt_edidd.
        WRITE:/ gs_segment_h-matnr, gs_segment_h-ersda, gs_segment_h-ernam,
                gs_segment_h-laeda, gs_segment_h-aenam, gs_segment_h-pstat.
    *ITEM 1
        LOOP AT gt_i_makt INTO gw_i_makt.
          IF gw_i_makt-matnr = gw_h_mara-matnr.
    *Item data
            gs_segment_i1-spras = gw_i_makt-spras.
            gs_segment_i1-maktx = gw_i_makt-maktx.
            gs_segment_i1-maktg = gw_i_makt-maktg.
    *Item segment
            gt_edidd-segnam = 'ZMAKT_I'.
            gt_edidd-sdata = gs_segment_i1.
            APPEND gt_edidd.
          ENDIF.
        ENDLOOP.                                            "at gt_i_vbak
    *ITEM2
        LOOP AT gt_i_mbew INTO gw_i_mbew.
          IF gw_i_mbew-matnr = gw_h_mara-matnr.
    *Item data
            gs_segment_i2-lvorm = gw_i_mbew-lvorm.
            gs_segment_i2-lbkum = gw_i_mbew-lbkum.
            gs_segment_i2-salk3 = gw_i_mbew-salk3.
            gs_segment_i2-vprsv = gw_i_mbew-vprsv.
            gs_segment_i2-verpr = gw_i_mbew-verpr.
            gs_segment_i2-stprs = gw_i_mbew-stprs.
            gs_segment_i2-peinh = gw_i_mbew-peinh.
    *Item segment
            gt_edidd-segnam = 'ZMBEW_I'.
            gt_edidd-sdata = gs_segment_i2.
            APPEND gt_edidd.
          ENDIF.
        ENDLOOP.
    *ITEM3
        LOOP AT gt_i_mvke INTO gw_i_mvke.
          IF gw_i_mvke-matnr = gw_h_mara-matnr.
    *Item data
            gs_segment_i3-vkorg = gw_i_mvke-vkorg.
            gs_segment_i3-vtweg = gw_i_mvke-vtweg.
            gs_segment_i3-lvorm = gw_i_mvke-lvorm.
            gs_segment_i3-versg = gw_i_mvke-versg.
            gs_segment_i3-bonus = gw_i_mvke-bonus.
            gs_segment_i3-provg = gw_i_mvke-provg.
    *Item segment
            gt_edidd-segnam = 'ZMVKE_I'.
            gt_edidd-sdata = gs_segment_i3.
            APPEND gt_edidd.
          ENDIF.
        ENDLOOP.
    *ITEM4
        LOOP AT gt_i_mlan INTO gw_i_mlan.
          IF gw_i_mlan-matnr = gw_h_mara-matnr.
    *Item data
            gs_segment_i4-aland = gw_i_mlan-aland.
            gs_segment_i4-taxm1 = gw_i_mlan-taxm1.
            gs_segment_i4-taxm2 = gw_i_mlan-taxm2.
            gs_segment_i4-taxm3 = gw_i_mlan-taxm3.
            gs_segment_i4-taxm4 = gw_i_mlan-taxm4.
    *Item segment
            gt_edidd-segnam = 'ZMLAN_I'.
            gt_edidd-sdata = gs_segment_i4.
            APPEND gt_edidd.
          ENDIF.
        ENDLOOP.
      ENDLOOP.                                              "at gt_h_kna1
    ENDFORM.                    " create_idoc
    *&      Form  distribute_idoc
    FORM distribute_idoc .
      CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
        EXPORTING
          master_idoc_control            = gs_control_rec
        TABLES
          communication_idoc_control     = gt_edidc
          master_idoc_data               = gt_edidd
        EXCEPTIONS
          error_in_idoc_control          = 1
          error_writing_idoc_status      = 2
          error_in_idoc_data             = 3
          sending_logical_system_unknown = 4
          OTHERS                         = 5.
      IF sy-subrc <> 0.
        WRITE:/ 'Error'.
      ELSE.
        LOOP AT gt_edidc.
          WRITE:/ gt_edidc-docnum.
        ENDLOOP.                                            "at gt_edidc
      ENDIF.
    ENDFORM.                    " distribute_idoc

  • Function module for the Inbound Delivery

    Dear ABAPers,
            I have created the Inbound Delivery in VL01N Transaction.I want to create the Post goods issue for the Delivery number.What is the Function module for the Post goods issue for the Delivery number and what all the Parameter needs to be passed.
    Thanks & Regards,
    Ashok.

    Hi,
    Try this code...
    PARAMETERS: p_vbeln LIKE likp-vbeln OBLIGATORY.
    DATA:    l_vbkok_wa   TYPE vbkok,
             l_i_prott    TYPE STANDARD TABLE OF prott,
             l_pgi_status TYPE xfeld,
             c_check      TYPE c VALUE 'X'.
    l_vbkok_wa-vbeln_vl =  p_vbeln.
    l_vbkok_wa-vbtyp_vl = 'T'.
    l_vbkok_wa-wabuc    = c_check.
    Do PGI
    CALL FUNCTION 'WS_DELIVERY_UPDATE'
      EXPORTING
        vbkok_wa                  = l_vbkok_wa
        commit                    = c_check
        delivery                  = l_vbkok_wa-vbeln_vl
      IMPORTING
        ef_error_in_goods_issue_0 = l_pgi_status
      TABLES
        prot                      = l_i_prott.
    IF l_pgi_status IS NOT INITIAL.
    WRITE:/ 'PGI Failure : ', p_vbeln.
    ELSE.
    WRITE:/ 'PGI Success : ', p_vbeln.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = c_check.
    ENDIF.
    Regards
    Meenakshi

  • Function Module for message "MBGMCR" in outbound process

    Hi all,
    I want to create an IDoc via EDI when I post a material document. I use messgae type MBGMCR and IDoc type MBGMCR02 and I already configured in partner profile and all about output determination in SAP-IM.
    And now I need a function module to process outbound IDoc of posting material document but I couldn't find a function module for processing.
    Pls let me know about that.
    Thanks for your time.

    Hi,
    You need to Code your own Z Function Module for this. Copy any standard outbound FM to create your own Z FM, so as to ensure that Interfaces are correct.  
    Refer to given below threads:
    Re: Standard IDOC for Goods Receipt
    Re: Idoc type for Goods Receipt
    Goods Receipt MIGO IDOC

  • Goods Receive for Outbound Delivery Without Reference using MIGO

    Dear Colleague ...
    We might need your insight on the case below related to Goods Receive of Outbound Delivery without Reference using MIGO:
    (1) In the current SAP Enjoy screen of MIGO, we are allowed to select the reference document (e.g. = PO, Material Document, Inbound Document, Outbound Document, etc.)
    (2) We did 3 (three) kind of test set: GR for Inbound Delivery, GR for Outbound Delivery with STO and GR for Outbound Delivery without reference.
    (3) The first 2 (two) cases work just find with MIGO.  We believe it is because the receiving plant is pretty much determined in the reference document, which is PO (case 1) or STO (case 3)
    (4) However, the last case came up with the error message "Goods receipt not possible for delivery 8000610236: error code 5".  We believe that this is the standard design of SAP, that the receiving plant is required and it is not defined explicitly in the delivery document.
    (5) Moreover, we also believe that that's the reason why SAP (via the Logistic Execution module) provide the Handling Unit and Shipment, which can be used to perform such receive function, which will imply the MM posting (goods issue and goods receive) IF there is stock transfer involved.
    Appreciate for any thoughts or input on the above.  Many thanks,
    Alvon Sibarani

    use transaction mb0a it will work for the scenario.

Maybe you are looking for