One Line Item per invoice

There is a standard routine provided by SAP for this. We just need to assign routine 6 at (copy control delivery to billing) data transfer VBRK/VBRP and maintain TVKO_MAXBI (Max no. of line items in invoice) = 1.

Purpose

This is an example of a data transfer routine.  FORM routines for data transfer allow you to fine tune the transferred fields during the copying process.  This requirement is used to limit the number of line items allowed in any single billing document.

Example

In some countries there are government regulations that state that there is a limit as to the maximum number of lines that can be in any single invoice document.  In order to insure that this regulation is adhered to, this requirement can be assigned to the billing item category and the appropriate limits maintained in configuration.

Procedure – Define a max number of line items in the IMG and then force an automatic split based on this using a copy control routine, email me if you have any problems, details are below.

IMG
Sales & Distribution>Billing>Billing Documents>Country Specific Features>Maintain Maximum Number of Billing Items
Enter the country code creating billng document and the Max allowed number of billing items (note problem is on the FI side so I’d advise 450 items or less).

In the copy control routine from your Delivery Doc or Sales Doc to your billing type at item category level enter the following code to force a split based on the max number of items you’ve defined. Adjust to suit any other internal requirements. This is SAP standard and works fine.

*———————————————————————*
* Data transfer for delivery related billing *
*———————————————————————*

*———————————————————————*
* FORM DATEN_KOPIEREN_633 *
*———————————————————————*
* —> 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 *
*———————————————————————*

DATA: BEGIN OF ZUK2,
MODUL(3) VALUE ‘006’,
VTWEG LIKE VBAK-VTWEG,
SPART LIKE VBAK-SPART,
VGBEL LIKE VBRP-VGBEL,
BILLNO LIKE TVKO-MAXBI,
END OF ZUK2.

DATA: BEGIN OF J_1B_SIZE_SPLIT2 OCCURS 0,
KUNRG LIKE VBRK-KUNRG,
KUNAG LIKE VBRK-KUNAG,
ZTERM LIKE VBRK-ZTERM.
INCLUDE STRUCTURE ZUK2.
DATA: ITEMNO LIKE TVKO-MAXBI.
DATA: END OF J_1B_SIZE_SPLIT2.

DATA: J_1B_SIZE_COPY2 LIKE J_1B_SIZE_SPLIT2.

*———————————————————————*
* FORM DATEN_KOPIEREN_633 *
*———————————————————————*
* This is a clone of routine 003. *
* It will ensure that *
* *
* — one billing document can only have one reference document *
* — the sum of item volumes will not exceed the amount *
* specified in the number of billing doc. items for the *
* sales organization (TVKO-MAXBI) *
*———————————————————————*

FORM DATEN_KOPIEREN_633.
CLEAR: VBRK-EXPKZ, VBRK-EXNUM.

VBRK-BZIRK = SPACE.
VBRK-KDGRP = SPACE.
VBRK-KONDA = SPACE.
VBRK-REGIO = SPACE.
VBRK-PLTYP = SPACE.

* If maximum number of billing items active
IF NOT TVKO-MAXBI IS INITIAL.

* Get billing doc. item number split data
READ TABLE J_1B_SIZE_SPLIT2
WITH KEY KUNRG = VBRK-KUNRG
KUNAG = VBRK-KUNAG
ZTERM = VBRK-ZTERM
VGBEL = VBRP-VGBEL.
IF SY-SUBRC <> 0.
CLEAR J_1B_SIZE_SPLIT2.
MOVE-CORRESPONDING VBRK TO J_1B_SIZE_SPLIT2.
MOVE-CORRESPONDING VBRP TO J_1B_SIZE_SPLIT2.
ENDIF.

* Check number of billing items against max. defined by tvko-maxbi
IF J_1B_SIZE_SPLIT2-ITEMNO < TVKO-MAXBI.
J_1B_SIZE_SPLIT2-ITEMNO
= J_1B_SIZE_SPLIT2-ITEMNO + 1.
ELSE.
J_1B_SIZE_SPLIT2-BILLNO
= J_1B_SIZE_SPLIT2-BILLNO + 1.
J_1B_SIZE_SPLIT2-ITEMNO = 1.
ENDIF.

* Store actual billing document counter and item counter
READ TABLE J_1B_SIZE_SPLIT2 INTO J_1B_SIZE_COPY2
WITH KEY KUNRG = VBRK-KUNRG
KUNAG = VBRK-KUNAG
ZTERM = VBRK-ZTERM
VGBEL = VBRP-VGBEL.
IF SY-SUBRC = 0.
MODIFY J_1B_SIZE_SPLIT2
TRANSPORTING ITEMNO BILLNO
WHERE KUNRG = VBRK-KUNRG
AND KUNAG = VBRK-KUNAG
AND ZTERM = VBRK-ZTERM
AND VGBEL = VBRP-VGBEL.
ELSE.
APPEND J_1B_SIZE_SPLIT2.
ENDIF.

* Add billing doc. number to split criteria
ZUK2-BILLNO = J_1B_SIZE_SPLIT2-BILLNO.

ENDIF.
* End of billing document split by number of allowed items

ZUK2-VTWEG = VBAK-VTWEG.
ZUK2-SPART = VBRP-SPART.
IF KURGV-PERFK = SPACE.
ZUK2-VGBEL = VBRP-VGBEL.
ENDIF.
VBRK-ZUKRI = ZUK2.
VBRK-KUNAG = VBRK-KUNRG.
ENDFORM.

Advertisements

7 thoughts on “One Line Item per invoice

  1. Raj

    Hi jiteshdua-

    Just wondering.. is it possible to programatically choose some line items of the delivery document for billing (say if I have 10 line items in delivery document and that I want to bill only 4 of them)?

    Thanks
    Raj

    Reply
  2. webmaster5526

    I have searched a lot to find where i can

    create free
    email and web forms.Finally after lot of

    searching i find a
    site where i can create email forms,web

    forms, php forms, contact
    forms for free and in easy way.
    its link is http://www.ezcontactform.com/

    Reply
  3. MDotty

    Hello, is anybody here interested in online job? It’s simple survey filling.
    Even $10 per survey (ten minutes of work). If you are
    interested, send me email to hans.orloski[@]gmail.com

    Reply
  4. JudsonChief

    I have checked your page and i have found some duplicate content, that’s why you don’t rank high in google’s search results, but there is a tool that can help you to create 100% unique articles,
    search for: boorfe’s tips unlimited content

    Reply
  5. BestCassie

    I have noticed you don’t monetize your website, don’t
    waste your traffic, you can earn additional cash every month.
    You can use the best adsense alternative for any type of website (they
    approve all websites), for more info simply search in gooogle: boorfe’s tips monetize your website

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s