When line item materials are same add the condition rate.

HI!
Im my smartform I am trying to get the unit price for the line items. There are are certain scenerions where my code faisl because the billing doc is prepared with multiple sales order which has several materials eneterd twice or thrice . SO as per my code the net value is getting added up for the identical materials but the condition rate is not adding up so when I do teh calculation to get the unit price it gives me wrong values. Like if theer are 3 materials in the billing doc with net price as 5000 each with eachs condition value for the tax is 500  then my code calucltes teh total for 3 items (identical ) as 150000 which is right but I have to substeract the condition value from this as teh condtion value is a tax and that is alreday included in teh net price so   we substarct, hence in this case it should do 15000 - 3*500 but unfortunately it does only 15000 - 500 , I beleive it takes the condition rate only for the last item found and substract that but i need to include all teh three items value so I get correct unit price.
Following is teh code I used. I need to add functionality such that the gs_it_kond_w-kwert  gets added up each time the material number is same. so that i get the correct unit price.
loop at  is_bil_invoice-it_kond into gs_it_kond_w where
      bil_number = wa_it_gen-bil_number and
      itm_number = wa_it_gen-itm_number .
    if gs_it_kond_w-kntyp = 'D'.
      gs_unit_price = ( gs_it_cont-netwr - gs_it_kond_w-kwert ) / gs_it_cont-fkimg.
      gs_it_cont-netwr = gs_unit_price * gs_it_cont-fkimg.
      is_bil_invoice-hd_gen-bil_netwr =  is_bil_invoice-hd_gen-bil_netwr  -  gs_it_kond_w-kwert .
    else.
      gs_unit_price = gs_it_cont-netwr / gs_it_cont-fkimg.
      is_bil_invoice-hd_gen-bil_netwr = is_bil_invoice-hd_gen-bil_netwr.
    endif.
  endloop.
  endif.
Thanks

Hi Aarav,
I am not sure how your code behaves but, you can try following ways:
1.  To ensure that if material for different line item is same, you can put a join on KONV, VBAK and VBAP as KONV-KNUMV = VBAK-KNUMV and VBAK-VBELN = VBAP-VBELN and KONV-KPOSN = VBAP-POSNR. After this, you can loop through the data extracted, sort it with material number and check for repeated materials and from KONV, you can get condition value and condition type etc.
2.  To ensure that you are considering tax deductions each time a certain material is repeating, you can calculate net value at each material using its calculation type (KONV-KRECH) (percentage or fixed value) and condition value (KONV-KBETR or KONV-KWERT) without checking whether it is repeated or not. So, in the end, you will have exact net value and you will not miss any deduction.
Let me know if this helps and also, for any clarifications.
Gouri.

Similar Messages

  • Line item and header records in the same infopackage

    Gurus,
    I wanted to check how can I make sure that I get all the line item documents in the same package with the header document record in the same infopackage? Is there some setting for that? If I am writing a custom extractore how can I make sure of this in ABAP?
    Thanks
    AK

    Dear AKBW,
    This is not very clear why you want to use same infopackage for line-item as well as header data. Normally there are 2 different datasources for line item and for header data.
    Say you are woking with Sales Order Data in ECC.
    So Line-item datasource for sales order data - 2LIS_11_VAITM
    and Header datasource for sales order data - 2LIS_11_VAHDR.
    Now as they are 2 different datasource, so you must need 2 different infopackages.
    Now if you have created one custom datasource in ECC, then just check if its extracting line-item level or header level data. Normally when we create any custom datasource, we try to make it line-item level, to have all the itemwise detail. Though its not mandatory.
    So if you have 2 different datasources (SAP or Custom), you definitely need 2 different infopackages.
    Please let me know, if you still have any more doubt. You can also give me the other detail of the custom datsource you are creating.( type, fields, what it is supposed to extract etc)..

  • PO Line item attachments going along with the PO o/p to Vendor!

    Hi all,
    We are on SRM 5.0 ECS SP 13.
    I had one question regarding the attachments in the PO line items.If I attach documents at the PO Line item and sent the PO o/p to vendior through e-mail,then all the attachments at the PO line item also go along with the o/p..Is this is  a  std behaviour in SRM 5.0?
    Also if i need to avoid sending of the PO line item attachments along with the PO o/p to the vendor,then I guess the "Internal" indicator for the documents need to be set rt?Is there any way the documents at the PO line item can be set as "INTERNAL"?
    I know this is achived in SRM 6.0 and above and there is an OSS note which mentions that.
    Has anybody worked on something similar?Please share your eperiences/suggestions.
    Thanks!

    HI,Rads:
         I think you should do the inhancements in this situation. I met this question in my last case .Follow is my suggestions ,maybe helpful .
        The   BADI NAME:BBP_OUTPUT_CHANGE_SF(Document Output)
      YOU should chage the code .If you do 't  send the attachment to the vendor ,you should set "Space ",jut like this :
      WHEN 'BUS2200'.
          CV_SMARTFORM = 'ZBBP_BID_INVITATION'.
          CV_SMARTFORM_MAIL = 'ZBBP_OUTPUT_COVER'.
          "exclude attachment
          CS_PARAMETERS-ATTACH_IND = SPACE.
       Then  the attachment will not been sent out ,you can try .
    Alex !
    Bestregards

  • Grey out profit center when line item is entered in VA01

    hi all,
    i have to set profit center in display mode when line item is entered in sales order processing, please tell me the exist where i can put my code.
    please reply
    with regards,
    bala

    hi bala,
    Please check this,
    u can create enhance point in that routine.
    first click on enhancement button (shift+F4) then
    use menu path edit->enhancement operation->show implicit enhancement operation
    after that it start showing line like that in USEREXIT_PRICING_PREPARE_TKOMP
    -> """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    right click on the line and enhancement implimentation and create, it will create enhancement point at that particular place.
    use this coding in ur enhancement spot
    IF  (   SCREEN-GROUP2  = 'LOO'
       AND SCREEN-NAME    = 'VBAP-PRCTR' ).
      SCREEN-INPUT = 0.
    ENDIF.
    it will solve ur problem.
    let me know, if solved
    Yogesh

  • HT1473 when ever i am about to add the file i double click on it and the the box with the documents disapears (windows 7)

    when ever i am about to add the file i double click on it and the box just dissapears does anyone else have this issue? please help me if you did!

    Make sure you are viewing your image at 100%. At smaller views, pixels and layers and the way they interact are approximate interpolations and won't show you the actual pixel-for-pixel changes.

  • Line item attachments were missing for the documents in FB03

    Hi all ,
    i had an issue that within the transaction FB03,  attachments for line items were missing for all the documents that were posted from zprogram (artist statement) but attachments for the header items were displayed .
    Is there any clue why these attachments are missing.
    help me out of this.................!

    Check that that document key has been specified correctly. How are you storing the attachments??

  • How to determine Component materials for PO line item Materials.

    Hello friends,
    I woluld like to know the table name for getting the component Materials of a Purchase Order line item material.
    There is a table called RESB, which is containing the component materials for the PO line item materials. But this table is populating only after creating (saving) the PO.
    But, i have to do some validations on component materials, before saving the PO. For that i would like to know the table, from which the component materials will pick.
    Or
    Please provide some user exit names, which will contain Component materials, during the PO creation.
    Thanks in Advance.

    hi
    header BOM table - STKO ( u need to fetch BOM# from here)
    Item table - STPO ( pass the BOM # here and retreive all the item details)
    try using FM
    CS_BOM_EXPL_MAT_V2
    regards
    kunal

  • Display number of line items in my report at the title bar

    hi,
    i would like to ask, how am i going to add in the number of line items to be display under the title bar above of the SAP. example similar to SE16, where it will show you the number of lines under the bar above.
    may i know how am i going to program it for my report? thanks

    Hi,
               check out the following code........copy-paste....and then....................
    data : it type STANDARD TABLE OF vbak,
           wa type vbak.
    data : ctr TYPE sy-dbcnt.
    data : str(20) type c.
    select * from vbak into table it UP TO 10 ROWS.
      ctr = sy-dbcnt.
      move ctr to str.
    set titlebar 'LIST' OF PROGRAM sy-repid with str.
    loop at it into wa.
      skip 1.
      write wa-vbeln.
    endloop  .
    ................create the title-bar 'LIST' as 'List Details : &'.
    (double-click on 'LIST' ....... 
    give 'TITLE' as 'List Details : &'. ).
    run.....& get solved !!!!!
    Rewards points if helpful..............

  • HT200020 I did the fix but it didn't fix the issue.  It allows me to create the script but when it runs it will not add the user account.

    I did the fix but it didn't fix the issue.  It allows me to create the script but when it runs it will not add the user account.

    Here is all the same setting aside from the user info being created.
    https://www.dropbox.com/s/kkxmhls3bfs6ns3/Apple%20Support%20Installer%20Script.p kg

  • Custom report to identify items that are consigned to the customer directly

    Custom report to identify items that are consigned to the customer directly
    the above requirment related to which module and for this which tables i can use
    pls give some details about this requirment.
    thanx

    Hello,
    I believe you are on the wrong forum. Application Express is a web development tool, and from your questions you probably should look under the E-Business Suite forums (http://forums.oracle.com/forums/category.jspa?categoryID=3).
    Regards,
    Arie.

  • Identify items that are consigned to the customer directly

    pls provide the informaton about " identify items that are consigned to the customer directly"

    Hello,
    I believe you are on the wrong forum. Application Express is a web development tool, and from your questions you probably should look under the E-Business Suite forums (http://forums.oracle.com/forums/category.jspa?categoryID=3).
    Regards,
    Arie.

  • IPC: How to read the Condition Rate(KBETR) in Java checkRequirement method.

    Hi Experts,
    As part of an IPC development, we need to read the Condition Type Rate (KBETR) in a Requirement Formula. The condition rate is the rate for the current record of the pricing procedure, e.g. Condition Type ZAB1.
    I can successfully read the condition rate in a Value formula using this piece of code:
    public BigDecimal overwriteConditionValue(IPricingItemUserExit pricingItem,IPricingConditionUserExit pricingCondition) {
                      BigDecimal ZConditionRate = pricingCondition.getConditionRate().getValue();
    In a Value Formula "IPricingConditionUserExit pricingCondition" is a input parameter of the overwriteConditionValue() method. However in a Requirement formula the standard method checkRequirement(IConditionFindingManagerUserExit item, IStep step, IAccess access) does not have any parameter which can give me the rate.
    I wrote the following logic in the requirement class, but line 2 is not executed.
    1. public boolean checkRequirement(IConditionFindingManagerUserExit item, IStep step, IAccess access) {
         2.  IPricingConditionUserExit pricingHeader = (IPricingConditionUserExit) item;
         3.  BigDecimal ZConditionRate = pricingHeader.getConditionRate().getValue();
    Please suggest how we can retrieve the condition rate in a requirement formula class using teh standard methods & classes.

    Hi,
    I have to set the condition rate as percentage in one of my codition value formula routine which i am developing based on java.
    I have overwritten  the method overwriteConditionValue() in my pricing routine which is 927. My logic is below.
    When I open my quotation using crmd_order, condition rate is not being displayed with % for unit condition rate coulmn in my pricing conditions.
    If I try to change my quotation for ex: Agrred price: xworke, then 927 formula is called and condition rate is displayed as %.
    So condition rate value is displayed perfectly , but when my quotation is in display mode condition rate value is coming as USA, but it should be % irrespective of my quotation is in display mode or change mode. I have attached the two screen shots for quotation display mode and change mode.
    Can some body throw insight what is wrong in my pricing routine logic in setting % condition rate rather than USD for the Condition rate value.
    public BigDecimal overwriteConditionValue(IPricingItemUserExit pricingItem,
      IPricingConditionUserExit pricingCondition) {
      BigDecimal condValue = null;
      BigDecimal discountValue = null;
      try{ 
        BigDecimal xworkg = pricingItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_G).getValue();
        userexitlogger.writeLogDebug(" 927 formula, Date=["+new Date()+"] , xworkg=["+xworkg+"]");
        BigDecimal xworke = pricingItem.getSubtotal(PricingCustomizingConstants.ConditionSubtotal.SUBTOTAL_E).getValue();
        userexitlogger.writeLogDebug(" 927 formula, Date=["+new Date()+"],  xworke=["+xworke+"]");
        pricingCondition.setCalculationType(PricingCustomizingConstants.CalculationType.PERCENTAGE); 
        if (xworkg.compareTo(PricingTransactiondataConstants.ZERO) != 0) {   
        condValue =  xworkg.subtract(xworke);
        pricingCondition.setConditionValue(condValue); 
        // Calculate percentage with 3-decimal-precision (as does ABAP-Version by multiplying with 100.000 instead of 100)
        pricingCondition.setConditionRate(condValue.multiply(PricingTransactiondataConstants.HUNDRED).divide(xworkg,
          3, BigDecimal.ROUND_HALF_UP), "%");
        pricingCondition.setPricingUnit(new BigDecimal(0), null);
        else {
        pricingCondition.setConditionRate(PricingTransactiondataConstants.ZERO, "%");
        pricingCondition.setPricingUnit(new BigDecimal(0), null);
      catch (Exception ex) {
        //pricingCondition.setInactive(PricingCustomizingConstants.InactiveFlag.INACTIVE_DUE_TO_ERROR);
        userexitlogger.writeLogError("Error Occured in 927 formula, reason code=["+ex.getMessage()+"]");
        return null;
      //return condValue;
      return null;
    Thanks
    Srikar

  • For same line item there are two or more values

    Hi Experts,
    I have to modify the output of the report with the VAS indicator (J_3AVATL-J_3ATLTYP). I am using two main internal tables. One for the Header data and another for the item level. For same J_3AVATL-BELNR there are two values for J_3ATLTYP.
    How to update the main internal table for item ?
    Kindly reply at earliest. I will reward for answers.
    Thanks.
    Ravi

    Hi,
    Against one Header data, there would be several line items i.e. 2 or more than 2.
    So there would be some other line item field viz POSNR . You can refer the same for line items.
    If still your question is not answered, then please elaborate your question.
    Best regards,
    Prashant

  • Main Window display when line items are less in next page.

    Hi all,
           In the smartform,if the line items extend to second page, then to print complete main window in second page and if there are only few line items in second page, how to remove the empty spaces in the nmain window and to print other windows after the end of main window.?
    Nagesh

    design ur next page .....
    goto next page reduce the size of the main window and place the other window that u need....
    goto new window that is specified in nextpage , in condition tab check the checkbox(only at the end of main window).....
    here u will get the other windows only in the lage page....

  • All Line Items need to send  in the PO Change EDI IDoC - ORDCHG

    Hi EDI Experts ,
    We have ECC 6.04.
    We are sending PO Change Message Tyep by using Message Type ORDCHG ( Basic Type ORDERS05)
    If PO Changes system trigger IDoc  and in Std IDoc it displays only that Line Item who had been changed .
    Requierment is that  if there is change in any single item, then  sytem should send entire/whole PO document ( all Line Items) .
    I think we need to write some code in teh routine /requierment ...etc.
    Can anyone suggest what I need to do to acehive the above ?
    Thanks
    NAP

    Hello NAP ,
         I have the same problem that you. I ´m using  the message type ORDCHG  with basic type ORDERS05.    when sending change order through Idoc only show me the updete/delete Item in segnment E1EDP01. 
    What object did you use for the message type ORDCHG ?
    What settings should I consider for this?
    Thanks in advance,
    Luis.-

Maybe you are looking for