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.
Showing results for 
Search instead for 
Did you mean: 

FBL3N help needed

Former Member
0 Kudos

Hi SAP Gurus,

I need to know the data extraction logic of tcode FBL3N as I have the requirement to develop a report program using the logic used in FBL3N.

The report program name of FBL3N is RFITEMGL. I tried to find the logic in debugging mode.. but no luck..

please help..

thanks and regrads,



Active Contributor
0 Kudos


FBL3N uses logical database SDF for data selection, please look in to the logical database for data extraction logic.



0 Kudos

Hi Lucy,

FBL3N is used to know the G/L account line items that are posted based on the key date what we entered.

Based on that Key date it will fetch data from table BSIK less than or eq to that date and as well as any entries that are above that date from BSAK.

that is the main logic of FBL3N.

and you can use this FM also for the same BAPI_AP_ACC_GETOPENITEMS with minor changes.



Former Member
0 Kudos

Hi Satish,

Really thanks for your prompt reply.

My requirement selection screen is as follows:

  • Company Code:
  • 2 Radiobuttons for Account type (Vendor or Customer)
  • G/L account no. range :
  • Cost center range :
  • Posting date range :

I have to display an ALV output containing the fields displayed by FBL3N, and have to add G/L Account text and vendor text in the display.

The functional side has not provided me with any logic, they want me to refer to FBL3N logic.

Could you please help me?

0 Kudos

Hi Lucy,

as regular as design a selection screen by your inputs.

you wanted everything with ranges right for achieving this you need to copy the FM what i have provided and change the selection logic by select-options(replace eq with IN ).and call that FM in your program you will get your data as per your requirement.



0 Kudos

Hi Lucy,

Please check the below code.

It is the code i written in one of my project.

Please check this.

TYPES: BEGIN OF ty_bsis,

          hkont TYPE bsis-hkont,

          shkzg TYPE bsis-shkzg,

          dmbtr TYPE bsis-dmbtr,

          dmbe2 TYPE bsis-dmbe2,

          END OF ty_bsis.

   DATA: lit_bsis       TYPE TABLE OF ty_bsis,

         lit_bsis_hkont TYPE TABLE OF ty_bsis,

         lit_bsis_final TYPE TABLE OF ty_bsis,

         lwa_bsis       TYPE ty_bsis,

         lwa_bsis_hkont TYPE ty_bsis,

         lwa_bsis_1     TYPE ty_bsis.

   DATA: lv_gjahr TYPE bsis-gjahr.

   DATA: lv_inr_amt TYPE p DECIMALS 2,

         lv_usd_amt TYPE p DECIMALS 2,

         lv_amt     TYPE p DECIMALS 4,

         lv_amt_1   TYPE p DECIMALS 4.

   DATA: lt_glu1_temp TYPE gusl_t_glu1.

   DATA: lwa_glu1 LIKE LINE OF lt_glu1.

   TYPES: BEGIN OF ty_glu1,

          racct TYPE bsis-hkont,

          tsl TYPE p DECIMALS 2,

          hsl TYPE p DECIMALS 2,

          ksl TYPE p DECIMALS 2,

          END OF ty_glu1.

   DATA: lit_amt_cum TYPE TABLE OF ty_glu1,

         lwa_amt_cum TYPE ty_glu1.

   DATA: lv_inr_diff TYPE p DECIMALS 2,

         lv_usd_diff TYPE p DECIMALS 2.

   RANGES:r_gjahr FOR lv_gjahr.



** -- > > Determine Fiscal Year and Period for Company Code



       i_bukrs        = '1000'





      E_GJAHR        r_gjahr-high.

*     E_MONAT        =

*** -- > > Preparing Ranges for Fiscal Year.

   CLEAR : r_gjahr[].

   r_gjahr-option = 'BT'.

   r_gjahr-sign   = 'I'.

   r_gjahr-low    = '2000'.

   r_gjahr-high   = r_gjahr-high.

   APPEND r_gjahr.

*** --- > > Fetching Accounting: Secondary Index for G/L Accounts

*** -- > > Where Currency eq 'INR' and date Lessthan or Equal to

*** ---- > > Key Date for Translation.

   SELECT hkont




          FROM bsis

          INTO TABLE lit_bsis

          WHERE bukrs IN so_bukrs

            AND hkont IN so_saknr

            AND gjahr IN r_gjahr

            AND waers EQ 'INR'

            AND budat LE 'STICHTAG'.

*** --- > > Accounting: Secondary Index for G/L Accounts (Cleared Items)

*** -- > > Where Currency eq 'INR' and date Lessthan or Equal to

*** ---- > > key date of Translation and Clearing date should be greater than translation date.

   SELECT hkont




          FROM bsas

          APPENDING TABLE lit_bsis

          WHERE bukrs IN so_bukrs

            AND hkont IN so_saknr


            AND gjahr IN r_gjahr

            AND waers EQ 'INR'

            AND budat LE 'STICHTAG'.

Please change according to your requirement.

Thanks & Regards,

Raghunadh Kodali

Active Contributor

The FBL*N transactions use logical database, SDF for G/L (FBL3N), KDF for vendor (FBL1N) and DDF for customer (FBL5N) so either set a logical database to the attributes of your program (and search in online help for statements required to use it like GET) or use a FM like LDB_PROCESS to access LDB data. ->  Try also to analyze the LBD thru transaction SE36.

Also inform your functional that there are BTE and BAdI to easily add fields to those standard reports -> Look for BAdI FI_ITEMS_CH_DATA or BTE 1650 (many threads already at SCN) to fill new fields appended to RFPOSX – so no need to create new transactions if only actual requirement is to add some texts.

If you actually want to read data yourself from database table (so BSIS/BSAS for G/L, BSIK/BSAK for vendor and BSID/BSAD for customer) you can then enrich the structure extracted using form GOT_BSEGA of report SAPBSEGA, and a FM as ITEM_DERIVE_FIELDS, then display it with FI_ITEMS_DISPLAY (This FM will call the BTE/BAdI implementations).



Former Member
0 Kudos

Hi all,

thanks for ur replys..

I got the logic.. Closing this thread now..


Active Participant
0 Kudos

Hello Lucy,

Although you closed this thread.

Can't you use the SUBMIT statement to get the selection from FBL3N and then add the 2 text fields after the initial selection?

I've used this recently, but don't know if this is the best course for you to follow.

The advantage I see, is that you keep all the selection logic in FBL3N and keep the future changes/bugfixes too.

Best regards,