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: 

FAGL_GET_OPEN_ITEMS_GL

Former Member
0 Kudos

Dear all,

My requirement is to get all the GL open items as of a specific date.

I found answers from forums to use this function module FAGL_GET_OPEN_ITEMS_GL

But do not know how to use it.

Anyone can help out?

Or does anyone know what are the modules to find the open GL balances (similar to FBL3N report).

Many Thanks

8 REPLIES 8

Former Member
0 Kudos

Dear Starry 99,

You can get it using simple select stmt as follows:

for GL Open Items.

DATA: T_GL_ITEMS LIKE STANDARD TABLE OF BSAS.


SELECT * FROM BSAS APPENDING TABLE T_GL_ITEMS WHERE BUKRS = ...

                                                AND HKONT = ....

                                                AND AUGDT > <DATE>

                                                AND BUDAT <= <DATE>.

<removed by moderator>

With Regards,

Akshay

Message was edited by: Thomas Zloch

0 Kudos

Hi Akshay,

Thanks for your reply. I am also using this statement.

But I will be selecting from a number of company codes (company group).

And they would like to select the posting date as an when they need it. So i also need to select from both BSAS and BSIS table correct?

Former Member
0 Kudos

Hey Starry 99,

       follow this link it may be helpful.

<link to pesky ads laden site removed by moderator>

thank you & Regards.

Message was edited by: Thomas Zloch

0 Kudos

Hi Rohan,

I couldn't see the link. It has been removed.

0 Kudos

Hi,

Try this,

<again, link removed by moderator>

Thank you

Message was edited by: Thomas Zloch

0 Kudos

Please note that I will keep removing links to this site, as it is not more than a massive (potentially illegal) dump of the SAP repository, garnished with tons of click through ads.

Replies consisting of just a link (or worse, many links) which "may be helpful" are not welcome anyway. Please stick to information that is immediately relevant to the problem under discussion.

Thomas

arnold_botha
Explorer
0 Kudos

Below is an example where:

iv_date is inputted date from screen

iv_hkont is the inputted Gl Acc from screen

iv_bukrs is the inputted company code


Just a note: your GL has to be Open Items Managed Enabled for the FM to work

                   TCode FS00. Goto Control Data Tab. Open Item Management must be ticked.


DATA: lt_hkont TYPE fagl_t_saknr,
         ls_hkont TYPE saknr,
         lt_fieldlist  TYPE ttfieldname,
         ls_fieldlist  LIKE LINE OF lt_fieldlist,
         lt_fieldlist_into TYPE fagl_t_mig_field_into,
         lt_into           TYPE TABLE OF fagl_s_mig_field_into,
         ls_fieldlist_into TYPE fagl_s_mig_field_into,
         lt_open_items TYPE fagl_t_xstring,
         lt_fcat TYPE TABLE OF lvc_s_fcat,
         ls_fcat TYPE lvc_s_fcat.

   "Build Gl Acc Table
   ls_hkont = iv_hkont.
   APPEND ls_hkont TO lt_hkont.

   CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
     EXPORTING
       i_structure_name = 'BSIS'
     CHANGING
       ct_fieldcat      = lt_fcat.

   DELETE lt_fcat WHERE fieldname = 'MANDT'.

   LOOP AT lt_fcat INTO ls_fcat.
     CLEAR ls_fieldlist.
     ls_fieldlist = ls_fcat-fieldname.
     APPEND ls_fieldlist TO lt_fieldlist.

     CLEAR ls_fieldlist_into.
     ls_fieldlist_into-name  = ls_fcat-fieldname.

     if ls_fcat-fieldname = 'BELNR'

     or ls_fcat-fieldname = 'GJAHR'

         ls_fieldlist_into-tab   = 'BKPF'.

     else.
          ls_fieldlist_into-tab   = 'BSIS'.

     endif.
     APPEND ls_fieldlist_into TO lt_into.
   ENDLOOP.
   lt_fieldlist_into[] = lt_into[].

   CALL FUNCTION 'FAGL_GET_OPEN_ITEMS_GL'
     EXPORTING
       i_migdt           = iv_date
       i_bukrs           = iv_bukrs
       it_hkont          = lt_hkont
       it_fieldlist      = lt_fieldlist
       it_fieldlist_into = lt_fieldlist_into
       i_read_bseg       = space
     IMPORTING
       et_open_items     = lt_open_items.


lt_open_items is in XSTRING format thus just convert it.

0 Kudos

Hi Arnold,

Your code help me solving my requirement 50%.

Technically in ABAP, I have to clear the open items against GL account. I need to create a custom ALV report(The report should be displayed as same as the second screen of F-03.) When I select any item and click on clear button(a custom button) it should clear open items as it is on the standard transaction.

In some SCN posts, they've suggested select queries.

DATA: T_GL_ITEMS LIKE STANDARD TABLE OF BSIS.

* Open Items

SELECT * FROM BSIS INTO TABLE T_GL_ITEMS WHERE BUKRS = ...                                           

                                                       AND HKONT = .... AND BUDAT <= <DATE>.

* Clear items:

SELECT * FROM BSAS APPENDING TABLE T_GL_ITEMS WHERE BUKRS = ... AND HKONT = ... .                                               

                                                        AND AUGDT > <DATE>         AND BUDAT <= <DATE>.


Can I consider this for clearing the open item.

If this is possible, then how I have to use the final internal table where I have the values ?