‎2010 May 06 12:46 AM
Hi,
I have to work with copy control.
My req is --
Based on Payer (customer - KNA1 - custom field value ) I have to split billing document.
1. One billing document per delivery
2. One billing document per material on delivery
For this .. I did copy of routine 007 and replaced the new routine 902.
In this routine I am having the following structures. -
VBAK Order Header KUAGV View Sold-to *
VBAP Order item KURGV View Payer *
VBKD Business data order KUREV View Bill-to *
LIKP Delivery Header KUWEV View Ship-to *
LIPS Delivery item
How to implement logic to split the billing document based on material?
Can anyone tell me the logic how I can achieve this?
Thanks in advance,
Rajesh
‎2010 May 06 2:14 AM
Is this a trick question? You have already mentioned all the ingredients, so just put it together...
Anyhow, since you posted the question, let me try to give a short background. When SAP creates billing documents it basically sorts selected documents by some criteria (as far as I remember it's customer, sales organization and billing type) and then tries to combine as many items as possible for those. Just imagine that for each selected item SAP generates a billing document header and a billing document item. Now if the generated billing document header matches the previously generated billing document header, then the new item is added to the previous billing document.
Now the billing document header field vbrk-zukri can be used to define your own billing document splitting criteria. I.e. if in your example you simply write the material document number lips-matnr to vbrk-zukri (in addition to all the other fields that are relevant in your case - your functional consultant should tell you that and also do the remaining configuration).
Cheers, harald
‎2010 May 06 5:44 AM
Hi,
Refer to the sample code for splitting billing document based on Material No. This code is to be written in the data transfer routine defined in VOFM.
DATA: BEGIN OF ZUK,
MODUL(3) VALUE '901',
VTWEG LIKE VBAK-VTWEG,
SPART LIKE VBAK-SPART,
MATNR LIKE VBAP-POSNR,
END OF ZUK.
ZUK-SPART = VBAK-SPART.
ZUK-VTWEG = VBAK-VTWEG.
ZUK-POSNR = VBAP-MATNR. " Material NO
VBRK-ZUKRI = ZUK.Regards
Vinod