Skip to Content

alv grid cells style

hi folks ,

does somone know how can i make the content of a specific cell inside alv grid invisible ?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 21, 2004 at 05:07 PM

    Assume FIELD1 is field name of the column you want to make invisible. Add FIELD1_HIDE to your internal table. Populate FIELD1 with spaces, and put the real data in FIELD1_HIDE.

    In the field catalog, for column FIELD1_HIDE, set TECH to 'X'. This hides the column in such a way that the user can never display it.

    Set up a double click handler so that PAI is invoked when the user double clicks. You can invoke PAI by using

    CALL METHOD cl_gui_cfw=>set_new_ok_code

    EXPORTING

    new_code = 'MY_FUNC_CODE'.

    in the handler method for double click.

    In your PAI logic, respond to function 'MY_FUNC_CODE'. The row number was returned in the handler method for double click, so go to that row in your internal table and move the contents of FIELD1_HIDE to FIELD1.

    In PBO, redisplay the internal table using the regular refresh_table_display method.

    Does this meet your needs?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Serdar Simsekler

      Thanks Serdar for your support in regard to the points!

      I would guess that you can refresh the ALV grid from the event logic without calling PAI and PBO but I have not tried it. I tend to try and put all of my screen logic in PAI rather than having it appear in multiple places.

      Happy New Year!

  • author's profile photo Former Member
    Former Member
    Posted on Dec 14, 2004 at 10:23 AM

    Hello Herzel,

    I cannot say that I have understood your question clearly. Nor can I fathom why you would want to do it.

    What do you mean making the content of a specific cell invisible? There is a way in which you can make an entire column invisible (the user might still be able to see that column by changing his layout and making that column visible, so you would have to disallow the user from doing so, by suppressing the Layout functionality).

    But if this is not what you want, and you are looking for making the cell-contents invisible, then the only thing you can do is to not populate the cell with any contents !!

    You can maintain another internal table in your program which would contain all the values, which you might want to use for other manipulations.

    A better explanation can be given if your requirement is made clearer.

    Regards,

    Anand Mandalika.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Harel Gilor

      Helo Herzel,

      u can perfectly make the cell contents dissapear with the cell still being visible.

      Method:

      U can make this work using the approach used to color individual cells in ALV GRID. U follow these steps:

      1) declare your internal table with an additional field for color table.

      DATA: BEGIN OF itab_alv1 OCCURS 10,

      emp_id LIKE zc9_employee-emp_id,

      emp_name LIKE zc9_employee-emp_name,

      celcol TYPE slis_t_specialcol_alv, (table for color)

      END OF itab_alv1.

      data: celcol1 type slis_specialcol_alv. (work area type).

      2) Then write the following code to check your internal table field values and make the contents invisible as follows:

      LOOP AT itab_alv2.

      CLEAR ITAB_ALV1.

      MOVE-CORRESPONDING itab_alv2 TO itab_alv1.

      CLEAR celcol1.

      celcol1-fieldname = 'EMP_ID'.

      if itab_alv1-emp_id = '15530'.

      itab_alv1-emp_id = ' '.

      endif.

      celcol1-color-COL = 1.

      APPEND celcol1 TO itab_alv1-celcol.

      celcol1-fieldname = 'EMP_NAME'.

      celcol1-color-COL = 2.

      APPEND celcol1 TO itab_alv1-celcol.

      APPEND itab_alv1.

      ENDLOOP.

      Lines 6 and 7 of the above code checks for a particular value of employee-id and if the condition matches it masks it , thereby making that particular cell content invisible.

      It really works out. If u need any clarification revert to me. thank u.

      regards,

      prabaharan.g

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.