Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Printing an invoice, where do Payment Terms come from? RV_BILLING_PRINT_VIEW

Former Member
0 Kudos

In one of our payment terms conditions, nothing is being printed on the invoice.

I have done much debugging on this. Many people believe that T052U is where the payment terms text comes from and this is true if in fact there is an english translation for the terms in T052U (we run in English). In part of the print processor, this is true however in our case, there are no english translations in this table, therefore nothing prints. The codes says, if you find a match, use it. If not, leave it as is.

I looked at another one where the terms were printing and verified that it did not have payment terms in english in T052U. I put a debugger in and learned that in fact the payment terms (VBDKR-ZTERM_TX1) are being populated within the function module called RV_BILLING_PRINT_VIEW. However, in looking in this function module I see nothing that maps to VBDKR-ZTERM_TX1.

Ultimately I need to find out what table this function module is getting the terms from.

Does anyone know the table(s) besides T052U that would have payment terms or how that function module produces the terms?

Thanks!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Usually terms of payment is available in the billing document at the pricing data in header level ( VF03).

If you want to use the FM RV_BILLING_PRINT_VIEW to get the payment terms! Need to pass the communication structure as below. ( BILLING DOC NO AND SPRAS)

The program is extracting the payment term from the billing document and getting the text from TVZBT table.  Based on the payment key and language getting the description. Check and debug the program as per your requirement. Check the results below!

Kiran

8 REPLIES 8

Former Member
0 Kudos

Hi,

Usually terms of payment is available in the billing document at the pricing data in header level ( VF03).

If you want to use the FM RV_BILLING_PRINT_VIEW to get the payment terms! Need to pass the communication structure as below. ( BILLING DOC NO AND SPRAS)

The program is extracting the payment term from the billing document and getting the text from TVZBT table.  Based on the payment key and language getting the description. Check and debug the program as per your requirement. Check the results below!

Kiran

0 Kudos

Hi, Kiran. This is the part that is not making sense for me. For example. the payment term is Z020. If you go into any of the text tables for payment terms such as T052U or TVZBT, the text will say as I expect which for this term is "45 Days Due Net".

However, when you print the invoice (for the one where terms shows up) it comes out as this:

Up    to   04/01/2013   without deduction.

This is being done inside RV_BILLING_PRINT_VIEW.

For the one that I am trying to fix, the terms do not show up at all. I am sure it is because this ones terms (Z025) description is not where the FM is looking but I need to find out where the FM is looking in order to fix the problem.

I think it is getting the descripton in the following piece of code which is a part of the FM:

  IF cl_ops_switch_check=>aci_sfws_sc_erptms_ii( ) EQ abap_true.

    ro_print = cl_tm_invoice=>get_instance( ).

    lv_sim_flag = ro_print->get_simulation_flag( ).

    IF lv_sim_flag IS NOT INITIAL.

      ro_print->get_invoice_data_from_buffer(

         IMPORTING es_header = ls_header

                   et_items  = lt_items ).

      kopf = ls_header.

      pos[] = lt_items.

      RETURN.

    ENDIF.

  ENDIF.

I can't say that for sure because I cannot put in a breakpoint in this FM because I don't have an access key yet. Can I debug this without an access key to add a breakpoint? Please bear with me as I have only been doing ABAP for about 6 months.

0 Kudos

Hi Richard,

Ok, In this case the SD terms are populating from the below FM and include! Please find the screen shot below! If you want to restrict and don't want or some of the terms you required just enhance the implicit enhancement there! ( just check before implementing)

Line No 45 : just clear the VBDKR-ZTERMxxxxx

0 Kudos

I have found this as well. Getting closer! In this FM it is looking for TermsOfPayment. In our case, it is not VBDKR-ZTERM but instead it is lsheader-zterm which ultimately comes from a view called komfkgn in the following pieces of code:

READ TABLE it_komfkgn INTO ls_komfkgn INDEX 1.

MOVE-CORRESPONDING ls_komfkgn TO ls_header.

I suspect when I find it I will see that when we are dealing with the good invoice, this field has a value and that is why it works. When dealing with the bad one I suspect it will be empty.

I have to find out where IT_KOMFKGN is being populated from.

This is all coming from CL_TM_INVOICE and the text comes from the method MAP_INVOICE_DATA inside there.

Getting closer!

Sriharsha, I am going to look at yours and Mallick in just a moment.

0 Kudos

I guess I am done at this point until I can get a debugger in here. For both the one that works and the one that doesn't, the terms are in all places that they should be. Just that the one that doesn't work isn't being returned anything to go into the terms description. Without the debugger in the function modules, I can't see what it sees so I have to wait. Both invoice and sales document have the payment terms in there as does T052.

The FM's SKONTOTERMIN and SKONTOTAGE are the ones that construct the line that is displayed on the printed invoice. They seem to look at several fields of T052 to determine what to say in the text line as in the example above (Up    to   04/01/2013   without deduction.)

Need the debugger so I have to wait till someone in our home office can give me the access key to put in my breakpoints. I will let you all know what the outcome is once I know. Thank you all for your help.

0 Kudos

Turns out that the problem was not with the function module RV_BILLING_PRINT_VIEW. It was doing exactly as it was told.

The problem was that there is a function module that gets called afterwards called GET_ZTERM which was customzied. It said that if the description is in english, go into T052U and get the payment terms description from that table. In many of the payment conditions, there is no english translation despite the fact that there was a record in T052U. In the case of the one that was working, it was simply working because there was no T052U english record at all so the conditions were not met in GET_ZTERM so nothing was changed that came out of RV_BILLING_PRINT_VIEW.

On the one that didn't work, it came out of RV_BILLING_PRINT_VIEW just fine but there was a record in T052U. Unfortunately , it was blanks so it was replacing the description from RV_BILLING_PRINT_VIEW with the blank description of T052U.

Thank you all for your help. All is good now.

Former Member
0 Kudos

Hi,

Payment terms is maintained at Customer master->sales area data( KNVV-ZTERM). During sales order creation for the customer, the system propose the payment terms maintained in customer master. The user has the option to override the payment terms in the sales order ( editable field).  Generally, in billing payment terms gets copied from the payment terms in the sales order.

Regards,

DPM

sriharsha_parayatham
Participant
0 Kudos

payment terms come from sales order for billing invoice, check so instead of invoice ,

as Mallick said , then look at customer data.