03-06-2009 3:57 PM
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.
03-06-2009 4:13 PM
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
03-06-2009 4:12 PM
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.
03-06-2009 4:13 PM
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
03-06-2009 4:39 PM
Hi Patel,
I used 2nd method but its not showing my Header..
Thanks,
Prasad.
03-08-2009 1:58 PM
Hi Nimesh,
Thanks a Lot .
I succeded using Data Element.
Once again Thanks.
Prasad.