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 is printing for every instance on GET evet

Former Member
0 Kudos

Hi,

I would appreciate your help and inputs on the following problem I'm facing.

I'm trying to print certain employee information to ALV.

I'm using HR logical database PNP.

The problem I have is that the ALV is being generated for every different employee and i want it just to be printed at the end when all the internal tables were filles and the GET process is finished.

What might be my problem?

this is the piece of code:

GET pernr.
  CLEAR itabname.
  IF r2 = 'X'.
    itabname = 'IT_PRESTAMO'.
    PERFORM completar_tabla_prestamos.
    PERFORM generar_catalogo_campos_alv USING itabname.
    PERFORM crear_eventos CHANGING gt_events.
    PERFORM crear_comentario  CHANGING gt_list_top_of_page.
    PERFORM mostrar_alv TABLES it_prestamo.

PERFORM completar_tabla_prestamos: fills the internal table

PERFORM mostrar_alv TABLES it_prestamo: call REUSE_ALV_LIST_DISPLAY function module.

the other routines are for generating ALV header , format, fielcatalogue and so on...

Thanks

Ivan

1 ACCEPTED SOLUTION

martin_voros
Active Contributor
0 Kudos

Hi,

GET event is called for each retrieved record. If you want to call something after your selection then you need to use event END-OF-SELECTION.

Cheers

4 REPLIES 4

martin_voros
Active Contributor
0 Kudos

Hi,

GET event is called for each retrieved record. If you want to call something after your selection then you need to use event END-OF-SELECTION.

Cheers

0 Kudos

thanks Martin,

I tried that but not working for some reason. I might have done something wrong.

This how i tried, is anything wrong?

START-OF-SELECTION.

GET pernr.

*& This routine fills the internal table
 PERFORM completar_tabla_prestamos.



END-OF-SELECTION.
  CLEAR itabname.
  IF r2 = 'X'.
    itabname = 'IT_PRESTAMO'.

*& This routine generates the fieldcatalogue
    PERFORM generar_catalogo_campos_alv USING itabname.

*& this routine creates the ALV events
    PERFORM crear_eventos CHANGING gt_events.

*& this routine creates ALV comments in the header
    PERFORM crear_comentario  CHANGING gt_list_top_of_page.

*& This routine calls the display ALV function.
    PERFORM mostrar_alv TABLES it_prestamo.

0 Kudos

And what do you get? Have you tried to debug your program to see what it's doing?

Cheers

0 Kudos

Martin,

I investigated the events order when working with Logical databases because of you suggestion and I finally make it work after putting the call to the ALV after END-OF-Selection.

Thanks a lot.