07-21-2016 8:45 AM
Hi all experts,
I deloped one sales report. Its working fine. But i added one user defined field 'status' in my final table declaration.
once i checked with break point that column heading is coming correctly but once i use cl_salv_table to display report
the column heading is not coming but the value of this field coming correctly.
I have go through thread but i am not able rectify my issues. so can you guys as well as all experts please help me out over here.
I am sharing screen shot please once go through that. Some declaration i might have to do but i am not understand which i need to do for the same.
Thanks in advance to all.
Thanks & Regards,
kaushik.
Report declaration
DATA : R_ALV TYPE REF TO CL_SALV_TABLE.
DATA : R_FUNCTIONS TYPE REF TO CL_SALV_FUNCTIONS_LIST.
DATA : R_COLUMNS TYPE REF TO CL_SALV_COLUMNS_TABLE.
FORM DISPLAY .
IF P_OP = 'X' AND P_CL = ' '.
try.
call method CL_SALV_TABLE=>FACTORY
* exporting
* LIST_DISPLAY = IF_SALV_C_BOOL_SAP=>FALSE
* R_CONTAINER = R_ALV
* CONTAINER_NAME =
importing
R_SALV_TABLE = R_ALV
changing
T_TABLE = T_FINAL
.
R_FUNCTIONS = R_ALV->GET_FUNCTIONS( ).
R_FUNCTIONS->SET_ALL( IF_SALV_C_BOOL_SAP=>TRUE ).
R_COLUMNS = R_ALV->GET_COLUMNS( ).
R_COLUMNS->SET_OPTIMIZE( IF_SALV_C_BOOL_SAP=>TRUE ).
R_ALV->DISPLAY( ).
catch CX_SALV_MSG .
MESSAGE 'ERROR WHILE DISPLAYING THE REPORT .' TYPE 'I' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
endtry.
please see the column heading after net value...
07-21-2016 9:48 AM
Hi Kaushik,
After calling of GET_COLUMNS method, Call GET_COLUMN method in CL_SALV_COLUMNS_TABLE class, Here declare your field and pass to GR_COLMN( CL_SALV_COLUMN_TABLE). And call SET_SHORT_TEXT, SET_MEDIUM_TEXT, SET_LONG_TEXT methods in CL_SALV_COLUMN_TABLE class.
Add this code:
TRY.
GR_COLMN ?= GR_COLMS->GET_COLUMN( COLUMNNAME = 'YOUR FIELD' ).
GR_COLMN->SET_SHORT_TEXT( VALUE = 'Status' ).
GR_COLMN->SET_MEDIUM_TEXT( VALUE = 'Status' ).
GR_COLMN->SET_LONG_TEXT( VALUE = 'Status').
CATCH CX_SALV_NOT_FOUND .
ENDTRY.
Regards,
E.Ananthachari.
07-21-2016 8:51 AM
How did you declare the field in the interna table definition, how did you provide the column headings?
07-21-2016 9:37 AM
Ok.
Thanks Raymond.
this is the way i declared int. table.
TYPES : BEGIN OF TY_FINAL,
VKORG TYPE VBAK-VKORG,
VTEXT_S TYPE TVKOT-VTEXT,
VTWEG TYPE VBAK-VTWEG,
VTEXT_D TYPE TVTWT-VTEXT,
KUNNR TYPE VBAK-KUNNR,
NAME1 TYPE KNA1-NAME1,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
NETWR TYPE VBAK-NETWR,
STATUS(6) TYPE C,
END OF TY_FINAL.
after this declaration i fetch the data accordingly and call the factory method. value is coming correctly
as per my test case.
but i didn't provide any heading its taking by default from ddic. if i want to provide in oops alv
how would be declaration part can you please help me out little.
Thanks & Regards,
kaushik.
07-21-2016 9:48 AM
Hi Kaushik,
After calling of GET_COLUMNS method, Call GET_COLUMN method in CL_SALV_COLUMNS_TABLE class, Here declare your field and pass to GR_COLMN( CL_SALV_COLUMN_TABLE). And call SET_SHORT_TEXT, SET_MEDIUM_TEXT, SET_LONG_TEXT methods in CL_SALV_COLUMN_TABLE class.
Add this code:
TRY.
GR_COLMN ?= GR_COLMS->GET_COLUMN( COLUMNNAME = 'YOUR FIELD' ).
GR_COLMN->SET_SHORT_TEXT( VALUE = 'Status' ).
GR_COLMN->SET_MEDIUM_TEXT( VALUE = 'Status' ).
GR_COLMN->SET_LONG_TEXT( VALUE = 'Status').
CATCH CX_SALV_NOT_FOUND .
ENDTRY.
Regards,
E.Ananthachari.
07-21-2016 10:15 AM
OK.
Thank you so much to all.
I resolved my Issue Mr. Ananthachari. The output is coming absolutely correct. Thank you so much for your support.
Thank & Reagrds,
kaushik.