Collective Billing:
Collective Billing combines different documents (orders / deliveries) into a single Invoice document provided certain data specified is common across these source documents. The Header data appearing in billing document must be same. Collective billing is not possible for a sales order and an export delivery. Collective billing can only be carried out for domestic business affairs.The transaction code for collective billing is via VF04.
Collective billing for order-related and delivery-related items :
If you create a sales order with an item which is relevant for billing by delivery and an item which is relevant for billing by the sales order up to now the items could not be grouped together in a billing document.
Order releted billing is done when we proceed directly to the billing from order while doing only the PGI.eg Cash sales
Delivery releted billing is the normal sales cycle where we go to dilivery from order and then to the invoice from delivery.eg normal sales cycle rush order.
1. Problems with the billing date
If a sales order and a delivery are billed together and the date of the sales order (proposal for the billing date) is not equal to the goods issue date (proposal for the billing date), there is a problem with specifying the billing date. If a common billing date is not determined, an invoice split is created.
This problem can be avoided if you specify a default date when creating the billing document.
This problem generally does not occur for period calculations.
You can determine a common billing date (for example, the current date) by creating a new data copying routine xxx (for example, by copying routine '001').
Using transaction VOFM and menu path "Data transfer -> Billing documents", you can copy the data transport routine and change it as follows :
form daten_kopieren_xxx.
:
vbrk-fkdat = sy-datum.
endform.
2. Implement note 40678.
3. Change LV60AF0F.
fakturadaten_auftragsbezogen.
if vbrk-knuma is initial.
* vbrk-fktyp = 'A'. " <- delete
vbrk-fktyp = 'L'. " <- insert
else.
:
form faktura_fakturabezogen.
:
* Positionsverarbeitung ( S C H L E I F E )
select * from vbrp into *vbrp where vbeln = xkomfk-vbeln.
case *vbrk-fktyp.
:
when 'L'.
* perform fakturaposi_fakturabezogen_l. " <- delete
>>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if *vbrp-vgtyp ca vbtyp_verk.
perform fakturaposi_fakturabezogen_a.
elseif *vbrp-vgtyp ca vbtyp_lief.
perform fakturaposi_fakturabezogen_l.
* the following statement is due to compatibility to Rel.2.2*
elseif *vbrp-vgtyp is initial.
perform fakturaposi_fakturabezogen_l.
endif.
<<<<<end of> :
endcase.
endselect.
form fakturaposi_fakturabezogen_a.
:
* Lesen VBAK
* if vbak-vbeln ne *vbrp-vgbel. " <- delete
perform beleg_sperren_vbak using *vbrp-vgbel *vbrp-posnr rc.
check: rc = 0.
if vbak-vbeln ne *vbrp-vgbel. " <- insert
select single * from vbak where vbeln = *vbrp-vgbel.
if sy-subrc ne 0.
xkomfk-fxmsg = '028'.
perform vbfs_hinzufuegen using *vbrp-posnr '028'
*vbrp-vgbel space space.
exit.
endif.
endif. " <- insert
* lesen VBUK des Referenzbeleges
if vbuk-vbeln ne vbak-vbeln. " <- insert
clear vbuk.
select single * from vbuk where vbeln = vbak-vbeln.
if sy-subrc ne 0.
xkomfk-fxmsg = '018'.
perform vbfs_hinzufuegen using *vbrp-posnr '018' space
space space.
exit.
endif.
* Status- und Flusstabellen des Referenzauftrages einlesen
* sofern nicht schon geschehen
perform xvbuk_xvbup_xvbfa_aufbauen.
endif. " <- insert
* endif. " <- delete
4. Change LV60AF0P.
form preisfindung using preisfindungsart.
:
* if xvbrk-fktyp ca 'IL' AND XVBRK-EXPKZ EQ 'X'. " <- delete
>>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if ( xvbrp-vgtyp ca vbtyp_lief and xvbrk-expkz eq 'X' ) OR
* the following statement is due to compatibility to Rel. 2.2*
( xvbrp-vgtyp is initial and xvbrk-fktyp ca 'IL'
and xvbrk-expkz eq 'X' ).
<<<<<end of> xxposnr = xvbrp-vgpos.
endif.
* Grenzübergangswert in Position Exportdaten
call function 'EXPIMP_ITEM_VALUE_MAINTAIN'
exporting
exnum = xvbrk-exnum
expos = xxposnr
grwcu = t001-waers
grwrt = tkomp-grwrt
importing
complete = xxkompl
exceptions
no_export_data = 04.
* IF XXKOMPL NE 'X' OR SY-SUBRC NE 0.
if ( xxkompl ne 'X' or sy-subrc ne 0 )
and tkomp-grwrt ne 0.
xvbrp-uvall = 'X'.
endif.
* IF XVBRK-FKTYP CA 'IL' AND XVBRK-EXPKZ CA 'YZ' " <- delete
* AND SY-SUBRC EQ 0. " <- delete
>>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if ( xvbrp-vgtyp ca vbtyp_lief and xvbrk-expkz ca 'YZ'
and sy-subrc eq 0 ) OR
* the following statement is due to compatibility to Rel. 2.2*
( xvbrp-vgtyp is initial and xvbrk-fktyp ca 'IL'
and xvbrk-expkz ca 'YZ'
and sy-subrc eq 0 ).
<<<<<end of p>
* Lieferung nachlesen
:
form preisfindung_gesamt using preisfindungsart_kopf.
:
* IF XVBRK-FKTYP CA 'IL' AND XVBRK-EXPKZ EQ 'X'. " <- delete
>>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if ( xvbrp-vgtyp ca vbtyp_lief and xvbrk-expkz eq 'X' ) OR
* the following statement is due to compatibility to Rel. 2.2*
( xvbrp-vgtyp is initial and xvbrk-fktyp ca 'IL'
and xvbrk-expkz eq 'X' ).
<<<<<end of> xxposnr = xvbrp-vgpos.
endif.
call function 'EXPIMP_ITEM_VALUE_MAINTAIN'
exporting
exnum = xvbrk-exnum
expos = xxposnr
grwcu = t001-waers
grwrt = tkomp-grwrt
importing
complete = xxkompl
exceptions
no_export_data = 04.
* IF XXKOMPL NE 'X' OR SY-SUBRC NE 0.
if ( xxkompl ne 'X' or sy-subrc ne 0 )
and tkomp-grwrt ne 0.
xvbrp-uvall = 'X'.
xvbrk-uvals = 'X'.
endif.
IF XVBRK-FKTYP CA 'IL' AND XVBRK-EXPKZ CA 'YZ' " <- delete
AND SY-SUBRC EQ 0. " <- delete
>>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if ( xvbrp-vgtyp ca vbtyp_lief and xvbrk-expkz ca 'YZ'
and sy-subrc eq 0 ) OR
* the following statement is due to compatibility to Rel. 2.2*
( xvbrp-vgtyp is initial and xvbrk-fktyp ca 'IL'
and xvbrk-expkz ca 'YZ'
and sy-subrc eq 0 ).
<<<<<end of p>
* Lieferung nachlesen
5. Change LV60AU03.
function rv_invoice_price.
:
* Positionspreisfindung
perform xvbrp_bearbeiten_vorbereiten.
perform preisfindung_vorbereiten using 'P'.
call function 'PRICING_DIALOG'
exporting
comm_text = comm_text
comm_head_i = tkomk
comm_item_i = tkomp
material_text = vbrp-arktx
t185_i = t185
t185f_i = t185f
t185v_i = t185v
importing
comm_head_e = tkomk
comm_item_e = tkomp
t185_e = t185
t185f_e = t185f
tables
tkomv = xkomv.
if tkomp-fxmsg ne space.
konv_geaendert = 'X'.
endif.
modify tkomk index tkomp-ix_komk.
if vbrp-kowrr = space.
move-corresponding tkomp to kompax.
move-corresponding kompax to vbrp.
vbrk-netwr = vbrk-netwr - vbrp-netwr + tkomp-netwr.
vbrp-uvall = space.
if vbrk-exnum ne space and vbrk-expkz eq 'X'.
data: xxposnr like vbrp-posnr,
xxkompl.
xxposnr = vbrp-posnr.
* IF VBRK-FKTYP CA 'IL' AND VBRK-EXPKZ eq 'X'. " <- delete
>>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if ( vbrp-vgtyp ca vbtyp_lief and vbrk-expkz eq 'X' ) OR
* the following statement is due to compatibility to Rel. 2.2*
( vbrp-vgtyp is initial and vbrk-fktyp ca 'IL'
and vbrk-expkz eq 'X' ).
<<<<<end of> xxposnr = vbrp-vgpos.
endif.
call function 'EXPIMP_ITEM_VALUE_MAINTAIN'
6. Change MV60AF0F.
form fcode_pexp using h185f structure t185f
h185 structure t185
h185v structure t185v.
:
case vbrk-expkz.
when 'X'.
xxposnr = vbrp-posnr.
* if vbrk-fktyp ca 'IL'. " <- delete
>>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if ( vbrp-vgtyp ca vbtyp_lief ) OR
* the following statement is due to compatibility to Rel. 2.2*
( vbrp-vgtyp is initial and vbrk-fktyp ca 'IL' ).
<<<<<end of> xxposnr = vbrp-vgpos.
endif.
vbrp-uvall = space.
call function 'EXPIMP_ITEM_DATA_MAINTAIN'
7. Change LV60AF0P.
form preisfindung using preisfindungsart.
:
* if xvbrk-fktyp ca 'IL'. " <- delete
>>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if ( xvbrp-vgtyp ca vbtyp_lief ) OR
* the following statement is due to compatibility to Rel. 2.2*
( xvbrp-vgtyp is initial and xvbrk-fktyp ca 'IL' ).
<<<<<end of> xxposnr = xvbrp-vgpos.
endif.
call function 'EXPIMP_ITEM_VALUE_MAINTAIN'
exporting
exnum = xvbrk-exnum
expos = xxposnr
grwcu = t001-waers
grwrt = tkomp-grwrt
importing
complete = xxkompl
exceptions
no_export_data = 04.
:
form preisfindung_gesamt using preisfindungsart_kopf.
:
* if xvbrk-fktyp ca 'LI'. " <- delete
>>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if ( xvbrp-vgtyp ca vbtyp_lief ) OR
* the following statement is due to compatibility to Rel. 2.2*
( xvbrp-vgtyp is initial and xvbrk-fktyp ca 'IL' ).
<<<<<end of> xxposnr = xvbrp-vgpos.
endif.
call function 'EXPIMP_ITEM_VALUE_MAINTAIN'
exporting
exnum = xvbrk-exnum
expos = xxposnr
grwcu = t001-waers
grwrt = tkomp-grwrt
importing
complete = xxkompl
exceptions
no_export_data = 04.
:
8. Change LV60AU03.
function rv_invoice_price.
:
* Positionspreisfindung
perform xvbrp_bearbeiten_vorbereiten.
perform preisfindung_vorbereiten using 'P'.
call function 'PRICING_DIALOG'
exporting
comm_text = comm_text
comm_head_i = tkomk
comm_item_i = tkomp
material_text = vbrp-arktx
t185_i = t185
t185f_i = t185f
t185v_i = t185v
importing
comm_head_e = tkomk
comm_item_e = tkomp
t185_e = t185
t185f_e = t185f
tables
tkomv = xkomv.
if tkomp-fxmsg ne space.
konv_geaendert = 'X'.
endif.
MODIFY TKOMK INDEX TKOMP-IX_KOMK.
IF VBRP-KOWRR = SPACE.
:
IF VBRK-EXNUM NE SPACE.
DATA: XXPOSNR LIKE VBRP-POSNR,
XXKOMPL.
XXPOSNR = VBRP-POSNR.
* IF VBRK-FKTYP CA 'IL'. " <- delete
>>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if ( vbrp-vgtyp ca vbtyp_lief ) OR
* the following statement is due to compatibility to Rel. 2.2*
( vbrp-vgtyp is initial and vbrk-fktyp ca 'IL' ).
<<<<<end of> XXPOSNR = VBRP-VGPOS.
ENDIF.
CALL FUNCTION 'EXPIMP_ITEM_VALUE_MAINTAIN'
:
9. Change MV60AF0F.
:
XXPOSNR = VBRP-POSNR.
* IF VBRK-FKTYP CA 'IL'. " <- delete
>>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if ( vbrp-vgtyp ca vbtyp_lief ) OR
* the following statement is due to compatibility to Rel. 2.2*
( vbrp-vgtyp is initial and vbrk-fktyp ca 'IL' ).
<<<<<end of> XXPOSNR = VBRP-VGPOS.
ENDIF.
:
10. Change LV60AF0F.
form faktura_fakturabezogen.
WHEN 'L'.
IF *VBRP-VGTYP CA VBTYP_VERK.
PERFORM FAKTURAPOSI_FAKTURABEZOGEN_A.
ELSEIF *VBRP-VGTYP CA VBTYP_LIEF.
PERFORM FAKTURAPOSI_FAKTURABEZOGEN_L.
>>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
* the following statement is due to compatibility to Rel.2.2*
ELSEIF *VBRP-VGTYP IS INITIAL.
PERFORM FAKTURAPOSI_FAKTURABEZOGEN_L.
<<<<<end of> ENDIF.
...
11. Change LV60AF0P.
form preisfindung using preisfindungsart.
:
>>>>>START OF DELETION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF XVBRP-VGTYP CA VBTYP_LIEF AND
XVBRK-EXPKZ EQ 'X'.
<<<<<end of> >>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF ( XVBRP-VGTYP CA VBTYP_LIEF AND XVBRK-EXPKZ EQ 'X' ) OR
* the following statement is due to compatibility to Rel. 2.2*
( XVBRP-VGTYP IS INITIAL AND XVBRK-FKTYP CA 'IL'
AND XVBRK-EXPKZ EQ 'X' ).
<<<<<end of> ...
>>>>>START OF DELETION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF XVBRP-VGTYP CA VBTYP_LIEF AND
TKOMP-GRWRT NE 0 AND
XVBRK-EXPKZ CA 'YZ' AND SY-SUBRC EQ 0.
<<<<<end of> >>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF ( XVBRP-VGTYP CA VBTYP_LIEF AND XVBRK-EXPKZ CA 'YZ'
AND SY-SUBRC EQ 0 ) OR
* the following statement is due to compatibility to Rel. 2.2*
( XVBRP-VGTYP IS INITIAL AND XVBRK-FKTYP CA 'IL'
AND XVBRK-EXPKZ CA 'YZ'
AND SY-SUBRC EQ 0 ).
<<<<<end of> * Lieferung nachlesen
...
form preisfindung_gesamt using preisfindungsart_kopf.
...
>>>>>START OF DELETION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF XVBRP-VGTYP CA VBTYP_LIEF AND
XVBRK-EXPKZ EQ 'X'.
<<<<<end of> >>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF ( XVBRP-VGTYP CA VBTYP_LIEF AND XVBRK-EXPKZ EQ 'X' ) OR
* the following statement is due to compatibility to Rel. 2.2*
( XVBRP-VGTYP IS INITIAL AND XVBRK-FKTYP CA 'IL'
AND XVBRK-EXPKZ EQ 'X' ).
<<<<<end of> ...
>>>>>START OF DELETION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF XVBRP-VGTYP CA VBTYP_LIEF AND
TKOMP-GRWRT NE 0 AND
XVBRK-EXPKZ CA 'YZ' AND SY-SUBRC EQ 0.
<<<<<end of> >>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF ( XVBRP-VGTYP CA VBTYP_LIEF AND XVBRK-EXPKZ CA 'YZ'
AND SY-SUBRC EQ 0 ) OR
* the following statement is due to compatibility to Rel. 2.2*
( XVBRP-VGTYP IS INITIAL AND XVBRK-FKTYP CA 'IL'
AND XVBRK-EXPKZ CA 'YZ'
AND SY-SUBRC EQ 0 ).
<<<<<end of> * Lieferung nachlesen
...
12.) LV60AU03 ändern
function rv_invoice_price.
:
>>>>>START OF DELETION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF VBRP-VGTYP CA VBTYP_LIEF AND
VBRK-EXPKZ = 'X'.
<<<<<end of> >>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF ( VBRP-VGTYP CA VBTYP_LIEF AND VBRK-EXPKZ EQ 'X' ) OR
* the following statement is due to compatibility to Rel. 2.2*
( VBRP-VGTYP IS INITIAL AND VBRK-FKTYP CA 'IL'
AND VBRK-EXPKZ EQ 'X' ).
<<<<<end of p>
12. Change MV60AF0F.
form fcode_pexp using h185f structure t185f
h185 structure t185
h185v structure t185v.
:
case vbrk-expkz.
when 'X'.
xxposnr = vbrp-posnr.
IF VBRP-VGTYP CA VBTYP_LIEF. <<<< >>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF ( VBRP-VGTYP CA VBTYP_LIEF ) OR
* the following statement is due to compatibility to Rel. 2.2*
( VBRP-VGTYP IS INITIAL AND VBRK-FKTYP CA 'IL' ).
<<<<<end of p>
13. Change LV60AF0P.
form preisfindung using preisfindungsart.
:
>>>>>START OF DELETION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF XVBRP-VGTYP CA VBTYP_LIEF AND
XVBRK-EXPKZ EQ 'X'.
<<<<<end of> >>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF ( XVBRP-VGTYP CA VBTYP_LIEF AND XVBRK-EXPKZ EQ 'X' ) OR
* the following statement is due to compatibility to Rel. 2.2*
( XVBRP-VGTYP IS INITIAL AND XVBRK-FKTYP CA 'IL'
AND XVBRK-EXPKZ EQ 'X' ).
<<<<<end of> ...
>>>>>START OF DELETION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF XVBRP-VGTYP CA VBTYP_LIEF AND
TKOMP-GRWRT NE 0 and
XVBRK-EXPKZ CA 'YZ' AND SY-SUBRC EQ 0.
<<<<<end of> >>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF ( XVBRP-VGTYP CA VBTYP_LIEF AND XVBRK-EXPKZ CA 'YZ'
AND SY-SUBRC EQ 0 ) OR
* the following statement is due to compatibility to Rel. 2.2*
( XVBRP-VGTYP IS INITIAL AND XVBRK-FKTYP CA 'IL'
AND XVBRK-EXPKZ CA 'YZ'
AND SY-SUBRC EQ 0 ).
<<<<<end of> * Lieferung nachlesen
...
form preisfindung_gesamt using preisfindungsart_kopf.
...
>>>>>START OF DELETION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF XVBRP-VGTYP CA VBTYP_LIEF AND
XVBRK-EXPKZ EQ 'X'.
<<<<<end of> >>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF ( XVBRP-VGTYP CA VBTYP_LIEF AND XVBRK-EXPKZ EQ 'X' ) OR
* the following statement is due to compatibility to Rel. 2.2*
( XVBRP-VGTYP IS INITIAL AND XVBRK-FKTYP CA 'IL'
AND XVBRK-EXPKZ EQ 'X' ).
<<<<<end of> ...
>>>>>START OF DELETION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF XVBRP-VGTYP CA VBTYP_LIEF AND
TKOMP-GRWRT NE 0 and
XVBRK-EXPKZ CA 'YZ' AND SY-SUBRC EQ 0.
<<<<<end of> >>>>>START OF INSERTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IF ( XVBRP-VGTYP CA VBTYP_LIEF AND XVBRK-EXPKZ CA 'YZ'
AND SY-SUBRC EQ 0 ) OR
* the following statement is due to compatibility to Rel. 2.2*
( XVBRP-VGTYP IS INITIAL AND XVBRK-FKTYP CA 'IL'
AND XVBRK-EXPKZ CA 'YZ'
<<<<<end of> * Lieferung nachlesen
...