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: 

print internal table

Former Member
0 Kudos

how to output an internal table in grid format .

and how to give field names while giving the output.

can anyone help me,

3 REPLIES 3

Former Member
0 Kudos

Hi,

1. The simple list display

a. Leading function-module

ii. REUSE_ALV_GRID_DISPLAY (the current version)

These function modules take various internal table, and generate a standard display, on an ALV-standard screen.

b. How to pass on the fields to be printed

This is done by passing an internal table called the field-catalog. It consists typically of the

u2022 internal table-field name,

u2022 the output length,

u2022 the name to be displayed for the column,

u2022 the justification

u2022 formatting, like number of decimals, bold/normal and so on.

REUSE_ALV_GRID_DISPLAY : This is the function module which prints the data.

The important parameters are :

I. Export :

i. I_callback_program : report id

ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status

iii. I_callback_user_command : routine where the function codes are handled

iv. I_structure name : name of the dictionary table

v. Is_layout : structure to set the layout of the report

vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE

vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.

II. Tables :

i. t_outtab : internal table with the data to be output

Also, if we are using a data-dictionary structure for the display, we can

avoid creating this internal table by making use of the function

REUSE_ALV_FIELDCATALOG_MERGE.

B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.

The Important Parameters are :

I. Export :

i. I_program_name : report id

ii. I_internal_tabname : the internal output table

iii. I_inclname : include or the report name where all the dynamic forms are handled.

II Changing

ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is

declared in the type pool SLIS.

Hope this helps you

Regards

Shiva

Former Member
0 Kudos

Hi,,

Formatting the same text clearly again..

REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.

The important parameters are :

I. Export :

i. I_callback_program : report id

ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status

iii. I_callback_user_command : routine where the function codes are handled

iv. I_structure name : name of the dictionary table

v. Is_layout : structure to set the layout of the report

vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE

vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.

II. Tables :

i. t_outtab : internal table with the data to be output

B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.

The Important Parameters are :

I. Export :

i. I_program_name : report id

ii. I_internal_tabname : the internal output table

iii. I_inclname : include or the report name where all the dynamic forms are handled.

II Changing

ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is

declared in the type pool SLIS.

Former Member
0 Kudos

hi....

try use this simple example..

*************************************************************

REPORT ZTEST_V1.

TABLES : EKKO.

TYPES : BEGIN OF STRUC,

EBELN TYPE EKKO-EBELN,"Purchasing Document Number

BUKRS TYPE EKKO-BUKRS,"Company Code

BSTYP TYPE EKKO-BSTYP,"Purchasing Document Category

BSART TYPE EKKO-BSART,"Purchasing Document Type

END OF STRUC.

DATA : IT_EKKO TYPE TABLE OF STRUC,

WA_EKKO TYPE STRUC.

TYPE-POOLS : SLIS.

DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, "For fieldcat definitionTABLE OF lvc_s_fcat,

WA_LAYOUT TYPE SLIS_LAYOUT_ALV, "For layout definition

WA_FIELDCAT LIKE LINE OF IT_FIELDCAT. "Work area for fieldcat

SELECTION-SCREEN BEGIN OF BLOCK B1. "with frame title t001.

SELECT-OPTIONS : s_ebeln FOR Ekko-ebeln.

SELECTION-SCREEN : END OF BLOCK B1.

START-OF-SELECTION.

PERFORM GETDATA.

PERFORM ALV.

END-OF-SELECTION.

&----


*& Form getdata

&----


  • text

----


FORM GETDATA.

SELECT EBELN

BUKRS

BSTYP

BSART

from ekko

into table it_ekko

where ebeln in s_ebeln[].

ENDFORM. "getdata

&----


*& Form alv

&----


  • text

----


FORM ALV.

WA_FIELDCAT-FIELDNAME = 'EBELN'.

WA_FIELDCAT-SELTEXT_M = 'Purchace No'.

WA_FIELDCAT-COL_POS = 1.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-FIELDNAME = 'BUKRS'.

WA_FIELDCAT-SELTEXT_M = 'Company Code'.

WA_FIELDCAT-COL_POS = 2.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-FIELDNAME = 'BSTYP'.

WA_FIELDCAT-SELTEXT_M = 'Document Category'.

WA_FIELDCAT-COL_POS = 3.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

is_layout = wa_layout

IT_FIELDCAT = IT_FIELDCAT[]

TABLES

T_OUTTAB = IT_ekko.

ENDFORM. "alv

********************************************

regards,

johnson