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 format

Former Member
0 Kudos

I hav an internal table with 35 fields. I want to get the output in the ALV grid format.

How can i Pl help me

1 ACCEPTED SOLUTION

Former Member
0 Kudos

This is a sample code.... which has some fields...

Once you populate 35 fields in an Internal table, just pass it to the FM...

Here is the sample code...

TYPE-POOLS: SLIS.

DATA:

BEGIN OF FS_SPFLI,

CARRID TYPE SPFLI-CARRID,

CONNID TYPE SPFLI-CONNID,

COUNTRYFR TYPE SPFLI-COUNTRYFR,

CITYFROM TYPE SPFLI-CITYFROM,

AIRPFROM TYPE SPFLI-AIRPFROM,

COUNTRYTO TYPE SPFLI-COUNTRYTO,

CITYTO TYPE SPFLI-CITYTO,

AIRPTO TYPE SPFLI-AIRPTO,

FLTIME TYPE SPFLI-FLTIME,

DEPTIME TYPE SPFLI-DEPTIME,

ARRTIME TYPE SPFLI-ARRTIME,

DISTANCE TYPE SPFLI-DISTANCE,

DISTID TYPE SPFLI-DISTID,

FLTYPE TYPE SPFLI-FLTYPE,

PERIOD TYPE SPFLI-PERIOD,

END OF FS_SPFLI.

DATA:

T_SPFLI LIKE STANDARD TABLE OF FS_SPFLI.

SELECT * FROM SPFLI

INTO CORRESPONDING FIELDS OF TABLE T_SPFLI.

DATA: T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

FS_FIELDCAT LIKE LINE OF T_FIELDCAT.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

  • I_CALLBACK_PROGRAM = ' '

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

I_STRUCTURE_NAME = 'SPFLI'

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

  • IT_FIELDCAT = T_FIELDCAT

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = T_SPFLI

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Regards,

Pavan.

6 REPLIES 6

Former Member
0 Kudos

This is a sample code.... which has some fields...

Once you populate 35 fields in an Internal table, just pass it to the FM...

Here is the sample code...

TYPE-POOLS: SLIS.

DATA:

BEGIN OF FS_SPFLI,

CARRID TYPE SPFLI-CARRID,

CONNID TYPE SPFLI-CONNID,

COUNTRYFR TYPE SPFLI-COUNTRYFR,

CITYFROM TYPE SPFLI-CITYFROM,

AIRPFROM TYPE SPFLI-AIRPFROM,

COUNTRYTO TYPE SPFLI-COUNTRYTO,

CITYTO TYPE SPFLI-CITYTO,

AIRPTO TYPE SPFLI-AIRPTO,

FLTIME TYPE SPFLI-FLTIME,

DEPTIME TYPE SPFLI-DEPTIME,

ARRTIME TYPE SPFLI-ARRTIME,

DISTANCE TYPE SPFLI-DISTANCE,

DISTID TYPE SPFLI-DISTID,

FLTYPE TYPE SPFLI-FLTYPE,

PERIOD TYPE SPFLI-PERIOD,

END OF FS_SPFLI.

DATA:

T_SPFLI LIKE STANDARD TABLE OF FS_SPFLI.

SELECT * FROM SPFLI

INTO CORRESPONDING FIELDS OF TABLE T_SPFLI.

DATA: T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

FS_FIELDCAT LIKE LINE OF T_FIELDCAT.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

  • I_CALLBACK_PROGRAM = ' '

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

I_STRUCTURE_NAME = 'SPFLI'

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

  • IT_FIELDCAT = T_FIELDCAT

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = T_SPFLI

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Regards,

Pavan.

Former Member
0 Kudos

Ramesh,

check this site:

http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm

Reward points for helpful answers.

Regards,

Hk.

former_member235056
Active Contributor
0 Kudos

Hi,

REPORT Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB .

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

*Simple example to use ALV and to define the ALV data in an internal

*table

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

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

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

*For a very long time, people gave me the feeling that ALV is a

*complicated tool that is difficult to understand and to use.

*Lately I had to use it and I discovered that ALV is easy to use and

*saves a lot of work:

*ALV will generate the column headings on its own, so one does not need

*to work on headlines and transalation.

*ALV allows the user to select the columns he wants to see, so the user

*does not need to contact a developer for every change he likes to have.

*ALV allows the user to create his own sums, so …

*ALV has a simple way to work with internal tables.

*If you really want to save time, use ALV instead of write!

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

*

*Please take 30 minutes to explore the following example and see how

*easy it is to use ALV!

*

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

*data definition

tables:

marav. "Table MARA and table MAKT

----


  • Data to be displayed in ALV

  • Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-

  • matically determine the fieldstructure from this source program

Data:

begin of imat occurs 100,

matnr like marav-matnr, "Material number

maktx like marav-maktx, "Material short text

matkl like marav-matkl, "Material group (so you can test to make

" intermediate sums)

ntgew like marav-ntgew, "Net weight, numeric field (so you can test to

"make sums)

gewei like marav-gewei, "weight unit (just to be complete)

end of imat.

----


  • Other data needed

  • field to store report name

data i_repid like sy-repid.

  • field to check table length

data i_lines like sy-tabix.

----


  • Data for ALV display

TYPE-POOLS: SLIS.

data int_fcat type SLIS_T_FIELDCAT_ALV.

----


select-options:

s_matnr for marav-matnr matchcode object MAT1.

----


start-of-selection.

  • read data into table imat

select * from marav

into corresponding fields of table imat

where

matnr in s_matnr.

  • Check if material was found

clear i_lines.

describe table imat lines i_lines.

if i_lines lt 1.

  • Using hardcoded write here for easy upload

write: /

'No materials found.'.

exit.

endif.

end-of-selection.

----


*

  • Now, we start with ALV

*

----


*

*

  • To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.

  • The fieldcatalouge can be generated by FUNCTION

  • 'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any

  • report source, including this report.

  • The only problem one might have is that the report and table names

  • need to be in capital letters. (I had it )

*

*

----


  • Store report name

i_repid = sy-repid.

  • Create Fieldcatalogue from internal table

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = i_repid

I_INTERNAL_TABNAME = 'IMAT' "capital letters!

I_INCLNAME = i_repid

CHANGING

CT_FIELDCAT = int_fcat

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3.

*explanations:

  • I_PROGRAM_NAME is the program which calls this function

*

  • I_INTERNAL_TABNAME is the name of the internal table which you want

  • to display in ALV

*

  • I_INCLNAME is the ABAP-source where the internal table is defined

  • (DATA....)

  • CT_FIELDCAT contains the Fieldcatalouge that we need later for

  • ALV display

IF SY-SUBRC <> 0.

write: /

'Returncode',

sy-subrc,

'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.

ENDIF.

*This was the fieldcatlogue

----


*

  • And now, we are ready to display our list

  • Call for ALV list display

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'

I_CALLBACK_PROGRAM = i_repid

IT_FIELDCAT = int_fcat

I_SAVE = 'A'

TABLES

T_OUTTAB = imat

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

*

*explanations:

  • I_CALLBACK_PROGRAM is the program which calls this function

*

  • IT_FIELDCAT (just made by REUSE_ALV_FIELDCATALOG_MERGE) contains

  • now the data definition needed for display

*

  • I_SAVE allows the user to save his own layouts

*

  • T_OUTTAB contains the data to be displayed in ALV

IF SY-SUBRC <> 0.

write: /

'Returncode',

sy-subrc,

'from FUNCTION REUSE_ALV_LIST_DISPLAY'.

ENDIF.

*

----


Pls reward helpful points.

Regards,

Ameet

kesavadas_thekkillath
Active Contributor
0 Kudos

DATA: alvfld TYPE slis_t_fieldcat_alv WITH HEADER LINE.

DEFINE alv_macro.

move : &1 to alvfld-col_pos,

&2 to alvfld-fieldname,

&3 to alvfld-seltext_m.

append alvfld.clear alvfld.

END-OF-DEFINITION.

start-0f-selection

perform assign_columns .

perform alv.

end-of-selection.

FORM assign_columns .

REFRESH alvfld.

alv_macro '1' 'MATNR_005' 'PART NO'.

alv_macro '2' 'MAKTX' 'DESCRIPTION'.

alv_macro '3' 'WERKS_006' 'PLANT'.

alv_macro '4' 'BUDAT_002' 'POSTING DATE'.

alv_macro '5' 'BKTXT_004' 'SHIFT'.

alv_macro '6' 'ERFMG_008' 'QUANTITY'.

alv_macro '7' 'ALORT_007' 'STGLOC'.

alv_macro '8' 'MSG_E' 'ERRORS DUE TO'.

alv_macro '9' 'MSG_S' 'STATUS'.

ENDFORM. " assign_columns

FORM alv .

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-repid

it_fieldcat = alvfld[]

TABLES

t_outtab = messages " your internal table.

EXCEPTIONS

program_error = 1

OTHERS = 2.

ENDFORM. " ALV

i guess u don need the top of page in alv...if u nedd only a grid display this may be helpful..

reward if useful

0 Kudos

Hi

Dont bother about how many fields are there in internal table just write your coding in a simple and easy way such that there should not be any performance issue

Check this sample report

*&---------------------------------------------------------------------*
*& Report  ZALVGRID_WITH_RADIOBUTTONS                                  *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  ZALVGRID_WITH_RADIOBUTTONS              .

TYPE-POOLS: abap, icon. " INCLUDE <icon>. for releases < 6.20
TYPES: BEGIN OF ty_s_sflight.
INCLUDE TYPE sflight.
TYPES: button1 TYPE iconname.
TYPES: button2 TYPE iconname.
TYPES: button3 TYPE iconname.
TYPES: button4 TYPE iconname.
TYPES: END OF ty_s_sflight.

DATA:gt_sflight TYPE STANDARD TABLE OF ty_s_sflight,
     gs_layout TYPE lvc_s_layo,
     gt_fcat TYPE lvc_t_fcat.

DATA:gd_okcode TYPE ui_func,
     go_docking TYPE REF TO cl_gui_docking_container,
     go_grid TYPE REF TO cl_gui_alv_grid.


*icon_wd_radio_button_empty TYPE REF TO icon_wd_radio_button_empty.
*---------------------------------------------------------------------*
* CLASS lcl_eventhandler DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*

CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
*---------------------------------------------------------------------*
* CLASS lcl_eventhandler IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
* define local data
FIELD-SYMBOLS:
<ls_entry> TYPE ty_s_sflight,
<ld_fld> TYPE ANY.
READ TABLE gt_sflight ASSIGNING <ls_entry> INDEX es_row_no-row_id.
CHECK ( <ls_entry> IS ASSIGNED ).
* Set all radio buttons "unselected"
<ls_entry>-button1 = icon_wd_radio_button_empty.
<ls_entry>-button2 = icon_wd_radio_button_empty.
<ls_entry>-button3 = icon_wd_radio_button_empty.
<ls_entry>-button4 = icon_wd_radio_button_empty.
ASSIGN COMPONENT e_column_id-fieldname OF STRUCTURE <ls_entry>
TO <ld_fld>.
IF ( <ld_fld> IS ASSIGNED ).
* Set selected radio button "selected".
<ld_fld> = icon_wd_radio_button.
ENDIF.
* Force PAI followed by refresh of table display in PBO
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'REFRESH'
* IMPORTING
* RC =
.
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
*---------------------------------------------------------------------*
* MAIN *
*---------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM select_data.
PERFORM init_controls.
PERFORM build_fieldcatalog.
PERFORM set_layout.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
* i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING
it_fieldcatalog = gt_fcat
it_outtab = gt_sflight.
* Link docking container to dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
lifetime_dynpro_dynpro_link = 3
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL SCREEN 100.
END-OF-SELECTION.
*---------------------------------------------------------------------*
* MODULE PBO OUTPUT *
*---------------------------------------------------------------------*
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
ENDMODULE. "PBO OUTPUT
*---------------------------------------------------------------------*
* MODULE PAI INPUT *
*---------------------------------------------------------------------*
MODULE pai INPUT.
* Leave report
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
* Refresh table display
WHEN 'REFRESH'.
PERFORM refresh_display.
WHEN OTHERS.
* do nothing
ENDCASE.
CLEAR gd_okcode.
ENDMODULE. "PAI INPUT
*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM build_fieldcatalog .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'ICON'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DELETE gt_fcat WHERE ( fieldname <> 'NAME' ).
* NOTE: field ICON-NAME has data element ICONNAME.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'SFLIGHT'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE gt_fcat INTO ls_fcat
WITH KEY fieldname = 'NAME'.
IF ( syst-subrc = 0 ).
DELETE gt_fcat INDEX syst-tabix.
ENDIF.
ls_fcat-fieldname = 'BUTTON4'.
ls_fcat-coltext = ls_fcat-fieldname.
ls_fcat-icon = 'X'.
ls_fcat-hotspot = 'X'.
INSERT ls_fcat INTO gt_fcat INDEX 5.
*
ls_fcat-fieldname = 'BUTTON3'.
ls_fcat-coltext = ls_fcat-fieldname.
INSERT ls_fcat INTO gt_fcat INDEX 5.
*
ls_fcat-fieldname = 'BUTTON2'.
ls_fcat-coltext = ls_fcat-fieldname.
INSERT ls_fcat INTO gt_fcat INDEX 5.
*
ls_fcat-fieldname = 'BUTTON1'.
ls_fcat-coltext = ls_fcat-fieldname.
INSERT ls_fcat INTO gt_fcat INDEX 5.
* Renumbering of the columns
LOOP AT gt_fcat INTO ls_fcat.
ls_fcat-col_pos = syst-tabix.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
*& Form SELECT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM select_data .
* define local data
DATA:
ls_sflight TYPE ty_s_sflight.
SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_sflight.
ls_sflight-button1 = icon_wd_radio_button. " selected radiobutton
ls_sflight-button2 = icon_wd_radio_button_empty.
ls_sflight-button3 = icon_wd_radio_button_empty.
ls_sflight-button4 = icon_wd_radio_button_empty.
* Alternatively: create icons using function module 'ICON_CREATE'
* on SAP releases where these icons are not available.
MODIFY gt_sflight FROM ls_sflight
TRANSPORTING button1 button2 button3 button4
WHERE ( carrid IS NOT INITIAL ).
ENDFORM. " SELECT_DATA
*&---------------------------------------------------------------------*
*& Form INIT_CONTROLS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM init_controls .
CHECK ( go_docking IS NOT BOUND ).
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
* REPID =
* DYNNR =
* SIDE = DOCK_AT_LEFT
* EXTENSION = 50
* STYLE =
* LIFETIME = lifetime_default
* CAPTION =
* METRIC = 0
ratio = 90
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Size of container = full screen size
CALL METHOD go_docking->set_extension
EXPORTING
extension = 99999
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid instance
CREATE OBJECT go_grid
EXPORTING
* I_SHELLSTYLE = 0
* I_LIFETIME =
i_parent = go_docking
* I_APPL_EVENTS = space
* I_PARENTDBG =
* I_APPLOGPARENT =
* I_GRAPHICSPARENT =
* I_NAME =
* I_FCAT_COMPLETE = SPACE
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler for event HOTSPOT_CLICK
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR go_grid.
ENDFORM. " INIT_CONTROLS
*&---------------------------------------------------------------------*
*& Form REFRESH_DISPLAY
*&---------------------------------------------------------------------*
* Refresh table display after switching the radiobuttons
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM refresh_display .
* define local data
DATA:
ls_stable TYPE lvc_s_stbl.
ls_stable-row = abap_true.
ls_stable-col = abap_true.
CALL METHOD go_grid->refresh_table_display
EXPORTING
is_stable = ls_stable
* I_SOFT_REFRESH =
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " REFRESH_DISPLAY
*&---------------------------------------------------------------------*
*& Form SET_LAYOUT
*&---------------------------------------------------------------------*
* Set layout for ALV list
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM set_layout .
CLEAR: gs_layout.
gs_layout-cwidth_opt = abap_true. " optimize column width
gs_layout-zebra = abap_true.
ENDFORM. " SET_LAYOUT

Reward all helpfull answers

Regards

Pavan

uwe_schieferstein
Active Contributor
0 Kudos

Hello Ramesh

Have a look at my sample report <b>ZUS_SDN_FIELDCATALOG_1</b> in the following thread:

Regards

Uwe