How to Hide, or Don't show colums in ALV Grid?

I am using the standard cataloging and Function Module, REUSE_ALV_DISPLAY to pass an internal table to display fields to my ALV output.
However, I'd like to give the user options on what the report will calculate, thus having the need to only diaply certain columns on the report. Because some columns will be blank.
How can I restrain certain columns from displying on my ALV grid? Is there some logic, or parameter manipulation I need to invoke prior to my calling REUSE_ALV_DISPLAY in order to do this?
                        Thank-You

Hi
You have to change the parameter of catalog table, if you don't want to see some fields set NO_OUT = 'X'.
LOOP AT GT_FIELDCAT INTO LT_FIELDCAT.
CASE LT_FIELDCAT-FIELDNAME.
  WHEN ....
    LT_FIELDCAT-NO_OUT = 'X'.
    MODIFY GT_FIELDCAT FROM LT_FIELDCAT.
ENDCASE.
ENDLOOP.
If you don't want those fields you can delete them from catalog too.
LOOP AT GT_FIELDCAT INTO LT_FIELDCAT.
CASE LT_FIELDCAT-FIELDNAME.
  WHEN ....
    delete GT_FIELDCAT.
ENDCASE.
ENDLOOP.
Max

Similar Messages

  • How to hide or do not show the receipt's name after miss called?

    1. How to hide or do not show the receipt's name after miss called?
    2. I do not want to show my message statement in the screen.

    I have also registered to this forum to inform that the problem with showing the MAC-address in the sidebar of the finder is still not solved.
    The strange thing is that the Embedded Web Server says:
    "This specifies the Bonjour domain name assigned to the device, in the form <host name>.local. If a user-specified host name has not been assigned, the default host name HPxxxxxx is used, where xxxxxx are the last 6 digits of the LAN hardware (MAC) address. This option cannot be modified."
    But I did assign a user-specified host name and that name does show-up everywere (also within Bonjour), except in the sidebar of the finder (hp###xx##x####). Lots of people have the same issue, when searching on the interet, but not one has found the solution.
    Please help with solving this issues?

  • How to hide Print and Filter option from dynamic ALV

    Hi,
    I have created the dynamic ALV. now User don't wan't Filter , export,print Option on the ALV dispaly.
    Could you please tell me How to hide Print and Filter option from dynamic ALV.
    Thanks and regards
    Amita.

    Hi,
    Please go through the following link to get an better idea on ALV.
    [https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9&overridelayout=true]
    This is the code  which you have to write in  WDDOINIT
    DATA LO_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE.
    LO_CMP_USAGE =   WD_THIS->WD_CPUSE_ALV_TEST( ).
    IF LO_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
      LO_CMP_USAGE->CREATE_COMPONENT( ).
    ENDIF.
    DATA LO_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
          LO_INTERFACECONTROLLER =   WD_THIS->WD_CPIFC_ALV_TEST( ).
            DATA LO_VALUE TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
            LO_VALUE = LO_INTERFACECONTROLLER->GET_MODEL(
    lo_value->IF_SALV_WD_STD_FUNCTIONS~SET_EXPORT_ALLOWED( abap_false ).
    lo_value->IF_SALV_WD_STD_FUNCTIONS~SET_PDF_ALLOWED( abap_false ).
    lo_value->IF_SALV_WD_STD_FUNCTIONS~SET_VIEW_LIST_ALLOWED( abap_false ).

  • How to change a color for a row in ALV grid display

    Hi,
       how to change a color for a row in ALV grid display based on a condition.Any sample code plz

    Hello Ramya,
    Did you check in [SCN|How to color a row of  alv grid]
    Thanks!

  • How to add F1 help for a field on ALV grid

    Hi All,
    When we execute a program, the output is displayed using ALV grid.
    on the ALV grid, if we press F1 on a field, it should popup the help document.
    How to add F1 help for a field on ALV grid.
    Thank you all in advance.

    fill field LVC_S_FCAT-ROLLNAME of your fieldcatalog in method SET_TABLE_FOR_FIRST_DISPLAY
    A.

  • How can i show details in ALV GRID with double click in a row?

    Hello, ich try to show the details of a row with double click in the line,
    but it doesn't work!?
    I have a eventhandler for doubleclick and the program run this code, but what i have to do, to show the details!?
    I try it with some methods like cl_gui_cfw=>set_new_ok_code, ...
    i think about the methods cl_gui_alv_grid->show_detail, but this method is private,
    i can create a class with inheritance of the cl_gui_alv_grid class and try this method!?
    Have anybody any ideas!?

    Hello Lars
    The following sample reports shows an ALV list with company codes. Double-clicking on any company code will open a second ALV list displaying all customers.
    *& Report  ZUS_SDN_ALVGRID_EVENTS_1
    REPORT  zus_sdn_alvgrid_events_1.
    DATA:
      gd_okcode        TYPE ui_func,
      gt_fcat          TYPE lvc_t_fcat,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_docking2      TYPE REF TO cl_gui_docking_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid,
      go_grid2         TYPE REF TO cl_gui_alv_grid.
    DATA:
      gt_t001          TYPE STANDARD TABLE OF t001,
      gt_knb1          TYPE STANDARD TABLE OF knb1.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING
              e_row
              e_column
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_double_click.
    *   define local data
        DATA:
          ls_t001     TYPE t001,
          ls_col_id   TYPE lvc_s_col.
        CHECK ( sender = go_grid1 ).
        READ TABLE gt_t001 INTO ls_t001 INDEX e_row-index.
        CHECK ( ls_t001-bukrs IS NOT INITIAL ).
        SELECT * FROM knb1 INTO TABLE gt_knb1
          WHERE bukrs = ls_t001-bukrs.
        IF ( syst-subrc NE 0 ).
          MESSAGE 'No customers found' TYPE 'S'.
        ELSE.
    *     Trigger PAI of dynpro '0100' and set new ok-code
          CALL METHOD cl_gui_cfw=>set_new_ok_code( 'CALL_SCREEN_0200' ).
        ENDIF.
      ENDMETHOD.                    "handle_hotspot_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT * FROM t001 INTO TABLE gt_t001.
      REFRESH: gt_knb1.
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT go_docking2
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Create ALV grid
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_docking
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT go_grid2
        EXPORTING
          i_parent          = go_docking2
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_double_click FOR go_grid1.
    * Display data
      CALL METHOD go_grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'T001'
        CHANGING
          it_outtab        = gt_t001
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL METHOD go_grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNB1'
        CHANGING
          it_outtab        = gt_knb1
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL METHOD go_docking2->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0200'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'CALL_SCREEN_0200'.
          go_grid2->refresh_table_display( ).  " necessary
          CALL SCREEN '0200'.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Regards
      Uwe

  • Hide the value of certain cells in ALV GRID

    Hello Gurus,
    i need to hide the value or show a icon instead ib certain cells in the ALV GRID for the users that don't have the corresponding rights. Can anyone help?
    Regards,
    Ioan Constantin.

    Check this example, you'll need to adjust it to your authority object to run it.
    TYPES: BEGIN OF t_alv,
             mandt TYPE s_mandt,
             carrid TYPE s_carr_id,
             connid TYPE s_conn_id,
             fldate TYPE s_date,
             price TYPE s_price,
             currency TYPE s_currcode,
             planetype TYPE s_planetye,
             seatsmax TYPE s_seatsmax,
             seatsocc TYPE s_seatsocc,
             paymentsum TYPE s_sum,
             seatsmax_b TYPE s_smax_b,
             seatsocc_b TYPE s_socc_b,
             seatsmax_f TYPE s_smax_f,
             seatsocc_f TYPE s_socc_f,
             planetype2 TYPE s_planetye,
           END OF t_alv.
    DATA: go_alv     TYPE REF TO   cl_gui_alv_grid,
          gt_sflight TYPE TABLE OF sflight,
          gt_alv TYPE STANDARD TABLE OF t_alv,
          wa_fl TYPE sflight,
          wa_fl2 TYPE t_alv,
          gt_fieldcat TYPE lvc_t_fcat,
          wa_fcat TYPE lvc_s_fcat.
    FIELD-SYMBOLS <gs_fcat> TYPE lvc_s_fcat.
    SELECTION-SCREEN BEGIN OF SCREEN 1001.
    SELECTION-SCREEN END   OF SCREEN 1001.
    START-OF-SELECTION.
      SELECT * FROM sflight INTO TABLE gt_sflight.
      LOOP AT gt_sflight INTO wa_fl.
        wa_fl2 = wa_fl.
        IF sy-tabix <> 5.
          wa_fl2-planetype2 = wa_fl2-planetype.
        ENDIF.
        APPEND wa_fl2 TO gt_alv.
      ENDLOOP.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
          i_structure_name             = 'SFLIGHT'
        CHANGING
          ct_fieldcat                  = gt_fieldcat.
      LOOP AT gt_fieldcat ASSIGNING <gs_fcat>.
        wa_fcat = <gs_fcat>.
        IF wa_fcat-fieldname = 'PLANETYPE'.
          wa_fcat-fieldname = 'PLANETYPE2'.
          wa_fcat-col_pos = 7.
          AUTHORITY-CHECK OBJECT 'ZPERMISO16'
              ID 'ZPERMI' FIELD '01'.
          IF sy-subrc = 0.
            wa_fcat-tech = 'X'.
            wa_fcat-no_out = 'X'.
          ELSE.
            <gs_fcat>-tech = 'X'.
            <gs_fcat>-no_out = 'X'.
          ENDIF.
          APPEND wa_fcat TO gt_fieldcat.
        ENDIF.
      ENDLOOP.
      CREATE OBJECT go_alv
        EXPORTING
          i_parent = cl_gui_container=>screen0.
      CALL METHOD go_alv->set_table_for_first_display
        CHANGING
          it_outtab                     = gt_alv
          it_fieldcatalog               = gt_fieldcat .
      CALL SELECTION-SCREEN 1001.

  • HOW TO PRINT LONG TEXT OF 255 CHARACTER IN ALV GRID instead of132 Char's

    Hi sir/mam
    i'm sreekar can any one help me on this please
    "As I took a variable 'STR' with 255 length, But still ALV GRID DISPLAYS the same 132 characters, and
    When I download the report into excel it is showing the 250 charactered text"
    how can i print it in alv grid
    FORM BUID_CATALOG .
      DATA : COL_POS TYPE I.
      COL_POS = COL_POS + 1.
    *--DECLARING FIELDCATALOG FOR HEADER
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'EBELN'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Purch.doc.no.'(002).
      LT_FCAT-REF_FIELDNAME = 'EBELN'.
      LT_FCAT-REF_TABNAME = 'EKKO'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'BEDAT'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Po Date'(003).
      LT_FCAT-REF_FIELDNAME = 'EBDAT'.
      LT_FCAT-EDIT_MASK = '__.__.____'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'EKGRP'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Purch.Grp'(004).
      LT_FCAT-REF_FIELDNAME = 'BKGRP'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'EKNAM'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Purch.Grp. Name'(005).
      LT_FCAT-REF_FIELDNAME = 'EKNAM'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'LIFNR'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Vendor No.'(006).
      LT_FCAT-REF_FIELDNAME = 'ELIFN'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'NAME1'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Vendor Name'(007).
      LT_FCAT-REF_FIELDNAME = 'NAME1_GP'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'ZTERM'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Pay.Code'(008).
      LT_FCAT-REF_FIELDNAME = 'ZTERM'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'TEXT1'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Own explanation'(009).
      LT_FCAT-REF_FIELDNAME = 'DZTERM'.
      LT_FCAT-OUTPUTLEN = '30'.
      LT_FCAT-DDICTXT = 'L'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'WAERS'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Curr'(010).
      LT_FCAT-REF_FIELDNAME = 'WAERS'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'NETWR'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Net Value'(011).
      LT_FCAT-REF_FIELDNAME = 'BWERT'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
    ENDFORM.                    " BUID_CATALOG
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_BUFFER_ACTIVE         = 'X'
          I_BACKGROUND_ID         = 'ALV_BACKGROUND'
          IS_LAYOUT               = GS_LAYOUT
          IT_FIELDCAT             = LT_FCAT[]
          I_SAVE                  = G_SAVE
          IS_VARIANT              = GS_VARIANT
        IMPORTING
          E_EXIT_CAUSED_BY_CALLER = G_EXIT_CAUSED_BY_CALLER
          ES_EXIT_CAUSED_BY_USER  = GS_EXIT_CAUSED_BY_USER
        TABLES
          T_OUTTAB                = LT_FINAL[]
        EXCEPTIONS
          PROGRAM_ERROR           = 1
          OTHERS                  = 2.
      IF SY-SUBRC = 0.
        IF G_EXIT_CAUSED_BY_CALLER = 'X'.
        ELSE.
          IF GS_EXIT_CAUSED_BY_USER-BACK = 'X'.       "F3
            EXIT.
          ELSE.
            IF GS_EXIT_CAUSED_BY_USER-EXIT = 'X'.     "F15
              LEAVE TO SCREEN 1000.
            ELSE.
              IF GS_EXIT_CAUSED_BY_USER-CANCEL = 'X'. "F12
                LEAVE TO SCREEN 1000.
              ELSE.
                EXIT.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
      ELSE.
      ENDIF.
    ENDFORM.                    " DISPLAY_DATA
    CALL FUNCTION 'READ_TEXT'
    EXPORTING
    CLIENT = SY-MANDT
    ID = 'F15' "ls_thead-tdid PAYMENT TERMS
    LANGUAGE = SY-LANGU "ls_thead-tdspras "CURRENT LANGUAGE 'E'
    NAME = NAME "ls_thead-tdname PO NUMBER LW_EKKO-EBELN
    OBJECT = 'EKKO' "ls_thead-tdobject TABLE NAME EKKO
    IMPORTING
    HEADER = HTEXT
    TABLES
    LINES = LTEXT
    EXCEPTIONS
    ID = 1
    LANGUAGE = 2
    NAME = 3
    NOT_FOUND = 4
    OBJECT = 5
    REFERENCE_CHECK = 6
    WRONG_ACCESS_TO_ARCHIVE = 7
    OTHERS = 8.
    IF SY-SUBRC = 0.
    LOOP AT LTEXT.
    IF LTEXT-TDLINE NE ''.
    MOVE LTEXT-TDLINE TO WA_WORD-TEXT.
    APPEND WA_WORD TO LT_SENTENCE.
    ENDIF.
    ENDLOOP.
    ENDIF.
    LOOP AT LT_SENTENCE INTO WA_WORD.
    COUNT = COUNT + 1.
    IF COUNT = 1.
    STR = WA_WORD-TEXT.
    LW_FINAL-TEXT1 = STR.
    ELSEIF COUNT = 2 OR COUNT = 3 OR COUNT = 4 OR COUNT = 5 OR COUNT = 6 OR COUNT = 7 OR COUNT = 8.
    CONCATENATE STR WA_WORD-TEXT INTO STR SEPARATED BY SPACE.
    LW_FINAL-TEXT1 = STR.
    ENDIF.
    ENDLOOP.

    can you provide an example of how to wrap the text i have like this please see the below code and correct if any errors
    FORM GET_TEXT_LINES .
      DATA :NAME TYPE THEAD-TDNAME.
      NAME = LW_EKKO-EBELN.
      V_TABIX = SY-TABIX.
    CALLING FUNCTION READ_TEXT FOR PAYMENT TEXTS
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          CLIENT                  = SY-MANDT          "CLIENT ID 200/600/400
          ID                      = 'F15' "ls_thead-tdid "PAYMENT TERMS TEXT ID 'F15'
          LANGUAGE                = SY-LANGU "ls_thead-tdspras "CURRENT LANGUAGE 'E'
          NAME                    = NAME "ls_thead-tdname "PO NUMBER LW_EKKO-EBELN
          OBJECT                  = 'EKKO' "ls_thead-tdobject "TABLE NAME EKKO
        IMPORTING
          HEADER                  = HTEXT "LS_THEAD
        TABLES
          LINES                   = LTEXT "LT_LINES[]
        EXCEPTIONS
          ID                      = 1
          LANGUAGE                = 2
          NAME                    = 3
          NOT_FOUND               = 4
          OBJECT                  = 5
          REFERENCE_CHECK         = 6
          WRONG_ACCESS_TO_ARCHIVE = 7
          OTHERS                  = 8.
      IF SY-SUBRC = 0.
        LOOP AT LTEXT.
          IF LTEXT-TDLINE NE ''.
            MOVE LTEXT-TDLINE TO WA_WORD-TEXT.
            APPEND WA_WORD TO LT_SENTENCE.
          ENDIF.
        ENDLOOP.
      ENDIF.
    Word Wrap the text in multiple lines
      LOOP AT LT_SENTENCE INTO WA_WORD.
        CALL FUNCTION 'RKD_WORD_WRAP'
          EXPORTING
            TEXTLINE            = WA_WORD-TEXT
             OUTPUTLEN           = 100
          TABLES
            OUT_LINES           = LT_SENTENCE
          EXCEPTIONS
            OUTPUTLEN_TOO_LARGE = 1
            OTHERS              = 2.
        IF SY-SUBRC EQ 0.
             IF not LT_SENTENCE IS INITIAL.
          READ TABLE LT_SENTENCE INTO WA_WORD INDEX v_tabix.
          LW_FINAL-TEXT1 = WA_WORD_TEXT.
          MODIFY LT_FINAL FROM LW_FINAL INDEX V_TABIX.
      ENDLOOP.
      CLEAR: LT_SENTENCE.
    ENDFORM.                    " GET_TEXT_LINES
    *&      Form  LAYOUT_INIT
          text
         -->P_GS_LAYOUT  text
    FORM LAYOUT_INIT  USING RS_LAYOUT TYPE SLIS_LAYOUT_ALV.
    *"Build layout for list display
      RS_LAYOUT-DETAIL_POPUP      = 'X'.
    ENDFORM.                    " LAYOUT_INIT
    *&      Form  EVENTTAB_BUILD
          text
         -->P_GT_EVENTS[]  text
    FORM EVENTTAB_BUILD  USING RT_EVENTS TYPE SLIS_T_EVENT.
    *"Registration of events to happen during list display
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = RT_EVENTS.
      READ TABLE RT_EVENTS WITH KEY NAME = SLIS_EV_AFTER_LINE_OUTPUT
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        APPEND LS_EVENT TO RT_EVENTS.
      ENDIF.
    ENDFORM.                    " EVENTTAB_BUILD
    *&      Form  AFTER_LINE_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM AFTER_LINE_OUTPUT.
    CLEAR :COUNT,LT_SENTENCE.
    LOOP AT LT_SENTENCE INTO WA_WORD.
      READ TABLE LT_SENTENCE INTO WA_WORD INDEX V_TABIX.
      CHECK SY-SUBRC = 0.
    CALL FUNCTION 'RKD_WORD_WRAP'
        EXPORTING
          TEXTLINE  = WA_WORD-TEXT
          OUTPUTLEN = 20
        TABLES
          OUT_LINES = LT_SENTENCE.
      DESCRIBE TABLE LT_SENTENCE LINES V_TABIX.
      CHECK V_TABIX > 1.
        COUNT = COUNT + 1.                                                   
        IF COUNT = 1.                                                      
          STR = WA_WORD-TEXT.                                                         
          LW_FINAL-TEXT1 = STR.                                          
        ELSEIF COUNT = 2 OR COUNT = 3 OR COUNT = 4 OR COUNT = 5 OR COUNT = 6 OR COUNT = 7 OR COUNT = 8.
          CONCATENATE STR WA_WORD-TEXT INTO STR SEPARATED BY SPACE.
          LW_FINAL-TEXT1 = STR.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " AFTER_LINE_OUTPUT

  • How to disable sorting for some columns in a ALV GRID?

    Hi i have requirement where I have to disable sorting for some columns in a ALV GRID. i am using REUSE_ALV_GRID_DISPLAY function module.
    Can anybody help me. how to acieve this? Any code snippets will really be appreciated.

    Hi,
    I have tried this but not completely successful. I think this can be done using the OOPS method.
      DATA: it_event_exit TYPE  slis_t_event_exit.
      DATA: w_exit TYPE slis_event_exit.
      w_exit-ucomm = '&ODN'.
      w_exit-before = 'X'.
      CLEAR w_exit-after.
      APPEND w_exit TO it_event_exit.
      w_exit-ucomm = '&OUP'.
      w_exit-before = 'X'.
      CLEAR w_exit-after.
      APPEND w_exit TO it_event_exit.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program          = w_repid
          i_callback_top_of_page      = 'ALV_TOP_OF_PAGE'
          i_callback_html_top_of_page = 'ALV_HTML_TOP_OF_PAGE'
          i_callback_user_command     = 'USER_COMMAND'  <- User command form
          is_layout                   = wm_layout
          it_fieldcat                 = wt_fieldcat
          it_events                   = i_events
          it_event_exit               = it_event_exit    <- Need to fill
          it_sort                     = wt_sort
          i_default                   = 'X'
    Now you can capture this events in the user command
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      IF r_ucomm = '&OUP' and rs_selfield-SEL_TAB_FIELD = 'Your field name'.
      ENDIF.
    ENDFORM.                    "user_command
    In this form you will get the function code in 'r_ucomm' and the field selected for sorting in 'rs_selfield-SEL_TAB_FIELD'. But reseting 'r_ucomm' will not work.
    May be somebody else can give some help on this.
    But this will work if you follow the oop method.
    Please see this document for more info.
    http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an easy reference for alv grid control.pdf
    Thanks
    Vinod

  • How can we find out data in an editable ALV grid has been changed or not?

    Hi Experts,
    How can we find out whether a data in an editable ALV grid has been changed or not.
    I am using the
    FM -> REUSE_ALV_GRID_DISPLAY_LVC
    for ALV display.
    I have to chekc whther data has been changed or not befor saving. if changed then only i want to
    SAVE
    . I cannot use the internal table comparison method for this purpose also i am not using OOP ALV.
    So kindly sugest me an alternative.
    Thanks and Regards,
    Shahana

    Hi,
    Thanks for your answer. I already saw this post.
    See this method.
    CALL METHOD reuse_alv_grid->check_changed_data
    IMPORTING
    e_valid = lv_check.
    This will update the internal table with the edited values. Then we can go for internal table comparison.
    But my scenario will not allow me for itab comparisons.I just want to know the ALV data has been changed or not.
    Regards,
    Shahana

  • How can I get the selected rows from two ALV grids at the same time?

    I have a program that uses two ALV grids in one dialog screen. I'm using the OO ALV model (SALV* classes).
    The user can select any number of rows from each grid. Then, when a toolbar pushbutton is pressed, I'd have to retrieve the selected rows from both grids and start some processing with these rows.
    It is no problem to assign event handlers to both grids, and use the CL_SALV_TABLE->GET_SELECTIONS and CL_SALV_SELECTIONS->GET_SELECTED_ROWS methods to find out which rows were marked by the user. Trouble is, this only works when I raise an event in each grid separately, for instance via an own function that I added to the grid's toolbar. So, I can only see the selected rows of the same grid where such an event was raised.
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.
    As it is right now, I can have an own button in both grid's toolbar, select the rows, click on the extra button in each grid (this will tell me what entries were selected per grid). Then, I'd have to click on a third button (the one in the dialog screen's toolbar), and process the selected rows from both grids.
    How can I select the rows, then click on just one button, and process the marked entries from both grids?
    Is it somehow possible to raise an event belonging to each grid programmatically, so that then the corresponding CL_SALV_SELECTIONS->GET_SELECTED_ROWS will work?
    Thanks.

    Hello Tamas ,
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.--->
    is it possible to  have a check box in each grid  & get the selected lines in PAI of the screen ?
    regards
    prabhu

  • How to realize page numbers when printing from an ALV-Grid

    Dear ABAPers,
    with resprect to SAP note 402627 ALV-Grids in 4.6-Systems
    do not produce a header with Actual date, report title
    and page number as it does from release 610 on.
    I've spent almost the entire day on searching the SDN
    for an answer on how I could produce a page numbering.
    I've also tried quite a lot, for example by using the
    END_OF_PAGE event, but nothing worked.
    I'm using the FM REUSE_ALV_GRID_DISPLAY, but even an SAP
    sample report BCALV_GRID_01, which is supposed to
    demonstrate the object-oriented use of the several
    PRINT-events does not process PRINT_END_OF_PAGE in our
    4.6C-System.
    Is my search in vain or does anybody have experience
    with those kinds of problems under 4.6x ?
    Thanks in advance
    Andreas Flügel

    I think you should be able to use PRINT_END_OF_PAGE event for the same. That should work. Use SY-PAGNO variable to print the page no in this event.
    You will have to register this event and set the handler for the same.
    Did you try this?
    Regards,
    Ravi

  • How to show icons in ALV grid ...

    Hi guyz ,
      A lill query ....
      In an ALV gird ,if i need to display icons in one of the columns , say i have
      a field called Status , where i need show some icons like green , yellow and
      red circles , depending on some other fileds say invoice reciept date .
      So can i get icons in ALV colums.
      Please advise .
    Thanks
    Jahan

    This is very easy.  IN your status field in your internal table, you simply write the icon to it.  Make sure that the status field is defined as a character field with a length of 4.  Then write the icon to it.
    Type-pools: icon.
        write icon_green_light as icon to itab-status.
    Then when filling the field catalog, set the ICON flag.  This puts the icon in the center of the cell in ALV.
      xfc-icon     = 'X'.
      append xfc to ifc.
    Regards,
    Rich Heilman

  • How to hide the negative sign while displayed in ALV

    Hi,
    I am having a field for 'Price' for which i need the negative sign to do the sum (i.e. futher calculation) but i dont want to display the negative sign which is with 'Price' field in the output screen.
    I tried with the attribute no_sign = 'X' in the field catalogue,but still the negative sign was getting displayed in the output.
    Please help me to not to display the sign in the output.
    Thanks in Advanced.
    Regards,
    Darshana

    Hi Darshana,
    Before displaying the ALV , check what is the value of that particulat field (in a loop ) and if it is less than 0 , make it positive.
    CALACULATION part
    LOOP AT itab into wa.
      IF wa-val1 < 0 .
        wa-val1 = wa-val1 * -1 .
        MODIFY itab from wa INDEX sy-tabix .
      ENDIF.
    ENDLOOP.
    Then build the field catalogue and finally display the ALV .
    Thanks

  • Matchcode Dinamic colum in ALV grid control objects

    We have a ALV whose columns we made dinamic with fields symbols, a column is type dats and we wants a matchcode with the calendary. For this in the fieldcat we put:
    F4AVAILABL = 'X'.
    REF_FIELD = 'F_CURSO'.
    REF_TABLE = 'ZEP_ALV_DATOS'.
    edit = 'X'.
    With that we get show the calendary but don't to take the value on the cell.
    I think that the problem is for that REF_FIELD = 'F_CURSO', because my internal table don't have the field with the name F_CURSO, because the name of all fields is dinamic as well. Thanks very much, take care.

    Hi,
    i did one such..
    i specified like this..
    X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '10'.
    <b>  X_FIELDCAT-EDIT = 'X'.
      X_FIELDCAT-DATATYPE = 'DATS'.
      X_FIELDCAT-INTTYPE = 'D'.
      X_FIELDCAT-REF_TABLE = 'VEKP'.
      X_FIELDCAT-REF_FIELD = 'ZZPROMDT'.</b>
    <b>ZZPROMDT</b> should be of type DATS.
    i got the F4 help for date.
    Regadrs
    vijay

Maybe you are looking for

  • [Solved] Xorg 1.5 screwed up my NVIDIA

    Hi, Today I did a pacman -Syu and I got the newest NVIDIA driver installed and the newest Xorg. Everything broke. Well not exactly everything. But my settings are all screwed up. For a start my screen refuses to load at the normal resolution (1680x10

  • Bpartner - Link between customer and vendor if its the same face

    Hello As I understood the primary idea to keep all business partners together is to make a link between differant roles of the same partner (like link customer and vendor if its the same face). Please correct me if I am wrong. The questions is : how

  • Question about File upload functionality in Weblogic

    Hi,     We're currently trying to deploy a web application on the weblogic 12c server (via war file). And the app needs to upload a text file onto the a temperary directory within weblogic server. And on the web page side, we use JQuery File upload p

  • I get an error trying to migrate my Boot Camp Windows to my new iMac.

    How do transfer windows from imac to imac using migrate. I get an error of data transfer whenever I use migrate. Is there another way to do this?

  • Arrow in the location bar does not work

    When I want to revisit some web pages I cannot use the down arrow in the location bar to go to those web sites gain. what should I do? Thanks