BAPI_GOODSMVT_CREATE for production order,not update database

hi guru,
i am using BAPI_GOODSMVT_CREATE for production order.When i m testing this BAPI
at se37 it creates one mat doc no and i m not getting any return messages.Now i m
writing code for it at se38. but it does not update the database even though i used
bapi_transaction_commit. here sy-subrc = 0.bt when i m checking MSEG table showing
that mat doc no does not exists.
please help me out  asap.
thanks and regurds,
manasi

CHECK THIS CODE
REPORT ZBAPI_GOODSMVT_CREATE.
*DECLARING INTERNAL TABLE TO HOLD FILE DATA.
DATA: BEGIN OF itab OCCURS 0,
          text(200),
      END OF itab.
*DECLARING INTERNAL TABLE TO PASS FILE DATA.
TYPES: BEGIN OF tw_goodsmvt,
            pstng_date TYPE budat,
            doc_date TYPE bldat,
            material TYPE matnr,
            plant TYPE werks_d,
            stge_loc TYPE lgort_d,
            move_type TYPE bwart,
*            entry_qnt TYPE erfmg,
            costcenter TYPE kostl,
        END OF tw_goodsmvt,
        tt_goodsmvt TYPE STANDARD TABLE OF tw_goodsmvt.
DATA: lt_goodsmvt TYPE tt_goodsmvt,
      lw_goodsmvt TYPE tw_goodsmvt.
*declaring internal table of bapi structure.
DATA:s_goodsmvt_header LIKE  bapi2017_gm_head_01,
     lt_goodsmvt_item TYPE STANDARD TABLE OF bapi2017_gm_item_create WITH HEADER LINE,
     lt_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
DATA:str_filename TYPE string,
     gm_code TYPE gm_code,
      v_head_count TYPE i VALUE 0,
      v_prev_count TYPE i VALUE 1,
      v_qnt TYPE string,
      v_dummy.
*selection screen
SELECTION-SCREEN BEGIN OF BLOCK bk with frame title text_001.
PARAMETERS:p_docdat TYPE bldat,
           p_pstdat TYPE budat,
           fname LIKE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK bk.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR fname.
*to provide F4 functionality.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      program_name = syst-cprog
    IMPORTING
      file_name    = fname.
* start of selection
START-OF-SELECTION.
  str_filename = fname.
  gm_code = '06'.
* to upload data
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename            = str_filename
      filetype            = 'ASC'
      has_field_separator = 'X'
      read_by_line        = 'X'
    TABLES
      data_tab            = itab.
*SPLITING DATA TO INTERNAL TABLES.
  LOOP AT itab.
    IF itab+0(1) EQ 'H'.
      v_head_count =  v_head_count + 1.
      IF v_head_count GT v_prev_count.
        PERFORM bapi_upload.
      ENDIF.
      SPLIT itab-text AT ',' INTO v_dummy
                                  lw_goodsmvt-pstng_date
                                  lw_goodsmvt-doc_date.
      s_goodsmvt_header-doc_date   = lw_goodsmvt-doc_date.
      s_goodsmvt_header-pstng_date = lw_goodsmvt-pstng_date.
      v_prev_count = v_head_count.
  ELSEIF itab+0(1) EQ 'L'.
    SPLIT itab-text AT ',' INTO v_dummy
                                lw_goodsmvt-material
                                lw_goodsmvt-plant
                                lw_goodsmvt-stge_loc
                                lw_goodsmvt-move_type
                                v_qnt
                                lw_goodsmvt-costcenter.
* PASSING DATA TO INTERNAL TABLE TYPE BAPI STRUCTURE.
    lt_goodsmvt_item-material = lw_goodsmvt-material.
    lt_goodsmvt_item-plant    = lw_goodsmvt-plant.
    lt_goodsmvt_item-stge_loc = lw_goodsmvt-stge_loc.
    lt_goodsmvt_item-move_type = lw_goodsmvt-move_type.
    lt_goodsmvt_item-entry_qnt = v_qnt.
    lt_goodsmvt_item-costcenter = lw_goodsmvt-costcenter.
    APPEND lt_goodsmvt_item.
  ENDIF.
  v_prev_count = v_head_count.
  ENDLOOP.
  PERFORM bapi_upload.
*&      Form  bapi_upload
form bapi_upload .
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
  EXPORTING
    goodsmvt_header             = s_goodsmvt_header
    goodsmvt_code               = gm_code
*   TESTRUN                     = ' '
* IMPORTING
*   GOODSMVT_HEADRET            =
*   MATERIALDOCUMENT            =
*   MATDOCUMENTYEAR             =
  tables
    goodsmvt_item               = lt_goodsmvt_item
*   GOODSMVT_SERIALNUMBER       =
    return                      = lt_return.
        PERFORM commit_work TABLES lt_return.
        CLEAR : lw_goodsmvt, s_goodsmvt_header.
        REFRESH: lt_goodsmvt[], lt_goodsmvt_item[].
endform.                    " bapi_upload
*&      Form  commit_work
*       text
*      -->P_LT_RETURN  text
form commit_work  tables   p_lt_return structure bapiret2.
  IF NOT lt_return[] IS INITIAL.
*error handling
loop at lt_return.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
   ID              = lt_return-id
   LANG            = sy-langu
   NO              = lt_return-NUMBER
   V1              = lt_return-message_v1
   V2              = lt_return-message_v2
   V3              = lt_return-message_v3
   V4              = lt_return-message_v4
IMPORTING
   MSG             = lt_return-MESSAGE
EXCEPTIONS
   NOT_FOUND       = 1
   OTHERS          = 2.
WRITE: lt_return-id, lt_return-message, lt_return-message_v1, lt_return-message_v2,
             lt_return-message_v3, lt_return-message_v4.
      CLEAR lt_return.
    ENDLOOP.
  ELSE.
* commit work
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*   EXPORTING
*     WAIT          =
   IMPORTING
     RETURN        = lt_return.
WRITE: lt_return-id, lt_return-message, lt_return-message_v1, lt_return-message_v2,
             lt_return-message_v3, lt_return-message_v4.
      CLEAR lt_return.
endif.
endform.                    " commit_work

Similar Messages

  • GR for Production Order, not updating Stock

    Hi All,
    Issue:
    I am posting a GR for a production order, but the stock qty is not getting updated. I checked in MB51, i find the document being posted, but in MMBE the stock is not updated. In the system, there is 2 settlement profiles, one which allows settlement on material & the other only on G/L or Cost Center. I find this issue only when i create orders which have settlement receivers as G/L or Cost Center, also in MB51 i find that the sloc field is blank, even though it is maintained in the order & the same is seen when i receive via MB31.
    Await your inputs as to where i need to check to resolve this issue.
    Regards,
    Vivek

    Hi Prasobh,
    I believe your pointing in the right direction. My suspicion is on similar lines.
    A brief backdrop:
    Order is created, whose settlement is to be done on a G/L acct, the settlement profile does not allow settlement onto material & hence in the GR tab, the GR non-valuated indicator is ticked. I manually ticked the GR indicator to post GR via MB31.
    In MB51 i find the material document, but what is interesting is, the storage location field is blank, even though the order contains this value, which was later seen during MB31 posting as well.
    But a similar order has been created in the legacy system with the same parameters as above & i find the stock to be updated.
    So i suspect, it is something to do with the account determination, which is not allowing the quantity updation to take place, because of the GR non-valuated tick in the order header.
    Hope i was able to put across the issue to you in a clear way.
    Regards,
    Vivek

  • Production orders not updated in Live Cache

    Hi All,
    We are currently facing a strange issue. Planned orders created in APO are converted into Production orders in R/3. When they are CIFfed to APO, those prodcution orders are captured in Product view but are not updated in either /SAPAPO/OM16 or Production list (/SAPAPO/PPL1). In these two transactions the production orders are not visible but their respective planned orders are showing up.
    When delta report is executed for Production orders with "Consider Requirements/Receipts" as sub-object, these orders are captured with Error code 501 (Requirement/Receipt for the order exists only in R/3). When pushed to APO, these orders are updated in the Live Cache.
    Can anyone share your thoughts on what could be the root cause for this issue.
    Appreciate your thoughts
    Thanks,
    Sai

    Thanks Vikas and Senthil,
    Its not the issue with all the Production orders. The issue is with only few orders and we are in the process of tracing out the pattern.
    Our Primary concern is that the orders captured in the delta report are visible in Product view even without taking any action in CCR but are missing in OM16. Its only after taking the action those orders are visible in OM16.  I believe the data in the product view is read from Live Cache and the Live Cache contents are displayed in OM16. So, whatever orders visible in Product view have to be displayed in OM16 which is not happening.
    Please let me know if I am missing anything.
    Thanks,
    Sai

  • GR  for  Production order not possible with  settlement receiver as IO

    Hi
    I   have  created a  production order  and  the settlement rule is  to  an internal order.  But  it  does not  allow me to do  goods receipt.    Pl  tell me  what to do.
    Thanks
    kamala

    Hi,
    SAP recommands production order settlment to be beow object and additional CO Object COPA.
    Settlement Receivers Depending on the Scenario
    1.Make-to-stock production >>The make-to-stock inventory (receiver = material) >> COPA
    2.Sales-order-related production with a valuated sales order stock>>The valuated sales order stock (receiver = material)>>COPA
    3. Sales-order-related production with a nonvaluated sales order stock>>The sales order item (receiver = sales order)>>COPA
    The scenario you are trying is doesn't fit into standard SAP framework for production order so please try said scenario with CO production order. Again CO production orders mostly recommondable without PP so figure out impact on cross modules.
    Regards,Ashok.

  • Template allocation enviornment 12 for production order not working

    Dear experts,
    i have more than 6 activity type in routing and the base will be machin hour qty means all my activity Fiance, HR,IT and quality ase will be machin hr qty defined in routing and rate will be different in kp26 for hr,IT<QC and finance.
    so i am planning for templete allocation and i m using production order.
    In templete allocation there are different enviornment for plan and actual for production order.
    For planning i have created environment 0
    Based on cost center and activity tpe ( all my activity-HR,IT,QC,Finance and one common cost center)-seperate line for each activity and plan qty is machin.I wrote the logic and same is working also.
    but for actaual .i have chosen enviornment 12 becoz i m using production order and logic will be actual machin hour qty.
    request you to guide me on actual environment based on machin hour actual qty
    regards
    RR

    dear friend,
    for the first issue please run OPU3 for your plant/prod.order type and
    set MORE days in 'Start in the Past' field
    or
    go back to your prod.order (run CO02 ) and REDUCE days in past
    for the second issue please run CR02 and fix the time (Scheduling tab)
    good luck!

  • Scheduled finish date for process orders not updating in BW

    We are having problems with the scheduled finish date (GLTRS) for process orders. When the process order is already released, changes done in R/3 on the scheduled finish date will not result to a delta hence data in BW is not updated. Table AFKO, where data is coming from, is always updated with the changes though. 2LIS_04_P_MATNR is used in extracting the data.
    Has anyone experienced the same problem? We are looking for possible ways on how to have a delta whenever there are changes on the process order even after it is already released.
    Any help would be greatly appreciated...

    Hi Donna,
    If I've understood your problem correctly, you can increase the load frequency as Sriee has pointed out.
    If you want latest data frequently and if you are on BI 7.0 then you can look at Real Time Data Acquisition(RDA)
    Regards,
    Tom.

  • ATP for production order

    Hi Friends,
    Need your help to figure out solution for an issue :
    I need ability to substitute alternate component when we do ATP during release of a production order.
    As far as I know, we can do this in 2 ways
    1) Maintain alternate BOM with the substitute material
    2) Use GATP production substitution procedures
    Can you think of any other ways of doing this. I do not want to use GATP (within APO) and want to get this done in ECC itself.
    Please suggest!!!

    Thanks for the reply Suri.
    I dont think I can use this as there will be multiple alternates for a product.
    Did anybody use GATP for production orders, not CTP or MLATP but vanilla ATP and RBA. Please let me know what precautions should be taken and are there any considerations for using the functionality. I have used GATP for sales orders earlier but never for production orders, I assume functionality should be same except for the business even which would be PP.
    Thanks and waiting for replies.
    Prod_Planner

  • UE for production order

    Dear gurus,
    when i create whit the transaction CO01 a production order i need of the information in the table MARM for read the Width upgraded,  but in this moment i don't have the number of production order.
    Is possible whit the UE find this information ?
    Are there the UE standad ?
    How i can knowledge the number of the production order after the save of the creation in the transaction CO01?
    Thanks a lot
    Daniele Pistilli
    PP Team

    Dear,
    Please refer this thread,
    user exit for production order creation - update BOM explosion date.
    Regards,
    R.Brahmankar

  • Report to check open reservations for production orders where GI not posted

    Hi experts,
    Can we get reservation details from any report/ table for production order where material has not been issued, report should also display the value of the reserved material.
    I could not find desired details in RESB (it has price but not value) and MB25.
    Thanks in advance, useful ansers will be rewarded.
    Thnx
    Anand

    Hello Anand,
    there is no report but you may use the production order info system with list "components" and create a layout contaning the issued quantity and/or the final issue indicator. With a correct sorting, the list should show all orders with non-issued components at the top.
    Regards, Andreas

  • How to restrict the GR for Production Order when Goods Issue is not done

    Hi Gurus
    How to restrict the GR for Production Order when all the required components for production order are not issued with all required quantity. Even for partial issue system should not allow GR with 101. The user status with RMWA, RMWF & CGFB is not working.
    Pls suggest best solution.
    Abhijit.

    Hi,
    You can club together the GI nad GR at the time of confirmation..
    I.e Backflush for the components and auto GR for the Product.
    So that you can stream line the Process.
    The best Option would be to use the User Exit:
    Enhancement - MBCF0002
    Functional Module - EXIT_SAPMM07M_001
    Include - ZXMBCU02
    Refer below link for further details..
    How to stop the goods receipt before issueing the goods for production orde
    Regards,
    Siva

  • Scheduling parameters are not defined for production orders

    Hi All,
             when i convert the planned order to production order  i got this massage popup coming  Scheduling parameters are not defined for production orders . please let me know this .

    Hi,
    One of major customization steps for the order type is missing. Run OPU3 and maintain settings for the order type you are using. You may copy settings from an older type.
    Regards.

  • Transfer Order not created while performing GR for Production order

    Hi, I am facing a problem while recieving stock from a production order. The system does not create a transfer requirement or a TO.
    Let me give you a brief background.
    This is a new functionality introduced in ECC 6.0 for working with kanban in WM.
    Supply area is created for WM location.
    Control cycle is created for material, supply area. Warehouse, storage type and Bin is maintained in control cycle record. When the GR is done for production order material is recieved in this bin.
    1) Now when the Kanban is set empty a production order is automatically created.
    2) Once the production order is confirmed the material automatically shows up in the bin.
    A material document is created which shows IM movement type 101 and WM movement type 103. Also in material document Immediate auto TO checkmark is blank.
    3) *PROBLEM* - System does not create a TR or a TO. the material automatically shows up in the Bin. How can we enable an auto TR and TO creation.
    Following are the settings which I have already checked:
    1) In IMG, WM movement type 103 has auto TO indicator set.
    2) IM-WM interface for 102 movement type and 103 movement type is maintained.
    The main problem is: Although the material document displays WM movement type 103 and the stock lies in WM bin, System never created a Transfer requirement or a Transfer order.
    I would really appreciate if anyone can help me in this.
    Thanks

    Hi Mike,
    I do not know this function in SAP, so these are just my ideas:
    1.
    System does not create a TR or a TO. the material automatically shows up in the Bin.
    I think it's a normal SAP behaviour. If you do GR against a PO the quant(s) will appear in interim storage bin w/o TO. The TO is to move the quants from one bin to another, but in this case the quant comes from 'nothing' and arrives at the bin.
    If you make confirmation and consume the components refering to a PrdOrd, the components will disappear w/o TO from storage type 100 + dynamic bin, because there's no TO that could move them from dynamic bin to 'nothing'.
    So, these 'movements' are to change the WM stock level and TOs are not designed for this.
    2.
    There's difference between auto creation of TO and immediate TO creation. Please check what SAP help says in case of TOs for outbound deliveries:
    http://help.sap.com/saphelp_47x200/helpdata/en/c6/f8406c4afa11d182b90000e829fbfe/frameset.htm
    3.
    Now when the Kanban is set empty a production order is automatically created.
    So, if you remove the stock from the Kanban it triggers the creation of a PrdOrd. This is very logical in a Kanban system because it is a pull system. but your problem is not this, it's clear.
    If you just created an automatic TO and would remove the stock from Kanban-bin, a new PrdOrd would be generated, and so on. As many times you remove the stock a new PrdOrd is created and this might be the reason why no TO is crated automatically. In this case this would be a push system and not kanban system.
    I do not know this process but if we concentrate only on the pull system, maybe this Kanaban is to store the FG until an event (e.g. shipment) should trigger the stock removal from this bin. (just my assumption)
    Please try to mark the TR creation for the movement type w/o auto / immediate TO and tell us the result (whether you get the TR if you confirm the PrdOrd).
    Regards,
    Csaba

  • Function module for Production order update (Table AFKO)

    Hello All,
    I know similar subject has been posted but please read the following.
    SAP 4.6c doesn't provide BAPI for production order update.
    We did develop an ABAP program that update production order and schedule it in a job.
    We are looking of avoiding direct update in table AFKO which our program do right now.
    We looked (with SE37) at either BAPI or FM to pass parameters to a functioin that would perform that update and ensure data integrity.
    CO_ZV_ORDER_POST seems interesting but is also using a lot of parameters and we have diffiulties to test it and understand it our dev team being fairly new.
    Can somebody tell us how to use this function or tell us another FM that could be used. (ie passing internal table content (New fields values) and a key value (AUFNR)) to update table AFKO and related objects/tables
    Regards
    Marc

    hi,
    TABLE IS AFKO
    rgds
    anver
    if hlped mark points

  • Production scheduling profile for production order type 10 does not exist – SAP Message No.10085

    When i tried to make confirmation for Production Order through CO15 transaction , i receive the following error message “ Production scheduling profile for production order type 10 does not exist – SAP Message No.10085 “
    In Work Scheduling view, Production Scheduling Profile is maintained as per OPKP only.
    How to check whether production scheduling profile is maintained for relevant order type 10.
    To do this , i went to OPKP & KOT2_OPA transactions but i don’t know how to check. I guide me through with a screen shot.
    Also, pls explain about  “Order Type 10” and how it is linked with material and order execution.
    Looking for a detailed explanation with screen shots , since i am new to SAP.
    Thanks With Regards,
    Dinesh Kumar V.

    Hello Dinesh,
    Please check the order type dependent parameter in OPL8 here you will get the Substitute Scheduler
    Then go to OPCH and check valid production scheduling profile assign here as per OPKP to your production scheduler for your plant.
    Production order have Order category as 10  Process Order  40 in standard SAP you can check this in OPJH.
    Best Regards,
    R.Brahmankar

  • Production scheduling profile for production order type 10 does not exist

    Kindly suggest me how to resolve this error
    Production scheduling profile for production order type 10 does not exist

    Hi Archana,
    Go to material master-work scheduling view and check what is the production scheduling profile maintained for the same materisl -plant combination.
    then go to OPKP and check if production scheduliong profile is maintained for relevent order type 10 in custmizing. If not maintain one and it should resolve the error.

Maybe you are looking for

  • How do I check a wifi network on my iphone 4S ?

    I was in a Dennys restaurant that boasts a free WI-FI network, but couldnt logon to it.  The iPhone saw the net but would not join it.  No-one else could get onto the network either.  This has happened in other locations too.  My home network is via

  • Limiting or control for Residual payment with reason codes

    Hi FI Gurus, When we are received or making payment to customer or vendor, sometimes we need to clear the invoice by receiving or making payments with small differences through residual payment. Is there any control for limiting residual payment. Let

  • When I watch any videos the pixels of the video go random colours

    when ever I watch videos or even go on facetime the screen goes blurry and random colours but only where the video is not the whole screen

  • Indesign CC crashing

    I've installed Indesign CC. It launched then shutdown with a message that there is a serious problem and it's shutting down.  I had a previous version of Indesign and it started doing the same thing.  I uninstalled it.  Then started again with the cl

  • IOS Updates Consistently Fail

    I have a 2-year-old iPOD Touch.  Every time a new iOS version is released, I select "download and upgrade". But after the download, an error message is displayed (error 3034).  At that point, I have to go through a complete restore cycle. This happen