GOODS ISSUE BAPI_GOODSMVT_CREATE problem

Hii Alll,
BAPI_GOODSMVT_CREATE is not posting my document but its creating material document
and doc year.
n i hv tested in se37 same  prob .
its not posting production  order

hi
good
go through this below code and use the functionmodule accordingly,
The following is an abap program making used of the BAPI function BAPI_GOODSMVT_CREATE to do Goods Receipts for Purchase Order after importing the data from an external system.
BAPI TO Upload Inventory Data
GMCODE Table T158G - 01 - MB01 - Goods Receipts for Purchase Order
                     02 - MB31 - Goods Receipts for Prod Order
                     03 - MB1A - Goods Issue
                     04 - MB1B - Transfer Posting
                     05 - MB1C - Enter Other Goods Receipt
                     06 - MB11
Domain: KZBEW - Movement Indicator
     Goods movement w/o reference
B - Goods movement for purchase order
F - Goods movement for production order
L - Goods movement for delivery note
K - Goods movement for kanban requirement (WM - internal only)
O - Subsequent adjustment of "material-provided" consumption
W - Subsequent adjustment of proportion/product unit material
report zbapi_goodsmovement.
parameters: p-file like rlgrap-filename default
                                 'c:\sapdata\TEST.txt'.
parameters: e-file like rlgrap-filename default
                                 'c:\sapdata\gdsmvterror.txt'.
parameters: xpost like sy-datum default sy-datum.
data: begin of gmhead.
        include structure bapi2017_gm_head_01.
data: end of gmhead.
data: begin of gmcode.
        include structure bapi2017_gm_code.
data: end of gmcode.
data: begin of mthead.
        include structure bapi2017_gm_head_ret.
data: end of mthead.
data: begin of itab occurs 100.
        include structure bapi2017_gm_item_create.
data: end of itab.
data: begin of errmsg occurs 10.
        include structure bapiret2.
data: end of errmsg.
data: wmenge like iseg-menge,
      errflag.
data: begin of pcitab occurs 100,
        ext_doc(10),           "External Document Number
        mvt_type(3),           "Movement Type
        doc_date(8),           "Document Date
        post_date(8),          "Posting Date
        plant(4),              "Plant
        material(18),          "Material Number
        qty(13),               "Quantity
        recv_loc(4),           "Receiving Location
        issue_loc(4),          "Issuing Location
        pur_doc(10),           "Purchase Document No
        po_item(3),            "Purchase Document Item No
        del_no(10),            "Delivery Purchase Order Number
        del_item(3),           "Delivery Item
        prod_doc(10),          "Production Document No
        scrap_reason(10),      "Scrap Reason
        upd_sta(1),            "Update Status
      end of pcitab.
call function 'WS_UPLOAD'
  exporting
    filename                      = p-file
    filetype                      = 'DAT'
IMPORTING
  FILELENGTH                    =
  tables
    data_tab                      = pcitab
EXCEPTIONS
  FILE_OPEN_ERROR               = 1
  FILE_READ_ERROR               = 2
  NO_BATCH                      = 3
  GUI_REFUSE_FILETRANSFER       = 4
  INVALID_TYPE                  = 5
  OTHERS                        = 6
if sy-subrc <> 0.
  message id sy-msgid type sy-msgty number sy-msgno
          with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  exit.
endif.
gmhead-pstng_date = sy-datum.
gmhead-doc_date = sy-datum.
gmhead-pr_uname = sy-uname.
gmcode-gm_code = '01'.   "01 - MB01 - Goods Receipts for Purchase Order
loop at pcitab.
  itab-move_type  = pcitab-mvt_type.
  itab-mvt_ind    = 'B'.
  itab-plant      = pcitab-plant.
  itab-material   = pcitab-material.
  itab-entry_qnt  = pcitab-qty.
  itab-move_stloc = pcitab-recv_loc.
  itab-stge_loc   = pcitab-issue_loc.
  itab-po_number  = pcitab-pur_doc.
  itab-po_item    = pcitab-po_item.
  concatenate pcitab-del_no pcitab-del_item into itab-item_text.
  itab-move_reas  = pcitab-scrap_reason.
  append itab.
endloop.
loop at itab.
  write:/ itab-material, itab-plant, itab-stge_loc,
          itab-move_type, itab-entry_qnt, itab-entry_uom,
          itab-entry_uom_iso, itab-po_number, itab-po_item,
                                              pcitab-ext_doc.
endloop.
call function 'BAPI_GOODSMVT_CREATE'
  exporting
    goodsmvt_header             = gmhead
    goodsmvt_code               = gmcode
  TESTRUN                     = ' '
IMPORTING
    goodsmvt_headret            = mthead
  MATERIALDOCUMENT            =
  MATDOCUMENTYEAR             =
  tables
    goodsmvt_item               = itab
  GOODSMVT_SERIALNUMBER       =
    return                      = errmsg
clear errflag.
loop at errmsg.
  if errmsg-type eq 'E'.
    write:/'Error in function', errmsg-message.
    errflag = 'X'.
  else.
    write:/ errmsg-message.
  endif.
endloop.
if errflag is initial.
  commit work and wait.
  if sy-subrc ne 0.
    write:/ 'Error in updating'.
    exit.
  else.
    write:/ mthead-mat_doc, mthead-doc_year.
    perform upd_sta.
  endif.
endif.
      FORM UPD_STA                                                  *
form upd_sta.
  loop at pcitab.
    pcitab-upd_sta = 'X'.
    modify pcitab.
  endloop.
  call function 'WS_DOWNLOAD'
    exporting
      filename                      = p-file
      filetype                      = 'DAT'
IMPORTING
  FILELENGTH                    =
    tables
      data_tab                      = pcitab
EXCEPTIONS
  FILE_OPEN_ERROR               = 1
  FILE_READ_ERROR               = 2
  NO_BATCH                      = 3
  GUI_REFUSE_FILETRANSFER       = 4
  INVALID_TYPE                  = 5
  OTHERS                        = 6
endform.
*--- End of Program
reward point if helpful.
thanks
mrutyun^

Similar Messages

  • Goods Issue causing problems

    hi,
    Imy prod orders are set to goods issue and not to backflush but when i confirm the pro with co11n it tries to backflush and creates a goods movement error. please help.
    thanks

    Hi saad
    If your are using discrete without back flash
    Before confirmation co 11 n , you should do GI for that particular prod order with movement type 261 in MB1A.
    If you are doing that GI will be against order reservaion and Storage location. Then do order confimration in Co 11n.
    At that time use Auto GR for production. Do setting in Production scheduling profile.
    Automatically the order will be confimmed with Auyto GR.
    To remove back flash indicator. Check you material master, Work center,Routing for the material, Production order. You assign back flash indicateo in the above mentioned locations. Please remove if it is set.
    Regards
    J. Saravan
    Edited by: Jagannathan Saravanan on Feb 25, 2008 11:21 AM

  • Goods Issue on Process Order with BAPI_GOODSMVT_CREATE

    Hi together,
    I want to post a goods issue on an process order (some of them are networks) but I have some problem with filling the structures.
    Could you please help me?
    Book material
        ls_bapi_head-pstng_date = ls_booking-budat.
        ls_bapi_head-doc_date   = sy-datum.
        ls_bapi_head-pr_uname   = sy-uname.
        ls_bapi_item-material   = ls_booking-idnrk.
        ls_bapi_item-plant      = p_werks.
        ls_bapi_item-stge_loc   = ls_booking-lgort.
        ls_bapi_item-entry_qnt  = ls_booking-dmeng.
        ls_bapi_item-entry_uom  = ls_booking-meins.
        ls_bapi_item-orderid    = ls_booking-aufnr.
        ls_bapi_item-mvt_ind    = gc_mvt_ind.
        IF ls_bapi_item-entry_qnt > 0.
          ls_bapi_item-move_type = '261'.
        ELSE.
          ls_bapi_item-move_type = '262'.
        ENDIF.
        APPEND ls_bapi_item TO lt_bapi_item.
        CLEAR: lt_bapi_ret, ls_bapi_item.
        CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
          EXPORTING
            goodsmvt_header  = ls_bapi_head
            goodsmvt_code    = '03'
            testrun          = p_test
          IMPORTING
            materialdocument = ls_mat_bel
          TABLES
            goodsmvt_item    = lt_bapi_item
            return           = lt_bapi_ret.

    Here send a example:
      DATA: RTR LIKE BAPIRET2.
      DATA: G_HEADER    LIKE BAPI2017_GM_HEAD_01,
            G_CODE      LIKE BAPI2017_GM_CODE,
            TESTRUN     LIKE BAPI2017_GM_GEN-TESTRUN,
            G_HEADRET   LIKE BAPI2017_GM_HEAD_RET,
            MATDOCUMENT TYPE BAPI2017_GM_HEAD_RET-MAT_DOC,
            MATYEAR     TYPE BAPI2017_GM_HEAD_RET-DOC_YEAR,
            G_ITEM      TYPE STANDARD TABLE OF BAPI2017_GM_ITEM_CREATE WITH HEADER LINE,
            RETURN      TYPE STANDARD TABLE OF BAPIRET2 WITH HEADER LINE.
    TOMO DATOS DE LA TABLA Z
      SELECT * FROM ZCOTT_ACT_VOLUM
               INTO CORRESPONDING FIELDS OF TABLE TI_VOLUMEN.
      CLEAR: RETURN. REFRESH: RETURN.
      CLEAR: WA_MJES.
      WA_MJES-ICONID = '@DH@'.
      WA_MJES-TYPE   = 'S'.
      WA_MJES-MSGTXT = 'Errores del Proceso Nro 2'.
      APPEND WA_MJES TO TI_MJES.
      LOOP AT TI_VOLUMEN INTO WA_VOL.
        CLEAR: G_HEADER, G_CODE, TESTRUN, G_HEADRET, MATDOCUMENT,
               MATYEAR, G_ITEM.
        REFRESH: G_ITEM.
        G_HEADER-PSTNG_DATE      = WA_VOL-BUDAT. " Fecha de contabilización en el documento
        G_HEADER-DOC_DATE      = WA_VOL-BLDAT. " Fecha de documento en documento
        G_HEADER-REF_DOC_NO      = 'REF NRO:'. " Número de documento de referencia
        G_HEADER-PR_UNAME      = SY-UNAME. " Nombre de usuario
        G_HEADER-HEADER_TXT      = WA_VOL-BKTXT. " Texto de cabecera de documento
        G_CODE  = '04'. " Traspaso
      Emisor
        G_ITEM-MATERIAL   = WA_VOL-DE_MATNR. " Nro de Material
        G_ITEM-PLANT      = WA_VOL-DE_WERKS. " Centro
        G_ITEM-STGE_LOC   = WA_VOL-DE_LGORT. " Almacen
        G_ITEM-MOVE_TYPE  = WA_VOL-BWART.    " Clase de Mov.
      G_ITEM-COSTCENTER = WA_VOL-KOSTL.    " Centro de Costo.
        G_ITEM-ENTRY_QNT      = WA_VOL-MENGE.    " Cantidad en unidad de medida de entrada
        G_ITEM-ENTRY_UOM      = WA_VOL-UNIT.     " Unidad de medida de entrada
        G_ITEM-ENTRY_UOM_ISO = WA_VOL-UNIT.  " Código ISO p.unidad de medida
        G_ITEM-BATCH         = WA_VOL-DE_LGORT. " Lote
      Receptor
        G_ITEM-MOVE_MAT   = WA_VOL-A_MATNR. " Nro de Material.
        G_ITEM-MOVE_PLANT = WA_VOL-A_WERKS. " Centro
        G_ITEM-MOVE_STLOC = WA_VOL-A_LGORT. " Almacen
        G_ITEM-MOVE_BATCH = WA_VOL-A_LGORT. " Lote
        APPEND G_ITEM.
        CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
          EXPORTING
            GOODSMVT_HEADER  = G_HEADER
            GOODSMVT_CODE    = G_CODE
            TESTRUN          = ' ' "TESTRUN
          IMPORTING
            GOODSMVT_HEADRET = G_HEADRET
            MATERIALDOCUMENT = MATDOCUMENT
            MATDOCUMENTYEAR  = MATYEAR
          TABLES
            GOODSMVT_ITEM    = G_ITEM
            RETURN           = RETURN.
        CLEAR: RTR.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            WAIT   = 'X'
          IMPORTING
            RETURN = RTR.
        LOOP AT RETURN.
          CLEAR: WA_MJES.
          WA_MJES-TYPE   = RETURN-TYPE.
          CASE WA_MJES-TYPE.
            WHEN 'S'.
              WA_MJES-ICONID = '@08@'.
            WHEN 'W'.
              WA_MJES-ICONID = '@09@'.
            WHEN 'E'.
              WA_MJES-ICONID = '@0A@'.
          ENDCASE.
          WA_MJES-MSGTXT = RETURN-MESSAGE.
          APPEND WA_MJES TO TI_MJES.
        ENDLOOP.
      ENDLOOP.

  • Posting Goods Issue problem?

    Hi SDN,
    I am using BAPI  BAPI_GOODSMVT_CREATE for posting of goods issue using movement type 261.
    I am getting following error = Goods movement not possible with mvmt type 261.
    But if i use movement type other than 261 it works.
    But unfortunately i have to use movement type 261.
    Please help
    Regards,
    Rahul Wagh

    Dear
    Pls follow the steps,
    Use tcode OB53, put X    and create on P& L account G/L and put it there. That is " Define retained earnings account".
    Your problem is solved. Enjoy.............!!!!!!
    Regs
    Rajakumar.k

  • Goods issue using bapi  BAPI_GOODSMVT_CREATE getting error E M7

    HI  consultants,
    While  posting goods issue using bapi BAPI_GOODSMVT_CREATE . Running the batch job(zprogram) to post the goods issue . The goods issue is been posted by passing  goods receipt data's.
    while processing 3 goods receipt , 2 works fine one goods receipt getting  E M 7 300 NO ITEMS ARE TRANSFERED error.
    when i  processing one by one all the 3 goods receipt is working fine and process sucessfully. While processing in bulk ,i am getting this issue.
    If anybody faces this same problem or knows the solution .Please post the answer.
    The way i am passing the parameter to bapi given bellow.
        WA_GOODSMVT_CODE-GM_CODE = C_03.
    *--populate header data
        WA_GOODSMVT_HEADER-DOC_DATE   = WA_MKPF-BLDAT.
        WA_GOODSMVT_HEADER-PSTNG_DATE = WA_MKPF-BUDAT.
    *--populate item data      
    *-- call the bapi for posting goods issue
                 IT_GOODSMVT_ITEM-NETWORK     = WA_RESBP-AUFNR.
                IT_GOODSMVT_ITEM-RESERV_NO   = WA_RESBP-RSNUM.
                IT_GOODSMVT_ITEM-RES_ITEM    = WA_RESBP-RSPOS.
                IT_GOODSMVT_ITEM-ACTIVITY    = WA_RESBP-VORNR.
                IT_GOODSMVT_ITEM-MOVE_TYPE   = C_281.
                IT_GOODSMVT_ITEM-ENTRY_QNT   = WA_RESBP-NET.
    *--get the item details
                  IT_GOODSMVT_ITEM-MATERIAL   = WA_MSEG-MATNR.
                  IT_GOODSMVT_ITEM-PLANT      = WA_MSEG-WERKS.
                  IT_GOODSMVT_ITEM-STGE_LOC   = WA_MSEG-LGORT.
                  IT_GOODSMVT_ITEM-ENTRY_UOM  = WA_MSEG-ERFME.
                  CALL FUNCTION 'CONVERSION_EXIT_ABPSP_OUTPUT'
                    EXPORTING
                      INPUT  = WA_MSEG-PS_PSP_PNR
                    IMPORTING
                      OUTPUT = WA_PSPHI_TEMP.
                  IT_GOODSMVT_ITEM-WBS_ELEM   = WA_PSPHI_TEMP.
                  APPEND IT_GOODSMVT_ITEM.  
                CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
                  EXPORTING
                    GOODSMVT_HEADER  = WA_GOODSMVT_HEADER
                    GOODSMVT_CODE    = WA_GOODSMVT_CODE
                  IMPORTING
                    MATERIALDOCUMENT = WA_MATERIALDOCUMENT
                  TABLES
                    GOODSMVT_ITEM    = IT_GOODSMVT_ITEM
                    RETURN           = IT_RETURN.
    With Regards,
    Ambrose Mohandoss.

    Problem solved.

  • Problem in creating a new entry in Goods Issue via DI

    Good Day Experts,
    Im having trouble creating Goods Issue Document Entry via DI API. The code works fine,
    it just returns "-1150 (Invelid Index)" after adding the GI Document. I would like to know
    if there's something i missed out?
    Below is my sample code for the creation of GI :
            Dim goodsIssue As SAPbobsCOM.Documents = Nothing
            Dim lRetCode As Long
            Try
                goodsIssue = _company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenExit)
                With goodsIssue
                    '// HEADER
                    .DocNum = GetDocEntry()
                    .Reference1 = _InventoryTransferLOBO.DocNumber
                    .HandWritten = SAPbobsCOM.BoYesNoEnum.tNO
                    .DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items
                    .DocDate = _InventoryTransferLOBO.CreatedDate
                    .DocDueDate = _InventoryTransferLOBO.CreatedDate
                    '// DETAILS
                    For x As Integer = 0 To _InvTransLOItems.Rows.Count - 1
                        .Lines.ItemCode = _InvTransLOItems.Rows(x).Item("U_ItemNo")
                        .Lines.ItemDescription = _InvTransLOItems.Rows(x).Item("U_ItemDesc") 'drITLOItems("U_ItemDesc")
                        .Lines.WarehouseCode = _InvTransLOItems.Rows(x).Item("U_FWhse") 'drITLOItems("U_FWhse")
                        .Lines.Quantity = _InvTransLOItems.Rows(x).Item("U_Qty") 'drITLOItems("U_Qty")
                        .Lines.AccountCode = GetAccountCode(_InvTransLOItems.Rows(x).Item("U_FWhse")) 'drITLOItems("U_FWhse"))
                        If x < _InvTransLOItems.Rows.Count - 1 Then .Lines.Add()
                    Next x
                    lRetCode = .Add()
                End With
                If Not lRetCode = 0 Then
                    _sboInventoryTransferLO.MessageBox("Error: " & lRetCode & ", " & _company.GetLastErrorDescription)
                End If
            Catch ex As Exception
            End Try
    Thanks in advenced
    Tyron James Gono

    Hi Sir Owen,
    Thank you so much for your reply, it still doesn't solved the problem. In my code below
    i repositioned the Line.Add Property and also added the "Lines.SetCurrentLine(Index)".
    It still returns the message "-1150 Invalid Index".
    Is it the row items im having a problem with? or the header itself?
                    For x As Integer = 0 To _InvTransLOItems.Rows.Count - 1
                        If x > 0 Then .Lines.Add()
                        .Lines.SetCurrentLine(x)
                        .Lines.ItemCode = _InvTransLOItems.Rows(x).Item("U_ItemNo")
                        .Lines.ItemDescription = _InvTransLOItems.Rows(x).Item("U_ItemDesc") 'drITLOItems("U_ItemDesc")
                        .Lines.WarehouseCode = _InvTransLOItems.Rows(x).Item("U_FWhse") 'drITLOItems("U_FWhse")
                        .Lines.Quantity = _InvTransLOItems.Rows(x).Item("U_Qty") 'drITLOItems("U_Qty")
                        .Lines.AccountCode = GetAccountCode(_InvTransLOItems.Rows(x).Item("U_FWhse")) 'drITLOItems("U_FWhse"))
                    Next x
                    lRetCode = .Add()
    Regards,
    Tyron

  • BAPI_GOODSMVT_CREATE goods issue for tmovement type  261 not updating costs

    GMHEAD-PSTNG_DATE =  SY-DATUM.
            GMHEAD-DOC_DATE   =  SY-DATUM.
            GMCODE-GM_CODE    =  '03'.   "03 - MB1A - Goods Issue
            GOODSMVT_ITEM-MOVE_TYPE   =   '261'.
            GOODSMVT_ITEM-ENTRY_QNT   =   '1'.
    I am using BAPI_GOODSMVT_CREATE for goods issue, instead of MB1A.
    it is updating the data correctly.
    The only issue i am having is that, it is not calculating the material costs.
    The actual costs for material cost from IW32 is $0.00
    I can see all the data updating correctly from MB02.
    Please let me know what might be the issue regarding costs.

    How did you solve it?

  • Goods Issue using BAPI_GOODSMVT_CREATE movement type 541

    Hi
        According to my requirement I need to do Post goods issue using BAPI_GOODSMVT_CREATE. But I am unable to do PGI . how to consume BOM details if batches are changed. please let me know what values I need to pass to BAPI . give with an example.
    Its an urgent requirement.

    are you passing batch number to the BAPI?
    if not try pass the batch number the rest of the things bapi will take care of.
    bi

  • Goods Receipt and Goods Issue - Posting Date and Document Date Problem

    Hi All,
    I was using SDK to build own add on to insert Posting Date and Document Date under Inventory> Inventory Transactions> Goods Receipt and  Inventory> Inventory Transactions> Goods Issue, but the UI Screen Posting Date and Document Date shown current date.
    My SAP Business One version was 2007A SP00 PL42 and alreadly upgrade to SP05.
    End up result still the same.
    Is there someone can help me?
    Thanks you.
    Best Regards,
    danny

    Hi there,
    I already solve it by myself.
    Actually is i call the initialization twice:
    Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenEntry)
    Thats what make this problem happened.
    Sorry.
    Best Regards,
    danny

  • Special stock partner data problem in ERP system during "Post Goods issue"

    Hi all,
    I have a (probably) customizing issue in an ERP 6.0 EhP4 test system which not occurs in the ERP 6.0 test system. There is a difference but no one could tell me, what causes the problem in this scenario:
    I have two customers, C1 and C2. C2 is the special stock partner (SB) of C1.
    I've created a Consignment Fill-up order, then a delivery document based on the order and posted it with "Post Goods Issue". During the update process, a function module (SD_PARTNER_UPDATE) receives partner data in an internal table which contains the sold-to, ship-to and special partner data.
    When we tried the same process in the ERP 6.0 EhP4 test system then special-partner data did not occur in the parameter table (I've used the same customers and materials). The special stock partner is probably not taken into consideration due to some customizing settings.
    My question is what should I change in the customization to run the process the same way as in the ERP 6.0 system? As far as I know there are no new modifications which have effect on this area, and the used test customers and materials are almost the same - there are no noticable differences.
    Thanks in advance.
    Akos

    I tried setting that field in the sale order this morning.  By defaulting it to "C"; I was able to get warning message for TAE line.  I was able to post goods with TAE and TAQ, being different quantities.  I need the check to determine if TAE and TAQ delivery quantity are different.  Using this fields seems to be line specific.  Thanks for the suggestion.  I now know what that field does to the delivery.
    I rewarded points.
    Thanks,
    Tony

  • Post Goods issue using bapi_goodsmvt_create

    hi,
    Iam trying to do post goods issue using bapi_goodsmvt_create. please let me know what are the mandatory fields to be passed?

    hi,
    *& Report  ZRPT_SUB_KO01GOODSMOVEMENT
    REPORT  ZRPT_SUB_KO01GOODSMOVEMENT.
    PARAMETERS : P_BAG(17)  TYPE C,
                 P_ZZORG LIKE zaUFK-ZZORG,
                 P_MATNR LIKE MARA-MATNR,
                 P_WERKS LIKE AUFK-WERKS,
                 P_WERK LIKE AFPO-PWERK,
                 P_DATE LIKE MKPF-BUDAT,
                 P_LGORT LIKE GOITEM-LGOBE.
    DATA : BDC_DATA TYPE STANDARD TABLE OF BDCDATA. "internla table for bdc data
      DATA : WA_BDC_DATA TYPE BDCDATA .                "work area for bdc data
      DATA : T_XMSEG TYPE   MSEG.
      DATA : T_XMKPF TYPE MKPF.
      DATA : V_BAGS1(17) TYPE C.
    DATA : BEGIN OF WA_MB1B,
           ZZGCODE TYPE ZMIGO-ZZGCODE,
           ZZGBAGS TYPE ZMIGO-ZZGBAGS,
           WERKS TYPE AUFK-WERKS,
           LGORT TYPE VBRP-LGORT,
           ZZORG TYPE zAUFK-ZZORG,
           END OF WA_MB1B.
    DATA : V_MATERIAL TYPE BAPI2017_GM_HEAD_RET-MAT_DOC.
    data : v_date(10) type c.
    DATA : T_GOODSMVT_HEADER TYPE BAPI2017_GM_HEAD_01,
           T_GOODSMVT_CODE TYPE BAPI2017_GM_CODE,
           T_GOODSMVT_ITEM TYPE STANDARD TABLE OF BAPI2017_GM_ITEM_CREATE,
           T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
    DATA : WA_GOODSMVT_ITEM TYPE BAPI2017_GM_ITEM_CREATE.
    DATA : BEGIN OF S_MARA,
           MEINS LIKE MARA-MEINS,
           END OF S_MARA.
    DATA : MATERIALDOCUMENT TYPE BAPI2017_GM_HEAD_RET-MAT_DOC.
    *FORM GOODSMOVEMENT TABLES T_RETURN
                             USING WA_MB1B LIKE WA_MB1B.
    SELECT SINGLE  MEINS
                   FROM MARA
                   INTO S_MARA
                   WHERE MATNR = P_MATNR.
       CONCATENATE p_date6(2) p_date4(2) p_date+0(4) INTO V_DATE SEPARATED BY '.'.
        T_GOODSMVT_HEADER-PSTNG_DATE = P_DATE.
        T_GOODSMVT_HEADER-DOC_DATE = P_DATE.
        T_GOODSMVT_CODE-GM_CODE = '04'.
        WA_GOODSMVT_ITEM-MATERIAL =      P_MATNR.                    "'000000000000001556'.
        WA_GOODSMVT_ITEM-PLANT  =        P_WERK.                     " '1000'.
        WA_GOODSMVT_ITEM-STGE_LOC =      P_LGORT.                    " '0001'.
        WA_GOODSMVT_ITEM-MOVE_TYPE =     'Z42'.
        WA_GOODSMVT_ITEM-VENDOR =         P_ZZORG.                   "'0000100224'.
        WA_GOODSMVT_ITEM-ENTRY_QNT =      P_BAG.                   " '1'.
        WA_GOODSMVT_ITEM-ENTRY_UOM =     S_MARA-MEINS.
        WA_GOODSMVT_ITEM-ENTRY_UOM_ISO = S_MARA-MEINS.
        WA_GOODSMVT_ITEM-MOVE_PLANT = P_WERKS.
        APPEND WA_GOODSMVT_ITEM TO T_GOODSMVT_ITEM.
    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
    EXPORTING
          GOODSMVT_HEADER          = T_GOODSMVT_HEADER
          GOODSMVT_CODE            = T_GOODSMVT_CODE
    IMPORTING
        MATERIALDOCUMENT           = V_MATERIAL
    TABLES
          GOODSMVT_ITEM            = T_GOODSMVT_ITEM
    RETURN                        = T_RETURN.
    BREAK shailajaa.
               EXPORT t_return  to MEMORY ID '123'.
               EXPORT V_MATERIAL TO MEMORY ID 'MAT'.
                CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
         EXPORTING
           WAIT          = ' '.
    *ENDFORM.

  • Deficit of Stck w.vend.unr.prev : Goods issue using BAPI_GOODSMVT_CREATE' subcontracting PO

    Hi Experts,
    I am facing one issue while doing Goods Issue for sub contracting PO . In my case, inbound idoc will trigger the BAPI 'BAPI_GOODSMVT_CREATE' with movement code '07'  and movement type as 543.
    But it throws the error Deficit of Stck w.vend.unr.prev 438.793 THD : U329557 0113 VARIOUS O. U329557 is the child material of finished material 0003121XAZ. When i checked in MMBE, for the given material/storageloc/batch it has sufficient quantity.
    I debugged the whole scenerio and found that from one table T156F in FM 'MB_MODIFY_STOCK_ENQUEUE_ENTRY', the value <m> is ASSIGNED from (t156f-felds) with value 1126.190. Later it subtract the value, provided in structure GOODS_ITEMS of BAPI BAPI_GOODSMVT_CREATE with quantity 1564.983 which is to be Goods issued from vendor. 
    1564.983 - 1126.190 = 438.793 .
    Please help me why i am getting this Deficit error even when quantity is present for child material.
    Thanks
    Shahab

    Hi Experts,
    Please help me in this issue.

  • Goods issue problem

    sir,
    we have prepare the p.o. regarding purchase of tea/coffe powder
    at the time of receipt migo following entry passed in a/c doc
    Inv-consumable  DR xxx
        To gr/ir                                xxx
    at the time of miro
    gr/ir a/c           Dr   xxxx
          To party a/c          xxx
    problem at the time of goods issue
    stores consumable (mp) a/c dr xxxx
    To inv-consumables                                  xxxx
    actaully we want to above exp go to tea Exp g/l instead of stores consumable (mp) a/c  .
    any care taken at the time of goods issue??

    Hi
    Please try the following
    1) Create a Material group for your requirement ( Log gen>Basic setting>Key fields for MMR>Mat grp)
    2) Create a valuation class(MM>Valuation>Account deter>Valuation cls)
    3) Assign the valuation class to the material group(MM>Purchasing>MMR>Entry aids w/o MMR)
    4) In OBYC>GBB maintain VBR/valuation class/GL account
    5) Use the material group in the material if u use material master or else in PO.(MM02 or ME21n)
    Hope it helps.
    Thanks/Karthik

  • Problem in goods issue

    Hi i have done following steps that lead me to a problem
    1. MIGO of a material done with posting date of march
    2. I have issued that material using mvt 281 Q to reservation with posting date in april
    Now, since i have done above step-2 by mistake, because i wanted to issue the material in march, i have done following two steps.
    3. I have cancelled the material issue document created by step 2 (Using MBST) above with posting date in march
    4. I have issued the material using 281 Q agaist a reservation in march
    Now the problem starts...System is showing the same material stock in March, which i dont want.
    System is also not allowing me to issue the mateial in march as already i have issued once agaist the reservation (Step 4)
    What should i do to remove that material from stock in march??
    Regards
    Kalpesh

    Hi,
    1) Have you cancelled the goods issue document on april date ??
    2) Once you cancel the goods issue document, again post the goods issue document on march's date..
    Regards,
    Prasath

  • Problem in cancelling a goods issue with WS_REVERSE_GOODS_ISSUE

    Hi all,
    I use the function module WS_REVERSE_GOODS_ISSUE in order to cancel a goods issue but most of the times it does not function as expected.
    I call the function module as follows:
      CALL FUNCTION 'WS_REVERSE_GOODS_ISSUE'
        EXPORTING
          i_vbeln                   = w_delivery_doc
          i_budat                   = w_date
          i_tcode                   = 'VL09'
          i_vbtyp                   = 'J'
        TABLES
          t_mesg                    = it_mesg
        EXCEPTIONS
          error_reverse_goods_issue = 1
          error_message             = 2
          OTHERS                    = 3.
    I traced the execution of the function module and found out that, although the field LIKP-VBELN contains the delivery document sent to the function module, when the statement PERFORM BELEG_LESEN(SAPMV50A) is executed the field LIKP-VBELN loses its contents (gets cleared).
    Does anyone know why the function module does not work properly?
    Am I missing something?
    Thanks in advance,
    GB

    hi george,
    why don't u use the function module 'BAPI_GOODSMVT_CREATE'
    ds_code-gm_code = '06'.
    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
          EXPORTING
               goodsmvt_header  = ds_header
               goodsmvt_code    = ds_code
          IMPORTING
               materialdocument = dg_matdoc
               matdocumentyear  = dl_year
          TABLES
               goodsmvt_item    = dt_item
               return           = dt_return.
    pls reward the points it it serves ur purpose
    thanks
    mahesh

Maybe you are looking for

  • Connecting a CSS doc to an XML file, in a dynamic text field in Flash

    Hi all, I am trying to connect a CSS file such that it applies it self to the content of an XML file, viewed inside a dynamic text field. So far I have managed to gather the code that "calls" the contents of the XML file and also the code that calls

  • Import Previews and Collections Only

    GOAL: to export the Previews and Collections info ONLY on an old Lightroom catalog/computer and apply that info to same photos on a new Lightroom catalog/computer. I'm moving my Lightroom Catalog from one computer that utilized multiple external driv

  • Difference in event handling between Java and Java API

    could anyone list the differences between Java and java-API in event handling?? thanks, cheers, Hiru

  • Problems with the graphic card driver after update?

    First my brand new Macbooks main board had to be replaced since I couln`t charge the battery. After 3 weeks on service it`s back. Everything is fine until I update the drivers. After the restart the screen displays totaly wrong colors. Take a look be

  • Saving query results as excel

    hi, Is there a way to save the query results as excel programatically (some kind of utility which does the job)? we are using oracle 10g. This will be a nightly job.. so that every other day morning we have the huge excel report ready for viewing. An