How create a new production order by C++ code?

Hi everybady
I'm trying to create new production orders using a VC++ 6.0,
but as i can't put a new DocumentNumber "It's Read only",
i can't add a new orders. show me sample code  plz....
help me....
Thanks

Hello
Docnum will be avaiable when you issed the Production order.
The method on each langugage is the same so hereby i am posting a VB.NET Code,and you can convert it.
The mandartory fields:
ItemCode - you would like to produce
Qty - how many you would like to producce
After you issued the Production order, you must change the Status from planned to Released
of course, you can add more properties.....
Dim oPO As SAPbobsCOM.ProductionOrders = oCompany.GetBusinessObject(BoObjectTypes.oProductionOrders)
        oPO.ItemNo = "ITEMCODE"
        oPO.PlannedQuantity = "QTY TO BE CREATED"
        oPO.PostingDate = Today.Date
        oPO.ProductionOrderType = BoProductionOrderTypeEnum.bopotStandard
        If oPO.Add <> 0 Then
            Dim POENTRY As String = oCompany.GetNewObjectKey()
            If oPO.GetByKey(CInt(POENTRY)) Then
                oPO.ProductionOrderStatus = BoProductionOrderStatusEnum.boposReleased
                ' Here you have a docnum like OPO.DocNum '
                If oPO.Update() <> 0 Then
                    sbo_application.MessageBox(oCompany.GetLastErrorDescription)
                    Exit Sub
                End If
            End If
        End If
Regards
János

Similar Messages

  • Strategy 82----How to stop creation of New Production Order

    Hi All,
    My client is facing problem with the material which having Strategy 82- Assembly to Order,  As when they make a sales order  , w,.r.t that a Production order is made automatically by system,. User complete the production process and deliver this material , now when ever the Sales user change "Credit Block: in that particular sales order again a New production order created to this sales order, How to control his creation of new Production order? As if new production Order create it brakes the link between Sales order and the previous Production order which is already in delivered status.
    Your Prompt response will be appreciated.

    HI ,
    I am closing this thread , as I know how to got a control on trhis, As of behaviour, startegy 82 says every time u change in sales order it will create a new Production order during saving, if the previous order is not been in ONLY REL status.   So the only option to control this is in S.O ,change the Item category to "CN" i.e NO MRP when if required there has been any modification to S .O.  In std SAP system item catageory has to be congiured , in SPRO SALES we can do the necessary settings.

  • Every time system create new production order after releasing sales order c

    Hi Guru,
    FG material strategy: 82 (sales order creates production order).
    After creating the sales order it goes in to credit block. Whenever we release sales order from credit block through VKM1, system has created production order. We confirmed this production order and delivered.
    But after this sales person change the sales order value, because of which again sales order goes into the credit block and after releasing sales order from credit block system create new production order even if one production order already confirmed and delivered against the same sales order.
    *Every time system create new production order after releasing sales order credit block.
    Thanx & regards
    pnu

    PNU,
    So, to restate:
    In MD04, you have Unrestricted Sales order Stock ('E' Stock) on hand.
    In the same MRP segment, and against the same Storage Location as the stock, you have a Sales Order requirement that was recently blocked and unblocked.
    During the unblocking event, the system produced a new production order.
    This is not normal.  If the above accurately depicts your situation, I would look for an altered Strategy 82, or a userexit.  SAP ATP (the beginning event of the Strat 82 process) will normally first check for the availability of stock.  Only if the stock is not available, then it will create the new production order.
    Best Regards,
    DB49

  • Error Message for new production order type

    I have created a new production order type and gone through all the configuration requirements that I'm aware of.  In testing this new order type, I get an error message in transacion CO02 when selecting the printer icon. The error is as follows:
    No reference document type defined for order type ZRWK
    Message no. CO179
    ZRWK being the new order type.
    I've searched through many posts and found nothing relating to this message.  Hopefully someone has encounted this before.
    I'm sure I've missed something, but can't pinpoint what it is.
    Help is greatly appreciated.

    Bob, did you check your print parameters?..Maybe you don't have your sap forms..You can check it with Tx. COPI
    The path is Print - Print Settings - Configuration Menu.
    Diego

  • How can I create a new sales order template

    Hello,
    how can I create a new sales order template in SAP CRM 7.0 (Web UI)? I want to use this sales order template in scenario ´'Mass Generation of Sales Orders via Marketing Projects'.
    Thanks for your support in advance.
    Best regards,
    anvan

    Hi,
    Did you set up this scenario? I want something similar, but I want an ERP order to be created. Do you know if that is possible? Do you have som tips?
    regards Camilla

  • How can I create a new sales order template in SAP CRM 7.0

    Hello,
    how can I create a new sales order template in SAP CRM 7.0 (Web UI)? I want to use this sales order template in scenario ´'Mass Generation of Sales Orders via Marketing Projects'.
    Thanks for your support in advance.
    Best regards,
    anvan

    Hi,
    Did you set up this scenario? I want something similar, but I want an ERP order to be created. Do you know if that is possible? Do you have som tips?
    regards Camilla

  • How to create a new sales order to internal requisition?

    Hi, All
    Need help!!!
    How to create a new sales order to internal requisition?
    The internal requisition has generated order sales but this has already been canceled, so I need to create a new sales order to the same internal requisition.
    How to release the internal requisition to re-create new sales order and after import in OM?
    please help me
    Thanks and regards
    Manuel,

    You cannot.
    Once a ISO is generated for an IR, the transferred_to_oe flag is set on that req.
    If the ISO was canceled, you should cancel the IR and create a new one.
    Hope this helps,
    Sandeep Gandhi

  • How to make a production order type default for a Plant.

    Hi All,
    I want to know the setting to make production order type ZP01 default for a plant so that when I create a production order using CO01 for that particular plant, it should always use ZP01 as order type?

    Hello Friend,
    One more method is to achieve this is by using Production Scheduling Profile. In transaction OPKP, for your Plant create a new production scheduling profile or use the existing one created in your plant. Inside the production scheduling profile, in order type section, for make to stock field, maintain the value as ZP01 (which you want to come automatically all the time while creating the order by co01) and save.
    Now assign this production scheduling profile in material master of all Semifinished and Finished materials.
    Now create new production order by co01. On initial screen of this transaction give only material code and production plant and enter (don't give anything in order type field).
    After giving material code and production plant, press Enter. After pressing enter system will take you inside the production order .
    Check here by default system will take order type as ZP01.
    Check and Confirm.

  • Tables for creating a new sales order with reference to another

    Hi Experts
      In ABAP, how can identify that  I'm creating a new sales order with reference to another in the userexit read_document??, In which tables is this information??.
    Thanks
    Regards

    In Table VBFA there are two fields
    a)  Preceding Document  and
    b)  Subsequent Document category
    Based on the above two fields, you can conclude that sale order is created with reference to a preceding document.
    thanks
    G. Lakshmipathi

  • Subscription that triggers when you create a new production ?

    I'd like to trigger a python script each time I create a new production in FCS.
    How can I do it ?
    thanks
    Fred

    Create a Script Response that will fire off your python script.
    Create a Subscription that will monitor the metadata fields of a Production for example the "Status".
    The idea here is that creating a new production with the Status = New will trigger your python script.
    Let me know if that makes sense. Thanks.
    Nicholas Stokes
    XPlatform Consulting

  • How to check the Production order exits

    Hi Experts
    Modification to processing of Command Orders & Tickets
    We require a modification to the processing being performed on sales data originating from the Command Concrete system and potentially from other systems yet to come online (e.g. Pinkenba Cement plant).
    The Sap process involved is ZINT_INBOUND_POLLING and within that, ZINT_CSTPORD_ROUTINES.
    The problem
    Currently there is an assumption that every sales order (and its deliveries) will include a product which is made to order, i.e. for which a production order will be required.
    In ZINT_CSTPORD_ROUTINES, a check is made to identify the production order linked to the sales order. If there is no such production order (usually because of the customeru2019s credit status) then processing of the ticket is terminated.
    This assumption would fall down if an order was to be raised (in Command) on which there is no concrete material. For example, if we sold a bag of pigment or a screed to a customer. In this case the item would be sold from stock and there would be no need for a production order.
    The solution
    In the routine which checks for the existence of a production order, modify the code as follows:
    Inspect each item on the sales order
    If (and only if) there is at least one item with a category of u201CZTACu201D then check for a production order, otherwise process the order in the usual manner.
    ----  ZINT_CSTPORD_ROUTINES -
    *&      Form  process_inbound_data
          Create prod. orders from ticket data extracted from the COMMAND
          system. Note that large portions of the code in this routine
          have been copied from the retired ZPPU_COMMAND_PRODUCTION
          interface program. This was done (1) because the old code works
          and (2) to save development time.
         -->T_ZINT_IDATA  Internal table of interface data
         -->T_ZINT_PARAM  Internal table of interface parameters
         -->T_ZINT_MSLOG  Internal table of messages
         -->P_ZINT_ID     Interface ID
         -->P_ZINT_TY     Inteface type
         -->P_ZINT_IS     IDOC group for interface
         -->P_ZINT_DL     Flag: delete IDOC group when complete
         -->P_ZINT_AL     Flag: run in standalone mode
         -->P_ZINT_NW     Flag: do not log warning messages
         -->P_ZINT_SQ     Interface sequence number
         <--P_ZINT_RC     Return code (<>0=>error)
    form process_inbound_data  tables   t_zint_idata structure zint_idata
                                        t_zint_param structure zint_param
                                        t_zint_mslog structure zint_mslog
                               using    p_zint_id    type      zint_id
                                        p_zint_ty    type      zint_ty
                                        p_zint_is    type      zint_is
                                        p_zint_dl    type      zint_dl
                                        p_zint_al    type      zint_al
                                        p_zint_nw    type      zint_nw
                                        p_zint_sq    type      zint_sq
                               changing p_zint_rc    type      zint_rc.
    program is continuing .............
    I WANT TO WRITE A CODING HERE **********************
    CHECK IF PRODUCTION ORDER REQUIRED
              IF NOT THEN GO TO PERFORM UPDATE DATA
      if production order required then check
                    for each item on sales order item list
                          with item category = 'ZTAC' then
                                     return true
                                next
                                  end function
        if there is no production code
               these has to be check from VBAP TABLE field VBELN and PSTYV (ZTAC,ZTAN Etc)
      select * from Vbap WHERE VBELN = '00000269951' and VBAP.PSTYV = 'ZTAC','ZTAN' Etc
    No production order?
        elseif lva_prodord is initial.
          clear v_messg.
          call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
            exporting
              input  = lva_filemat
            importing
              output = lva_filemat.
        No production order found - log a warning message.
          concatenate 'Production Order not be found for'
                      'Command order' lva_cmdord
                      'Material'      lva_filemat
                      'Customer'      lwa_02-customer
            into v_messg separated by space.
          perform write_log_entry
            tables t_zint_mslog
            using  'E' 'ZINT_CSTPORD_ROUTINES'
                       'FIND_SAP_PRODORD'
                         v_messg
                         p_zint_nw
                         lwa_01-ticketnumber.                " RJS
          continue.
        endif.
    Production Order WAS found... Continue creating IDOCS
        lwa_hdrlevel-postg_date = lwa_01-ticketdate.
    Obtain the storage location parameter value.
        read table t_zint_param with key zint_fn = 'LGORT'.
        if sy-subrc ne c_noerr.
          perform write_log_entry
            tables t_zint_mslog
            using  'E' 'ZINT_CSTPORD_ROUTINES'
                       'PROCESS_INBOUND_DATA'
                       'Parameter LGORT is missing from ZINT_PARAM'
                       p_zint_nw
                       lwa_01-ticketnumber.                " RJS
          exit.
        endif.
        loop at l_it_05 into lwa_05
          where ticketnumber = lwa_01-ticketnumber.
          clear lwa_gm_item_create.
          lva_filemat = lwa_05-material.
          if lva_filemat eq lva_prodmat.
            concatenate 'Command ticket-' lwa_05-ticketnumber
              into lwa_hdrlevel-conf_text.
            lwa_hdrlevel-conf_quan_unit = lwa_05-unitofmeasure.
            lwa_hdrlevel-yield          = lwa_05-quantity.
    check whether the confirmed value + current delivery value is equal *
    the production order qty. If the production order value is less
    than the total delivered value, set final conf indicator  and clear
    reservations
            lva_wemng = lva_wemng + lwa_05-quantity.
            if lva_wemng < lva_psmng.
              lwa_hdrlevel-clear_res      = c_false.
              lwa_hdrlevel-fin_conf       = ' '.
            else.
              lwa_hdrlevel-clear_res      = c_true.
              lwa_hdrlevel-fin_conf       = 'X'.
            endif.
            move: 'Z1BP_PP_HDRLEVEL' to t_idoc_data-segnam,
                  lwa_hdrlevel       to t_idoc_data-sdata.
            append t_idoc_data.
            clear lva_formmat.
            lva_formmat                   = lwa_05-material.
            lwa_gm_item_create-material   = lva_formmat.
            lwa_gm_item_create-plant      = lwa_03-plant.
            lwa_gm_item_create-ref_date   = lwa_01-ticketdate.
            lwa_gm_item_create-prod_date  = lwa_01-ticketdate.
            lwa_gm_item_create-move_type  = '101'.
            lwa_gm_item_create-spec_stock = 'E'.
            lwa_gm_item_create-sales_ord  = lva_saleord.
            lwa_gm_item_create-entry_qnt  = lwa_05-quantity.
            lwa_gm_item_create-entry_uom  = lwa_05-unitofmeasure.
            lwa_gm_item_create-orderid    = lva_prodord.
            lwa_gm_item_create-move_mat   = lva_formmat.
            lwa_gm_item_create-move_plant = lwa_03-plant.
            lwa_gm_item_create-mvt_ind    = 'F'.
            clear t_idoc_data.
            move: 'E1BP2017_GM_ITEM_CREATE' to t_idoc_data-segnam,
                  lwa_gm_item_create        to t_idoc_data-sdata.
            append t_idoc_data.
          else.
            clear: lva_loggr,
                   lva_formmat.
            lva_formmat = lwa_05-material.
            select single loggr into lva_loggr from marc
              where matnr = lva_formmat
              and   werks = lwa_03-plant.
            if sy-subrc ne 0.
              clear v_messg.
              No logistics handling group - log a warning message.
              concatenate 'No logistics handling group for material'
                           lva_formmat
                          'in plant'
                           lwa_03-plant
                into v_messg separated by space.
              perform write_log_entry
                tables t_ldata
                using 'W' 'ZINT_CSTPORD_ROUTINES'
                          'PROCESS_INBOUND_DATA'
                          v_messg
                          p_zint_nw
                          lwa_01-ticketnumber.                " RJS
              clear lva_loggr.
            endif.
            if lwa_03-satsur eq 'T'.
              lwa_e1edl21-lprio = 30.
            else.
              lwa_e1edl21-lprio = 20.
            endif.
          else.
            if lwa_03-satsur eq 'T'.
              lwa_e1edl21-lprio = 10.
            else.
              lwa_e1edl21-lprio = '  '.
            endif.
          endif.
          lwa_e1edl21-berot = lwa_04-driver.
          move: 'E1EDL21'   to t_idoc_data-segnam,
                lwa_e1edl21 to t_idoc_data-sdata.
          append t_idoc_data.
          lwa_e1edl55-qualf = '001'.
          lwa_e1edl55-refnr = lva_saleord.
          move: 'E1EDL55'   to t_idoc_data-segnam,
                lwa_e1edl55 to t_idoc_data-sdata.
          append t_idoc_data.
    Loop at materials - create delivery entry for each
          loop at l_it_05 into lwa_05
            where ticketnumber = lwa_01-ticketnumber.
            clear t_idoc_data.
            lwa_e1edl24-matnr = lwa_05-material.
            lwa_e1edl24-werks = lwa_03-plant.
            lwa_e1edl24-vfdat = lwa_01-ticketdate.
            lwa_e1edl24-lfimg = lwa_05-quantity.
            lwa_e1edl24-vrkme = lwa_05-unitofmeasure.
            lwa_e1edl24-lgort = t_zint_param-zint_fv.
            clear lva_loggr.
            lva_formmat = lwa_05-material.
            clear lva_loggr.
            select single loggr into lva_loggr from marc
              where matnr = lva_formmat
              and   werks = lwa_03-plant.
            if sy-subrc ne 0.
            No logistics handling group - log a warning message.
              concatenate 'No logistics handling group for material'
                           lva_formmat
                          'in plant'
                           lwa_03-plant
                into v_messg separated by space.
              perform write_log_entry
                tables t_ldata
                using 'W' 'ZINT_CSTPORD_ROUTINES'
                          'PROCESS_INBOUND_DATA'
                          v_messg
                          p_zint_nw
                          lwa_01-ticketnumber.                " RJS
              lva_loggr = 'BBIN'.
            endif.
            if lva_loggr is initial.
              move: 'E1EDL24'   to t_idoc_data-segnam,
                    lwa_e1edl24 to t_idoc_data-sdata.
              append t_idoc_data.
            endif.
          endloop.
          clear: lva_xabln,
                 lva_vbeln,
                 l_vbfa.
    Matching ticket against a Delivery?
          select single xabln vbeln into (lva_xabln,lva_vbeln) from likp
              where xabln = lwa_01-ticketnumber.
          if sy-subrc = 0.
    If found, does this delivery match the sales order?
            select * from vbfa into l_vbfa
              where vbelv = lva_saleord
              and   vbeln = lva_vbeln.
              exit.
            endselect.
          endif.
    No matching delivery found, or Matching delivery, but for other Sls Ord
          if lva_xabln is initial
          or ( lva_vbeln <> space and l_vbfa is initial ).
            if not lva_saleord is initial.
              perform create_delivery_idocs tables t_zint_mslog
                                            using  s_idcgp
                                                   lwa_01-ticketnumber
                                                   p_zint_nw.
            else.
              concatenate 'Error finding a Sales Order for ticket "'
                          lwa_01-ticketnumber
                          '" reprocess the file AFTER'
                          ' the sales order issues have been fixed'
              into        lva_outtext.
              perform write_log_entry tables t_zint_mslog
                                      using  'E'
                                             'ZINT_CSTPORD_ROUTINES'
                                             'PROCESS_INBOUND_DATA'
                                             lva_outtext
                                             p_zint_nw
                                             lwa_01-ticketnumber. " RJS
            endif.
          else.
            concatenate 'Command Ticket "'
                        lwa_01-ticketnumber
                        '" has already been processed into delivery "'
                        lva_vbeln
            into        lva_outtext.
            perform write_log_entry tables t_zint_mslog
                                    using  'I'
                                           'ZINT_CSTPORD_ROUTINES'
                                           'PROCESS_INBOUND_DATA'
                                           lva_outtext
                                           p_zint_nw
                                           lwa_01-ticketnumber. " RJS
            refresh t_idoc_data.
          endif.
        endif.
        refresh t_idoc_data.
    Write out all messages collected so far
        perform update_data tables t_zint_mslog
                            using p_zint_id p_zint_ty.
      endloop.
    Write out all messages collected so far
      perform update_data tables t_zint_mslog
                          using p_zint_id p_zint_ty.
    endform.                    " process_inbound_data
    Thnaks
    Regards

    Thanks
    Thread closed

  • How to get open production orders by plant wise

    Hi,
    How to get open production orders by plant wise.
    i know from tcode COOIS, is it possible to get from this. if so what are the parameters we have to give to get open production orders by plant wise.
    is there any tcode or tables available , please provide details .
    regards,
    Hari priya

    Hi,
    What is your definition of Open Production Orders?
    Definetly you will get the report from COOIS for Plant wise.
    Whther you want to consider all the Orders having the Status REL but not DLV?
    Then there is a chance of having the Orders, still with PDLV status but GR is done for the full Qty. May be you don't want to consider the TECO status, eventhough the Order is short closed??
    Better to ommit the Orders with CRTD status also..
    So, based on this which status to consider and which status not to consider..
    You can define the "Selection profile status" in BS42.
    Use this selection profile in COOIS, so that the rsults will be accurate..
    Best Regards,
    Siva

  • IMG Settings for creating a new sales order type

    Hello All,
    I seek you valuable inputs on the steps to follow in IMG(SPRO) setting to create a new sales order type in the system.
    I want to create a new sales order type for which i have done the following setting in IMG,
    1) Sales and Distribution->Sales->Sales Document Header->Define sales document type.
    2)  Sales and Distribution->Sales->sales Document Header->Assign Sales Area To Sales Document Types.
    3) Sales and Distribution->Sales->Sales Document Item->Define Items Categories
    4) Sales and Distribution->Sales->Sales Document Item->Assign Item categories
    5) Sales and Distribution->SalesàSchedule Lines->Assign Schedule lines Categories.
    Also created a new number range for the same.
    After this when i am trying to create a sales order with VA01 i get an error "Enter a Sales Area".
    what am i missing ?Please suggest.
    Thanks in advance,
    Swati

    Hello,
    In the Initial screen of VA01 you have to enter the sale area which is nothing but the combination of
    Sales organization
    Distribtion channgel
    Division
    And in the transaction code  OVAZ you should assign the sales document type for this sales area .
    Please revert if you need any frther clarification
    regards,
    santosh

  • How to add new product in interactive demand planning(IDP)

    Hi gurus,
    How to add new product in interactive demand planning(IDP), can you suggest me, when i click data view in IDP, it will show new product.
    Regards
    babu

    Hi Raj,
    Since the New Product is already in MPOS what you need to do in your Data view is to go to "Selection Window" on the left side of the screen(make sure you dont click on the existing selection ids). Select Product at the top, the planning version will come in the next row and then you again select the Product as charateristic and enter the New product name against the Product(Characteristic) and then save it in case you want it to use for your future references. When you will double cilck on the newly made selection id you will be able to see you product with the keyfigure details in right side.
    Please let me know if it works.
    Thanks,
    Anand.

  • How do we do production orders for same item code in different sizes

    Hi,
    We have Items which we buy as a single sheet of material and our customers can ask for us to cut the complete sheet into different sizes before despatching it. i.e
    Item Code Sheet1: Sheet size 100mm x 100mm
    Customer asks for sheet to be cut into 10 off 10mm x 10mm sheets, which we presently put on the sales order as a line note
    We then generate a production order for this item and indicate on the production order printout the line note
    We've recently had a customer who has asked for Item 1 in two different sizes on the same sales order ie
    Order Line 1 Sheet1 Qty:1 Line note: cut into 10mm x 10mm sheets
    Order Line 2 Sheet1 Qty:1 Line note: cut into 50mm x 50mm sheets
    When generating the Production order SAP combines the items into
    Product No: Sheet1
    Planned Qty: 2
    Where as we want it to create 2 production orders 1 of each different sizes items.
    I know I can create BOMs for those two sizes, but customers can ask for the sheets to be cut to whatever size they want. Is the best method to create BOMs on the fly for each different sizing option or are there alternative methods that are easier to manage ?
    Thanks
    Carl

    Hi Carl Rutter,
    You have to creat 2 special production order for this item. when issue the component make sure you issue the stock as per the cosumption becaue one have 10mmx10mm and the another item have 50x50 in this case you issue component by square inch wise. for example 10*10 = 100 squre inch.
    50*50 = 2500 square inch so the cost will be approtionate. you can Use multiple uom method to obtain this, other wise you have covert into stock then you issue the component. If you want traxk size wise ,you can use batch option for Finishe goods.
    Regards
    Sridharan

Maybe you are looking for

  • BAPI_DOCUMENT_CREATE2 - Copy Attached file issue

    Hi, I am trying to create a document with attachment in CV01 using the BAPI BAPI_DOCUMENT_CREATE2. Here my requirement is to copy the attached files from a document to another document (which I will be creating newly). I mean attachments from documen

  • Missing trade in credit - please help

    I typically don't like to complain, but the bestbuy employee I had to deal with was horrible.  Simply didn't want to do his job.  I'm a very reasonable person, but again this person was a slacker.  I purchased Gamers Unlocked last night then traded 2

  • Strange corruption problem with AVCHD

    This problem is so weird I can't even figure out how to explain it, but here goes: I have video taken in the AVCHD file structure (puts clip into a nesting of folders, the MTS files are playable by Windows Media Player/VLC). The problem I'm having is

  • Does TM overwrite or just replace what's missing?

    When I went on a business trip recently I had to delete about 15GB worth of music from iTunes to free up some hard drive space. When I got home i hooked up my iPhone to sync it and thought it would transfer all the music I had deleted. Needless to sa

  • Advice for next computer :)

    Some people are buying a laptop and a large display to work with the laptop at home. You could buy a mac mini for $600. This would give you a new computer. You could reuse you keyboard & mouse. Some people are connecting their mini their lcd tv's Dea