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: 

ALV GRID - need to display the list of pernrs at a time using the funtional module.

Former Member
0 Kudos

Hi,

can any one help me to get list of record at a time.Not one by one using the select statement.

Requirement:

I have to get the list of record (pernr) at a time to be fetched in the table using the Function module in the end of selection event and it should be exported in alv.

Right now i am getting the single perner,stat2,werks,ansal from tables pa0000, pa0001, pa0002, pa0008 record  and it is stored in the itabfinal by appending from wa_itabfinal. But now i need all the record to be fetched at a time and it should be displayed with out loop.so help me by informing the what functional module is to be used for this to fetch all the records in ALV .

8 REPLIES 8

former_member197132
Participant
0 Kudos

please share your code ..

0 Kudos

Hi can any one help how to import the internal table into functional module.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

If you use LDB, it will process one by one pernr.

http://wiki.scn.sap.com/wiki/display/Snippets/Report+in+HR+ABAP+-+LDB

If you don't want to use, refer the below sample provided in the link by me.

http://wiki.scn.sap.com/wiki/display/Snippets/Report+in+HR+ABAP+-+without+LDB

If you know the list of pernr already, then you should loop for the above process.

0 Kudos

Hi,

If you know payroll area and want to find list of pernrs under it, use the BAPI BAPI_OUTEMPLOYEE_GETLIST.

GirieshM
Active Contributor
0 Kudos

Hi Vishnu,

Try this sample for reference:

TABLES: pernr.

NODES: peras.

data: it_pa0000 TYPE TABLE OF pa0000.

TYPES: BEGIN OF ty_pernr,

        pernr TYPE persno,

       END OF ty_pernr.

Data : it_pernr TYPE TABLE OF ty_pernr,

       wa_pernr TYPE ty_pernr.

START-OF-SELECTION.

get peras.

wa_pernr-pernr = pernr-pernr.

APPEND wa_pernr to it_pernr.

CLear : wa_pernr.

END-OF-SELECTION.

IF it_pernr is NOT INITIAL.

select *

  from Pa0000

  into TABLE it_pa0000

  for ALL ENTRIES IN it_pernr

  WHERE pernr = it_pernr-pernr.

ENDIF.

Former Member
0 Kudos

I have  internal table "itabfinal" with fields "pernr, werks, btrtl, plan, ansal, Persk".

now i need to pass "itabfinal" into the functional module and get back the all of "itabfinal"  field from the function module into the program.

for this i am creating the funtional module " ZFM1"


inside the functional module i have given the import as "itab1-type-table"

inside the functional module i have given the export as "itab2-type-table".

inside the functional module i have given the changing  as "itab3-type-table"

inside the functional module i have given the Table as "itab4-type-ZFM1_STRU_T"

where "ZFM1_STRU_T" is the table type with reference to itabfinal.

in my program i am calling the functional module as below.

CALL FUNCTION 'ZFM1'


   EXPORTING

     itab1         = itabfinal


  IMPORTING

    ITAB2         = itab4


   changing

     itab3         = itab4.

But in functional module i had given the code as below :

FUNCTION zfm1.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     REFERENCE(ITAB1) TYPE  TABLE

*"  EXPORTING

*"     REFERENCE(ITAB2) TYPE  TABLE

*"  TABLES

*"      ITAB4 TYPE  ZFM1_STRU_T

*"  CHANGING

*"     REFERENCE(ITAB3) TYPE  TABLE

*"----------------------------------------------------------------------

data: wa type ZFM1_STRU.

clear wa.

loop at itab1 into wa.

move wa to itab4.

   modify itab4.

   endloop.

ENDFUNCTION.

please help me to get the itabfinal into the program using above funtional module

GirieshM
Active Contributor
0 Kudos

Hi Vishnu,

Why you need FM?

Are you going to reuse this FM in more than one program.

Fetch the data from the respective infotype which has endda 31.12.9999.

Loop Pa0000 and read the other infotypes with key fields and pass it to workarea.

Then append the workarea to final internal table.

With Regards,

Giriesh M

Former Member
0 Kudos

Hi Giriesh Chakaravarthy,

Can you please help me how to pass the internal table to  Dynamic Functional module .