Skip to Content
author's profile photo Former Member
Former Member

NET DUE DATE

Hi Experts,

I want to know how the system calculates net due date(FAEDT) in transaction FBL1N.

is there some function module?

Please help

Thanks

Kapil.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 17, 2009 at 12:06 PM

    HI USE THIS CODE AND DEVELOPE THE FUNCTION MODULE. OTHER WISE DIRECTLY USE THE CODE TO FETCH DUE DATE.

    FUNCTION zsd_get_due_date.

    *"----


    ""Local Interface:

    *" IMPORTING

    *" VALUE(COMPANY_CODE) TYPE LBBIL_INVOICE-HD_ORG-COMP_CODE

    *" VALUE(PAYER) TYPE LBBIL_INVOICE-HD_GEN-PAYER

    *" VALUE(BIL_NUMBER) TYPE LBBIL_INVOICE-HD_GEN-BIL_NUMBER

    *" EXPORTING

    *" VALUE(DUE_DATE) TYPE RFPOS-FAEDT

    *"----


    DATA :lv_zfbdt TYPE bsid-zfbdt, " Baseline Date for Due Date Calculation

    lv_zbd1t TYPE bsid-zbd1t, " Cash discount days 1

    lv_zbd2t TYPE bsid-zbd2t, " Cash discount days 2

    lv_zbd3t TYPE bsid-zbd3t, " Cash discount days 3

    lv_shkzg TYPE bsid-shkzg, " Debit/Credit Indicator

    lv_rebzg TYPE bsid-rebzg. " Number of the Invoice the Transaction Belongs to

    DATA : wa_bsid TYPE bsid, " Accounting: Secondary Index for Customers

    wa_bsad TYPE bsad. " Accounting: Secondary Index for Customers (Cleared Items)

    CLEAR :lv_zfbdt,

    lv_zbd1t,

    lv_zbd2t,

    lv_zbd3t,

    lv_shkzg,

    lv_rebzg.

    *Fething the data from Accounting: Secondary Index for Customers

    SELECT SINGLE * FROM bsid INTO wa_bsid

    WHERE bukrs = company_code

    AND kunnr = payer

    AND xblnr = bil_number.

    IF sy-subrc = 0.

    MOVE: wa_bsid-zfbdt TO lv_zfbdt,

    wa_bsid-zbd1t TO lv_zbd1t,

    wa_bsid-zbd2t TO lv_zbd2t,

    wa_bsid-zbd3t TO lv_zbd3t,

    wa_bsid-shkzg TO lv_shkzg,

    wa_bsid-rebzg TO lv_rebzg.

    ELSE.

    *Fething the data from Accounting: Secondary Index for Customers (Cleared Items)

    SELECT SINGLE * FROM bsad INTO wa_bsad

    WHERE bukrs = company_code

    AND kunnr = payer

    AND xblnr = bil_number.

    MOVE: wa_bsad-zfbdt TO lv_zfbdt,

    wa_bsad-zbd1t TO lv_zbd1t,

    wa_bsad-zbd2t TO lv_zbd2t,

    wa_bsad-zbd3t TO lv_zbd3t,

    wa_bsad-shkzg TO lv_shkzg,

    wa_bsad-rebzg TO lv_rebzg.

    ENDIF.

    CALL FUNCTION 'NET_DUE_DATE_GET'

    EXPORTING

    i_zfbdt = lv_zfbdt

    i_zbd1t = lv_zbd1t

    i_zbd2t = lv_zbd2t

    i_zbd3t = lv_zbd3t

    i_shkzg = lv_shkzg

    i_rebzg = lv_rebzg

    IMPORTING

    e_faedt = due_date

    EXCEPTIONS

    OTHERS = 1.

    ENDFUNCTION.

    Thanks,

    Ajay

    Edited by: Ajay kumar on Aug 17, 2009 2:07 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 17, 2009 at 12:12 PM

    to create a Function module

    source code of FM:

    function zsd_get_due_date.

    *"----


    ""Local Interface:

    *" IMPORTING

    *" VALUE(COMPANY_CODE) TYPE LBBIL_INVOICE-HD_ORG-COMP_CODE

    *" VALUE(PAYER) TYPE LBBIL_INVOICE-HD_GEN-PAYER

    *" VALUE(BIL_NUMBER) TYPE LBBIL_INVOICE-HD_GEN-BIL_NUMBER

    *" EXPORTING

    *" VALUE(DUE_DATE) TYPE RFPOS-FAEDT

    *"----


    data :lv_zfbdt type bsid-zfbdt, " Baseline Date for Due Date Calculation

    lv_zbd1t type bsid-zbd1t, " Cash discount days 1

    lv_zbd2t type bsid-zbd2t, " Cash discount days 2

    lv_zbd3t type bsid-zbd3t, " Cash discount days 3

    lv_shkzg type bsid-shkzg, " Debit/Credit Indicator

    lv_rebzg type bsid-rebzg. " Number of the Invoice the Transaction Belongs to

    data : wa_bsid type bsid, " Accounting: Secondary Index for Customers

    wa_bsad type bsad. " Accounting: Secondary Index for Customers (Cleared Items)

    clear :lv_zfbdt,

    lv_zbd1t,

    lv_zbd2t,

    lv_zbd3t,

    lv_shkzg,

    lv_rebzg.

    *Fething the data from Accounting: Secondary Index for Customers

    select single * from bsid into wa_bsid

    where bukrs = company_code

    and kunnr = payer

    and xblnr = bil_number.

    if sy-subrc = 0.

    move: wa_bsid-zfbdt to lv_zfbdt,

    wa_bsid-zbd1t to lv_zbd1t,

    wa_bsid-zbd2t to lv_zbd2t,

    wa_bsid-zbd3t to lv_zbd3t,

    wa_bsid-shkzg to lv_shkzg,

    wa_bsid-rebzg to lv_rebzg.

    else.

    *Fething the data from Accounting: Secondary Index for Customers (Cleared Items)

    select single * from bsad into wa_bsad

    where bukrs = company_code

    and kunnr = payer

    and xblnr = bil_number.

    move: wa_bsad-zfbdt to lv_zfbdt,

    wa_bsad-zbd1t to lv_zbd1t,

    wa_bsad-zbd2t to lv_zbd2t,

    wa_bsad-zbd3t to lv_zbd3t,

    wa_bsad-shkzg to lv_shkzg,

    wa_bsad-rebzg to lv_rebzg.

    endif.

    call function 'NET_DUE_DATE_GET'

    exporting

    i_zfbdt = lv_zfbdt

    i_zbd1t = lv_zbd1t

    i_zbd2t = lv_zbd2t

    i_zbd3t = lv_zbd3t

    i_shkzg = lv_shkzg

    i_rebzg = lv_rebzg

    importing

    e_faedt = due_date

    exceptions

    others = 1.

    endfunction.

    Import>>>

    Export>>>

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 17, 2009 at 12:12 PM

    there is no standard FM available to fetch DUE DATE. Please use my code given above only. even we to have attached like above.

    Thanks,

    Ajay

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 17, 2009 at 12:16 PM

    Hello Kapil,

    The FM for calculating the Net Due Date is SD_PRINT_TERMS_OF_PAYMENT. Here you pass the Document Date (BKPF-BLDAT), Posting Date (BKPF-BUDAT) & the Payment Term (BSEG-ZTERM) & the due date is returned in the table TOP_TEXT.

    Please refer to this [post|Due Date based on input date & payment Terms; for details.

    BR,

    Suhas

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi,

      You can use DETERMINE_DUE_DATE function module. Pass lv_faede accordingly.

      You can fetch this information from BSIK table and populate FAEDE parameter.

      READ TABLE li_bkpf INTO lwa_bkpf
                WITH KEY awkey = <lfs_rbkp>-awkey BINARY SEARCH.
                IF sy-subrc EQ 0.
                  READ TABLE li_vbsegk INTO lwa_vbsegk
                  WITH KEY ausbk = <lfs_rbkp>-bukrs
                           belnr = lwa_bkpf-belnr
                           gjahr = <lfs_rbkp>-gjahr.
                  IF sy-subrc EQ 0.
                    lv_faede-shkzg = lwa_vbsegk-shkzg.
                    CLEAR lwa_vbsegk.
                  ENDIF."IF sy-subrc EQ 0.
                ELSE.
                  lv_faede-shkzg = c_h.
                ENDIF."IF sy-subrc EQ 0.
      
                lv_faede-koart = c_k.
                lv_faede-zfbdt = <lfs_rbkp>-zfbdt.
                lv_faede-zbd1t = <lfs_rbkp>-zbd1t.
                lv_faede-zbd2t = <lfs_rbkp>-zbd2t.
                lv_faede-zbd3t = <lfs_rbkp>-zbd3t.
                lv_faede-bldat = <lfs_rbkp>-bldat.
      
      
      CALL FUNCTION 'DETERMINE_DUE_DATE'
                  EXPORTING
                    i_faede                    = lv_faede
                  IMPORTING
                    e_faede                    = lv_faede
                  EXCEPTIONS
                    account_type_not_supported = 1
                    OTHERS                     = 2.

      Please let me know in case of any issues.

      KR Jaideep,

  • author's profile photo Former Member
    Former Member
    Posted on Aug 17, 2009 at 12:55 PM

    .

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi,

      I am calculating due date for Vendor Invoice using above function module. This function module is used by the system to calculate due date in MIRO, MIR4 and MIR7 transaction. Only thing you need to take care of is SHKZG (Debit/Credit Indicator) field which I am fetching from VBSEGK table. This is used by Function module in calculating the correct due date.

      KR Jaideep,

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.