Force free item (TANN) in the sales order?

Is there any way to force a free item (TANN category) to be added to a sales order (VA01)? Standard configuration cannot be used because users want the item to be added after they have filled in an custom (Z) field on a line.
With standard free goods determination free item is added immediately after user hits [Enter]. But in this case they enter data for the line, hit [Enter], SAP goes through all its stuff and only then the field becomes available. After they fill in the field and hit [Enter] SAP doesn't go back to the same place where normally free goods are determined.
Could I use some flag to fool the program into going back or is there an FM that I could call? Does anyone know where exactly standard free goods determination is performed?
I've been debugging the whole day, so your help will be trully appreciated. Thanks!

Thanks for your response. Basically yes, they want just to add a free item to the order, it's just not based on the material entered (otherwise standard would have worked fine) but on the custom "deal" field.
User expectations are along these lines:
1. User enters material, quantity, sales unit.
2. Use goes to the tab 'Additional data B' on the item
3. User enters 'Deal" and hits Enter (or goes back to the overview screen).
4. Free item appears.
The problem is that standard free goods determination happens between 1 and 2. Nothing happens between 3 and 4.

Similar Messages

  • SD - Manual entries allowed for item category in the Sales Order

    Hi experts,
    please do you know any OSS note related to SD, in order to increase the number of Manual entries allowed for item category in the Sales Order (table T184)?
    Thank you very much
    Andrea

    Hi,
    I searched OSS notes and did not find any OSS Note related to add more than 11 Manual Item categories or append T184 Table.
    Has any found solution for this, will this be a CORE MOD.
    Pavan Verma

  • Condition populated twice in the item conditions in the sales order

    Hi,
    We are creating the sales order through .csv flat file. The program calls the relevant BAPI which creates the sales order. It also fills the amount from the file for the manual condition type YNET in the pricing procedure. YNET is defaulted automatically in the sales order. But maintaining value is not mandatory.
    The problem is in sales order, YNET is displayed twice in the item conditions.
    One YNET with no value and another YNET with value which we passed through file.
    Any suggestions how we can get only one YNET in the item conditions in the sales order or how the value from our file can be added against the YNET in the pricing procedure with showing another YNET in the item conditions in the sales order
    Thanks in advance,

    Hi Ramakrishnan,
    Thanks for your reply. Its a manual condition type. No condition records maintained.
    Thanks,
    Ram
    Original thread:
    Hi,
    We are creating the sales order through .csv flat file. The program calls the relevant BAPI which creates the sales order. It also fills the amount from the file for the manual condition type YNET in the pricing procedure. YNET is defaulted automatically in the sales order. But maintaining value is not mandatory.
    The problem is in sales order, YNET is displayed twice in the item conditions.
    One YNET with no value and another YNET with value which we passed through file.
    Any suggestions how we can get only one YNET in the item conditions in the sales order or how the value from our file can be added against the YNET in the pricing procedure without showing another YNET in the item conditions in the sales order
    Thanks in advance,

  • Incompletion log Profitability Segment at item level in the Sales Order

    Hello Sapians,
    We recently activated the "Sales Order value flow to COPA". When we create the Sales Orders the Profitability segment for the item is getting picked up automatically and have no issue in saving the Sales Order.
    But when we edit the Sales Order and then try to save it, Sales Order has incompletion log which is leading to Profitability segment in the item level.
    When I click the little box in Sales Order Item > Account Assignment tab> Profitability Segment forward arrow--> "continue" or "derivation" in the populated screen, then the Forward arrow in the profitability segment is deriving the characteristics, then system lets us to save the Sales order with out any incompletion log.
    I checked the OSS notes 114520, in this OSS note, my sitiuation is exactly first point but could not get any clue how to resolve automatically.
    Why it is happening only when we edit the Sales Order? How to update bulk of Sales Order automatically?
    Any inputs?
    Thank you.

    Hi
    Since you have activated the Sales order flow to COPA, any change in the sales order triggers a Prof Segment redetermination.... Thats why you are able to save it once you redetermine the Prof Segment....
    Ideally, if no Chars like Plant/Org Elements/etc are changed - It need not trigger the Prof Segment redetermination...
    Refer  Note 729381 - When is a profitability segment supposed to be determined?.... With ref to this note, raise an OSS msg to SAP and check if it is possible to avoid the redetermination of PSG as long as none of the relevant chars are changed in the sales order....
    There is a similar issue in MTO where by, even if you change the Header text of sales order, it triggers the Sales order cost estimate.... SAP provided a note to stop this... Note 1548608 & 1260868.... Your case is similar to this.... Raise an OSS to SAP and ask them if they can provide such a note for your case.... I feel, it should be possible for SAP to give this!
    br, Ajay M

  • Re: Printing Cancelled line items in the sales order on the packing slip

    Hi gurus,
    Currently we have a unique requirement in our company. Our wholesale customers send the Purchase order to us via EDI. Now saw they have requested an order containing 10 materials out of which we can fulfill only 8. the other 2 due to some reasons cannot be fulfilled.
    So the business wants to keep the other 2 line items to be entered in the sales order with a cancelled status.
    Now correct me if I am wrong, only the confirmed line items will be copied from a sales order to a delivery document. So thats the reason why these cancelled line items cannot be printed on the packing slip.
    However somehow the business wants the packing slip tp have the 2 line items printed on it with the reason of not being delivered. this is to facilitate the customer to know why those items couln't be fulfilled by our company. Now we cannot use a manual work-around of letting the customer know about the impossibility of not fulfilling the other 2 items as there are a lot of orders that come thru EDI per day.
    Can anyone suggest a solution to this requirement asap.
    Thanks in advance
    Vinit

    Hi Vinit,
    This requirement makes a lot of sense, that is to be able to inform your customer that some item(s) of the sales order could not be delivered, not even partially.
    A possible solution would be to allow for zero quantity in the delivery item (check customizing and mark "zero quantity allowed" in the item category).
    Then in the packing split, it would be easy to print the delivered quantity (0) and the sales order quantity (whatever it was), because you have the "null" item available in the delivery.
    Personally I am not found of having have delivery items with zero quantity, but they are useful in that case, and they can also be useful to automatically "close" the sales order item (instead of having to do it manually if the goods can't be served).
    Note: Usually in Consumer Goods, if you can't serve part of a sales order to a customer, you have to close it, because the Retailer's next Sales Order will include the remaining quantity.
    Hope it helps.
    Best Regards,
    Franck Lumpe
    Freelance SAP ERP Consultant

  • Free Goods not appearing in the Sales Order

    Hi,
    I have created the condition record for Exclusive free goods for a material. However when i create a sales order with the same material, the free goods materials is not appearing.
    I did a Free goods Analysis in the sales order and when i checked the field values, I found that for a particular access sequence it says "Access not made ( initialized field)"
    Please help.
    Thanks.

    Hi,
    This error usually happens when we donot maintain any of the fields in the access sequence that we use.For Eg., if your access sequence is Sales Org/Dist Channel/Mat group and if you fail to maintain your condition record with the same sequence,you will get this error.Please maintain the condition record with the respective access sequence and you will not get this error.Please try and confirm.
    (Also in the above example even if you maintain condition record and didnot maintain material group in the materisl master you will get this error.So check all the possibilities and confirm.)
    Regards,
    Phani Prasad.

  • How to find the text id for the text in the sales order

    Hi all,
    How to find the text id for the item-text in the sales order?
    There are different Text available in  the sales order under item like Warehouse instruction, CSR instruction...
    I want to know the corresponding Text id for the text ELECTRONIC ORDER COMMENT.
    Table TTXID contains the validation of the Text id.
    Please help me in knowing the way to identify the text-id from the text list..
    Thanks foryour help
    Suresh Kumar

    U can fetch the texts for the items using
    Read_text.
    Example:
        g_f_tdname = xvttp-vbeln.
        g_f_obj = p_obj.
        g_f_langu = 'DE'.
        REFRESH g_t_lines.
        CLEAR g_t_lines.
        CALL FUNCTION 'READ_TEXT'
             EXPORTING
                  id                      = p_var
                  language                = g_f_langu
                  name                    = g_f_tdname
                  object                  = g_f_obj
             TABLES
                  lines                   = g_t_lines
             EXCEPTIONS
                  id                      = 1
                  language                = 2
                  name                    = 3
                  not_found               = 4
                  object                  = 5
                  reference_check         = 6
                  wrong_access_to_archive = 7
                  OTHERS                  = 8.
        IF sy-subrc <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    The Required fields are,
    Text-id ,language,name,object.
    Let me know if you further require help.
    Regards

  • Adding Variant in Header Level in the Sales Order

    Field "Card Verification Value" (CVV) is part of the Standard from Support Package SAPKH47028 onwards. But if you like you can use a variant for screen SAPMV45A4440 and set
    field "Card Verif.Code" to invisible in this variant.
    This is the reply from SAP after implementing the new support pack. Now there is an additional field in VA01 that I am trying to remove.
    I can add the variant in Table Settings but that is on Item Level in the Sales Order (VA01). How do I do it in Header Level?

    Hi,
    Go to SHD0 ,write down the Transaction code , transaction variant then go to Tab " With Processing'.
    Now you will be in T Code VA01 ,press enter and you will get all the variants maintained in Header Level.
    Now you can activate / deactivate as per your requirement.
    Best Regards,
    Ankur

  • Purchase requisition got deleted in the sales order..

    Hi All,
    I got stuck up with an issue in AFS.
    The issue is that after creating a P.O with the help of a TAB order,the user has assigned a rejection reason at the item level in the sales order.
    Then again the rejection reason was removed and now the purchase requisition is not appearing in the sales order.
    Now how can i get back the purchase requisition??Is there any option to retreve the purchase requisition with the help of a correction report??
    Can any one please help me out..
    Thanks.

    Many thanks for your answer. It help me to solve the issue.
    So applying note 738171, with transaction OVB5 (or VOFM, requirements->subsequent functions->Purch.requisitions) we create one new requirement, ie RV07A900, and then we apply the rule that if we have delivery or billing block, that is, VBAK-LIFSK or VBAK-FAKSK not empty, then we set an error with a code similar to this:
                da_sy-msgid = 'Z1'.    (message class)
                da_sy-msgno = '001'.  (message number)
                error_exception = true.
    and then the PR is not created.
    Regards.

  • How to include both items and service on Sales Orders

    Hello experts,
    I have a client who wants to include extra handling charges such as gift wrapping charges on their sales order in addition to regular items that is on the sales order.
    If I create the sales order as a Item/Service Type ='Service'. I can select the correct G/L account for this Sales Order. But if I create the sales order as a Item/Service Type ='Item', then I can only select items and not the sales order.
    The client wants to include both the items and service in the sales order. Is there a way to do this in SAP B1?
    Michael

    Hello Michael,
    I think you may create Service type items to include both by Item Type documents.
    Thanks,
    Gordon

  • Free Goods - Not showing in sales order as subsequent item

    Dear Gurus,
    I have created a Free Goods procedure determination and maintained it at Customer/ Material level in VBN01.
    The procedure is inclusive as follow:
    For every 100 units purchased, the customer gets 10 units free
    However at sales order level there is no indication at all that the Free Goods are being triggered.
    When I check the pricing procedure, the condition record NA00 that I have used doesn't show-up.
    There is no subsequent item in the sales order under the main item showing the Free-Goods discount.
    Could you please help me go through the customizing process to correct the error?
    Many thanks for your help
    Chris

    Hi,
    FYI
    Free goods can be configured in SAP by following two methods.
    (1) Manually
    (2) Automatically
    Manually: By specifying higher level item category for a line item we can determine free goods as a free of charge
    items during sales order processing.
    Automatically: System proposes free of goods automatically in the sales order. In automatic free goods
    configuration system follows two methods.
    (1) Exclusive
    (2) Inclusive
    Exclusive: System configures free goods in exclusive option like free goods quantity is going to be excluded in
    order quantity. Ex: For 10 items 1 item is free. Then system configures free goods as 10 + 1.
    Inclusive: System configures free goods in inclusive option like free goods quantity is going to be included in order
    quantity. Ex: For 10 items 1 item is free. Then system configures free goods as 9 + 1.
    NOTE: In exclusive method other items also can be given as a free of charge items for order item.
    Configuration steps: INCLUSIVE
    SAP follows condition technique to configure free goods automatically.
    Maintain pricing procedure
    Path:
    IMG
    Sales and distribution
    Basic functions
    Free goods
    Condition technique for free goods
    Maintain pricing procedures
    Choose free goods procedure NA0001 and select it
    Click on copy icon on application tool bar and rename it Ex: SRI001
    Condition type is NA00 and Access sequence also NA00
    Save it and Exit
    Activate free goods determination
    Path:
    IMG
    Sales and distribution
    Basic functions
    Free goods
    Condition technique for free goods
    Activate free goods determination
    Go to new entries
    Specify our sales area, document pricing procedure, customer pricing procedure and specify our free goods
    procedure Ex: SRI001
    Save and Exit
    Control free goods pricing
    Path:
    IMG
    Sales and distribution
    Basic functions
    Free goods
    Control free goods pricing
    Control pricing for free goods item category
    Choose item category TAN from position button
    Specify the pricing as X = Pricing standard
    Choose item category TANN from position button
    Specify pricing as B = Pricing for free goods (100% discount)
    Save and Exit
    Maintain condition type for 100% discount
    Path:
    IMG
    Sales and distribution
    Basic functions
    Free goods
    Control free goods pricing
    Maintain condition type for 100% discount
    Check whether condition type R100 is available or not (R100 = is 100% discount)
    Exit
    Maintain pricing procedure for pricing
    Path:
    IMG
    Sales and distribution
    Basic functions
    Free goods
    Control free goods pricing
    Maintain pricing procedure for pricing
    Choose our pricing procedure form position button and select it
    Click on control data icon under dialog structure
    Include condition type R100 between the steps of discounts.
    Specify requirement = 55 and Routine No: 28 (100% discount) in Alt. CBV.
    Save and Exit
    Requirement 55: The Routine No. 55 is assigned to condition type R100. If the user wants to look both revenues
    and sales deductions for the free items since the product that we are going to give as a free of charge item can be
    sold separately in the same sales order. Then the item category of free goods TANN has the pricing value as B.
    Then the system calculates value of the free goods as 100% discount as we discussed above the same material [that
    is going to be given as a free of charge item]. Some times the same item is going to be given as a normal item.
    Then system calculates price for normal item and system should not calculate price for same item [free of charge
    item]. So as to perform this calculation we have to assign Requirement/Routine 55 is to assign condition type
    R100.
    Alt CBV = 28: [100% Discount] Condition type R100 should be taken as a ZERO value. The formula 28
    calculates condition type R100 value as a ZERO.
    Set Transfer of cost to Main item: [Copy control]: Transaction code: VTFL
    Copy control is a concept by which the system copies the data from source document to target document.
    Path:
    IMG
    Sales and Distribution
    Basic functions
    Pricing
    Free goods
    Control free goods pricing
    Set transfer of cost to main item [copy control]
    Choose Billing type F2 Delivery document type LF from position button
    Select it and click on itemicon under dialog structure
    Choose item category Ex: TAN
    Click on details icon
    Click on display or change icon
    Choose item category as TAN again
    Select it and click on details icon
    Check cumulative cost
    Save and Exit
    Cumulative cost controls whether the cost value (VPRS) is to be copied from relevant sub items into main items.
    Sub items cost are not relevant for billing.
    Maintain copying control: Transaction code: VTAA
    Path:
    IMG
    Sales and Distribution
    Basic functions
    Free goods
    Control free goods pricing
    Maintain copying control
    We maintain copy control at item level category for free goods. In this field we can control whether the
    free goods should also be transferred when we copy from one document to another document.
    Choose source document type as QT and target document type as OR from position button
    Select it and click on item control button under dialog structure
    Choose AGN item category from position button
    Click on display or change button
    Again click on AGN
    Click on details icon
    Check Re u2013 explode structure/Free goods
    Save and Exit
    This indicator controls whether the free goods are copied from source document to target document or redetermined
    again.
    Maintain condition records for Free goods [INCLUSIVE]: Transaction code: VBN1
    Path:
    Logistics
    Sales and Distribution
    Master data
    Conditions
    Free goods
    VBN1 u2013 Create
    Specify condition type NA00
    Click on key combination
    Specify all the data
    Choose inclusive by clicking the INCLUSIVE/EXCLUSIVE push button
    Specify the Material No., Minimum order quantity (Ex: 10), Specify [from] the free goods quantity (Ex:
    10), Unit of measure u201CEAu201D (Each), Free goods (are free goods) as u201C1u201D.
    Calculation procedure: We can specify the Routines for calculation procedure as 1 or 2 or 3
    1 = Pro u2013 Rata (Proportionate): Ex: If the customer places order for 100 cases of material u201CXu201D, then customer
    receives 20 cases of same material as free. That means, the business can say that buy 100 and get 20. If the
    customer orders for 162 cases, then system automatically grants 32 cases as a free of cost (162x20/100 = 32 Cases).
    2 = Unit of reference: When customer orders for 100 cases of material u201CXu201D, then the customer receives an
    additional 20 cases as a free of goods. That means business can say that buy 100 get 20 free by granting 200 free
    for every full of 100 cases. The customer places order for 162, then system automatically grants only 20 cases
    (100x20/100=20).
    3 = Whole unit: When a customer places order for 100 cases of material u201CXu201D, then the customer receives additional
    20 cases of material u201CXu201D as a free of goods item. The business can say that buy 100 and get 20 free of charge items.
    If the customer orders for increment of 100 that means 200 (100 + 100) items, then he gets 40. If he placed the
    order for 101 u2013 199 items he gets only ZERO.
    Save and Exit
    Condition record for EXCLUSIVE: Transaction code: VBN1
    Path:
    Logistics
    Sales and Distribution
    Master data
    Conditions free goods
    Specify the discount type u201CNA00u201D
    Click on key combination
    Click on Choose inclusive by clicking the INCLUSIVE/EXCLUSIVE push button
    Specify the sales organization, distribution channel
    Specify customer number and validity periods, material, minimum quantity, order quantity, unit of
    measure, calculation procedure, free goods (3)
    Specify additional material free goods (if other goods is going to be given as a free of charge item.
    Save and Exit
    Go to VA01 and raise the sales order for INCLUSIVE and EXCLUSIVE.
    See the Free Goods effect.
    Condition type NRAB = Free goods: Requirement = 59, Alt CBV = 29: [only for INCLUSIVE purpose]
    Requirement 59: We have to assign requirement 59 to the condition type NRAB. If the customer buys 100 cases
    of product u201CXu201D, then he receives 10 cases of the product free. If the user would not like the additional line item in
    the sales order for free goods rather than the discount of the 10 cases is represent in the same line item as other 90
    cases. If the free goods discount should not apply on credit for returns that do not make reference in the previous
    document.
    Alt CBV 29: The condition type NRAB is to be assigned with 29 formula to support inclusive free goods
    agreement where the user would have to apply the discount to the order item rather than having a sub item
    generated for the free quantity.
    Ex: The customer orders for 100 cases of product u201CXu201D, 10 cases are free instead of having a free sub item generated
    b the system to represent the free 10 cases, the user would like to have a discount applied to the 100 cases line item
    equal to the value of the 10 cases.
    NOTE: Free goods can only be configured on document category type u201CCu201D (OR). That means we cannot configure
    free goods on Inquiry and Quotation.
    Header Conditions
    SAP has delivered two kinds of condition types: (1) Header conditions
    (2) Item conditions
    Header conditions: The value of the header condition applies to the whole items in the sales document.
    Header conditions do not have any access sequence.
    So that, value of the header conditions should be maintained manually.
    Ex: HA00, HB00
    Configuration settings:
    Include condition types HA00, HB00 in V/08 in between the discount condition types.
    Go to VA01 and raise the sales order
    Select line item and go to Go to button
    Header Conditions
    Include condition type HA00 HB00 with values [HA00 is percentage discount and HB00 is absolute
    discount]
    If HA00 = 1%, then system applies 1% on base value on all items in the sales order.
    If HB00 = 100/- Rupees, then system applies 100/- Rupees proportionately to all items in the sales order. If sales
    order has two items, then system applies 50/- Rupees to each item.
    Click on activate button
    Go to item condition screen
    Check how system applied header conditions for line items
    NOTE: Make sure that sales order contains more than one item.
    Condition Scales
    We can maintain scales for each and every condition type. So that we can determine pricing conditions values
    depending upon the range of the order quantity.
    Ex: If you maintain condition record for PR00 for material one as a 100/- Rs. For 1 material, then we can maintain
    scales for this material like below:
    From Quantity Price
    1 u2013 10 1000
    11 u2013 20 999
    21 u2013 30 998
    31 u2013 40 997
    Configuration settings:
    Go to VK11
    Maintain condition record for PR00
    Select line item and click on scales icon on the application tool bar
    Maintain scales and scale rates accordingly
    Save and Exit
    Go to VA01 and raise the sales order
    Enter the order quantity according to the scale and see the scale effect
    Regards,
    Siva

  • Promotion number in the sales order for free goods promotion.

    Hi,
    I have a business scenario in which "Sales Orders are created" for the customers in SAP IS Retail System.(This is for helpdesk ordering). In most of the occasions, free goods promotion would be running. The free goods promotions(exclusive) are maintained using promotion module in IS Retail system(condition type NA00). In this situation, the promotion number is not getting populated in the sales order automatically. Is there any specific configuration required or any BADI needs to be activated?
    Note: Free goods item is getting generated automatically in the sales order with item category TANN.
    Can any one advice pls.
    Thanks and Regards,
    Selvakumar

    Hi selva
    1)Check in Change Promotion T.code - WAK2
    in the item level   Promotion announcement category(Ann column) - set indicator as F     Promotion announcement
    2)Check sales periods dates - Sales order from to TO it should be valid date
    if not works, reply me i will give some more solutions
    regards
    Satish

  • Sample Material in the 3rd Line item of the Sales Order

    Hi,
    We have configured the system in the sales order as follows.
    1. Commercial Material
    2. Bonus Material.(ie Free Material)
    Now, i want to add the 3rd line item in the sales order as Sample with different Material number. How go about this. kindly let me.
    Regards
    Ravi

    Hi there,
    Enter the material in the sales order & change the item catg manually in VA02.
    But free goods & sample materials are dealt differently..
    Freegoods is entered as TANN item catg along with nornam TAN item in standard order OR.
    But sample materials or free of charge items are processed through different order type FD for eg.
    Even thought the item catg proposed in FD is TANN,, the whole process will not have pricing as TANN items arenot relevant for pricing.
    Regards,
    Sivanand

  • Free Good Qty as non modifiable field in the Sales Order Level

    Dear Friends,
    I have successfully done the config change for the Free Goods, But now i want make the free good line item qty as a non modifiable field in the Sales Order Level.
    How can i do this.. Please advice.
    Thank U,
    Uwanthi

    Hi
    This is a standard behaviour in the system
    kindly use the below program and user exitexit
    MV45AFZZ and use "Userexit_filed_modification"
    Regfards
    Damu

  • Production Order and Internal Order for each item of the sales order

    Hi
       I am developing Make To Order Report where I have to display the MTO Line Items and non MTO Line Items. For non MTO Line Items I have to display Internal order with Planned and Actual Costs and also Production Order with Planned and Actual Costs. Could anybody tell how to get the Internal order no and production order with Planned and Actual costs for each line item for a sales order.
    Thanks
    Naga

    Hi,
    You can get the Production orders, Planned orders, Internal orders generated for Sales order item from AFPO table (use fields KDAUF-Sales order number & KDPOS-Sales order item). Then to identify the order type use order category (AUTYP) from table AUFK.
    Once you have the Production/internal order, you can ge the cost from COSS and COSP table. Use the object number from AUFK to get the cost entries from COSS & COSP.
    You can use the following sample code as reference.
    Hope this is helps.. (Don't forget to mark it... )
    Form GET_COSTS                                                       *
    Get the material cost, labour hours and the labour cost for the      *
    sales order material.                                                *
    There are no interface parameters to be passed to this subroutine.   *
    FORM GET_COSTS.
      DATA V_OBJNR LIKE AUFK-OBJNR.
    DATA v_menge LIKE vbap-kwmeng.
      SELECT SINGLE OBJNR
        INTO V_OBJNR
        FROM AUFK
       WHERE AUFNR EQ AFPO-AUFNR.
      SELECT * FROM COSS
       WHERE OBJNR EQ V_OBJNR
         AND WRTTP IN ('01', '04'). " p_wrttp. "Labour Cost ( Plan, Actual)
        PERFORM GET_VALUES_FROM_COSS.
      ENDSELECT.
      SELECT * FROM COSP
       WHERE OBJNR EQ V_OBJNR
         AND WRTTP IN ('01', '04')         " p_wrttp
         AND KSTAR NE '0000510033'. " EQ p_kstar2.      "Material Cost
        PERFORM GET_VALUE_FROM_COSP.
      ENDSELECT.
    Get the unit cost of the production order by dividing the production
    cost by the order quantity. The result will be multiplied by the
    GL posting qunatity (Delivery quantity) to get the production cost
    for the quantity being deluivered.
      IF NOT AFPO-PSMNG IS INITIAL.
        OUT_REC-LABOUR_HOURS_ACT = OUT_REC-LABOUR_HOURS_ACT / AFPO-PSMNG.
        OUT_REC-ADDNL_LABOUR_HOURS_ACT =
                          OUT_REC-ADDNL_LABOUR_HOURS_ACT / AFPO-PSMNG.
        OUT_REC-LABOUR_HOURS_PLN = OUT_REC-LABOUR_HOURS_PLN / AFPO-PSMNG.
        OUT_REC-ADDNL_LABOUR_HOURS_PLN =
                         OUT_REC-ADDNL_LABOUR_HOURS_PLN / AFPO-PSMNG.
        OUT_REC-LABOUR_COST_ACT = OUT_REC-LABOUR_COST_ACT / AFPO-PSMNG.
        OUT_REC-ADDNL_LABOUR_COST_ACT =
                         OUT_REC-ADDNL_LABOUR_COST_ACT / AFPO-PSMNG.
        OUT_REC-LABOUR_COST_PLN = OUT_REC-LABOUR_COST_PLN / AFPO-PSMNG.
        OUT_REC-ADDNL_LABOUR_COST_PLN =
                         OUT_REC-ADDNL_LABOUR_COST_PLN / AFPO-PSMNG.
        OUT_REC-MATERIAL_COST_ACT = OUT_REC-MATERIAL_COST_ACT / AFPO-PSMNG.
        OUT_REC-ADDNL_MATERIAL_COST_ACT =
                         OUT_REC-ADDNL_MATERIAL_COST_ACT / AFPO-PSMNG.
        OUT_REC-MATERIAL_COST_PLN = OUT_REC-MATERIAL_COST_PLN / AFPO-PSMNG.
        OUT_REC-ADDNL_MATERIAL_COST_PLN =
                         OUT_REC-ADDNL_MATERIAL_COST_PLN / AFPO-PSMNG.
      ENDIF.
    Multiply the calculated Unit Production costs with the GL quantity to
    get the actual production cost of the quantity delivered.
    Calculation for Labour Hours
      OUT_REC-LABOUR_HOURS_ACT = OUT_REC-LABOUR_HOURS_ACT *
                                 OUT_REC-QUANTITY.
      OUT_REC-ADDNL_LABOUR_HOURS_ACT = OUT_REC-ADDNL_LABOUR_HOURS_ACT *
                                 OUT_REC-QUANTITY.
      OUT_REC-LABOUR_HOURS_PLN = OUT_REC-LABOUR_HOURS_PLN *
                                 OUT_REC-QUANTITY.
      OUT_REC-ADDNL_LABOUR_HOURS_PLN = OUT_REC-ADDNL_LABOUR_HOURS_PLN *
                                 OUT_REC-QUANTITY.
    Calculation for Material Cost
      OUT_REC-MATERIAL_COST_ACT = OUT_REC-MATERIAL_COST_ACT *
                                  OUT_REC-QUANTITY.
      OUT_REC-ADDNL_MATERIAL_COST_ACT =
          OUT_REC-ADDNL_MATERIAL_COST_ACT * OUT_REC-QUANTITY.
      OUT_REC-MATERIAL_COST_PLN = OUT_REC-MATERIAL_COST_PLN *
                                  OUT_REC-QUANTITY.
      OUT_REC-ADDNL_MATERIAL_COST_PLN =
          OUT_REC-ADDNL_MATERIAL_COST_PLN * OUT_REC-QUANTITY.
    Calculation for Labour cost
      OUT_REC-LABOUR_COST_ACT   = OUT_REC-LABOUR_COST_ACT *
                                   OUT_REC-QUANTITY.
      OUT_REC-ADDNL_LABOUR_COST_ACT = OUT_REC-ADDNL_LABOUR_COST_ACT *
                                  OUT_REC-QUANTITY.
      OUT_REC-LABOUR_COST_PLN   = OUT_REC-LABOUR_COST_PLN *
                                  OUT_REC-QUANTITY.
      OUT_REC-ADDNL_LABOUR_COST_PLN = OUT_REC-ADDNL_LABOUR_COST_PLN *
                                  OUT_REC-QUANTITY.
    Get the planned material cost from the total of the planned cost of
    the component materials in the production order confirmations.
      SELECT BWART MENGE MATNR SHKZG FROM AUFM
        INTO (AUFM-BWART, AUFM-MENGE, AUFM-MATNR, AUFM-SHKZG)
       WHERE AUFNR EQ AFPO-AUFNR.
        CHECK AUFM-BWART NE '101'.
        READ TABLE I_MBEW WITH KEY MATNR = AUFM-MATNR
                                   BWKEY = AFPO-DWERK.
        IF SY-SUBRC NE 0.
          SELECT MATNR BWKEY ZPLPR LPLPR PEINH
            FROM MBEW
            INTO I_MBEW
           WHERE MATNR EQ AUFM-MATNR
             AND BWKEY EQ AFPO-DWERK.
            APPEND I_MBEW.
          ENDSELECT.
        ENDIF.
        IF SY-SUBRC EQ 0.
          IF I_MBEW-ZPLPR NE 0.
            IF AUFM-SHKZG EQ 'H'.
              OUT_REC-PLANNED_MATERIAL_COST =
              OUT_REC-PLANNED_MATERIAL_COST +
                           ( I_MBEW-ZPLPR * AUFM-MENGE / I_MBEW-PEINH ).
            ELSE.
              OUT_REC-PLANNED_MATERIAL_COST =
              OUT_REC-PLANNED_MATERIAL_COST -
                           ( I_MBEW-ZPLPR * AUFM-MENGE / I_MBEW-PEINH ).
            ENDIF.
          ELSEIF I_MBEW-LPLPR NE 0.
            IF AUFM-SHKZG EQ 'H'.
              OUT_REC-CURRENT_MATERIAL_COST =
              OUT_REC-CURRENT_MATERIAL_COST +
                           ( I_MBEW-LPLPR * AUFM-MENGE / I_MBEW-PEINH ).
            ELSE.
              OUT_REC-CURRENT_MATERIAL_COST =
              OUT_REC-CURRENT_MATERIAL_COST -
                           ( I_MBEW-LPLPR * AUFM-MENGE / I_MBEW-PEINH ).
            ENDIF.
          ENDIF.
        ENDIF.
      ENDSELECT.
    Get the Future material cost per Unit by deviding the calculated
    Future material cost above with the goods reciept quantity to, then
    multiply the unit cost with the GL quantity to get the Future material
    Cost for the Quantity delivered. (Quantity in the entery from GLPCA
    Table).
      IF NOT AFPO-WEMNG IS INITIAL.
        OUT_REC-PLANNED_MATERIAL_COST =
           OUT_REC-PLANNED_MATERIAL_COST / AFPO-WEMNG * OUT_REC-QUANTITY.
        OUT_REC-CURRENT_MATERIAL_COST =
           OUT_REC-CURRENT_MATERIAL_COST / AFPO-WEMNG * OUT_REC-QUANTITY.
      ENDIF.
    ENDFORM.                               " GET_COSTS
    Form GET_VALUE_FROM_COSP                                             *
    Get the Material cost from COSP table.                               *
    There are no interface parameters to be passed to this subroutine.   *
    FORM GET_VALUE_FROM_COSP.
      FIELD-SYMBOLS: <FS> TYPE ANY.
      DATA: V_COMPONENT TYPE I.
    Cummulate the posting values of all the 16 period buckets as to get
    total production order cost. This is to handle the aprtial posting of
    prodction order values in diffrent periods.
      V_COMPONENT = 15.
      DO 16 TIMES.
        ADD 1 TO V_COMPONENT.
        ASSIGN COMPONENT V_COMPONENT OF STRUCTURE COSP TO <FS>.
        IF COSP-WRTTP EQ '04' AND COSP-KSTAR EQ P_KSTAR2.
          ADD <FS> TO OUT_REC-MATERIAL_COST_ACT.
        ELSEIF COSP-WRTTP EQ '04'.
          ADD <FS> TO OUT_REC-ADDNL_MATERIAL_COST_ACT.
        ELSEIF COSP-WRTTP EQ '01' AND COSP-KSTAR EQ P_KSTAR2.
          ADD <FS> TO OUT_REC-MATERIAL_COST_PLN.
        ELSEIF COSP-WRTTP EQ '01'.
          ADD <FS> TO OUT_REC-ADDNL_MATERIAL_COST_PLN.
        ENDIF.
      ENDDO.
    ENDFORM.                               " GET_VALUE_FROM_COSP
    Form GET_VALUES_FROM_COSS                                            *
    Get the Labour cost and Labour hours from the COSS table.            *
    There are no interface parameters to be passed to this subroutine.   *
    FORM GET_VALUES_FROM_COSS.
      FIELD-SYMBOLS: <FS1> TYPE ANY,
                     <FS2> TYPE ANY.
      DATA: V_COMPONENT1 TYPE I,
            V_COMPONENT2 TYPE I.
    Cummulate the posting values of all the 16 period buckets as to get
    total production order cost. This is to handle the aprtial posting of
    prodction order values in diffrent periods.
      V_COMPONENT1 = 15.
      V_COMPONENT2 = 111.
      DO 16 TIMES.
        ADD 1 TO: V_COMPONENT1, V_COMPONENT2.
        ASSIGN COMPONENT V_COMPONENT1 OF STRUCTURE COSS TO <FS1>.
        ASSIGN COMPONENT V_COMPONENT2 OF STRUCTURE COSS TO <FS2>.
        IF COSS-WRTTP EQ '04' AND COSS-KSTAR EQ P_KSTAR1.
          ADD <FS1> TO OUT_REC-LABOUR_COST_ACT.
          ADD <FS2> TO OUT_REC-LABOUR_HOURS_ACT.
        ELSEIF COSS-WRTTP EQ '04'.
          ADD <FS1> TO OUT_REC-ADDNL_LABOUR_COST_ACT.
          ADD <FS2> TO OUT_REC-ADDNL_LABOUR_HOURS_ACT.
        ELSEIF COSS-WRTTP EQ '01' AND COSS-KSTAR EQ P_KSTAR1.
          ADD <FS1> TO OUT_REC-LABOUR_COST_PLN.
          ADD <FS2> TO OUT_REC-LABOUR_HOURS_PLN.
        ELSEIF COSS-WRTTP EQ '01'.
          ADD <FS1> TO OUT_REC-ADDNL_LABOUR_COST_PLN.
          ADD <FS2> TO OUT_REC-ADDNL_LABOUR_HOURS_PLN.
        ENDIF.
      ENDDO.
    ENDFORM.                               " GET_VALUES_FROM_COSS

Maybe you are looking for

  • How to change number of records displayed in Web service: Query_view_data

    Hi experts I´m using webservice Query_view_data to fill a Xcelsius model with data. The Bex Query contains appr. 300 records but the webservice returns only 50 records. When I test it it says "displaying 50 of 312 records". When I tried ABAP FM RRW3_

  • Bridging AIR-AP1131AG with TP-Link

    Hi Guys, Today I want to build a wireless bridge using AIR-AP1131AG (running WLC) and TP-LINK wireless router. The result is failed. May I know AIR-AP1131AG is support bridging the wireless connection with other vendor's access point or not? In the T

  • Embedded Flash not working on Safari/Google Sites not just my system

    Hi- This issue is not limited to my system. First some information on my system: Intel based iMac OS X 10.6.5 Safari Version 5.0.2 (6533.18.5) Site affected: www.trpeters.com I uninstalled Flash Player and reinstalled the latest version 3 times yeste

  • Po tax related data

    hi experts,                can u tell me where the tax related data is stored(tables) for the po created

  • Ref cursor question

    Hi, I have stored proc that takes pl/sql table as IN parameter and returns a ref cursor. Data from pl/sql table is separated into two table type objects ... oType1 and oType2 based on some condition. following works fine... If oType1.Count > 0 then