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: 

Field Lables not populating while using cl_salv_hierseq_table

former_member184367
Active Participant
0 Kudos

Hi all,

     I have created a hierarchical ALV using class cl_salv_hierseq_table. In 1st level ALV (highlighted yellow in below screenshot) I am not able to populate the field labels because I am not using data elements while declaration.

below is the declaration:

BEGIN OF ty_count,

          ustyp TYPE string,

          count TYPE i,

        END OF ty_count.

Please refer below screenshot.

Thanks,

Sneha.

4 REPLIES 4

Tomas_Buryanek
Active Contributor
0 Kudos

Hi,

use method GET_COLUMNS of your CL_SALV_HIERSEQ_TABLE object. From its returning object (of CL_SALV_COLUMNS_HIERSEQ) call method GET_COLUMN for each column you want to set "text label" (USTYP and COUNT). Then you end up with column object (CL_SALV_COLUMN), where you can use "setter" methods: SET_SHORT_TEXT, SET_MEDIUM_TEXT and SET_LONG_TEXT.

Its almost same like setting up column text in SALV Grid (cl_salv_table).

-- Tomas --

0 Kudos

Hi Tomas,

     I tired using the solution provided by you. But I am getting the following error.

'Method set_medium_text is unknown or protected or private'.

0 Kudos

Hi Sneha,

Please find the below code.


data: gr_columns type ref to cl_salv_columns_table.

data: gr_column type ref to cl_salv_column_table.

gr_columns = gr_table->get_columns( ).

gr_column ?= gr_columns->get_column( 'Field_Name' ).

gr_column->set_long_text( 'Long Text' ).

gr_column->set_medium_text( 'Medium Text' ).

Also find the below link

USING HIERARCHICALLY -SEQUENTIAL TABLE Factory method - Community Profiles - SCN Wiki

Regards

Rajkumar Narasimman

Moderator message: Linking farming is not allowed. Points removed

Message was edited by: Suhas Saha

raymond_giuseppi
Active Contributor
0 Kudos

Try :

  • Use CL_SALV_HIERSEQ_TABLE method GET_COLUMNS,
  • Then CL_SALV_COLUMNS_HIERSEQ method GET,
  • Now loop on the VALUE structure SALV_T_COLUMN_REF itab
  • Then CL_SALV_COLUMN_LIST the set text methods (SET_*_TEXT) on the element R_COLUMN of itab record

Before coding, try some navigation in the mentionned methods (also correct any typo)

Regards,

Raymond