Pushbutton in alv column

Hello,
I have to create an ALV(not using OO) with a pushbutton column.  The requirement is as follows: the grid contains a text column.  When the text contains more than 100 characters, a column with a pushbutton (named: More...) is selected by the user to view the rest of the text description.  Scrolling within the text column is not desired.
Can someone tell me how to define the column as a pushbutton.  How about how to disable the pushbutton for the row, when the text is less than 100 characters?  I am thinking that I can handled the event in the user_command area of the ALV.
Can this be done?
Regards,
Anna-Liza

Hi
You can  show a field as ICON (it menages it in catalog table) and assign the HOTSPOT option to it.
In this way the field should behave itself like a push button.
As soon as you know the row you can decide which action has to be done: to show or not to show the rest of text:
you can do it activing the event HOTSPOT_CLICK.
Max

Similar Messages

  • Column as pushbutton in alv

    Hi all,
           i want to know the moethod by which we can display a coulumn as pushbutton in alv when we are usingFM Reuse_alv_list_display.. to display  ALV...
    if possible then give me some sample code
    Regards,
    Syed

    Check This example which shows button in a cell
    REPORT ZTESTALV.
    type-pools: slis.
    *Fieldcatalog
    data: it_fieldcat type lvc_t_fcat,
    it_fieldcat1 type slis_t_fieldcat_alv..
    *For Events
    data:it_events type slis_t_event.
    data: x_fieldcat type lvc_s_fcat,
    x_fieldcat1 type slis_fieldcat_alv.
    data:x_layout type lvc_s_layo.
    data: begin of it_vbap occurs 0,
    vbeln like vbap-vbeln,
    posnr like vbap-posnr,
    button(10),
    end of it_vbap.
    data: ls_outtab like line of it_vbap.
    select vbeln
    posnr
    up to 10 rows
    into corresponding fields of table it_vbap
    from vbap.
    data:l_pos type i value 1.
    clear: l_pos.
    l_pos = l_pos + 1.
    x_fieldcat-seltext = 'Button'.
    x_fieldcat-fieldname = 'BUTTON'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-icon = 'X'.
    x_fieldcat-col_pos = l_pos.
    x_fieldcat-outputlen = '10'.
    x_fieldcat-style = x_fieldcat-style bit-xor
    cl_gui_alv_grid=>mc_style_button bit-xor
    cl_gui_alv_grid=>mc_style_enabled.
    append x_fieldcat to it_fieldcat.
    clear x_fieldcat.
    l_pos = l_pos + 1.
    x_fieldcat-seltext = 'VBELN'.
    x_fieldcat-fieldname = 'VBELN'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = l_pos.
    x_fieldcat-edit = 'X'.
    x_fieldcat-outputlen = '10'.
    x_fieldcat-ref_field = 'VBELN'.
    x_fieldcat-ref_table = 'VBAK'.
    append x_fieldcat to it_fieldcat.
    clear x_fieldcat.
    l_pos = l_pos + 1.
    x_fieldcat-seltext = 'POSNR'.
    x_fieldcat-fieldname = 'POSNR'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = l_pos.
    x_fieldcat-outputlen = '5'.
    append x_fieldcat to it_fieldcat.
    clear x_fieldcat.
    l_pos = l_pos + 1.
    call function 'REUSE_ALV_GRID_DISPLAY_LVC'
      exporting
        i_callback_program = sy-repid
        is_layout_lvc      = x_layout
        it_fieldcat_lvc    = it_fieldcat
      tables
        t_outtab           = it_vbap[]
      exceptions
        program_error      = 1
        others             = 2.
    if sy-subrc eq 0.
    endif.

  • Pushbutton Inside ALV Grid

    How can I add a pushbutton inside ALV toolbar?

    Hi,
    This can be included into ALV by defining a GUI and setting that GUI using Set PF Status.
    Check the below code for the same,
    REPORT  ZSPRENH069 NO STANDARD PAGE HEADING.
    TYPE-POOLS : SLIS.                            "Global Type for ALV      
       T Y P E S                                                         *
    TYPES:
           BEGIN OF TY_VB_AKAP,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to party
             POSNR      TYPE POSNR_VA,                       "Item Number
             MATNR      TYPE MATNR,                          "Material Number
             PMATN      TYPE PMATN,                          "Pricing Reference Material/Newly Created Material
             KWMENG     TYPE KWMENG,                         "Cumulative Order Qty. in Sales Units
             VRKME      TYPE VRKME,                          "Sales Unit
            NETPR      TYPE NETPR,                          "Net Price
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             VKAUS      TYPE ABRVW,                          "Usage Indicator
           END   OF TY_VB_AKAP,
           BEGIN OF TY_MARA,
             MATNR      TYPE MATNR,                          "Material Number
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
           END   OF TY_MARA,
           BEGIN OF TY_MVKE,
             MATNR      TYPE MATNR,                          "Material Number
             VKORG      TYPE VKORG,                          "Sales Organization
             VTWEG      TYPE VTWEG,                          "Distribution Channel
             KONDM      TYPE KONDM,                          "Material Pricing Group
           END   OF TY_MVKE,
           BEGIN OF TY_VBKD,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             POSNR      TYPE POSNR_VA,                       "Item Number
             BSTKD_E    TYPE BSTKD_E,                        "Used to capture New Material Number
           END   OF TY_VBKD,
           BEGIN OF TY_IHEADER,
             SELECT(1)  TYPE C,                              "Check Box
             VBELN      TYPE VBELN,                          "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to Party
           END   OF TY_IHEADER,
           BEGIN OF TY_MESSAGE1,
            VKORG     TYPE VKORG,                            "Sales Organization
            VTWEG     TYPE VTWEG,                            "Distribution Channel
            KUNNR     TYPE KUNAG,                            "Customer number
            KONDM     TYPE KONDM,                            "Material pricing group
            ZCOUNT(2) TYPE N,                                "Zcount
            MSGTYP(1) TYPE C,                                "Message type
            TEXT(150) TYPE C,                                "Message text
           END OF TY_MESSAGE1,
           BEGIN OF TY_MESSAGE2,
            VKORG     TYPE VKORG,                            "Sales Organization
            VTWEG     TYPE VTWEG,                            "Distribution Channel
            KUNNR     TYPE KUNAG,                            "Customer number
            MATNR     TYPE MATNR,                            "Material Number
            MSGTYP(1) TYPE C,                                "Message type
            TEXT(150) TYPE C,                                "Message text
           END OF TY_MESSAGE2,
           BEGIN OF TY_IFINAL,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KWMENG     TYPE KWMENG,                         "Cumulative Order Qty. in Sales Units
             POSNR      TYPE POSNR_VA,                       "Item Number
             KUNNR      TYPE KUNAG,                          "Sold-to party
             MATNR      TYPE MATNR,                          "Material Number
             VRKME      TYPE VRKME,                          "Sales Unit
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             VKAUS      TYPE ABRVW,                          "Usage Indicator
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
             PMATN      TYPE PMATN,                          "Pricing Reference Material/Newly Created Material
             KONDM      TYPE KONDM,                          "Material Pricing Group
           END   OF TY_IFINAL,
           BEGIN OF TY_ACC1,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to party
             KONDM      TYPE KONDM,                          "Material Pricing Group
             ZCOUNT(2)  TYPE N,                              "ZCount indicator
             KSTBM      TYPE KSTBM,                          "Quantity
             VRKME      TYPE VRKME,                          "Sales Unit
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             ERROR(1)   TYPE N,                              "Error Field
           END   OF TY_ACC1,
           BEGIN OF TY_ACC2,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to party
             MATNR      TYPE MATNR,                          "Material Number
             KSTBM      TYPE KSTBM,                          "Cumulative Order Qty. in Sales Units
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
             VRKME      TYPE VRKME,                          "Sales Unit
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             ERROR(1)   TYPE N,                              "Error field
           END   OF TY_ACC2.
       D A T A                                                           *
    Internal Table Declarations
    DATA: T_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV,           "Fieldcatalog IT
          T_EVENTS       TYPE SLIS_T_EVENT,                  "Event IT
          T_HEADER       TYPE SLIS_T_LISTHEADER,             "Header IT
          T_VB_AKAP      TYPE STANDARD TABLE OF TY_VB_AKAP,  "To hold records from VBAK & VBAP Table
          T_MARA         TYPE STANDARD TABLE OF TY_MARA,     "To hold records from MARA Table
          T_MVKE         TYPE STANDARD TABLE OF TY_MVKE,     "To hold records from MVKE Table
          T_VBKD         TYPE STANDARD TABLE OF TY_VBKD,     "To hold records from VBKD Table
          T_IHEADER      TYPE STANDARD TABLE OF TY_IHEADER,  "To hold records from VBAK Table
          T_IFINAL       TYPE STANDARD TABLE OF TY_IFINAL,   "To hold cumulative data for ALV
          T_BDCDATA      TYPE STANDARD TABLE OF BDCDATA,     "IT for bdcdata
          T_BDCMSGCOLL   TYPE STANDARD TABLE OF BDCMSGCOLL,  "IT for error messages
          T_MESSAGE1     TYPE STANDARD TABLE OF TY_MESSAGE1, "IT for conditions1 messages
          T_MESSAGE2     TYPE STANDARD TABLE OF TY_MESSAGE2, "IT for conditions2 messages
          T_ACC2         TYPE STANDARD TABLE OF TY_ACC2,     "IT for holding data for Second Access Sequence Processing
          T_ACC1         TYPE STANDARD TABLE OF TY_ACC1,     "IT for holding data for First Access Sequence Processing
          T_SELECT       TYPE STANDARD TABLE OF RSPARAMS,    "IT for holding data related to the selection screen
    Work area Declarations
          W_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV,             "Fieldcatalog WA
          W_EVENT        TYPE SLIS_ALV_EVENT,                "Event WA
          W_HEADER       TYPE SLIS_LISTHEADER,               "Header WA
          W_LAYOUT       TYPE SLIS_LAYOUT_ALV,               "Layout WA
          W_KEYINFO      TYPE SLIS_KEYINFO_ALV,              "Key Information WA
          W_VB_AKAP      TYPE TY_VB_AKAP,                    "To hold records from T_VB_AKAP
          W_MARA         TYPE TY_MARA,                       "To hold records from T_MARA
          W_MVKE         TYPE TY_MVKE,                       "To hold records from T_MVKE
          W_VBKD         TYPE TY_VBKD,                       "To hold records from T_VBKD
          W_IHEADER      TYPE TY_IHEADER,                    "To hold records from T_IHEADER
          W_IFINAL       TYPE TY_IFINAL,                     "To hold records from T_IFINAL
          W_PARAMS       TYPE CTU_PARAMS,                    "CTU Params
          W_BDCDATA      TYPE BDCDATA,                       "Work Area for BDCDATA
          W_BDCMSGCOLL   TYPE BDCMSGCOLL,                    "Work Area to collect BDC Messages
          W_MESSAGE1     TYPE TY_MESSAGE1,                   "WA for price conditions1 messages
          W_MESSAGE2     TYPE TY_MESSAGE2,                   "WA for price conditions2 messages
          W_ACC2         TYPE TY_ACC2,                       "WA for holding records from T_ACC2
          W_ACC1         TYPE TY_ACC1,                       "WA for holding records from T_ACC1
    Variable declarations
          G_AUDAT       TYPE AUDAT,                          "Document Date (Date Received/Sent)
          G_VBELN       TYPE VBELN_VA,                       "Sales Document
          G_KUNNR       TYPE KUNAG,                          "Sold-to party
          G_MATNR       TYPE MATNR,                          "Material Number
          G_REPID       TYPE SY-REPID,                       "Program Name
          G_MESSAGE(73) TYPE C,                              "To Capture Message
          G_FLAG1(1)    TYPE C,                              "Flag
          G_ANSWER(1)   TYPE C.                              "Optional Button
    Constant declarations
    CONSTANTS:
          C_A(1)         TYPE C VALUE 'A',                    "Constant Value A
          C_S(1)         TYPE C VALUE 'S',                    "Constant Value S
          C_U(1)         TYPE C VALUE 'U',                    "Constant Value U
          C_X(1)         TYPE C VALUE 'X',                    "Constant Value X
          C_E(1)         TYPE C VALUE 'E',                    "Constant Value E
          C_I(1)         TYPE C VALUE 'I',                    "Constant Value I
          C_R(1)         TYPE C VALUE 'R',                    "Constant Value R
          C_B(1)         TYPE C VALUE 'B',                    "Document Category is Quotation
          C_HTNAME(10)   TYPE C VALUE 'T_IHEADER',            "Internal table for Header Data
          C_ITNAME(10)   TYPE C VALUE 'T_IFINAL',             "Internal Table with processed data
          C_Q2(2)        TYPE C VALUE 'Q2',                   "Constant Order Reason Q2
          C_100(3)       TYPE C VALUE '100',                  "Popup screen
         C_046(3)       TYPE C VALUE '046',                    "Value 046
         C_047(3)       TYPE C VALUE '047',                    "Value 047
          C_25(2)        TYPE C VALUE '25',                   "Popup screen
          C_5(1)         TYPE C VALUE '5',                    "Popup screen
          C_1            TYPE I VALUE  1,                     "Value 1 for Error Denotion
          C_2            TYPE I VALUE  2,                     "Value 2 for Error Denotion
          C_3            TYPE I VALUE  3,                     "Value 3 for BDC Error Denotion
          C_1000(4)      TYPE N VALUE 1000,                     "Value 1000
          C_01(2)        TYPE N VALUE '01',                   "Value 01 for Zcount
          C_VK11(4)      TYPE C VALUE 'VK11',                 "Transaction VK11
          C_DYNBEGIN(1)  TYPE C VALUE 'X',                    "Indicator
          C_UPDATE(1)    TYPE C VALUE 'S',                    "Update
          C_DISMODE(1)   TYPE C VALUE 'N',                    "Display
          C_ZBPR(4)      TYPE C VALUE 'ZBPR',                 "Condition Type ZBPR
          C_ERROR(5)     TYPE C VALUE 'ERROR'.                "Error screen title
       S E L E C T   O P T I O N S  &  P A R A M E T E R S               *
    Selection-screen Block 1
    SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
    PARAMETERS:     P_VKORG TYPE VKORG OBLIGATORY,           "Sales Organization
                    P_VTWEG TYPE VTWEG OBLIGATORY,           "Distribution Channel
                    P_SPART TYPE SPART DEFAULT '00'.         "Division
    SELECTION-SCREEN END OF BLOCK BLK1.
    SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-002.
    SELECT-OPTIONS: S_AUDAT FOR G_AUDAT,                     "Document Date (Date Received/Sent)
                    S_VBELN FOR G_VBELN,                     "Sales Document
                    S_KUNNR FOR G_KUNNR,                     "Sold-to party
                    S_MATNR FOR G_MATNR.                     "Material Number
    PARAMETERS:     P_VKAUS(2) TYPE N.                       "Usage Indicator
    SELECTION-SCREEN END OF BLOCK BLK2.
      I N I T I A L I Z A T I O N                                        *
    INITIALIZATION.
      CLEAR : G_REPID.                                       "Program Name
      G_REPID = SY-REPID.                                    "Program Name
      A T   S E L E C T I O N   S C R E E N                              *
    AT SELECTION-SCREEN.
      S T A R T   O F   S E L E C T I O N                                *
    START-OF-SELECTION.
    Data Selection
      PERFORM DATA_RETRIEVAL.
    Build Field Catalog
      PERFORM BUILD_FIELDCATALOG.
    Bulid layout
      PERFORM BUILD_LAYOUT.
    Build Events
      PERFORM BUILD_EVENTS.
    Captures the Values of Selection Screen
      PERFORM CAPTURE_SCREEN.
      E N D   O F   S E L E C T I O N                                    *
    END-OF-SELECTION.
    Display List
      PERFORM DISPLAY_ALV_REPORT.
      F O R M S                                                          *
    *&      Form  DATA_RETRIEVAL
          Retrieves Data for ALV Display
    FORM DATA_RETRIEVAL .
      DATA : L_VKAUS   TYPE VKAUS.            "Variable to hold Usage Indicator
      CLEAR L_VKAUS.
      SELECT VBELN
             KUNNR
        INTO CORRESPONDING FIELDS OF TABLE T_IHEADER
        FROM VBAK
        WHERE VBELN IN S_VBELN
          AND KUNNR IN S_KUNNR
          AND VKORG EQ P_VKORG
          AND AUDAT IN S_AUDAT
          AND VTWEG EQ P_VTWEG
          AND SPART EQ P_SPART
          AND AUGRU EQ C_Q2
          AND VBTYP EQ C_B.
      IF NOT T_IHEADER IS INITIAL.
        IF NOT P_VKAUS IS INITIAL OR P_VKAUS NE C_1.
          CONCATENATE 'C' P_VKAUS INTO L_VKAUS.
          SELECT A~VBELN
                 A~KUNNR
                 B~POSNR
                 B~MATNR
                 B~PMATN
                 B~KWMENG
                 B~VRKME
                B~NETPR
                 B~KZWI1
                 B~VKAUS
           INTO  TABLE T_VB_AKAP
           FROM  VBAK AS A
           JOIN  VBAP AS B
             ON  A~VBELN EQ B~VBELN
           FOR ALL ENTRIES IN T_IHEADER
            WHERE A~VBELN EQ T_IHEADER-VBELN
              AND B~MATNR IN S_MATNR
              AND B~VKAUS EQ L_VKAUS.
        ELSE.
          SELECT A~VBELN
                 A~KUNNR
                 B~POSNR
                 B~MATNR
                 B~PMATN
                 B~KWMENG
                 B~VRKME
                B~NETPR
                 B~KZWI1
                 B~VKAUS
           INTO  TABLE T_VB_AKAP
           FROM  VBAK AS A
           JOIN  VBAP AS B
             ON  A~VBELN EQ B~VBELN
           FOR ALL ENTRIES IN T_IHEADER
           WHERE A~VBELN EQ T_IHEADER-VBELN
             AND B~MATNR IN S_MATNR.
        ENDIF.
        IF NOT T_VB_AKAP IS INITIAL.
          SELECT  VBELN
                  POSNR
                  BSTKD_E
             INTO TABLE T_VBKD
             FROM VBKD
             FOR ALL ENTRIES IN T_VB_AKAP
             WHERE VBELN EQ T_VB_AKAP-VBELN
               AND POSNR EQ T_VB_AKAP-POSNR.
        ENDIF.
        SORT T_VBKD BY VBELN POSNR.
        CLEAR W_VB_AKAP.
      After much of coding was completed, Usage of PMATN was dropped and
      the first eighteen characters of the field BSTKD was proposed for usage
      Hence PMATN is overwritten by BSTKD value in the below loop
        LOOP AT T_VB_AKAP INTO W_VB_AKAP.
          CLEAR: W_VBKD,
                 W_VB_AKAP-PMATN.
          READ TABLE T_VBKD INTO W_VBKD
                            WITH KEY VBELN = W_VB_AKAP-VBELN
                                     POSNR = W_VB_AKAP-POSNR
                            BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_VB_AKAP-PMATN = W_VBKD-BSTKD_E+0(18).
          ENDIF.
          MODIFY T_VB_AKAP FROM W_VB_AKAP TRANSPORTING PMATN.
          CLEAR W_VB_AKAP.
        ENDLOOP.
        IF NOT T_VB_AKAP IS INITIAL.
          SELECT    MATNR
                    ZZTECHSPEC
            INTO    TABLE T_MARA
            FROM    MARA
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-MATNR.
          IF SY-SUBRC EQ 0.
            SORT T_MARA BY MATNR.
          ENDIF.                     "Checking SY-SUBRC for T_MARA
          SELECT    MATNR
                    ZZTECHSPEC
            APPENDING TABLE T_MARA
            FROM    MARA
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-PMATN.
          IF SY-SUBRC EQ 0.
            SORT T_MARA BY MATNR.
          ENDIF.                     "Checking SY-SUBRC for T_MARA
          SELECT    MATNR
                    VKORG
                    VTWEG
                    KONDM
            INTO    TABLE T_MVKE
            FROM    MVKE
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-PMATN.
          IF SY-SUBRC EQ 0.
            SORT T_MVKE BY MATNR VKORG VTWEG.
          ENDIF.                     "Checking SY-SUBRC for T_MVKE
          SELECT    MATNR
                    VKORG
                    VTWEG
                    KONDM
            APPENDING TABLE T_MVKE
            FROM    MVKE
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-MATNR.
          IF SY-SUBRC EQ 0.
            SORT T_MVKE BY MATNR VKORG VTWEG.
          ENDIF.                     "Checking SY-SUBRC for T_MVKE
        ENDIF.                    " FOR T_VB_AKAP NOT INITIAL.
      ENDIF.                    " FOR T_IHEADER NOT INITIAL.
      CLEAR: W_VB_AKAP,
             W_IFINAL.
      LOOP AT T_VB_AKAP INTO W_VB_AKAP.
        W_IFINAL-VBELN  = W_VB_AKAP-VBELN.
        W_IFINAL-KUNNR  = W_VB_AKAP-KUNNR.
        W_IFINAL-POSNR  = W_VB_AKAP-POSNR.
        W_IFINAL-MATNR  = W_VB_AKAP-MATNR.
        W_IFINAL-PMATN  = W_VB_AKAP-PMATN.
        W_IFINAL-KWMENG = W_VB_AKAP-KWMENG.
        W_IFINAL-VRKME  = W_VB_AKAP-VRKME.
       W_IFINAL-NETPR  = W_VB_AKAP-NETPR.
        W_IFINAL-KZWI1  = ( W_VB_AKAP-KZWI1 / W_VB_AKAP-KWMENG ) * 1000.
        W_IFINAL-VKAUS  = W_VB_AKAP-VKAUS.
      Populating Material Pricing Group from New Material Group, if such Group doesn't exist
      Population of Material Pricing Group from Material Number is tried.
      Similar condition does suit for Tech Spec too.
        SORT: T_MVKE BY MATNR VKORG VTWEG,
              T_MARA BY MATNR.
        IF NOT W_VB_AKAP-PMATN IS INITIAL.
          CLEAR W_MVKE.
          READ TABLE    T_MVKE
               INTO     W_MVKE
               WITH KEY MATNR = W_VB_AKAP-PMATN
                        VKORG = P_VKORG
                        VTWEG = P_VTWEG
               BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_IFINAL-KONDM = W_MVKE-KONDM.
          ENDIF.
          READ TABLE     T_MARA
               INTO      W_MARA
               WITH KEY  MATNR = W_VB_AKAP-PMATN
               BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_IFINAL-ZZTECHSPEC = W_MARA-ZZTECHSPEC.
          ENDIF.                              " SY-SUBRC FOR READ TABLE T_MARA
       IF W_MVKE-KONDM IS INITIAL.
        ELSE.
         SORT T_MVKE BY MATNR VKORG VTWEG.
          CLEAR W_MVKE.
          READ TABLE     T_MVKE
               INTO      W_MVKE
               WITH KEY  MATNR = W_VB_AKAP-MATNR
                         VKORG = P_VKORG
                         VTWEG = P_VTWEG
               BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_IFINAL-KONDM = W_MVKE-KONDM.
          ENDIF.
          READ TABLE     T_MARA
               INTO      W_MARA
               WITH KEY  MATNR = W_VB_AKAP-MATNR
               BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_IFINAL-ZZTECHSPEC = W_MARA-ZZTECHSPEC.
          ENDIF.                              " SY-SUBRC FOR READ TABLE T_MARA
       ELSE.
         W_IFINAL-KONDM  =  W_MVKE-KONDM.
        ENDIF.                              " IS INITIAL CHECK FOR W_MVKE-KONDM
        APPEND W_IFINAL TO T_IFINAL.
        CLEAR: W_VB_AKAP,
               W_IFINAL.
      ENDLOOP.
      SORT T_IFINAL BY VBELN.
    Checking whether if there are any header quotations which does not have items against them in item internal table
    if such records exist then, ensuring that such records gets deleted from header too, so that inconsitency is removed.
      CLEAR W_IHEADER.
      LOOP AT T_IHEADER INTO W_IHEADER.
        CLEAR W_IFINAL.
        READ TABLE T_IFINAL INTO W_IFINAL WITH KEY VBELN = W_IHEADER-VBELN.
        IF SY-SUBRC NE 0.
          W_IHEADER-SELECT = C_X.
          MODIFY T_IHEADER FROM W_IHEADER TRANSPORTING SELECT.
        ENDIF.
      ENDLOOP.
      DELETE T_IHEADER WHERE SELECT = C_X.
      SORT T_IFINAL BY VBELN.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  build_layout
          To build ALV Layout
    FORM BUILD_LAYOUT.
      CLEAR  : W_LAYOUT.
      W_LAYOUT-COLWIDTH_OPTIMIZE = C_X.
      W_LAYOUT-BOX_TABNAME       = C_HTNAME.      "tabname for checkbox
      W_LAYOUT-BOX_FIELDNAME     = 'SELECT'.      "fieldname for checkbox
      CLEAR  : W_KEYINFO.
      W_KEYINFO-HEADER01 = 'VBELN'.               "Header1 key information
      W_KEYINFO-ITEM01   = 'VBELN'.               "Item1 key information
    ENDFORM.                                      "build_layout
    *&      Form  build_events
          To build ALV Events
    FORM BUILD_EVENTS.
      CONSTANTS: C_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE     = 1
        IMPORTING
          ET_EVENTS       = T_EVENTS
        EXCEPTIONS
          LIST_TYPE_WRONG = 1
          OTHERS          = 2.
      IF SY-SUBRC = 0.
        READ TABLE T_EVENTS INTO W_EVENT
                            WITH KEY NAME = C_TOP_OF_PAGE.
        IF SY-SUBRC = 0.
          MOVE C_TOP_OF_PAGE TO W_EVENT-FORM.
          MODIFY T_EVENTS INDEX SY-TABIX
                          FROM  W_EVENT
                          TRANSPORTING FORM.
        ENDIF.
      ELSE.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                                      "build_events
    *&      Form  top_of_page
          To display top of page in ALV Report
    FORM TOP_OF_PAGE.                                           "#EC CALLED
      DATA :
        L_VKORG(35) TYPE C,                        "Sales Organization
        L_VTWEG(35) TYPE C,                        "Distribution Channel
        L_SPART(35) TYPE C.                        "Division
    Title
    CLEAR W_HEADER.
    W_HEADER-TYP  = C_H.
    W_HEADER-INFO = TEXT-003.
    APPEND W_HEADER TO T_HEADER.
    Sales Organization
      CLEAR W_HEADER.
      W_HEADER-TYP  = C_S.
      CONCATENATE TEXT-004 P_VKORG INTO L_VKORG.
      W_HEADER-INFO = L_VKORG.
      APPEND W_HEADER TO T_HEADER.
    Distribution Channel
      CLEAR W_HEADER.
      W_HEADER-TYP  = C_S.
      CONCATENATE TEXT-005 P_VTWEG INTO L_VTWEG.
      W_HEADER-INFO = L_VTWEG.
      APPEND W_HEADER TO T_HEADER.
    Division
      CLEAR W_HEADER.
      W_HEADER-TYP  = C_S.
      CONCATENATE TEXT-006 P_SPART INTO L_SPART.
      W_HEADER-INFO = L_SPART.
      APPEND W_HEADER TO T_HEADER.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = T_HEADER.
    ENDFORM.                                      "top_of_page
    *&      Form  pf_status
          To set PF-Status (user interface)
         -->EXTAB     The excluding table (function codes)
    FORM PF_STATUS                                              "#EC CALLED
              USING T_EXTAB TYPE SLIS_T_EXTAB.                  "#EC NEEDED
      SET PF-STATUS 'ZSTANDARD_FULLSCREEN'.
    ENDFORM.                                      "pf_status
    *&      Form  display_alv_report
          To display ALV report
    FORM DISPLAY_ALV_REPORT.
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
      I_INTERFACE_CHECK              = ' '
         I_CALLBACK_PROGRAM             = G_REPID
         I_CALLBACK_PF_STATUS_SET       = 'PF_STATUS'
         I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'
         IS_LAYOUT                      = W_LAYOUT
         IT_FIELDCAT                    = T_FIELDCATALOG
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
         I_DEFAULT                      = C_X
         I_SAVE                         = C_A
      IS_VARIANT                     =
         IT_EVENTS                      = T_EVENTS[]
      IT_EVENT_EXIT                  =
         I_TABNAME_HEADER               = 'T_IHEADER'
         I_TABNAME_ITEM                 = 'T_IFINAL'
      I_STRUCTURE_NAME_HEADER        =
      I_STRUCTURE_NAME_ITEM          =
          IS_KEYINFO                     = W_KEYINFO
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                =
      IR_SALV_HIERSEQ_ADAPTER        =
      IT_EXCEPT_QINFO                =
      I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          T_OUTTAB_HEADER                = T_IHEADER
          T_OUTTAB_ITEM                  = T_IFINAL
       EXCEPTIONS
         PROGRAM_ERROR                  = 1
         OTHERS                         = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                                      "display_alv_report
    *&      Form  BUILD_FIELDCATALOG
          To build ALV Field Catalog
    FORM BUILD_FIELDCATALOG .
      DATA: L_COUNT TYPE I VALUE 0.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_HTNAME.
      W_FIELDCATALOG-FIELDNAME   = 'SELECT'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C01.
      W_FIELDCATALOG-CHECKBOX    =  C_X.
      W_FIELDCATALOG-EDIT        =  C_X.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_HTNAME.
      W_FIELDCATALOG-FIELDNAME   = 'VBELN'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C02.
      W_FIELDCATALOG-KEY         =  C_X.   "Fixes the column for no-scroll
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_HTNAME.
      W_FIELDCATALOG-FIELDNAME   = 'KUNNR'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C04.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR L_COUNT.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'POSNR'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C03.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'KWMENG'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C06.
      W_FIELDCATALOG-EMPHASIZE   =  'C400'.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'VRKME'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C07.
      W_FIELDCATALOG-JUST        =  C_R.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
    W_FIELDCATALOG-FIELDNAME   = 'NETPR'.
      W_FIELDCATALOG-FIELDNAME   = 'KZWI1'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C08.
      W_FIELDCATALOG-EMPHASIZE   =  'C400'.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'VKAUS'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C12.
      W_FIELDCATALOG-JUST        =  C_R.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'ZZTECHSPEC'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C09.
      W_FIELDCATALOG-EMPHASIZE   =  'C400'.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'MATNR'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C05.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'PMATN'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C10.
      W_FIELDCATALOG-EMPHASIZE   =  'C400'.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'KONDM'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C11.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  user_command
          EXIT routine for command handling
         -->L_UCOMM      Function code that PAI triggered
         -->W_SELFIELD   Information cursor position ALV
    FORM USER_COMMAND USING L_UCOMM    LIKE SY-UCOMM            "#EC CALLED
                            W_SELFIELD TYPE SLIS_SELFIELD.      "#EC NEEDED
    Check function code
      CASE L_UCOMM.
        WHEN 'CREATE'.
          SORT T_IHEADER BY SELECT.
          READ TABLE T_IHEADER INTO W_IHEADER
                              WITH KEY SELECT = C_X
                              BINARY SEARCH.
          IF SY-SUBRC <> 0.
            MESSAGE I000(ZS) WITH TEXT-M01.
          ELSE.
            CLEAR : G_ANSWER.
    Dialog box for save prompts
            CALL FUNCTION 'POPUP_TO_CONFIRM'
              EXPORTING
                TEXT_QUESTION         = TEXT-OP1
                DISPLAY_CANCEL_BUTTON = ''
              IMPORTING
                ANSWER                = G_ANSWER
              EXCEPTIONS
                TEXT_NOT_FOUND        = 1
                OTHERS                = 2.
            IF SY-SUBRC <> 0.
              MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
            ELSE.
              IF G_ANSWER = 1.
                SET PF-STATUS 'ZSTANDARD_SCREEN'.
                PERFORM DATA_IDENTITY_4_ACCESS_SEQ.
                PERFORM CREATE_CONDITIONS.
                PERFORM DISPLAY_RESULT.
              ENDIF.
            ENDIF.
          ENDIF.
        WHEN '&REFRESH'.
          SUBMIT ZSPRENH069 USING SELECTION-SCREEN 1000
                            WITH SELECTION-TABLE T_SELECT.
        WHEN 'BACKTO'.
          SUBMIT ZSPRENH069 USING SELECTION-SCREEN 1000
                            WITH SELECTION-TABLE T_SELECT.
      ENDCASE.
    ENDFORM.                                      "user_command
    *&      Form  DATA_IDENTITY_4_ACCESS_SEQ
    Seperates the Available Data for processing for both Access Sequences
    FORM DATA_IDENTITY_4_ACCESS_SEQ .
      CLEAR : W_IFINAL,
              W_ACC1,
              W_ACC2.
      SORT T_MVKE BY MATNR VKORG VTWEG.
      LOOP AT T_IHEADER INTO W_IHEADER WHERE SELECT = C_X.
        LOOP AT T_IFINAL INTO W

  • Web dynpro for abap how to create a customize search help in alv column

       hi:
          Web dynpro for abap how to create a customize search help in alv column and put search help value into alv column?
          Are there specific examples ?
          thanks!!

    HI:
       I want to created a freely programed help which include date&time,and put help value to alv column.
      I have created a freely programed help in web dynpro for abpa application,I refer:
      **************** - WebDynpro for ABAP
      but have a problem!
       If you focus on the the input field in the first row, you get the value help
    However if  I go to the second row and focus on the same input field in this column, I don't get the value help:
    What is a good way to solve similar problems?
    thanks

  • Problem while exporting ALV column header to excel sheet.

    Hi,
    I am able to export an ALV grid details to an excel sheet. But the ALV column headers when exported to excel sheet are getting truncated.
    For eg: if my column header in ALV grid is displayed as 'Material' then the column header in excel sheet is 'Mater' only. Remaining portion is getting truncated.
    How can I view the entire column header text?
    Kindly assist.
    Thanks.

    I have the same problem with you, when user export to excel. I fixed it by using
    w_layo-colwidth_optimize = 'X'. <<<<<<<<<<<<This
    perform generate_fcat_reftab
        using 'PRUEFLOS' 'T_INPUT' '' '' 'Inspection Lot' 0.
    form generate_fcat_reftab  using    p_fieldname
                                        p_tabname
                                        p_ref_tabname
                                        p_ref_fieldname
                                        p_output_text
                                        p_output_lenght.
      clear w_fcat.
      w_fcat-fieldname = p_fieldname.
      w_fcat-tabname   = p_tabname.
      w_fcat-ref_fieldname = p_ref_fieldname.
      w_fcat-ref_tabname = p_ref_tabname.
      w_fcat-seltext_s = p_output_text.
      w_fcat-seltext_m = p_output_text.
      w_fcat-seltext_l = p_output_text.
      w_fcat-outputlen = p_output_lenght.
      w_fcat-ddictxt = 'L'. <<<<<<<<<<<<<<<<<<This
      append w_fcat to t_fcat.
    endform.

  • Show image in Web Dynpro ALV column

    Hello everybody,
    I have a WD component with an ALV table bound to a context node. Works very fine so far.
    Now in the first column of the node I have put an image source (MIME object in my WD component).
    I configured the first ALV column as Link To Action and now would like to link it to the image source. My problem is that the image is not loaded in the ALV.
    This is my coding (INIT method of my view):
    METHOD wddoinit .
      DATA: lo_alv_cmp         TYPE REF TO if_wd_component_usage,
                  lo_alv_if          TYPE REF TO iwci_salv_wd_table,
                  lo_alv_config      TYPE REF TO cl_salv_wd_config_table,
                  lo_column_settings TYPE REF TO if_salv_wd_column_settings,
                  lo_column          TYPE REF TO cl_salv_wd_column,
                  lo_link_to_action  TYPE REF TO cl_salv_wd_uie_link_to_action.
    get instance of ALV component
      lo_alv_cmp = wd_this->wd_cpuse_alv( ).
      IF lo_alv_cmp->has_active_component( ) IS INITIAL.
        lo_alv_cmp->create_component( ).
      ENDIF.
    get instance of ALV Interface Controller
      lo_alv_if = wd_this->wd_cpifc_alv( ).
    configure ALV
      lo_alv_config = lo_alv_if->get_model( ).
      lo_column_settings ?= lo_alv_config.
      lo_column = lo_column_settings->get_column( 'IMAGE' ).
      CREATE OBJECT lo_link_to_action.
    fix settings for test purpose (how must I change it to get the information from the context node??)
      lo_link_to_action->set_image_height( '50px' ).
      lo_link_to_action->set_image_width( '50px' ).
      lo_link_to_action->set_image_source( 'ICE Flottenportal.jpg' ).
      lo_column->set_cell_editor( lo_link_to_action ).
    ENDMETHOD.
    Thanx a lot in advance for any help!!

    Thanks a lot for your helpful advice.
    I now found that method cl_wdr_utilities=>get_mime_path is the best way to get the path.
    But one question is still open:
    How can I retrieve my image source from the context? Do I have to read the context and then write it to the image_source attribute? Or ist there a more elegant solution?
    Thank you for any help!

  • How to Display  Formatted Text  IN ALV Column?

    HI experts ,
    I am displaying  ALV with Multiple Column's , One of the Column is TEXT(Fomatted text).
    When ALV is Displayed  TEXT Column Comes as Continues TEXT . and is Not Formatted .
    Now when i want to edit this text i am Calling another View  which contains text edit . This Text edit will display correct Formatted Text . but when i save it and Come back to ALV again i do see continues text .
    Is there  any way where in i can display  the Formatted text in ALV Column ?
    Any body have any clue with this ...
    Thanks in Advance
    Patil
    Edited by: Badarinarayan Patil on Feb 22, 2008 3:45 PM

    Hi Juergen,
    I found Your blog and found it  really interesting... though I was not able to use it: I (like Jun Li is asking, I guess) need to use a dynamic text, containing formatting informations (according the xhtml syntax).
    I tried to pass it to the form by an ABAP-dictionary based interface and by means of the context (in a webdynpro page), but both tries failed.
    Some suggestion will be greatly appreciated.
    Thankyou
    Simone

  • Drag And Drop in ALV Column Tree

    Hello All,
    Can anyone tell me the method used for  a drag and drop in a column tree....
    i found it for a simple tree but not for a column tree.....
    thanks in advance....
    Regards,
    Praveen

    Check the links -
    drag drop required for alv column!
    drag and drop in a tree
    Drag&Drop within the Tree
    Drag&Drop within a tree
    Drag and drop in ALV tree
    Regards,
    Amit
    Reward all helpful replies.

  • How to hide ALV column in webdynpro

    Hi frnds,
                   I want to hide one columns in ALV output on webdynpro , give the procedure ...
    Thanks & Regards,
    Rajesh.j

    Procedure is :
    a) Get ALV Model reference
    b) Get list of ALV Columns
    c) Loop at each column and set visibility
    Code would be something like this
    I'm storing ALV model reference in view attributes wd_this->alv_config_table of type ref to CL_SALV_WD_CONFIG_TABLE.
    Data: lo_cmp_usage type ref to if_wd_component_usage.
      DATA: lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
            lr_column          TYPE REF TO cl_salv_wd_column,
            lt_column type salv_wd_t_column_ref,
            ls_column type salv_wd_s_column_ref.
    *create an instance of ALV component
      lo_cmp_usage =   wd_this->wd_cpuse_OVERVIEW_EARNED_ALV( ).
    * if not initialized, then initialize
      if lo_cmp_usage->has_active_component( ) is initial.
        lo_cmp_usage->create_component( ).
      endif.
    * get ALV component
      lr_salv_wd_table = wd_this->wd_cpifc_OVERVIEW_EARNED_ALV( ).
       wd_this->alv_config_table = lr_salv_wd_table->get_model( ).
      lr_column_settings ?= wd_this->alv_config_table.
      lt_column = lr_column_settings->get_columns( ).
      loop at lt_column into ls_column.
        CASE ls_column-id.
          when 'POST_YEAR'.
            ls_column-r_column->set_visible( if_wdl_core=>visibility_none ).
       ENDCASE.
    endloop.

  • Study Material on Alv Column Tree required.

    Hello friends,
    Pls let me know the links where I can get information regarding alv column tree creation. If u have any study material regarding the same then do forward me that too.
    Waiting for ur reply,
    Sweta.

    Hello Sweta,
    http://www1.sapdesignguild.org/resources/MiniSG/3_Managing/3_Overview_Tree_Variants.htm
    http://www1.sapdesignguild.org/resources/MiniSG/3_Managing/3_Design_Layout.htm
    <b>Check this demo program:</b>
    SAPCOLUMN_TREE_CONTROL_DEMO
    <b>
    Sample code:</b>
    http://www.geocities.com/victorav15/sapr3/utilities/zvvooa3.txt
    Regards,
    Beejal
    **Reward if this helps

  • Toolbar buttons in ALV column tree

    Dear Experts,
    Currently a report is being displayed using 2 custom container and class CL_GUI_ALV_COLUMN_TREE in a single screen Screen 100.
    Funtions like Select all, Deselect All, Expand All, Colapse all are in the GUI status of this Screen 100.
    <b>Q1</b>. Is it possible to have buttons on the container itself (instead of having it in the GUI status of Scr. 100) and have the above funtions work for ALV column tree .
    <b>Q2.</b> There exists a check box in each row of the node in both the containers which is meant for comparing data between two containers.
    e.g the user Checks one row of the first container (ALV tree output) and another in 2nd container and press Compare button which is present in Scr 100 GUI status.
    When the ckeck box is selected the rows are being selected, this is done in CheckBoX Change event of CL_GUI_ALV_COLUMN_TREE. Now when the Deselect ALL button is clicked rows are getting deselected but check marks are not getting cleared from the check box.
    How can the check box be cleared when we press Deselect All button which is in GUI Status of Scr 100.?
    Thanks n Regards

    Hello Mahesh
    Assuming that you are dealing with class
    CL_GUI_ALV_TREE (because I cannot find class CL_GUI_ALV_COLUMN_TREE) sample report BCALV_TREE_04 shows how to add a button to the toolbar.
    The crucial points can be found in routine CHANGE_TOOLBAR: 
    form change_toolbar.
    * §1.Get toolbar instance of your ALV Tree.
    * When you instantiate an instance of CL_GUI_ALV_TREE the constructor
    * of the base class (CL_ALV_TREE_BASE) creates a toolbar.
    * Fetch its reference with the following method if you want to
    * modify it:
      call method g_alv_tree->get_toolbar_object
              importing
                  er_toolbar = g_toolbar.
      check not g_toolbar is initial. "could happen if you do not use the
                                      "standard toolbar
    * §2.Modify toolbar with methods of CL_GUI_TOOLBAR:
    * add seperator to toolbar
      call method g_toolbar->add_button
              exporting
                  fcode     = ''
                  icon      = ''
                  butn_type = cntb_btype_sep.
    * add Standard Button to toolbar (for Delete Subtree)
      call method g_toolbar->add_button
              exporting
                  fcode     = 'DELETE'
                  icon      = '@11@'
                  butn_type = cntb_btype_button
                  text      = ''
                  quickinfo = text-901.   "Delete subtree
    endform.
    Regards
      Uwe

  • Subdivide a ALV column header

    Hi experts ,
    I have an requirment to divide a ALV column header.
    I want to add a header row grouping the column headers.
            Departure                                               Arrival        <-- This row is what I want to add
    Airport    Gate    Date                         Airport    Gate    Date
    Thanks,
    Regards ,
    Swashrayee
    Edited by: SWASHRAYEE77928 on Feb 1, 2012 7:30 AM
    Moderator Message: UserID sent for deletion, for ignoring multiple Moderator warnings.
    Edited by: kishan P on Feb 1, 2012 12:05 PM

    Hello,
    Take a look on this code:
      DATA:
        lv_title              TYPE        string,
        lt_columns            TYPE        salv_wd_t_column_ref,
        lr_column_settings    TYPE REF TO if_salv_wd_column_settings,
        lr_salv_wd_table      TYPE REF TO iwci_salv_wd_table,
        lr_table              TYPE REF TO cl_salv_wd_config_table,
      FIELD-SYMBOLS:
        <fs_column> LIKE LINE OF lt_columns,
      lr_salv_wd_table = wd_this->wd_cpifc_cmp_alv( ).
      lr_table         = lr_salv_wd_table->get_model( ).
      lr_column_settings ?= lr_table.
      lt_columns = lr_column_settings->get_columns( ).
      LOOP AT lt_columns ASSIGNING <fs_column>.
        lr_col_header = <fs_column>-r_column->get_header( ).
        lr_col_header->set_ddic_binding_element( space ).
        lr_col_header->set_ddic_binding_field( if_salv_wd_c_column_settings=>ddic_bind_none ).
          lv_title = cl_wd_utilities=>get_otr_text_by_alias( alias = 'HISTORIC' ).
          lr_col_header->set_text( lv_title ).
          CLEAR lv_title.
    I suggest you to put this code in some method called over the method WDDOMODIFYVIEW.
    Regards.

  • Editing ALV Column

    Hi,
    I am using these methods;
    lr_config      TYPE REF TO cl_salv_wd_config_table,
    lr_config->IF_SALV_WD_TABLE_SETTINGS~SET_EDIT_MODE ()
    What is supposed to be written in the parenthesis in order to edit the ALV column
    Thanks

    Hi,
    Try go through this [excellent blog|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1] by Claudia Dangers to understand how you can change 1 particular column of your ALV to editable mode.
    Regards,
    Uday
    First it is necessary to use an input field as cell editor for the column u201Cprice,u201D which should be editable. Therefore we need to enhance method WDDOINIT of view ResultView:
    WDDOINIT()
    [u2026] " Do all your basic stuff first
    " set cell editor for input fields (~make colum PRICE editable)
    DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
          lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
    lr_column_settings ?= l_value.
    lr_column = lr_column_settings->get_column( 'PRICE' ).
    CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'PRICE'.
    lr_column->set_cell_editor( lr_input_field ).
    " The u201Cread only modeu201D has to be set to abap_false to make the table editable.
    " set read only mode to false (and display edit toolbar)
    data: lr_table_settings type ref to if_salv_wd_table_settings.
    lr_table_settings ?= l_value.
    lr_table_settings->set_read_only( abap_false ).
    ENDMETHOD.
    Without this setting the input field will not be editable!

  • Dynamic tooltips on alv column

    I am displaying one alv column as the traffic lights icon.
    Depending on whether it is red, yellow or green, i want to have a different tooltip for this column.
    is this possible? if yes then can someone please tell me how to do it?
    regards,
    Priyank

    Well Sascha,
    Thanks for the response but i have a slight change in requirement now. The tooltip content will have to be fetched from the backend (database level) now through the function module which is returning the data to be displayed in the ALV. Thus, the option that seems available now is to get the tooltip content in another column in the alv, keep this column hidden and use the content of this column as the tooltip for the traffic lights column.
    Any direct way of doing this?
    By the way i tried using the following code in the domodifyview method to see if it works....did not work for me....let me know what wrong i might have been doing.
      DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage,
            l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table,
            l_value TYPE REF TO cl_salv_wd_config_table.
      l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
      IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
        l_ref_cmp_usage->create_component( ).
      ENDIF.
      l_ref_interfacecontroller =   wd_this->wd_cpifc_alv( ).
      l_value = l_ref_interfacecontroller->get_model( ).
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
             lr_column TYPE REF TO cl_salv_wd_column.
      lr_column_settings ?= l_value.
      DATA:
        lt_columns TYPE salv_wd_t_column_ref.
      lt_columns = lr_column_settings->get_columns( ).
      DATA:
          ls_column TYPE salv_wd_s_column_ref.
      LOOP AT lt_columns INTO ls_column.
        DATA: lr_cv TYPE REF TO cl_salv_wd_cv_standard.
        CREATE OBJECT lr_cv.
        lr_cv->set_key( 'ICON_GREEN_LIGHT' ).
        DATA: lr_textview TYPE REF TO cl_salv_wd_uie_text_view.
        CREATE OBJECT lr_textview.
        lr_textview->set_text_fieldname( ls_column-id ).
    lr_textview->set_tooltip( 'TOOLTIP FOR GREENLIGHT' ).
        lr_cv->set_editor( lr_textview ).
        ls_column-r_column->add_cell_variant( r_cell_variant = lr_cv ).
        ls_column-r_column->set_sel_cell_variant_fieldname( 'EXPIRYSTATUS' ).
        CASE ls_column-id.
          WHEN 'EXPIRYSTATUS'.
        ENDCASE.
      ENDLOOP.

  • Controlling visibility of ALV columns at runtime

    Hi
    I have an ALV column which is of type DropdownByKey. I can control the visibility of the dropdown by setting it based on another context node attribute (for e.g., 'CAT_VALUE_I_VISIBLE') which I modify at runtime. But then I want to hide the column itself based on the other context node attribute which I am not able to. Is it possible ?
    I have something like this to hide the dropdown
    lo_drdn_by_key->set_visible_fieldname( 'CAT_VALUE_I_VISIBLE' ).
    But on the column level there is only a method like :
    DATA lo_column type ref to cl_salv_wd_column.
    lo_column-r_column->set_visible( cl_wd_uielement=>e_visible-none ).
    Is there a possibility to control the visibility of an ALV column at runtime ?
    Thanks and regards
    Sukanya

    Hi,
    Depending upon another context attribute condition get th ecolumn ref of the alv field which you want to hide and set the visibility property to none.
    data : lt_columns type SALV_WD_T_COLUMN_REF.
    Get the column ref
      CALL METHOD lo_value->if_salv_wd_column_settings~get_columns
        RECEIVING
          value = lt_columns.
    CALL METHOD lr_column->set_visible
            EXPORTING
              value = cl_wd_uielement=>e_visible-none.
    Thanks,
    Shailaja Ainala.

Maybe you are looking for