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: 

Due Date based on input date & payment Terms

Former Member
0 Kudos

Hi,

I want to know

1) Is there any Function Module to get the Due date based the input Date

and Payment Terms Code

2) No of days in the Payment Terms Code.

Edited by: praveen kumar on Jan 19, 2009 1:49 PM

1 ACCEPTED SOLUTION

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Praveen,

Check the FM: SD_PRINT_TERMS_OF_PAYMENT.

In the input you give the relevant date & tems of pymt, in return table TOP_TEXT of type VTOPIS.

Sort this table DESCENDING BY hdatum & read the first entry.


  DATA : l_wa_text   TYPE ty_text.

  DATA : l_it_text TYPE  ty_t_text.

  CALL FUNCTION 'SD_PRINT_TERMS_OF_PAYMENT'
    EXPORTING
     bldat                              = fp_v_bsid-zfbdt
*   BUDAT                              = l_wa_bsid-budat
*   CPUDT                              = l_wa_bsid-cpudt
*   LANGUAGE                           = ' '
     terms_of_payment                   = fp_v_bsid-zterm
*   COUNTRY                            =
*   HOLDBACK                           = ' '
*   TOP_HOLDBACK_INFO                  =
*   DOCUMENT_CURRENCY                  = l_wa_bsid-waers
* IMPORTING
*   BASELINE_DATE                      =
*   PAYMENT_SPLIT                      =
*   ZFBDT                              =
    TABLES
      top_text                           = l_it_text
   EXCEPTIONS
     terms_of_payment_not_in_t052       = 1
     OTHERS                             = 2 .
  IF sy-subrc <> 0.
    CASE sy-subrc.
      WHEN c_1.
        MESSAGE i000  WITH 'TERMS OF PAYMENT NOT IN T052'.
        LEAVE  LIST-PROCESSING.
      WHEN c_2.
        MESSAGE i000  WITH 'Other program error'.
        LEAVE  LIST-PROCESSING.
    ENDCASE.
  ENDIF.

  SORT l_it_text DESCENDING BY hdatum.

  READ  TABLE l_it_text  INDEX 1  INTO l_wa_text.
  fp_l_duedate = l_wa_text-hdatum

Hope this helps.

BR,

Suhas

2 REPLIES 2

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Praveen,

Check the FM: SD_PRINT_TERMS_OF_PAYMENT.

In the input you give the relevant date & tems of pymt, in return table TOP_TEXT of type VTOPIS.

Sort this table DESCENDING BY hdatum & read the first entry.


  DATA : l_wa_text   TYPE ty_text.

  DATA : l_it_text TYPE  ty_t_text.

  CALL FUNCTION 'SD_PRINT_TERMS_OF_PAYMENT'
    EXPORTING
     bldat                              = fp_v_bsid-zfbdt
*   BUDAT                              = l_wa_bsid-budat
*   CPUDT                              = l_wa_bsid-cpudt
*   LANGUAGE                           = ' '
     terms_of_payment                   = fp_v_bsid-zterm
*   COUNTRY                            =
*   HOLDBACK                           = ' '
*   TOP_HOLDBACK_INFO                  =
*   DOCUMENT_CURRENCY                  = l_wa_bsid-waers
* IMPORTING
*   BASELINE_DATE                      =
*   PAYMENT_SPLIT                      =
*   ZFBDT                              =
    TABLES
      top_text                           = l_it_text
   EXCEPTIONS
     terms_of_payment_not_in_t052       = 1
     OTHERS                             = 2 .
  IF sy-subrc <> 0.
    CASE sy-subrc.
      WHEN c_1.
        MESSAGE i000  WITH 'TERMS OF PAYMENT NOT IN T052'.
        LEAVE  LIST-PROCESSING.
      WHEN c_2.
        MESSAGE i000  WITH 'Other program error'.
        LEAVE  LIST-PROCESSING.
    ENDCASE.
  ENDIF.

  SORT l_it_text DESCENDING BY hdatum.

  READ  TABLE l_it_text  INDEX 1  INTO l_wa_text.
  fp_l_duedate = l_wa_text-hdatum

Hope this helps.

BR,

Suhas

Former Member
0 Kudos

Hi,

Try using the FM FI_TERMS_OF_PAYMENT_PROPOSE to determine the payment due date for the payment term and the baseline date.

With Regards,

Dwaraka.S