Skip to Content
author's profile photo Former Member
Former Member

User defined column name not coming to output screen using OOPS Alv.

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...

pastedImage_0.png (18.0 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jul 21, 2016 at 08: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 21, 2016 at 07:51 AM

    How did you declare the field in the interna table definition, how did you provide the column headings?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.