Seperate/Different COGS at the time of delivery from sales order

Hi Friends,
I have a reqirement where i need to hit different COGS accounts at the time of goods issue for a sales order, based on distribution channel. All sales would have same order type and all the parameters (material, item catagories, customers etc etc) are same, except for the distribution channel.
For example  Sales Org/D.channel/Div   S001/01/01 should hit like
CR: ABC Inventory
DB: COGS 1
and for Sales Org/D.channel/Div   S001/02/01 should hit like
CR: ABC inventory
DB COGS 2.
Limitations:
1. I do not have choice of creating a seprate order types for these sales
2.  Creating a new movement type is an option, but i would like this to make it as last option.
Directions for soutions.
1. Has any body implemented BADI for such case. If yes, request to share the BADI name.
2. can we use Substitutions, Is subsitutuions possibile for replacing the GL Accounts at the time of posting?
Any directions would be of great help

Dear,
You can put the substitution at the Document Line level, please write below logic:
Prerequisite:
BKPF-BLART = "WA" & BSEG-HKONT = "you normal GL Account which will is picked normally"
Substituin:
BSEG-HKONT  User Exit
Now in this user exit as ABAPer to write code as per below logic
1. Pick BSEG-VBEL2, pass the same in VBAK-VBELN and check VBAK-SPART if this is 01 then move COGS 1 to BSEG-HKONT where transaction is GBB,
similary write the sam elogic for Dist Channel 2
Hope this helps
Br, Vivek

Similar Messages

  • What is the relation between delivery num , sales order num and invoice

    what is the relation between delivery num , sales order num and invoice

    Look at VBFA Table
    goto VBFA table ,enter order number number vbelv ,vbtyp_n is C,then VBELN is the delivery
    if you enter delivery number in vbelv ,vbtyp_n is J,then vbeln is Invoice.
    here VBTYP_N is the import.
    VBFA is the sales document flow table,and very important table
    Thanks
    seshu

  • Delivery from Sale Order for Inquiry stock

    Dear All,
    We have unique requirement from client mentioned below, any help would be greatly appreciated.
    This is a trading sale which is initiated from inquiry.
    1. Inquiry is created in SD, which in turn triggers Purchase Requisition.
    2. PR is converted to RFQ.
    3. Based on RFQ prices are negotiated with vendors, then Quotation is sent to Customer from VA21 which is created against inquiry.
    4. Now when the PO is created w.r.t RFQ, then GR is done , Stock will be lying against inquiry.
    5. But i want to do delivery from sales order for stock lying against inquiry.
    we are looking for a workaround solution.
    Note:
    1. Client has disagreed with Stock Movement from Inquiry to quotation using MB1B, as it becomes manual transaction.
    2. PR triggering has to be @ Inquiry, as sale order will not be created until quotation is approved.
    Looking forward for valuable inputs.
    Thanks in advance
    Best Regards,
    Chaithru

    Tien,
    Approval will not work when you have mutiple rows of data.  You would have to work with SP Transaction Notification
    There has been threads before on the forum on the same topics.
    Block the Quantity in Sales Delivery
    Approval Procedure for chaning quantity in Delivery Document
    Suda

  • BAPI or FM to create outbound delivery from Sales order

    Hello All,
    My requirement is to create a outbound delivery from sales order. Also i need the batch number and texts to be updated in the delivery.
    For this i need a single FM. The catch is that we don't have the batch number and texts in the sales order. That i have to take from some other delivery. I can get all the information .
    The problem is that i can not find a FM through which i can create the delivery from the order and update the same.
    I should not use two FM.
    Could you please tell me some FM which does both in one go?
    Thanks and Regards,
    Rahul Sinha

    Hi
    Hi,
    You can use the BAPI BAPI_DELIVERYPROCESSING_EXEC.
    Check this sample code..
    PARAMETERS: p_vbeln LIKE vbak-vbeln.
    DATA: BEGIN OF t_vbap OCCURS 0,
    vbeln LIKE vbap-vbeln,
    posnr LIKE vbap-posnr,
    kwmeng LIKE vbap-kwmeng,
    matnr LIKE vbap-matnr,
    werks LIKE vbap-werks,
    END OF t_vbap.
    DATA: t_request TYPE STANDARD TABLE OF bapideliciousrequest
    WITH HEADER LINE.
    DATA: t_created TYPE STANDARD TABLE OF bapideliciouscreateditems
    WITH HEADER LINE.
    DATA: t_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
    SELECT vbeln posnr kwmeng matnr werks
    INTO TABLE t_vbap
    FROM vbap
    WHERE vbeln = p_vbeln.
    LOOP AT t_vbap.
    t_request-document_numb = t_vbap-vbeln.
    t_request-document_item = t_vbap-posnr.
    t_request-quantity_sales_uom = t_vbap-kwmeng.
    t_request-id = 1.
    t_request-document_type = 'A'.
    t_request-delivery_date = sy-datum.
    t_request-material = t_vbap-matnr.
    t_request-plant = t_vbap-werks.
    t_request-date = sy-datum.
    t_request-goods_issue_date = sy-datum.
    t_request-goods_issue_time = sy-uzeit.
    APPEND t_request.
    ENDLOOP.
    CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
    TABLES
    request = t_request
    createditems = t_created
    return = t_return
    READ TABLE t_return WITH KEY type = 'E'.
    IF sy-subrc = 0.
    MESSAGE e208(00) WITH 'Delivery creation error'.
    ENDIF.
    COMMIT WORK.
    READ TABLE t_created INDEX 1.
    Write: / 'Delivery ', t_created-document_numb.
    Regards,
    Sreeram

  • Budget error while creating delivery from sales order

    hi Gurus,
    System is throwing error PB603 "Item 004 WBS element ABC-XXX budget exceeded" while creating delivery from sales order.
    I am picking material from unrestricted plant stock (not in project stock).
    I am also confused as sales order has 3 line items & error shows Item 004 !

    Hi Kuldeep,
    Check this note,
    Note 159387 - Message BP603: incorrect line item is displayed
    Its valid only till 4.6. Might give you some idea but.
    Regards,
    Gokul

  • BAPI to create Delivery from Sales Order posting EIKP data

    Hi All,
    I'm searching for BAPIs to create a Delivery from Sales Order which I can update/insert data into EIKP table because I am receiving data that it must be saved into ZOLLA and ZOLLB fields (Customs Office: Office of Exit/Entry and Destination for Foreign Trade).
    I tried with BAPI_OUTB_DELIVERY_SAVEREPLICA, BAPI_OUTB_DELIVERY_CREATE_SLS and BAPI_DELIVERYPROCESSING_EXEC but I didn't find structures with these fields.
    Please, I need some help to resolve this issue.
    Thanks in advance.

    Hello Manoj what you have to do to create PO from PR is that
    1) Use   BAPISDORDER_GETDETAILEDLIST (pass sales order number in sales_document table) and then get PR (Purchase requisition number from this BAPI.
    2) Use  BAPI_REQUISITION_GETDETAIL to get PR items
    3) Use BAPI_PO_CREATE1 to craete PO from PR then.
    to create goods movement you can use
    BAPI_GOODSMVT_CREATE
    REWARDS IF USEFUL.

  • Create Delivery from Sales Order Document

    Hello all,
    I have a business requirement to create deliveries from sales orders in the most effcient way possible.  Our current program uses BDC and calls transaction VL01N, however this has been found to dramatically increase the run-time of this program.  I have been searching for a BAPI to essentially do the same thing. 
      I came across one BAPI, BAPI_DELIVERYPROCESSING_EXEC, but have been getting inconsistent results.  It will create deliveries for some line items and not others with little rhyme or reason.  The return table is not being populated unless it is a high level error, such as the quantity passed being 0.
    To the BAPI, I am passing: Sales Doc Number, Line Item, Quantity, and Document Category.  This is done through an internal table.  I also pass internal tables to receive the return messages and the created documents. 
    Has anyone seen the same thing with this BAPI? Is there a better BAPI to use for such a purpose?
    many thanks for any help,
    brian

    Hi!
    For delivery creation you can use FM SHP_VL10_DELIVERY_CREATE:
        DATA:
          if_ledat TYPE lfdat_a,
          if_nur_vorgabe_pos TYPE xfeld,
          it_key_to_enque_t TYPE shp_vl10_package_t,
          it_key_to_enque LIKE LINE OF it_key_to_enque_t,
          it_komdlgn_t TYPE shp_komdlgn_t,
          cx_sd_order TYPE shp_vl10_sd_order,
          ct_vbsk_all_t TYPE shp_vbsk_t,
          ct_vbls_t TYPE shp_vbls_t,
          ct_key_late TYPE shp_vl10_package_t,
          ct_vorgabe_daten_t TYPE shp_vorgabe_daten_t,
          ct_vorgabe_daten LIKE LINE OF ct_vorgabe_daten_t,
          wa_dlvsrc LIKE LINE OF m_it_dlvsrc,
          msg TYPE string.
        LOOP AT m_it_dlvsrc
          INTO wa_dlvsrc.
          CLEAR it_key_to_enque.
          it_key_to_enque-panum = '1'.
          it_key_to_enque-vbobj = 'A'.
          it_key_to_enque-vbtyp = 'C'.
          it_key_to_enque-vbeln = wa_dlvsrc-vbeln.
          it_key_to_enque-posnr = wa_dlvsrc-posnr.
          it_key_to_enque-id = '1'.
          it_key_to_enque-tabix = '1'.
          it_key_to_enque-vstel = wa_dlvsrc-vstel.
          APPEND it_key_to_enque TO it_key_to_enque_t.
          CLEAR ct_vorgabe_daten.
          ct_vorgabe_daten-vgbel = it_key_to_enque-vbeln.
          ct_vorgabe_daten-vgpos = it_key_to_enque-posnr.
          ct_vorgabe_daten-lfimg = wa_dlvsrc-lfimg.
          ct_vorgabe_daten-akmng = 'B'.
          ct_vorgabe_daten-postab_tabix = it_key_to_enque-tabix.
          ct_vorgabe_daten-panum = it_key_to_enque-panum.
          ct_vorgabe_daten-id = it_key_to_enque-id.
          APPEND ct_vorgabe_daten TO ct_vorgabe_daten_t.
        ENDLOOP.
        if_ledat = sy-datum.
        if_nur_vorgabe_pos = 'X'.
        CALL FUNCTION 'SHP_VL10_DELIVERY_CREATE'
             EXPORTING
                  if_ledat           = if_ledat
                  if_nur_vorgabe_pos = if_nur_vorgabe_pos
                  it_key_to_enque    = it_key_to_enque_t
                  it_komdlgn         = it_komdlgn_t
             CHANGING
                  cx_sd_order        = cx_sd_order
                  ct_vbsk_all        = ct_vbsk_all_t
                  ct_vbls            = ct_vbls_t
                  ct_key_late        = ct_key_late
                  ct_vorgabe_daten   = ct_vorgabe_daten_t.
        COMMIT WORK AND WAIT.
    All created deliveries numbers:
    SELECT vbeln
          INTO TABLE m_it_vbeln
          FROM vbss
          FOR ALL ENTRIES IN ct_vbsk_all_t
          WHERE sammg = ct_vbsk_all_t-sammg.
    All errors during processing:
          SELECT msgid msgno msgv1 msgv2 msgv3 msgv4
            INTO TABLE it_msg
            FROM vbfs
          FOR ALL ENTRIES IN ct_vbsk_all_t
          WHERE sammg = ct_vbsk_all_t-sammg.
    Regards,
    Maxim.

  • Need to add a custom defined partner at the time of creation of sales order

    Hi Experts,
    I request you some solution for me in this urgent requirement.
    Scenario 1:
    I have to create a partner in the sales order based on some validations with repect to bill-to party and ship-to party. The validations if success, will return me the data from an 'Z' function module which i need to populate to the new partner that will be created in the sales order.
    I am using the program MV45AFZZ and the userexit USEREXIT_SAVE_DOCUMENT_PREPARE.
    Now after getting the data for the new partner to be added, i have done this code..
          LOOP AT ws_dealer.
            xvbpa-kunnr  = ws_dealer-kunwe.
            xvbpa-parvw  = 'ZD'.
            xvbadr-telx1 = ws_dealer-primaryid.
            xvbadr-name1 = ws_dealer-physname.
            xvbadr-stras = ws_dealer-physstreet.
            xvbadr-ort01 = ws_dealer-physcity..
            xvbadr-regio = ws_dealer-physstate.
            xvbadr-pstlz = ws_dealer-postalcode.
            xvbadr-land1 = ws_dealer-ctrycode.
            xvbadr-telf1 = ws_dealer-phone.
            xvbadr-telf2 = ws_dealer-fax.
           xvbadr- = ws_dealer-email.
            xvbadr-telbx = ws_dealer-distance.
            APPEND xvbadr.
            APPEND xvbpa.
          ENDLOOP.
    Now i'm getting the new partner number in the partners tab in sales order, but the new address details are not getting updated and the ship-to party address is only appearing in the screen.
    Also i'm finding difficulty in updating the telex, email information in the sales order.
    Scenario 2:
    There are cases where some sales orders are getting created through an idoc. In that case, i have to populate the values from idoc especially the address details of all the partners to the screen and update the sales order.
    Apart from populating value to all the partners, the process of scenario 1 will have to be carried again to create the 'Z' partner (if validation is successful).
    For this case, i do not know which userexit i need to use. and how to go about this..
    This is having a very tight deadline and it is extremely urgent for me.
    Please help with your valauble answers.
    Your help would certainly be appreciated and rewarded.
    Thanks,
    Ananth

    Hi Mahulenka,
    Thanks for your reply. I do not want the data from the customer master.
    The partner data will come in the idoc and i wish to put the data in the sales order based on some validation for the standard partners like WE/AG/RE/RG.
    The client has developed some 'Z' function module which contains the functionality of SAP FM - IDOC_INPUT_ORDERS.
    Now for the partner which i'm creating 'ZD' i believe i should update the indicator UPDKZ to 'I' for XVBADR table as it is a new record. Why should i update in XVBAP table and i'm adding only partner and his address details. Also i think all this change i should put in USEREXIT_SAVE_DOCUMENT at the point of saving.
    Please advise.
    Thanks,
    Ananth

  • Get the Ship-to-Party from Sales Order and Line item

    Hi all,
    I am developing one report in which I want to get the Ship-to-Party for a particular Sales Order and Sales Order Line item number.
    I can see table VBPA from I can get value of KUNNAR and so on. But my concern is that can the Ship-to-Party differ for different line items for sales Order, if yes how to get that one, any table or any function module?
    In my scenario i found out that ship-to-party only depend upon sales order and partner function not line item.
    please help me..
    regards,
    vikas.

    Hi,
    First step: Customer Creation (T. Code: XD01)
    i) Create Sold to Party (Ordering Party) with Account Group: Sold-to-Party
    ii) Create as many Ship-to-Party and Bill-to Party, if reqd, with Account appropriate Account Groups.
    iii) Match all the Ship-to-party/ Bill-to-Party/ Payer for the respective Sold-to-Party under Tab: Sales Area data, Sub-tab: Partners.
    Second Step: Sales Order Creation (T.Code: VA01)
    i) Enter Sold-to-Party at Header Level.
    ii) Enter Materials (at Line-item level).
    iii) Now, System will pop-up all the Ship-to-Party/ Bill-to Party/ Payer, Matched for the particular Sold-to-Party. Click on appropriate selection.
    OR
    Now, (if option doesn't pops-up) select the line and Double Click on to the same line. it will lead to the next page. Here, Click Tab: Partners
    Now, in Column: Partner Function, search for appropriate Partner: Ship-to-Party or Bill-to-Party or Payer.
    Remember: Sold-to-Party will be non-editable as entered at Header level.
    Repeat the same for Each Line-item.
    Regs,
    Amit K. Yadav

  • Changing PO date to Actual GI date in Delivery from SALES ORDER(VA01)

    THe Actual Requirement is...Whenever I create a SALES Order with PO date this PO date should automatically trigger in Actual GI date field in Delivery.
    I just want to share my solution before I get some help from you Guys.. I have actually used a userexit MV50AFZ1. This was working fine for me when they are creating the order manually.
    But the client's requirement is that.. it should work for automatic process.. this is nothing a FILE Is being send to SAP through MIDDLEWARE and IDOC get triggers with that... So the CLients wants when this process is happening he wants the PO date of the Sales order to be the ACTUAL GI DATE in Delivery.
    Can you please help me out with this Aumatic Process...

    Shivakumar,
    U would need to check the inbound FM associated with the particular IDOC...you would need to make similar changes as you did in MV50AF71 to fulfill your requirement.
    Regards
    Anurag

  • Workflow for Delivery from Sales Order Creation

    Hi All,
    I am new to SAP workflow.  There is a requirement to create a delivery through VL04 (in background) based on the Shipping Point of the approved Sales Order.  How can this be done?  I am assuming that I should be using BUS2032 for the Sales Order and BUS2015 for the Delivery. 
    The first step should be to send an email that gives the user two options (Approve and Reject) once a Sales Order is saved.  However, I am unsure of how to pass parameters to VL04 and submit the program.
    For example, if the order is approved the Shipping Point will be passed to VL04 and run in background to create the delivery.  How can you determine the Shipping Point from BUS2032?  I did not see any attribute for this within the BOR.  Also, how do you create the step to submit that Shipping Point to transaction VL04 in background? 
    Any help you can give would be greatly appreciated.  Thanks.
    John

    Hello,
    You could try using a BDC with VL04 but first preference would be to see if there are any BAPI functions (search for BAPI) that can do this.
    If BUS2032 doesn't have an attribute that you want (eg shipping point) then sub-delegate to ZBUS2032 and add the attribute, it's straightforward. You just have to know how to determine the value programmatically.
    regards
    Rick Bakker
    hanabi technology

  • IDOC to create from outbound delivery from sales order as INBOUND process

    Hi Experts,
    We have third party interface for sales processing. Sales order, Outbound delivery and PGI will be done in Third party software and XML files will be send to SAP.
    We have to process this XML file into SAP with IDOC.
    Sales order processing is done but i am not able to find correct IDOC type for creating outbound delivery.
    Can you suggest Basic IDOC type / Message type and process code for the same.
    Regards,
    Sahadev Abhyankar

    Good morning !
    In the transaction WE20 to create the customer EDI  KU with EM function.
    Output parameter: message type DESADV and basic IDOC DESADV01.
    I associate the IDoc message type to LAVA, you should link it to the XML file, that is not how.
    Please : Could you please explain how you linked the XML file to IDOCS to create sales order ?
    Sorry for my poor English
    A greeting.

  • User exit while creating delivery from sales order

    Hi Guys ,
    Is there any user exit in sales order which triggers when we try to DELIVER(from the menu bar) .
    My requirement is to not include some line items(base on some condition) before they are included in the delivery .
    Thnx in advance .
    Anil

    Hi Naimesh ,
    Thnx for your reply.
    I'm not sure of the functionality in VOFM .Can u please tell me how can i acheive my current functionality as explained above in my question .
    I'll tell u my requirement .
    When creating delivery , I have to check for some condition and depending upon this condition , the line items must not be included in the delivery .
    I have acheived this by BADI  LE_SHLP_DELIVERY~SAVE_DOCUMENT_PREPARE.
    if suppose any line items gets deleted in the delivery(based upon my condition) , and then if I look at the status of the slaes order(VA03) , it shows partially confirmed at the header level and the item which is rejected(in delivery) shows OPEN .
    Can u tell me how to update the status of the sales order header and item level (if any item is deleted) during creation of delivery .
    Thnx .
    Anil

  • List the intercompany billing numbers from sale order numbers.

    suppose i have a set of sale order numbers. is there any report can list the intercompany billing numbers related to those sale order numbers?  i don't want to use VA03 because it can display only one sale order number.
    thank you very much,
    Anek

    Hi Anek,
    Run the transaction code VA05. Click on the Further Selection Criteria, Select the check box 'Sales Document Type' and click OK. System will ask for the Sale Document Type. ENter the inter company Document Type, Press Enter and select the date range press Enter.
    System will list the orders.
    Hope it helps. Let me know whether it resolves you issue.
    Thanks & Regards,
    Nagaraj Kalbavi

  • Finished Goods valued at Future Standard price at the time of Delivery .

    Hi,
    My client requires the Finished Goods to be valued at Future Standard price at the time of delivery from Production order. This is required because in case there are frequent changes in the material prices, i can mark my material several times.. and change the future standard price.
    I have checked and found that it is always valued at Current standard price only.. and not at the future standard price.
    1) i have tested by changing the costing variant in OPL1 ( Planned costing variant for Production orders).. such that the valuation variant picks up the Future price... it seems it will work only for the Raw materials and SFG's consumed in the Production order and not for the Finished goods.
    2. Define valuation variant for Goods received option in the IMG - It seems it is relevant only when your FG is valued at Moving average price only.. so not relevant for my case.
    My question :
    Can i value my Finished goods at future standard price ( i.e Marked standard cost estimate ) at the time of receiving goods from Production order ? If yes how ?
    Thanks in advance for your answers.
    Njoy
    Siva

    Hi Siva
    It is very much possible, but you need to use exit... I think exit COPCP002 should be the relevant....
    Usually, this is used to valuate the GR in case of Valuated sales order stock... I guess this should work in MTS also...
    The reason why I feel it should be possble, is that if you read SAP text for the IMG Step Define Goods Received Valuation for Order Delivery, it says at the end
    For materials with price control S, on the other hand, the credit posting is always made at standard price.
    If you deliver to stock at a price that is not the standard price, the system will report an output price variance in variance calculation
    Hence, it should be very much possible to achieve what you want.. Only thing is it will hit a PPV and that you need to find relevant exit if the one abov does not work
    Regards
    Ajay M

Maybe you are looking for