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 Using TYPE-POOLS: SLIS

Former Member
0 Kudos

hi

Using TYPE-POOLS: SLIS

I created a "special group" using structure

slis_sp_group_alv

and appending it to table of type

slis_t_sp_group_alv

i call this special group internal table using the function module:

"REUSE_ALV_HIERSEQ_LIST_DISPLAY"

the sample code will look something like this:

DATA: gt_sgroup TYPE slis_t_sp_group_alv.

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

IT_SPECIAL_GROUPS = gt_sgroup.

My question is How should i add the contents of my internal tables which i create using 'fieldcat' into this "special group" say 'xyzw' is the name of my special group.

Deepak

3 REPLIES 3

Former Member
0 Kudos

Hi Deepak,

First you have to populate the internal table ( i.e, Fill the internal table ). Then pass that internal table to that function u r calling.

See d below code for your reference for how to add the rows to the internal table. Follow similarly,


REPORT zsomalv3 NO STANDARD PAGE HEADING.

TYPE-POOLS: slis.

DATA: BEGIN OF i_data OCCURS 0,
        qmnum      LIKE qmel-qmnum,
        qmart      LIKE qmel-qmart,
        qmtxt      LIKE qmel-qmtxt,
        ws_row     TYPE i,
        ws_char(5) TYPE c,
        chk,
      END OF i_data.

DATA: report_id  LIKE sy-repid.
DATA: ws_title   TYPE lvc_title VALUE 'An ALV Report'.
DATA: i_layout   TYPE slis_layout_alv.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv.

SELECT qmnum
       qmart
       qmtxt
       INTO TABLE i_data
       FROM qmel
       WHERE qmnum <= '00030000010'.


LOOP AT i_data.
  i_data-ws_row = sy-tabix.
  i_data-ws_char = 'AAAAA'.
  MODIFY i_data.
ENDLOOP.

report_id = sy-repid.
PERFORM f1000_layout_init CHANGING i_layout.
PERFORM f2000_fieldcat_init CHANGING i_fieldcat.


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
   i_callback_program                = report_id
   i_grid_title                      = ws_title
   is_layout                         = i_layout
   it_fieldcat                       = i_fieldcat
   i_save                            = 'A'
  TABLES
    t_outtab                          = i_data
 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.

*&---------------------------------------------------------------------*
*&      Form  F1000_Layout_Init
*&---------------------------------------------------------------------*

FORM f1000_layout_init USING i_layout TYPE slis_layout_alv.

  CLEAR i_layout.
  i_layout-colwidth_optimize = 'X'.
  i_layout-edit = 'X'.

ENDFORM.                    " F1000_Layout_Init
*&---------------------------------------------------------------------*
*&      Form  f2000_fieldcat_init
*&---------------------------------------------------------------------*
FORM f2000_fieldcat_init CHANGING i_fieldcat TYPE slis_t_fieldcat_alv.

  DATA: line_fieldcat TYPE slis_fieldcat_alv.

  CLEAR line_fieldcat.
  line_fieldcat-fieldname = 'QMNUM'.
  line_fieldcat-tabname   = 'I_DATA'.
  line_fieldcat-key       = 'X'.  
  line_fieldcat-seltext_m = 'Notification No.'
  APPEND line_fieldcat TO i_fieldcat.

  CLEAR line_fieldcat.
  line_fieldcat-fieldname = 'QMART'.
  line_fieldcat-ref_tabname = 'I_DATA'.
  line_fieldcat-hotspot = 'X'.           
  line_fieldcat-seltext_m = 'Notif Type'.
  APPEND line_fieldcat TO i_fieldcat.

  CLEAR line_fieldcat.
  line_fieldcat-fieldname = 'QMTXT'.
  line_fieldcat-tabname   = 'I_DATA'.
  line_fieldcat-seltext_m = 'Description'.
  APPEND line_fieldcat TO i_fieldcat.

  CLEAR line_fieldcat.
  line_fieldcat-fieldname = 'WS_ROW'.
  line_fieldcat-tabname   = 'I_DATA'.
  line_fieldcat-seltext_m = 'Row Number'.
  APPEND line_fieldcat TO i_fieldcat.

  CLEAR line_fieldcat.
  line_fieldcat-fieldname = 'WS_CHAR'.
  line_fieldcat-tabname   = 'I_DATA'.
  line_fieldcat-seltext_l = 'Test Character Field'.
  line_fieldcat-datatype  = 'CHAR'.
  line_fieldcat-outputlen = '15'.     
  APPEND line_fieldcat TO i_fieldcat. 

  CLEAR line_fieldcat.
  line_fieldcat-fieldname = 'CHK'.
  line_fieldcat-tabname   = 'I_DATA'.
  line_fieldcat-seltext_l = 'Checkbox'.
  line_fieldcat-checkbox  = 'X'. 
  line_fieldcat-edit      = 'X'. 
  APPEND line_fieldcat TO i_fieldcat.

ENDFORM.                    " f2000_fieldcat_init

Here i_fieldcat is the internal table u r passing to the function above. Just see how it is populated.

Regs,

Venkat

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Check the standard program BCALV_TEST_HIERSEQ_LIST.It will help you.

Check this also.

http://www.geocities.com/mpioud/Z_ALV_HIERSEQ_LIST.html

Former Member
0 Kudos

HI,

Below is the explanation that I could find for your case.

" If fields have been grouped in the field catalog by a shared value of the parameter SP_GROUP, the technical key of the group (FIELDCAT-SP_GROUP) is assigned to the field group text in internal table IT_SPECIAL_GROUPS.

See also the documentation of the field catalog parameter

FIELDCAT-SP_GROUP of the IMPORTING parameter IT_FIELDCAT

and the Layout paramter LAYOUT-GROUP_BUTTONS of the IMPORTING paramter

IS_LAYOUT. "

In your case you have a special group XYZW in the Field catalog. This group and the text should be populated in IT_SPECIAL_GROUPS table.

Regards,

Varaprasad

Message was edited by: Varaprasad B V V