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: 

Small Query on SALV_DEMO_HIERSEQ_SIMPLE

Former Member
0 Kudos

Hi Guys,

I am using the above ALV for my output display.

I am using 2 Internal Tables for passing the values.

Some fields of my internal table has the following formats


types:begin of Itab,
          PN(20) 
         end of itab.

When I am using to display in output I am not getting with heading PN.

I am getting space.

Plz let me know how to do this.

Thanks,

Prasad.

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

You are not getting the label in the column because SALV model doesn't find the appropriate Descritption for your column PN.

There are two ways, you can handle the situation.

1. Change the type defintion to refer to some data element with description.


types:begin of Itab,
          PN type Z_PN,
         end of itab.

Create Z_PN data element and put relevant description to it.

2. You can get the Column object and change the column heading:


  data:
    lr_columns type ref to cl_salv_columns_hierseq,
    lr_column  type ref to cl_salv_column_hierseq.

  try.
      lr_columns = gr_hierseq->get_columns( 1 ).
                                          " 1 - Master table
                                          " 2 - Item table
    catch cx_salv_not_found.
  endtry.

  try.
      lr_column ?= lr_columns->get_column( 'PN' ).
        Lr_COLUMN->SET_LONG_TEXT( 'PN' ).
        Lr_COLUMN->SET_MEDIUM_TEXT( 'PN' ).
        Lr_COLUMN->SET_SHORT_TEXT( 'PN' ).
        Lr_COLUMN->SET_OUTPUT_LENGTH( '20' ).
    catch cx_salv_not_found.                            "#EC NO_HANDLER
  endtry.

Check program: SALV_DEMO_HIERSEQ_COLUMN

Regards,

Naimesh Patel

4 REPLIES 4

former_member156446
Active Contributor
0 Kudos

Hi try this way: with your field catalog table..

READ TABLE g_fieldcat_tab into w_fielcat_tab with key FIELDNAME  = 'PN'.
if sy-subrc eq 0.
  w_fielcat_tab-SELTEXT_L  = 'Long text'.
w_fielcat_tab-SELTEXT_M = 'Medium text'.
w_fielcat_tab-SELTEXT_S = 'short text'.

modify g_fieldcat_tab from w_fielcat_tab.
  endif.

naimesh_patel
Active Contributor
0 Kudos

You are not getting the label in the column because SALV model doesn't find the appropriate Descritption for your column PN.

There are two ways, you can handle the situation.

1. Change the type defintion to refer to some data element with description.


types:begin of Itab,
          PN type Z_PN,
         end of itab.

Create Z_PN data element and put relevant description to it.

2. You can get the Column object and change the column heading:


  data:
    lr_columns type ref to cl_salv_columns_hierseq,
    lr_column  type ref to cl_salv_column_hierseq.

  try.
      lr_columns = gr_hierseq->get_columns( 1 ).
                                          " 1 - Master table
                                          " 2 - Item table
    catch cx_salv_not_found.
  endtry.

  try.
      lr_column ?= lr_columns->get_column( 'PN' ).
        Lr_COLUMN->SET_LONG_TEXT( 'PN' ).
        Lr_COLUMN->SET_MEDIUM_TEXT( 'PN' ).
        Lr_COLUMN->SET_SHORT_TEXT( 'PN' ).
        Lr_COLUMN->SET_OUTPUT_LENGTH( '20' ).
    catch cx_salv_not_found.                            "#EC NO_HANDLER
  endtry.

Check program: SALV_DEMO_HIERSEQ_COLUMN

Regards,

Naimesh Patel

0 Kudos

Hi Patel,

I used 2nd method but its not showing my Header..

Thanks,

Prasad.

0 Kudos

Hi Nimesh,

Thanks a Lot .

I succeded using Data Element.

Once again Thanks.

Prasad.