Adding Freight costs

Hi folks,
I have a requirement where I have to add freight costs to a delivery. I am using the following code.
DECLARE
  action_code         VARCHAR2(15);
  pub_freight_costs   wsh_freight_costs_pub.pubfreightcostrectype;
  freight_cost_id     NUMBER;
  lv_freight_cost_id  NUMBER;
  lv_msg_data         VARCHAR2(10000);
  lv_msg_count        NUMBER;
  lv_ret_status       VARCHAR2(5);
  l_user_id           NUMBER;
  l_resp_id           NUMBER;
  l_appl_id           NUMBER;
  l_msg_index         NUMBER;
  lv_msg_index_out    NUMBER;
  lv_error_message    VARCHAR2(10000);
BEGIN
  SELECT user_id
    INTO l_user_id
    FROM fnd_user
   WHERE user_name = 'ANUJ_K';
  SELECT responsibility_id, application_id
    INTO l_resp_id, l_appl_id
    FROM fnd_responsibility_vl
   WHERE responsibility_name = 'Order Management Super User';
  fnd_global.apps_initialize(l_user_id, l_resp_id, l_appl_id);
  mo_global.set_policy_context('S',82);
  mo_global.init('ONT');
  pub_freight_costs.freight_cost_type_id := 1;
  pub_freight_costs.unit_amount          := 20;
  pub_freight_costs.currency_code        := 'USD';
  pub_freight_costs.delivery_id          := 36661664;
  pub_freight_costs.delivery_detail_id   := 9319784;
  wsh_freight_costs_pub.Create_Update_Freight_Costs(p_api_version_number  => 1.0              ,
                                                    p_init_msg_list       => fnd_api.g_false  ,
                                                    p_commit              => fnd_api.g_false  ,
                                                    x_return_status       => lv_ret_status    ,
                                                    x_msg_count           => lv_msg_count     ,
                                                    x_msg_data            => lv_msg_data      ,
                                                    p_pub_freight_costs  => pub_freight_costs,
                                                    p_action_code         => 'CREATE'         ,
                                                    x_freight_cost_id     => lv_freight_cost_id
  COMMIT;
  dbms_output.put_line('Return Status: '||lv_ret_status);
  dbms_output.put_line('Message Count: '||lv_msg_count);
  dbms_output.put_line('Freight Cost ID: '||lv_freight_cost_id);
  IF (lv_ret_status = 'S') THEN
      DBMS_OUTPUT.put_line('Freight Costs added.');
  ELSE
      DBMS_OUTPUT.put_line('Error creating freight costs');
      FOR i IN 1 .. lv_msg_count LOOP
                   apps.fnd_msg_pub.get(p_msg_index     => i              ,
                                        p_encoded       => fnd_api.g_false,
                                        p_data          => lv_msg_data    ,
                                        p_msg_index_out => lv_msg_index_out);
                   --COMMIT;                    
                   IF lv_error_message IS NULL THEN
                      lv_error_message := SUBSTR(lv_msg_data, 1, 250);
                   ELSE
                      lv_error_message := lv_error_message || ' /' ||SUBSTR(lv_msg_data, 1, 250);
                   END IF;
                   --show_mesg('------------------------------------------','LOG');
                   --show_mesg('Return Status : ' || lv_return_status,'LOG');
                   --show_mesg('Error Message : ' || lv_error_message,'LOG');
                   --show_mesg('------------------------------------------','LOG');
                   dbms_output.put_line('------------------------------------------');
                   dbms_output.put_line('Return Status : ' || lv_ret_status);
                   dbms_output.put_line('Error Message : ' || lv_error_message);
                   dbms_output.put_line('------------------------------------------');
      END LOOP;
  END IF;
EXCEPTION
  WHEN OTHERS THEN
     dbms_output.put_line('Error: '||SQLERRM);
END;    
But upon execution I get the following Error.
Return Status: E
Message Count: 0
Freight Cost ID:
Error creating freight costs
Could someone help me as to where exactly I am going wrong? Since the message count is 0 so it is not displaying any error.
Thanks                                                   

Since you are already on R12 please refer to Note 781061.1. Please note that this is referring to 12.1.1 (after 12.1 which I believe is yet to be released). This functionality is available out of the box in that release. Since then if you want real time solution (cost has to change for the receipt and accounting needs to be correct) for the purchase receipt transaction, you have to use Costing hooks. You have to use transaction costing hooks as well as accounting hooks to offset receiving account value.
Thanks
Nagamohan

Similar Messages

  • Subcontract Process:Transport/Freight Cost should not be added to Inventory

    Hi,
    I am following subcontract process; the involvement of transport/freight cost should not be added to the inventory account during Goods Receipt (MIG0).
    Regards,
    Biju K

    Hi BIjay,
    You may try this
    1.  New condition type to be created by copying the standard condition type FRA1/FRB1/FRC1
    New condition type ZFR1 created by copying FRA1 - M/06.Accrual flagged in this condition type same as FRA1 and Condition category of the new condition type should be Blank and maintain X-Negative value in the plus/minus field. Accrual must be flagged.
    2. New account key ZR1 created
    OLME -- >conditions -- >Define pricing Determination process -- >Define Transaction/Event keys
    3. Assign this condition type to pricing procedure - M/08 .Also assign transaction key ZR1 .
    80     1     FRA1     Freight %     70             X                              FR1
    80     2     ZRA1     Freight  in spl GL     70             X                         FRE     ZR1
    4.GL account maintained in OBYC for this new account key -ZR1
    Maintain same conditions for FRA1 and ZFR1.
    5. Goods receipt debits freight amount to separate account
    Hope Help U !
    Regards,
    Pardeep Malik

  • Post freight cost to a different a GL account during 411-K for consignment PO Process

    We are planning to implement PO consignment for one of the client.
    The scenario is, client pays the freight cost to the supplier in advance upon receipt of consignment stock .When consignment stock is moved to own stock (411k), during the movement of the stock we need to create two accounting entries one for the material cost and the other for freight cost such that the freight can be adjusted with advance paid freight cost. Freight cost can be settled manually with another PO but the requirement is moving average price of the material should include the  cost of material  and freight cost .
    For an example if the material cost is $100(PB00) and freight cost is $10(FAR1 - 10%), during 411k it  should create  two entries one for material cost($100) and the other for freight cost($10) which can be adjusted manually.
    We tried by adding freight condition (FRA1) in consignment info record along with PB00 –Gross price and in this case during 411k it is summing both the prices($110) and posting to one GL account and the same settles during MRKO  but what we are looking for is how we can split this into $100 and $10 .
    I know standard SAP does not support this this during 411k.
    I want to know if there is any User exit, pricing procedure, routines, etc...  Or any other way that can be used to achieve this requirement. Appreciate more detailed answer

    Hi,
       As you know, currently the delivery cost are not supported in consignment and pipeline settlement. The system design is explained in the note: 208555 - MB11 Delivery costs for pipeline and consignment.
       If you want delivery cost in consignment, you have to go for development. There should be additional entry for delivery costs in RKWA table. I am not sure about the feasibility, but still would like to share the below points:
       For creating additional entry in the accounting document while doing MB1B / MB11, you may check the BADI AC_DOCUMENT.
       You may refer the note: 165647 - Documentation: Enhancement RMVKON00 (MM-IV) which explains some enhancements related to consignment settlement.
    Regards,
    AKPT

  • Add freight cost in a cross company code scenario using a costing sheet

    Dear Forum,
    I will like to add freight cost to a material using a costing sheet. The freight percentage is very easy to add and works fine when the cost is added in the company code costing. My problems start when I want to add the freight in the cross-company code costing. I want to setup a cross-company code costing where the freight cost is added to the material in the buying company code and not on the selling company code. The cross-company code costing is setup using special procurement costing keys. 
    In below costing (CK11N) the procurement costing key is not used.
    From the itemization it is shown that purchase info.record 5300067643 is read and the price of 12,97 is determined. There is added 10% in freight coming from the costing sheet.
    The freight is shown in the cost component structure as well.
    The special procurement type is now changed from ‘20’ to ‘AT´ on the MRP2 screen in the material master. The procurement is now pointing to an internal plant called ‘DCN’.
    The costing of material 105050 is now repeated. I get the expected result from changing the procurement key, as I can now see the material is sourced from plant ‘DCN’. DCN is sourcing the material from BJ07, but that is not relevant for the example.
    If I now look at the itemization again on the costing in BGA1 I now see that the price is not coming from the info.record. It is the costing in DCN that is used.
    I will still like to add the freight cost in BGA1.
    How do I add freight cost in BGA1 when I at the same time want to have the costing to be taken from plant DCN?
    Please let me know if you need additional information on the customizing setup of the system.
    Best regards,
    Kim Hjorth Poulsen

    Hi Srinu,
    Thank You for a prompt feedback.
    I have tried to follow Your advise. The special procurement costing key is customized like below.
    I have updated the special procurement costing key on the costing 1 view of the material master. When costing the material it is using the special procurement key. This can be seen from the qty. structure tab in CK11N.
    It is also costing cross company as intended.
    The itemization looks like below.
    and the cost component structure looks like below.
    Unfortunately the freight is not added in the costing in BGA1.
    I noticed that when the costing is made without special procurement key the costing sheet used in the costing is for material components. If the costing is made with the special procurement keys the costing sheet used is for finished and semi-finished materials. The customizing in both of the costing sheets are the same, but only when costing is without the special procurement keys the freight is added.
    So unfornutely Your suggestion did not solve the problem.
    Best regards,
    Kim

  • Freight cost to be copied from Sales order

    Hi
    I settling freight cost via third party PO .
    In an SO  i have setup the freight as service line items , so a Pr will be created for these items subsequently a PO will be created for each line item .
    In this PO i need to capture the freight price from the sales order . in other words i want a specific price to flow from SO directly to PO( the price in SO can be manually entered  or condition based ).
    i tried using a calculation routine for this . I was trying to pass the SO no to the pricing structure but on adding KDAUF and KDPOS to structure KOMP  the fields have no value in it. 
    Can you please help me in passing the sales order no and item no to the structure .
    Thanks

    Hi ,
    I am afraid its a bit complicated ... I have 4 costs involved with a sale of a stock item   plant to port freight , sea freight ....etc . All these 4 freights can have different vendors .
    the doc flow is like this
    SO ->  PO -GR (Accrual  ) - IV ( Miro ) On miro the actual costs a capture till GR i am using a planned costs
    The planned costs are entered in the SO ( generally via contion record) this planned cost should flow into the PO
    the conditions you mentioned are SD conditions . I am not looking for a manual . I have to automate the PO creation and possible GR   on  Goods issue of the actual stock item

  • Stock Transfer Order - Post freight cost in diff. G/L of the material cost

    Hi Friends,
    I created PO (stock transfer Plant to plant). In condition I added
    standard price and Freight cost. When I received material in
    receiving plant the freight cost was added in total stock valuation of
    receiving plant.
    In Plant to Plant transfer I want to see only stock value without
    freight cost in receiving plant. We want freight cost in other G/L different of the material cost.
    Best Regards,
    Edgardo Delgado

    Hi
    Futher to Imdarpan statement, normally we will have different pricing procedure for STO's for the reason you are mentioning with this procedure for freight you can define acct key & accrual if reqed seperately & while posting respective documents it will not go to material cost it will get accounted in different G/L account.
    If you are not maintaining accural tick in condition it will get added to material cost, just maintain this in freight condition.
    Regards

  • Adding Addictive Cost to avoid Plant to plant cost discripency

    Hello gurus,
    We have a situation where Plant 1  recieved a sub contracted material which has Freight charges included as we maintained freight orgin group in one plant and we dont maintain freight orgin for plant 2.
    So now the issue is when i try to add addictive cost for plant 2 i am unable to do that can somebody tell me step by step process to add the Freight cost it is one time and specific to this material only.
    I do not want to extend freight orgin group to the costing sheet of plant 2. so please help me how do i add addictive cost here.
    while adding addictive cost i do not see item category overhead, Can some one help step by step process .
    Thank you
    Prasad

    Prasad,
    Go to CK74n
    Step 1-Enter the material number and Plant number
    Step-2- Enter the category usually it should be V but it can be anything else as well
    Step-3- Enter the Amount and lot size, cost element
    Save it
    remember to save it 2 times
    And go to ck40n or ck11n to do cost run.
    Thank You
    Hrusikesh

  • Post freight cost in diff. G/L of the material cost Accnt Cat. E

    Hi MM experts,
    I created a PO in reference to Sales Order (account assignment E-Trading materials)
    In condition I added a custom condizion for freight (SPRO Cond.category B, flag on accruals).
    When I received material the freight cost was added in total stock valuation.
    Account    Account short text             Amount Trs
    174020     STOCK M  VENT DIR                 576,03     BSX
    319500     FACT/REC                                 476,03-    WRX
    171090     Cte pass.stock march               476,03     EIN
    171090     Cte pass.stock march               576,03-    EKG
    422000     TRANSPORT                             100,00-    Z03
    319500     FACT/REC                          100,00     ZMA
    I want to see only stock value without freight cost in G/L account. I want freight cost in other G/L different of the material cost.
    I expect that the result is as follows:
    174020     STOCK M VENT DIR                  476,03     BSX
    319500     FACT/REC                                 476,03-    WRX
    422000     TRANSPORT                             100,00-    Z03
    319500     FACT/REC                                 100,00     ZMA
    Is there any other way to avoid this problem?
    Thank you very much.
    Regards,
    Michela

    Hi Michela,
    This is possible by adding one more condition type with blank condition category and negative value in plus/minus field.
    please refer the following wiki which gives step by step configuration.
    Appreciate if it is useful
    http://wiki.sdn.sap.com/wiki/display/ERPLO/PostingplanneddeliverycosttoNon-inventoryaccount
    Edited by: Raja Ramasamy on Apr 14, 2010 7:20 PM

  • LE-TRA Freight Costs on Re-dispacth

    Dear friends,  I'd like to count on you all to figure out how to solve one problem faced here.
    Well, several customers are closed when the truck lives the plant  and the truck do not drop the good in the customer side. the truck return to the plant and the customer will be contacted on next day and the truck go there again.
    A new freight cost must be created, but how to handle the new freight cost (re-dispatch) in LE-TRA keeping the relation with the actual Sales Order and so on ? does anyone has this scenario ?
    best regards,
    Alessandro

    Hi
    I understand that you would like to put an additional charge as the customer dint accept in first delivery and since its a second attempt for delivery.
    You may have several approches.
    1. Create a condition type and enter the value on the condition in shipment cost .
    2. Use user exits in the shipment planning to flag if its rescheduling and re planning and based on that you may have some % of actual delivery cost added up in shipment cost.
    This can also be addressed several ways depending on business need
    Thanks
    Sudhakar

  • Freight Cost not reflecting in MIRO for Return PO

    HI MM Experts,
    In standard Return Process we used to enter all the freight charges + base Price in the base Price only but we have a requirement where we have to show these freight charges (-100 INR) seperately other than base Price (-1000 INR) and the net price must appear as -1100 INR in PO.
    I have a business scenario in hand where in Return PO different condition types like Insurance, Octroi and Freight cost are not reflecting while creating Credit Memo in MIRO.
    I have created different condition types as mentioned above and Condition category as "F- Freight" is used and also used a routine 164 in Calculation type  in Schema against these conditions to make the conditions negative (to make sure that all the above mentioned conditions must be added in base Price in PO).
    In PO, all conditions are reflecting correctly and adding to the base Price. In GR also Return accounting is also happening correctly but in MIRO when i am trying to make credit memo then system only showing base price and taxes it is not reflecting other condition types (Insurance, Octroi and Freight ) in MIRO.
    If anyone have any idea how to get these freight cost, insurance and octroi cost in MIRO then please reveret back.
    Regards,
    Neeraj

    Hi Neeraj,
    Before to answer this, once you are in MIRO, into the "PO reference" tab, do you have selected the option: 3 Good/services items + planned delivery costs?
    This option is in the top on this tab in the right side.
    Please, let me know your feedback.
    Kind regards,
    Sandra

  • STO pricing- FREIGHT COST NOT CAPTURED IN ACCOUNTING DOC

    Hi...
    I HAVE a requirement where i have to transport Material from one plant to another withen the same company code using sto delivery root,
    the freight cost shoud be captured in seperate GL account, thus i have maiantined FR1 in pricing and assigned FRC1 condition type, i have maintained FRC1 as stastical as i dont want the freight cost to be added to material cost,
    when i create STO and add FRC1 condition type, and do goods issue the price in the FRC1 condition type is not getting captured in the accouing document..
    i have maintained OBYC setting  for FR1 as well
    Could anyone tell me where am i going wrong.

    HI,
    Check your Pricing Procedure in M/08 whether you have given FRE for your Act Key & FR1 for your Accrls key in your Freight Condition type FRC1 & also check the G/L account assignments in OBYC for the same.
    Thanks & Regards,
    SAP FC

  • Shpmnt Freight Cost varies(extra/short material)

    Hello,
    We have recently implemented Shipment freight cost for Inbound Shipments. Shipment cost is calulated based on weight.
    The issue we are facing is:
    If In an Inbd/delivery there are two HU and each having 100 cartons(total shipment 200 cartons) and weight is 1000Kg per HU, so assmue total cost of the entire shipment (two HUs) is 2000 USD.
    Shipment cost document is created and enter the cost as 2000 USD for entire shipment.
    Now While PGR for first HU (inbound delivery) we found that qty is 110 car inplace of 100 cartons,
    System calculate the Freight cost as 1100 USD and while PGR of the 2nd HU(inbound delivery) we found the correct qty 100 cartons and system calculate the freight cost as 1000 USD.
    The problem is actual shipment cost is 2000 USD whereas system is calculating 2100 USD.....
    Has anybody this issue earlier, please share your experience....
    Regards,
    JPS

    Hi Michela,
    This is possible by adding one more condition type with blank condition category and negative value in plus/minus field.
    please refer the following wiki which gives step by step configuration.
    Appreciate if it is useful
    http://wiki.sdn.sap.com/wiki/display/ERPLO/PostingplanneddeliverycosttoNon-inventoryaccount
    Edited by: Raja Ramasamy on Apr 14, 2010 7:20 PM

  • Multiple account assignment for distribution of freight cost in MIRO Transaction

    Hi MM Gurus
    I have created one Purchase order with multiple account assignment for Asset 'A' in which freight cost is added.
    I have done good receipt in which only material document is generated. (No financial document generated).
    While doing the MIRO for the same Purchase order I m not able to view delivery cost for the same.
    I  check this thing in SDN but no concrete solution ..
    My question is how to capture delivery cost in Multiple account assignment Purchase roder
    Regards
    Amit

    Hi,
    You have done goods receipt for Asset PO but no accounting document created. Now cross check in t.code:OME9 and find GR Non-Valuated check box selected which cause your concern on why your accounting document created for goods receipt for Asset PO!
    Check how delivery cost designed for your Asset Purchase, may be in your case - delivery cost added  to your asset purchase- which result, you could not find delivery cost in invoice posting!
    Regards,
    Biju K

  • Free goods but want to freight cost updation upon GR

    Hi,
    Scenario:
    I have a PO with 20 line items and header freight cost.
    There are few more items in PO which are ticked as free goods.
    There is a stock of those materials with certain MAP.
    Freight condition has been configured as vendor GR so that it gets loaded on materials upon GR.
    Requirement is that
    Upon GR of this PO,MAPshould get updated with the freight cost for those materials also which have been marked as free goods.
    How this can be achieved ?
    Regards,
    manOO

    Hi Rang,
    Thanks for the feedback.However service PO is out of scope as client do not want to go for servicees.
    I could not understand your suggestion
    <u>you give PO to frieght vendor for freight value & in remarks you mention reciving as FREE GOODS from vendor xxxxx & do GR load cost to material & pay to freight vendor. (this is not advisible, but one solution for your problem).</u>
    I have to receive one material via purchase order as a free item but I need to pay vendor for the freight charges that will be incurred to ship this item along with all the other items in the same PO.
    Can you please explain me further as what you mean to say in your post.
    I should be able to load these freight cost on all the materials in PO including the material with 'free' indiactor.
    In short upon GR MAP should affect with freight cost as there will not be value addition of the material since received as free.
    Please suggest.
    Thanks in advance
    Regards,
    manOO

  • Purchase Order's Freight cost

    Dear All,
    I'm using SAP B1 2007B SL 0 PL 15. I have problems with the Freight cost on the distribution rule. It will not store the store or update the distribution rule code in PO, GR & Invoice. I have to manually tag the distribution rule code in the journal entry after the Invoices are posted. Does anyone face this problem or know how to solve this?
    Regards,
    Ken Seng

    Dear Ken Seng,
    You may check this: Re: AP Invoice type service with 2 profit center and JE without Dist. Rule.
    Thanks,
    Gordon

Maybe you are looking for

  • Class override, how to create the child class and then the base class

    I started to write a program for a smart DMM, the problem is every version of the DMM the company change the communication commend. My idea is to write a child class for every DMM version and every SubVI of the child will override the base class SubV

  • File Download and Mime-Types

    I have some files (txt, xls, rtf, pdf) that need to be downloaded from our site. I have an http link to the files on the web page. I've set mime-types for each file type in web.xml for that web app. I'm using WLS 6sp2 on Windows 2K. I'm using an MVC

  • Trying to use Crystal Reports XI Release 2  to display a report

    I am creating an application in Visual Basic using Microsoft Visual Studio 2005.  I have downloaded the trial version of Crystal Reports XI and I have built my report and have attached to the Crystal Viewer that is on my form in my application.  I us

  • SUBMIT statement using variant

    Hi Gurus, i am trying to use execute a variant , and that variant has to be submitted in memory.(i.e i have three variants A,B,C whenever i run the report using variant A then that fields only has to be passed to memory) , but instead of that , even

  • Increment decrement visible property

    It would appear that (in LV 2012 SP1) the simple numeric control from the Classic palette shows following behaviour when accessing via VI Server: Class Name = "Digital" Increment / Decrement Visible = Error, property not found ?? What ?? It appears t