cancel
Showing results for 
Search instead for 
Did you mean: 

Get Due Date or Days in Arrears in SAP user query

former_member242326
Participant
0 Kudos

Hello,

I am creating a user query (SQ01) in SAP, in which I combine Customer Open Items (table BSID) with several master data tables.

This is working fine, but now I would like to add the Due Date or Days in Arrears to the query.

Are those fields in any table I can use in Query? I can't find them in BSID or BSEG. In FLB5N they are in structure RFPOSXEXT.

I can't use that in query!?

If not in any table, is it possible to calculate them? How would I do that?

Hope someone can help.

Thanks!

Ed

Accepted Solutions (1)

Accepted Solutions (1)

former_member197737
Contributor
0 Kudos

Hi Ed,

You can use some Function Modules to get those fields:

Field:= Net Due Date (RFPOSXEXT-FAEDT)

FM1:= DETERMINE_DUE_DATE (used in FBL5N/FAGLL03)

FM2:= NET_DUE_DATE_GET

Field:= Arrears after net due date (RFPOSXEXT-VERZN)

FM1:= ITEM_OVERDUE_DAYS (used in FBL5N)

FM2:= FAGL_ITEM_OVERDUE_DAYS (used in FAGLL03)

Create two new fields in your infoset, and add codings using those FMs.

If you don't know how to add new field to infoset, please see the following link:

Adding Custom fields to the ABAP Query - Community Profiles - SCN Wiki

I hope i'ts helpful.

Best Regards!

former_member242326
Participant
0 Kudos

Hello mgitur,

Thanks for your reply!

I succeeded in using the function module DETERMINE_DUE_DATE.

The values are calculated. I found an ABAP example on the internet, as I am not an ABAP programmer (is it a logic solution?):

The format of the (text)field is CCYYMMDD. Is it possible to make a date field as well?

So far I did not succeed in retreiving the days in arrears by Function Module ITEM_OVERDUE_DAYS.

The ABAP is accepted, but I get a error when executing the query (via SQ01).

I will try to figure out why that is.


I tried this ABAP source:


Maybe someone with ABAP knowledge can see the error right away?!

Thanks!



former_member197737
Contributor
0 Kudos

Hi Ed,

For field Z_DUE format, try with format "D" Lengh 008 Lengh Output 010.

For coding try the following:

CALL FUNCTION 'NET_DUE_DATE_GET'
EXPORTING
I_ZFBDT      
= bsid-zfbdt
I_ZBD1T      
= bsid-zbd1t
I_ZBD2T      
= bsid-zbd2t
I_ZBD3T      
= bsid-zbd3t
I_SHKZG      
= bsid-shkzg
I_REBZG      
= bsid-rebzg
*   I_KOART       = 'D'
IMPORTING
E_FAEDT      
= Z_DUE.



For field Z_ARREAS try the following coding:


CALL FUNCTION 'ITEM_OVERDUE_DAYS'
EXPORTING
KEY_DATE               
= bsid_bldat
*   PAY_DATE                =
DUE_DATE               
= Z_DUE
*   CLEAR_DATE              =
IMPORTING
*   OVER_SKONTO1_DAYS       =
OVERDUE_DAYS           
= Z_ARREAS.


Best regards!

former_member242326
Participant
0 Kudos

Thanks!

The query can be executed now!

Main problem was probably that I defined Z_ARREARS as data type I.

After I changed that to P, no ABAP error occur anymore while running the query.

Answers (0)