Billing Copy control-invoice split by material document

Splitting the invoice based on the material Document(ekbe-belnr). Suppose i have 3 material documents for one Purchase order. Based on the 3 material documents, it shpould create  3 invoices. So for this i created a routine. Its for  billing document copy control. But my routine is combining all the material document quantities and it creating only one invoice but i required multiple invoices based on no of material document. i wrote code like this. Its urgent..
FORM daten_kopieren_901.
  TABLES:  kna1.
  DATA : v_kunnr TYPE kunag,
         v_katr2 TYPE katr2,
         v_belnr TYPE ekbe-belnr,
         v_bewtp TYPE ekbe-bewtp.
  DATA: BEGIN OF it_zuk1,
            modul(3) VALUE '904',
            vtweg LIKE vbak-vtweg,
            spart LIKE vbak-spart,
            belnr LIKE ekbe-belnr,
            vgbel LIKE vbrp-vgbel,
        END OF it_zuk1.
  TYPES:BEGIN OF t_ekbe,
           belnr TYPE ekbe-belnr,
           bewtp TYPE ekbe-bewtp,
           flag  TYPE c,  "Rajiv
        END OF t_ekbe.
  TYPES:BEGIN OF t_vbap,
           vbeln TYPE vbap-vbeln,
           posnr TYPE vbap-posnr,
       END OF t_vbap.
  TYPES:BEGIN OF t_vbep,
             banfn TYPE vbep-banfn,
          END OF t_vbep.
  TYPES:BEGIN OF t_eban,
            ebeln TYPE eban-ebeln,
            ebelp TYPE eban-ebelp,
        END OF t_eban.
  STATICS:i_ekbe TYPE STANDARD TABLE OF t_ekbe.
  DATA: wa_ekbe TYPE t_ekbe.
  DATA: i_vbap TYPE STANDARD TABLE OF t_vbap.
  DATA: i_vbep TYPE STANDARD TABLE OF t_vbep.
  DATA: i_eban TYPE STANDARD TABLE OF t_eban.
  SELECT vbeln posnr FROM vbap INTO TABLE i_vbap
                          WHERE vbeln = vbak-vbeln.
  IF sy-subrc = 0.
    SELECT banfn FROM vbep INTO TABLE i_vbep
                    FOR ALL ENTRIES IN i_vbap
                     WHERE vbeln = i_vbap-vbeln
                     AND   posnr = i_vbap-posnr.
  ENDIF.
  IF sy-subrc = 0.
    SELECT ebeln ebelp FROM eban INTO TABLE i_eban
                    FOR ALL ENTRIES IN i_vbep
                     WHERE banfn = i_vbep-banfn.
  ENDIF.
  IF sy-subrc = 0.
    SELECT belnr bewtp FROM ekbe INTO  TABLE i_ekbe
              FOR ALL ENTRIES IN i_eban
                   WHERE ebeln = i_eban-ebeln
                   AND   ebelp = i_eban-ebelp.
endif.
  LOOP AT i_ekbe INTO wa_ekbe WHERE flag NE 'X'.
    IF ( ( wa_ekbe-bewtp = 'E' ) OR  ( wa_ekbe-bewtp = 'R' ) OR
                                        ( wa_ekbe-bewtp = 'Q' ) ).
      it_zuk1-vtweg = vbak-vtweg.
      it_zuk1-spart = vbak-spart.
      it_zuk1-belnr = wa_ekbe-belnr.
      it_zuk1-vgbel = vbrp-vgbel.
      wa_ekbe-flag = 'X'.
      MODIFY i_ekbe FROM wa_ekbe TRANSPORTING flag.
      vbrk-zukri = it_zuk1.
      EXIT.
    ENDIF.
  ENDLOOP.
  REFRESH: i_vbap,i_vbep,i_eban,i_ekbe.
ENDFORM.

Hi Ramana,
I'm afraid this is not possible. Correct me if I'm wrong: You have a TPO scenario in which you create a purchase order for a sales order item. This purchase order may have multiple GR? As billing is based on the sales order position (which is only one) there is no way to split this one position into multiple lines for each GR. This would only work if there is a 1:1 relation between sales order item and GR!
Regards,
John.

Similar Messages

  • Problems with bill copying control and materials with variant configuration

    Hi experts,
    I have a problem with a bill copying control and the way that my customer is trying to create and print the Bill (VF01).
    Let me explain...They have in a Sales Order a material with variant configuration per position, each one can have many characteristics. This characteristics must be printing on the billing document, creating different bills 'coz the max. lines number is 18, so the bill must change page per material-characteristics.
    Example:
    Max. Number Lines = 3
    Position 10      
    Material A     
         -Characteristic A
         -Characteristic B
         -Characteristic C     (Bill 1) 
         -Characteristic D
         -Characteristic E
         -Characteristic F     (Bill 2)
    Position 20
    Material B     
         -Characteristic A     (Bill 3) counting characteristics upside
         -Characteristic B
         -Characteristic C
         -Characteristic D     (Bill 4)
    I created on Tx VOFM (Data Transfer-Billing documents) a routine trying to control this jump, but my problem is when I'm creating the Bill document (VF01) this work only by position, the debugging enter per position.. so I don't have any control to tell the program must count the characteristics and create another bill.
    So... Somebody can help me..or have any idea to solve this problem.....
    Thxs a lot!!!!
    Diego Helfer

    HI Diego
      For our coming assignment, we do have similar sort of situation. Currently we are in Requirements Gathering phase.
      Though we do not have Variant Configuration in place, we do have restriction for no..of items to be used for printing in Billing Documents.
      Current proposal is that we will restrict at Sales Order Creation. If the number of items are increasing, we will restrict saving the document and loading has to be done again. As itz better to restrict at initial phase.
      Our schema is One Sales Order -> One Delivery -> One Billig Document.
       Will post if we can manage to acheive some other way and do request you the same.
    Kind Regards
    Eswar

  • Does pricing type have any effect in Delivery to billing copy controls

    Hi,
    Does pricing have any effect on delivery to billing copy controls, for example pricing type, since there is no pricing related data in delivery.
    iF the billing is maintained as delivery related billing, will pricing type has any effect.
    Thanks
    Keshi

    Yaa, It is a good question.
    If the billing is maintained as delivery related, its all about the qty of the material to be billed after delivery. (setting maintained at VOV7).
    Even though the delivery doesnt have any pricing relevant data, the pricing type has an important effect.
    Of course it is maintained at delivery to billing copy control, but u have to see where u are finding the pricing type field. It is in the copy control item level for TAN. So it is not relevant to the delivery transaction any more, it is relevant to the item category only.
    So the conclusion here is if the item category is relevant for billing transaction, after delivering the item, how the pricing is carried out during the billing (whether the same pricing or diff. pricing). This is explained by the pricing type field.
    Hope i answers ur query. if u have any further queries, please post.
    Do reward points if it is useful.

  • Invoice Verification with material document - can we check material doc?

    hi,
    we have Invoice Verification with material documents in MIRO
    is there any way to find out (from MSEG or ekbe maybe) if a particular
    material document was invoiced or not ?
    (without comparing material doc and invoice lines ?)
    thank you,
    Regards,
    michal

    Hi
    Materials Management under Logistics Invoice Verification u2192 Incoming Invoice u2192 Activate Direct Posting to G/L Accounts and Material Accounts
    When you create an invoice containing only items without reference to a PO, the system cannot copy any information (such as currency or invoicing party) from the purchase order. This means that in addition to the document date and the amount, you first have to enter the following information in the header data:
    1. On the Basic data tab page: Currency
    2. On the Payment tab page: Baseline payment date
    3. On the Detail tab page: Invoicing party
    Finally, you enter the item data on the G/L Account and Material tab pages.
    use transaction FB60 to post vendor invoice
    SAM

  • Excise Invoice no. using Material document no.

    Hi Masters
      How to find Excise Invoice no. using material document no.(In my case it is GR No.)
    Regards
    Mohan

    Hi,
    Use: J1I7 , In selection range you can give Excise Group, Excise Transaction Type as GRPO , Vendor Number, Material Document , Material or Purchasing Document , select  Part 1 and part 2 Posted , Off.No is Excise Invoice No entered at the time of Excise Capturing.
    Regards,
    Vikas

  • Unable to create excise invoice against the Material document

    Hi experts,
    Unable to create excise invoice against the Material document in J1IEX transaction.
    Material document is generated through quality management which movement type is 105.
    error message :
    Material document cannot be processed
    Message no. M7130
    Thanks
    SAP MM

    Steps to do GR along with excise,
    1.Capture excise invoice using J1IEX.
    2. Refer excise invoice no. in MIGO(SAP not recommends to post excise invoice against 105 mvmt against blocked stock)
    3. Post excise invoice using J1IEX

  • Copying the VPRS from PGI material document to Billing

    Hi ,
    We have a requirement to copy the cost price VPRS from PGI - Accounting document to the Billing
    I explored some configuration in copy controls by putting the Price source as E which will copy the cost price from the PGI to the Billing
    But i found that it will do only when the Material price control in the Material master is V and not for S ( not sure there may be other settings also)
    The scenario is , Order will be created ( lets say) in May and the dellivery is done in June
    Mean while at the end of May the cost price will change only for the sales order in MR21 as Special sales order ( only for the order) and PGI is done in subsequent month
    In the next month the price will effect the PGI and when i do the billing, the cost price is fetching from the Sales document and not from the PGI
    Hope i am clear in explaining the requirement
    Please let me know if there is any standard configuration available
    regards,
    santosh

    Hi,
    Hi in copy control delivery to billing at item level
    Maintain PRICING TYPE - N (Transfer pricing components unchanged, NEW COST)
    kapil

  • Copy Control for splitting items

    Here is my situation...  a single delivery will contain multiple truckloads.  The business process cannot avoid that, and transaction VLSP (subsequent delivery split) is not an option to avoid that.  However, we must split the Pro Forma invoices out by truckload.  At first glance, this doesn't seem difficult.  Simply use a Data Transfer Copy Control routine to put the truck's trailer number into VBRK.  That way, each item will align to the right truck, and the Pro Forma creation process will automatically split into multiple resulting billing documents.
    But what about the scenario where a single item on the delivery is shipped on multiple trucks?  Item 000010 has 25 units of Material A.  19 go on Truck 1 and 6 go on Truck 2.  How do I get Item 000010 to go onto two different Pro Formas, with 19 units on one and 6 on the other?
    My best options so far are to process VF01 multiple times, once per truck, and reduce the quantity via the data transfer routine appropriately each time (with something included to figure out which truck is being processed each time), or to do a core code modification to split the delivery item into two items in the ALIPS structure before the data transfer routine is called.
    Am I missing a cleaner wat to solve this?
    Thanks,
    Chris

    hi,
    surely new coding is required for item level Billing plan copying from order to order,
    you can copy the 402 requirement do the changes according to your requirement by the help of ABAPERS.

  • Invoice split with same document type

    Hi Experts,
    Kindly suggest on following issue:-
    Currently we are using two billing types ZBBL  for division 11 & ZDBL for division 12.
    Whenever we do invoice with billing type ZBBL(manual entry) with reference to delivery for 12, system gives error message i.e. ZBBL can not be processed with division 12 & vice versa.  This is OK .
    But if we do VF01 for two delivery document one with division 11 & other with division 12-billing document ZBBL(manual entry) , system splits the invoces. It create two invoices. Again its a standard process.
    So my problem is system is creating two different invoices , one for division 11 & other for 12-but with same billing type.
    How can I make setting so that if system splits into two invoices ,it should create one invoice with ZBBL & other with ZDBL.
    Please advise.
    Thanks in advance.
    Regards,
    Dharminder dalal

    There can be many reasons why your invoices with same sales area are getting split. It many based on:
    - Billing type
    - Billing date
    - Payer
    - Billing unit
    - Terms of payment
    - Incoterms
    - Letter of credit
    Further, if you want analysis, on what bases system is splitting these in invoice. Try following steps:
    - Try using Tcode VF04. Opt for delivery related billing.
    - Select the desired delivery docs in Billing due list. (Press Ctrl Key from keyboard to select multiple lines).
    - Then click on simulation button.
    - Billing Doc Simulate: Billing Doc Overview Screen
    - Select all lines.
    - There first go for Logs, by pressing Log button.
    - If log is fine then, click on Split Analysis button to get split analysis.
    For further reference on Invoice split. Refer SAP Note 11162 - Invoice split criteria in billing document
    So, how to handle this?
    Based on the split analysis amend your copying control for Delivery to Billing in TCode VTFL.
    There many be a possibility that you might need to create customized routine with help of a tech consultant to suffice your requirement.
    Also, refer link - multiple delivery but single invoice for reference/understanding.
    Then to combine the billing. Follow following steps:
    1. Use Tcode VF04. Opt for delivery related billing.
    2. Select the desired delivery docs in Billing due list. (Press Ctrl Key from keyboard to select multiple lines).
    3. Then click on Collective Billing button.
    Regards
    JP

  • Copy Control Invoice - Debit Memo

    Dear All,
    I have some typical problem when i creating the debit memo request with reference to Invoice.
    I have BOM Material in the Invoice i.e. with 2 sub items
    M001 TAQ
    S001   ZCRD
    S002   ZCRD
    i set the copy control to from Invoice to Sales document -- Item category
    If it is TAQ copy as L2W
    And ZCRD as L2W also
    But when i try to create the Debit memo request it is copying TAQ as L2w but not ZCRD as L2W it is copying same as ZCRD..
    Where ZCRD is is relevant for delivery so i didnu2019t want this item category to be copied can any one suggest why it is doing that???
    Thanks
    Sundhu

    Did you check Item category assignment?
    Sub items in BOM have different item category group (in material master record) and it appears you did not properly assign it.

  • Billing Due List - Invoice Split

    Can anyone advise how i can get 2 deliveries to combine into 1 billing?
    While performing the collective billing online, i keep getting invoice split due to assignment no = DO number and no of foreign trade data = internally assigned by SAP during DO creation.  There 2 criterion do not seem to be the splitting criterion stipulated.
    Thanks
    Peter

    Hi Suresh,
    Am curious why std SAP consider foreign trade and assignment no (delivery number) as split criterion. 
    1. Delivery number will always be different for each delivery.  Does it make sense to split based on this?
    2. Foreign trade data number. This is internally assigned by SAP as well and in running number.  Is there a configuration to turn this off at delivery level?
    I would like to know the std SAP split criterion (delivery to billing) before making changes to copy control.
    Thanks
    Peter

  • Copy control invoice - order - KDMAT will not be there

    Hi Experts!
    we create customer orders (in this case credit notes) with reference to an invoice.
    the problem is that the field vbap-kdmat is empty in the copy control and so it could not be filled into the new order.
    in VTAF we use the copy requirement 153 Item from bill.doc.
    in the PO tab of the invoice the customer material is filled (manually)
    We don't have set up information in VD51 but we fill the customer material with some information and this should be copied into the returns.
    does anyone have an idea how to get the copy control working?
    I tried to change the 153 to 151 where the source says:
        vbap-kdmat = cvbap-kdmat.
    but without the value in vbap (it is empty while executing this code) the field will remain empty.
    Thank you in advance
    Regards
    Daniel Hermann

    hi
    billing level PO tab customer material number comes through order , here table also VBAP, so actually this PO tab all fields are display mode only ,
    when enter the sale order item PO tab level enter the customer material number , then pass to same billing level ,
    when billing level you enter manually this data fet at VBAP table only ,
    so you assign the copy routine 151 then on kdmat copy billing to credit memo order OR we maintain same kdmat  in main order its copy to billing then also copy credit memo also
    do this
    regards
    sankar

  • Pricing type in billing copying control

    Hi All,
    For copying control from delivery to billing document, the pricing typee is set as "Z' which means customer reserve.
    Usually it is standard SAP option like A, B, G etc.
    But in this case it is Z. Where can i find out what is the coding for "Z"? Where is the coding for "Z" done?
    Thanks
    Sonalika

    Hello,
    the customer own pricing types can be realized in userexit.
    FORM userexit_pricing_rule in program RV61AFZA.
    Please have a look in teh program RV61AFZA.
    The standard pricing types are includes in program LV61AA12.
    I hope that the information are helpful.
    regards
    Claudia

  • Excise Invoice Capturing thru Material Document

    Hi Gurus,
    When i am trying to capture Excise Based on Material document i am getting a Error
    "PLA-AT2 amount 18.05.2009 is greater than available amount".
    How to rectify.
    Thanks in advance
    Ganapathy.V

    Hi Vikas,
    I made a PO for a material with excise.
    At the time of GR i have not recd the Excise Copy from the Vendor.
    So i made the GR by Selecting create with Excise Entry.
    Now i rece the Excise Copy.
    I want to do the part 1-Capturing of Excise in J1iex Capture Excise
    After that my Excise department will Check and Post the Part2 in J1iex Post the Excise invoice.
    This is the Scenario.
    Now i am getiing the Error in Capturing Stage.
    Tks/Rgds
    Ganapathy.

  • Link between invoice number and material document number

    I need a way to get the list of material document numbers which correspond to a particular invoice.  Is there a way to find this information?  I am looking [looping] at table EKBE during a user exit in SAPMV60S but I need to restrict the entries by a range of (multiple) material document numbers.
    Regards,
    Davis

    It looks like you're missing a piece of code.
            SELECT SINGLE * FROM BKPF WHERE BUKRS = Z_EKKO-BUKRS AND
    *                                       BELNR = EKBE-BELNR AND
                                            AWKEY LIKE X_KEYFLD AND
            CHECK SY-SUBRC = 0.
    The SELECT just ends at the "AND".
    Should there be another line after the "AND"?
    You said you had an invoice number; why can't you use that in your WHERE clause to limit what is returned from BSEG?
    What field are you using for the invoice?
    I had mentioned BKPF-XBLNR before, which we use to store the vendor invoice on a PO, but what you are doing sounds different.  Are you referring to an invoice that you created?
    I think that this might be in BSEG-REBZG, and you should be able to filter on this field.
    Shouldn't such an additional filter give you what you want?
    e.g.
    if the invoice specification is a single value:
    * Getting the Vendor Invoice header data
      SELECT SINGLE * FROM bseg WHERE bukrs = z_ekko-bukrs AND
                                      belnr = bkpf-belnr AND
                                      hkont = '0000416000' AND
                                      rebzg = invoice
    or, if the invoice specification is a range or list:
    * Getting the Vendor Invoice header data
      SELECT SINGLE * FROM bseg WHERE bukrs = z_ekko-bukrs AND
                                      belnr = bkpf-belnr AND
                                      hkont = '0000416000' AND
                                      rebzg IN s_invoice
    If you are not using rebzg, then do the same against whatever field you are using.
    Good luck
    Brian

Maybe you are looking for

  • Syncing issues with Windows 7...

    I cannot get my iphone to sync anymore once I updated to Windows 7. The computer bogs down and the iphone times out shortly after syncing a few songs. I have read about this problem and have tried a few fixes but nothing seems to be working for me. E

  • Crystal reports server 2008 VI questions

    I aplogixze if I am asking many questions in the same thread. If so please let me know. and I'll create seperate threads. Questions with Crystal reports server 2008 VI 1. In my current VS2005 web application with CR 2008 developer I have done the fol

  • Java Thread : How to run a method using Thread

    hi, I have a method which i need to run with thread. Is there any way to do that. I have a code like below public class parentClass extends Thread{ public static void main(String[] args){ ThreadClass threadClass = new ThreadClass() Thread th = new Th

  • Address Indepndent communication in SAP CRM

    Hi I am trying to create a BUSINESS PARTNER in CRM. I have US country inserted by default in address independent communication screen of the Business Partner. I don't want US to appear. I don't want any country to appear by default. How do  execute i

  • Exception in AdminRealm servlet, help needed

    I am trying to install the WebLogic LDAP realm, but I get an exception when I try to test the LDAP realm using the AdminRealm servlet. Through wlpsadmin, I managed viewing groups and search users, but the LDAP tab displays no values and I could not l