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: 

Trouble creating a open items report (BSID and BSAD tables)

Former Member
0 Kudos

Hi guys,

im creating a report that must display open items for an especific date, and i do it very well with a query from BSID table.

The problem comes when u use a date on the past, example last week.

if u do that, the items are now closed and are no longer stored in BSID table, so i think that they must be now in BSAD table, but i dont know how to relate wich ones are recently closed...

i also tried to do a query from BSAD with augdt >= last week date, and i almost get the items that i needed(this items plus the ones from BSID), but is not exactly because u can close an item with a date in the past..

is there any way to relate that 2 tables, or what exactly happens when an items change from bsid to bsad??

any ideas?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi;

I think the best way to recive the necessary information is using logical data base DDF. You can use report RFITEMAR to see how use the logical data base.

Some months ago I've read the data in my report in following way:

1. make Z-copy of report RFITEMAR

2. in Z-copy after end-of-selection insert

export it_pos to memory id 'POS_TABLE'.

3. In your report write a form similar to my form below:


*&---------------------------------------------------------------------*
*&      Form  submit_zrfitemar
*&---------------------------------------------------------------------*
FORM submit_zrfitemar  tables    rkunnr  type trgr_kunnr
                                 it_pos  type it_rfposxext
                       using     ibukrs  type bukrs
                                 idatsd  type sy-datum.

   data: rspar    type table of rsparams,
         l_rspar  type rsparams,
         l_pos    type rfposxext,
         akunnr  type kunnr.


   l_rspar-selname = 'DD_KUNNR'.
   l_rspar-kind    = 'S'.
   loop at rkunnr.
       move-corresponding rkunnr to l_rspar.
       if l_rspar-high = ''.
           l_rspar-option  = 'EQ'.
           else.
           l_rspar-option  = 'BT'.
       endif.
       append l_rspar to rspar.
    endloop.

    clear: l_rspar.
    l_rspar-selname = 'DD_BUKRS'.
    l_rspar-kind    = 'S'.
    l_rspar-sign    = 'I'.
    l_rspar-option  = 'BT'.
    l_rspar-low  = ibukrs.
    append l_rspar to rspar.

    clear: l_rspar.
    l_rspar-selname = 'PA_STIDA'.
    l_rspar-kind    = 'S'.
    l_rspar-sign    = 'I'.
    l_rspar-option  = 'BT'.
    l_rspar-low  = idatsd.
    append l_rspar to rspar.

    clear: it_pos[].

  submit ZRFITEMAR
  with selection-table rspar
  and return.

  import it_pos from memory id 'POS_TABLE'.

ENDFORM.                    " submit_zrfitemar

You find the necessary data in table IT_POS.

JS

Edited by: John Smith on Oct 9, 2008 5:42 PM

6 REPLIES 6

Former Member
0 Kudos

I think your approach is correct. An item is open until the clearing date.

Rob

0 Kudos

Hi Javier Santana,

May i know What's wrong with your result?

Regards,

R.Nagarajan.

-


We can -


former_member194797
Active Contributor
0 Kudos

You must discard from BSID the document with a CPUDT > your specific date and you must include from BSAD the documents which where cleared after the specific date, i.e. you must read BKPF-CPUDT for the document# BSAD-AUGBL. Keep in mind that a document may be cleared before a specific date, and the clearing may be reversed after this date... it is more difficult to track such cases: you must read change documents.

0 Kudos

Im doing exactly that, but u are correct is not the completo solution, because in some cases u can close an open item with a date on the past, i dont know how to track that ones...

can u explain me how BKPF table may help me?

tks in advance.

former_member194797
Active Contributor
0 Kudos

Each entry in BSAD correspond to a document. The document number is BSAD-BELNR. This document was cleared at a given date. This date is not BSAD-AUGDT, which is the POSTING date of the clearing (and not the actual entry date of the clearing). The actual date may be found thru de clearing document. You find the number of the clearing document in BSAD-AUGBL. If you search in BKPF for this document, when you find the right entry, you know the actual entry date of this clearing document. Its id BKPF-CPUDT.

Former Member
0 Kudos

Hi;

I think the best way to recive the necessary information is using logical data base DDF. You can use report RFITEMAR to see how use the logical data base.

Some months ago I've read the data in my report in following way:

1. make Z-copy of report RFITEMAR

2. in Z-copy after end-of-selection insert

export it_pos to memory id 'POS_TABLE'.

3. In your report write a form similar to my form below:


*&---------------------------------------------------------------------*
*&      Form  submit_zrfitemar
*&---------------------------------------------------------------------*
FORM submit_zrfitemar  tables    rkunnr  type trgr_kunnr
                                 it_pos  type it_rfposxext
                       using     ibukrs  type bukrs
                                 idatsd  type sy-datum.

   data: rspar    type table of rsparams,
         l_rspar  type rsparams,
         l_pos    type rfposxext,
         akunnr  type kunnr.


   l_rspar-selname = 'DD_KUNNR'.
   l_rspar-kind    = 'S'.
   loop at rkunnr.
       move-corresponding rkunnr to l_rspar.
       if l_rspar-high = ''.
           l_rspar-option  = 'EQ'.
           else.
           l_rspar-option  = 'BT'.
       endif.
       append l_rspar to rspar.
    endloop.

    clear: l_rspar.
    l_rspar-selname = 'DD_BUKRS'.
    l_rspar-kind    = 'S'.
    l_rspar-sign    = 'I'.
    l_rspar-option  = 'BT'.
    l_rspar-low  = ibukrs.
    append l_rspar to rspar.

    clear: l_rspar.
    l_rspar-selname = 'PA_STIDA'.
    l_rspar-kind    = 'S'.
    l_rspar-sign    = 'I'.
    l_rspar-option  = 'BT'.
    l_rspar-low  = idatsd.
    append l_rspar to rspar.

    clear: it_pos[].

  submit ZRFITEMAR
  with selection-table rspar
  and return.

  import it_pos from memory id 'POS_TABLE'.

ENDFORM.                    " submit_zrfitemar

You find the necessary data in table IT_POS.

JS

Edited by: John Smith on Oct 9, 2008 5:42 PM