Dynamically ALV  Titles  Using Events - How To

Dear All,
There is a selection screen. Depending upon the selection, there will be output in ALV grid or list. This output doesn't contain any field of selection.
So the output must be grouped on the basis of selection as their common title.
Eg. If model and type are in selection screen then output something like
Model No. 1    Type No. 2
     ALV Grid for Model 1 and Type 2
Model No. 3    Type No. 4
     ALV Grid for Model 3 and Type 4
How to use ALV Events to process the data dynamically for the titles as in above case the numbers 1, 2 ,3 & 4 are present in the output table which is passed to ALV for display.
Thanks & Regards,
Sapna Modi.

Hi Sapna
To set title you can fill a structure of type <b>"LVC_S_LAYO"</b> (the field gridtitle) and use the method <b>"set_frontend_layout"</b>. You can get the current layout structure using the method <b>"get_frontend_layout"</b>.
To set column headers you can use to get and set the fieldcatalog at any instance of the runtime. For this you can use <b>"set_frontend_fieldcatalog"</b> and <b>"get_frontend_fieldcatalog"</b>. At the field catalog, you can set titles for columns using <i>"coltext", "scrtext_s", "scrtext_m", "scrtext_t"</i> .
For more information you can refer to the tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an%20easy%20reference%20for%20alv%20grid%20control.pdf">"An Easy Reference For ALV Grid Control"</a>.
*--Serdar
[email protected]

Similar Messages

  • Dynamic ALV Title

    Hello Experts,
    Please suggest how to generate dynamic ALV title for dynamic alv output.
    Scenario: My ALV output is dynamic based on custom table. We have maintained 10 fields in custom table. In selection screen one of the parameter is number.
    If i enter 2 or more than 2 accordingly my fieldcatlog will be prepared with same fields. But it will be mulitiple based on selection screen.
    I have achieved till this part, now i need to generate title for each set of 10 columns.
    Best example:
    ALV output:
             Title 1                     Title2                        Title3
    A B C D E F G H I J | A B C D E F G H I J | A B C D E F G H I J | 
    I hope you all understand my problem and i appreciate your answers....
    Thanks
    Cris

    Dear,
             Use the below report code to print your dynamic coloumn in alv grid.
    below just go through the use of variable w_bom for text,u will use single varible w_bom but clear it b4
    printing it again. on the conditional base header will come in w_bom and print in fieldcatalog.
    operate all operation b4 putting the text in fieldcatalog.
    jus go through the code and you may ask any clarificaiton regarading that.
      loop at i_fldcat into x_fldcat WHERE
      fieldname = 'IDNRK' or
      fieldname = 'MAKTX' or
      fieldname = 'MEINS' or
         FIELDNAME =  'MENGE1' OR
            FIELDNAME =  'MENGE2' OR
            FIELDNAME =  'MENGE3' OR
             FIELDNAME =  'MENGE4' OR
              FIELDNAME =  'MENGE5' OR
               FIELDNAME =  'MENGE6' OR
               FIELDNAME =  'MENGE7' OR
               FIELDNAME =  'MENGE8'.
        if stlal-low ne ''.
          if x_fldcat-fieldname = 'IDNRK'.
            x_fldcat-seltext_l = 'Component'.
            x_fldcat-outputlen = 25.
            x_fldcat-reptext_ddic = 'Component'.
            x_fldcat-inttype = c_c.
          endif.
          if x_fldcat-fieldname = 'MAKTX'.
            x_fldcat-seltext_l = 'Component Description'.
            x_fldcat-outputlen = 25.
            x_fldcat-reptext_ddic = 'Component Description'.
            x_fldcat-inttype = c_c.
          endif.
          if x_fldcat-fieldname = 'MEINS'.
            x_fldcat-seltext_l = 'UOM'.
            x_fldcat-reptext_ddic = 'UOM'.
            x_fldcat-ddictxt = c_l.
          endif.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE1'.
            read table t_stas1 with key stlal = '01'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
              X_FLDCAT-TECH = 'X'.
            ELSE.
              PERFORM VAR_BOM USING T_STAS1-STLAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE2'.
            read table t_stas1 with key stlal = '02'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
            ELSE.
              PERFORM VAR_BOM USING T_STAS1-STLAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE3'.
            read table t_stas1 with key stlal = '03'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
            ELSE.
              PERFORM VAR_BOM USING T_STAS1-STLAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE4'.
            read table t_stas1 with key stlal = '04'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
            ELSE.
              PERFORM VAR_BOM USING T_STAS1-STLAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE5'.
            read table t_stas1 with key stlal = '05'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
            ELSE.
              PERFORM VAR_BOM USING T_STAS1-STLAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            ENDIF.
          endif.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE6'.
            read table t_stas1 with key stlal = '06'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
            ELSE.
              PERFORM VAR_BOM USING 6.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            ENDIF.
          endif.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE7'.
            read table t_stas1 with key stlal = '07'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
            ELSE.
              PERFORM VAR_BOM USING 7.
              if sy-subrc = 0.
                CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
                IF T_BOM-STLST = '1'.
                  X_FLDCAT-EMPHASIZE = 'C511'.
                ENDIF.
                x_fldcat-seltext_l = W_BOM.
                x_fldcat-reptext_ddic = W_BOM.
                x_fldcat-ddictxt = c_l.
              ENDIF.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE8'.
            read table t_stas1 with key stlal = '08'.
            if sy-subrc NE 0.
              x_fldcat-no_out = 'X'.
            ELSE.
              PERFORM VAR_BOM USING 8.
              if sy-subrc = 0.
                CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
                IF T_BOM-STLST = '1'.
                  X_FLDCAT-EMPHASIZE = 'C511'.
                ENDIF.
                x_fldcat-seltext_l = W_BOM.
                x_fldcat-reptext_ddic = W_BOM.
                x_fldcat-ddictxt = c_l.
              ENDIF.
            endif.
          ENDIF.
          modify i_fldcat from x_fldcat index T_INDEX.
          T_INDEX = T_INDEX + 1.
          CLEAR X_FLDCAT.
         ELSE.
          if x_fldcat-fieldname = 'IDNRK'.
            x_fldcat-seltext_l = 'Component'.
            x_fldcat-reptext_ddic = 'Component'.
            x_fldcat-inttype = c_c.
          endif.
          if x_fldcat-fieldname = 'MAKTX'.
            x_fldcat-seltext_l = 'Component Description'.
            x_fldcat-outputlen = 25.
            x_fldcat-reptext_ddic = 'Component Description'.
            x_fldcat-inttype = c_c.
          endif.
          if x_fldcat-fieldname = 'MEINS'.
            x_fldcat-seltext_l = 'UOM'.
            x_fldcat-reptext_ddic = 'UOM'.
            x_fldcat-ddictxt = c_l.
          endif.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE1'.
            PERFORM VAR_BOM USING 1.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE2'.
            PERFORM VAR_BOM USING 2.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE3'.
            PERFORM VAR_BOM USING 3.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE4'.
            PERFORM VAR_BOM USING 4.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            endif.
          ENDIF.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE5'.
            PERFORM VAR_BOM USING 5.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            ENDIF.
          endif.
          CLEAR T_BOM-STLST.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE6'.
            PERFORM VAR_BOM USING 6.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            endif.
          endif.
          CLEAR T_BOM-STLST.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE7'.
            PERFORM VAR_BOM USING 7.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            endif.
          endif.
          clear t_bom-STLST.
          CLEAR W_BOM.
          if x_fldcat-fieldname = 'MENGE8'.
            PERFORM VAR_BOM USING 8.
            if T_BOM-STKTX IS NOT INITIAL.
              CONCATENATE '' T_BOM-STKTX INTO W_BOM separated BY SPACE.
              IF T_BOM-STLST = '1'.
                X_FLDCAT-EMPHASIZE = 'C511'.
              ENDIF.
              x_fldcat-seltext_l = W_BOM.
              x_fldcat-reptext_ddic = W_BOM.
              x_fldcat-ddictxt = c_l.
            else.
              X_FLDCAT-NO_OUT = 'X'.
              X_FLDCAT-TECH = 'X'.
            endif.
          endif.
          modify i_fldcat from x_fldcat index sy-tabix.
          CLEAR X_FLDCAT.
        endif.
      endloop.
    endform. " build_field_catalog
    FORM VAR_BOM USING P_CNT.
      if NOT stlal-low = ''.
        LOOP AT T_BOM where stlal = t_stas1-stlal .
          READ TABLE T_BOM with key stlal = t_stas1-stlal.
          IF SY-SUBRC <> 0.
            T_BOM-STKTX = ''.
            clear t_bom.
            exit.
          ENDIF.
        ENDLOOP.
      ELSE.
        LOOP AT T_BOM .
          READ TABLE T_BOM INDEX P_CNT.
          IF SY-SUBRC <> 0.
            T_BOM-STKTX = ''.
            clear t_bom.
            exit.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "VAR_BOM
    form call_list_viewer.
      delete T_FINAL where IDNRK eq  ''.
      data : T1_MAST like T_MAST occurs 0 with header line.
      data : t_stas like STAS occurs 0 with header line.
       data : t_stko like stko occurs 0 with header line.
      clear : t_stas[],t_stas,t1_STPO,t1_STPO[],t_stko,t_stko[],t1_mast,
      t1_mast[].
      SELECT MATNR WERKS STLAN STLNR STLAL ANDAT
             INTO CORRESPONDING FIELDS OF TABLE T1_MAST
             FROM MAST WHERE MATNR = MATNR AND WERKS = WERKS
             AND STLAN = STLAN AND STLAL IN STLAL.
      if not T1_MAST[] is initial.
        read table T1_MAST index 1.
        select * from stas into table t_stas
                 where stlnr = T1_MAST-STLNR
                 and stlal in stlal
                 and STLTY NE 'D'.
      endif.
      IF NOT T1_MAST[] IS INITIAL.
        SELECT STLTY STLNR STLKN STPOZ ANDAT IDNRK POSTP POSNR
        MEINS MENGE FMENG POTX1 OBJTY STVKN
        INTO  CORRESPONDING FIELDS OF TABLE T1_STPO
        FROM STPO
        FOR ALL ENTRIES IN T1_MAST
        WHERE STLNR = T1_MAST-STLNR
        AND FMENG = 'X'.
      ENDIF.
      sort t_stas by STLAL STVKN.
      sort t_stas by STLNR STLAL.
      loop at T1_MAST.
        loop at t_stas where STLNR = T1_MAST-STLNR
                          and STLAL =  T1_MAST-STLAL.
          LOOP AT T1_STPO where STLKN = t_stas-STLKN.
            IF T1_MAST-STLAL = 01.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE1 = T1_STPO-MENGE.
            ELSEIF T1_MAST-STLAL = 02.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE2 = T1_STPO-MENGE.
            ELSEIF T1_MAST-STLAL = 03.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE3 = T1_STPO-MENGE.
            ELSEIF T1_MAST-STLAL = 04.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE4 = T1_STPO-MENGE.
            ELSEIF T1_MAST-STLAL = 05.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE5 = T1_STPO-MENGE.
            ELSEIF T1_MAST-STLAL = 06.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE6 = T1_STPO-MENGE.
            ELSEIF T1_MAST-STLAL = 07.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE7 = T1_STPO-MENGE.
            ELSEIF T1_MAST-STLAL = 08.
              T_FINAL-MAKTX = T1_STPO-POTX1.
              T_FINAL-MEINS = T1_STPO-MEINS.
              T_FINAL-MENGE8 = T1_STPO-MENGE.
            ENDIF.
            read table T_FINAL with key MAKTX = T1_STPO-POTX1.
            if sy-subrc ne 0.
              APPEND  T_FINAL.
              clear T_FINAL.
                     elseif T1_MAST-STLAL = 08.
                T_FINAL-MAKTX = T1_STPO-POTX1.
                T_FINAL-MEINS = T1_STPO-MEINS.
                T_FINAL-MENGE8 = T1_STPO-MENGE.
                MODIFY T_FINAL FROM T_FINAL TRANSPORTING MENGE8
                                          WHERE MAKTX = T1_STPO-POTX1.
                clear T_FINAL.
              endif.
            endif.
          endloop.
        endloop.
        clear : T_FINAL.
      endloop.
      sort T_FINAL by IDNRK descending.
    *end  09.07.2007
    *endded
    Thanks and regards
    vijay dwivedi

  • ALV grid using methods: how to get modified cells

    Hi all,
    IAM USING alv grid using methods,
    i have few fields as editable
    if the user edits any of those fields how can i know which cell is modified and what is the new value.
    i tried to use method get_modified_cells
    but iam getting a msg saying protected method and u can  not use.
    please advise.
    thanks
    JAfar

    Jafar,
    You need to Take the Help of DATA_CHANGED event, when ever there is a change in the Grid, it will trigger, here you can capture the Cells which are modified.
    in your PAI call the method check changed data
    CL_GUI_ALV_GRID-->CHECK_CHANGED_DATA
    You need to set the handler for datachanged.
    set the handler for this, and register the event modified or enter.
    **Handler to Check the Data Change
        HANDLE_DATA_CHANGED FOR EVENT DATA_CHANGED
                             OF CL_GUI_ALV_GRID
                             IMPORTING ER_DATA_CHANGED
                                       E_ONF4
                                       E_ONF4_BEFORE
                                       E_ONF4_AFTER,
    **Handle Data Change
      METHOD HANDLE_DATA_CHANGED.
    DATA: X_CHANGE TYPE LVC_S_MODI.  "modified cells
        LOOP AT ER_DATA_CHANGED->MT_GOOD_CELLS INTO X_CHANGE.
        ENDLOOP.
      ENDMETHOD.                    "HANDLE_DATA_CHANGED
    Regards
    Vijay

  • ALV Title using I_GRID_TITLE not showing up in REUSE_ALV_GRID

    data:      vg_grid_title    TYPE LVC_TITLE.
    move 'Batch: XXXXXX'' to vg_grid_title.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = sy-repid
           i_callback_pf_status_set          = vg_status
           i_callback_user_command           = vg_ucom
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
    *   I_STRUCTURE_NAME                  =
    *   I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = vg_grid_title
    *   I_GRID_SETTINGS                   =
       IS_LAYOUT                         = sg_layout
    Title is not showing up.
    Do i need to do anything extra.?

    Hi
    Please try dis :
    VG_GRID_TITLE = 'Batch: XXXXXX'.
    and
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = VG_GRID_TITLE
    *or *
    make use of
    class : CL_DD_DOCUMENT .
    DATA: TEXT1 TYPE SDYDO_TEXT_ELEMENT,
    data : DOCUMENT TYPE REF TO CL_DD_DOCUMENT. "#EC CALLED
      CALL METHOD DOCUMENT->ADD_GAP
        EXPORTING
          WIDTH = 150.
      TEXT1 =  'YOUR GRID TITLE IN THE REPORT '.
      CALL METHOD DOCUMENT->ADD_TEXT
        EXPORTING
          TEXT         = TEXT1
          SAP_EMPHASIS = strong .
    Hope it helps
    Regards
    Swapnil

  • How to add sum in dynamic alv ?

    hello ,
    i create dynamic alv , by using FIELD-SYMBOLS ,
    but my columns are char type , and the SUM an SUBTOTAL
    not work .
    how i can tern the internal table that build with char
    columns to be numeric (like BSIK-WRBTR)?

    FIRST OF ALL THANKS  , BUT ....  ))
    NOW THE LINE OF THE SUM DISPLAY AS THE FIRST LINE AND
    ALL OTHER LINE AFTER IT )) .
    HOW CAN I TERN IT TO BE NORMAL ( IN BUTTOM ) ? .
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          I_STRUCTURE_NAME = 'YAG_ST_FOR_SPLITE_PER_VEND'
        CHANGING
          CT_FIELDCAT      = LT_FIELDCATALOG[].
      DESCRIBE TABLE LT_FIELDCATALOG LINES LIN6 .
      LIN6 = LIN6 + 1 .
      LOOP AT IT_SPLITE_COLUMNE .
        LS_ALV_CAT-FIELDNAME = IT_SPLITE_COLUMNE-FIELD_NAME.
        LS_ALV_CAT-REF_FIELD = IT_SPLITE_COLUMNE-FIELD_NAME.
        LS_ALV_CAT-COL_POS   = LIN6.
        LS_ALV_CAT-DATATYPE   = 'QUAN'.
        LS_ALV_CAT-DO_SUM     = 'X'.
        LS_ALV_CAT-TABNAME   = 'IT_SPLIT_FOR_REP'.
        APPEND LS_ALV_CAT TO LT_FIELDCATALOG.
        LIN6 = LIN6 + 1 .
      ENDLOOP.

  • Displaying items in a single line in ALV grid using  ALV_TOP_OF_PAGE.

    Hello Guys,
    I am having a problem in displaying items in a single line in the ALV Grid using event ALV_TOP_OF_PAGE.
    My requirement is to group items on a single line i.e. in the example below, Vendor code and posting date are on the same line. The next line the prints Vendor Name and Document no.
    Vendor Code: 123123                               Posting Date : 01.01.2011
    Vendor Name: ABCD                                 Document No: 152246598.
    Here is my code in subroutine 'ALV_TOP_OF_PAGE', 
      wa_list_comments-typ = 'S'. 
      wa_list_comments-key = ''.
      wa_list_comments-info = 'Vendor Code'.
      APPEND wa_list_comments TO it_list_comments.
      wa_list_comments-typ = 'S'. 
      wa_list_comments-key = ''.
      wa_list_comments-info = 'Posting Date'.
      APPEND wa_list_comments TO it_list_comments.
    The above code prints in the following format i.e one below the other,
    Vendor Code: 123123                              
    Posting Date : 01.01.2011.
    I also tried using HTML_TOP_OF_PAGE, but it didn't work.
    Can anybody please help me out with this.
    Regards,
    Danish.

    Hi Danish,
    Your problem is with the alignment and you need some fix positions .
    The solution i feel is u can use as below :
    In CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    use 
    i_callback_html_top_of_page       = 'HTML_TOP_OF_PAGE'.
    Now on calling routine call use cl_dd_document class :
    FORM html_top_of_page USING document TYPE REF TO cl_dd_document .
    data : doctable TYPE REF TO cl_dd_table_element,
              col1_t1 TYPE REF TO cl_dd_area,
              col2_t1 TYPE REF TO cl_dd_area,
              col1_t2 TYPE REF TO cl_dd_area,
              col2_t2 TYPE REF TO cl_dd_area.
    add quick table with five columns
        CALL METHOD lw_document->add_table
          EXPORTING
            no_of_columns               = 2
            border                      = '0'
         cell_background_transparent = ' '
            width                       = '100%'
          IMPORTING
            table                       = doctable.
    Filling columns in row
        CALL METHOD doctable->add_column
          EXPORTING
            width  = '40%'
          IMPORTING
            column = col1_t1.
    Filling columns in row
        CALL METHOD doctable->add_column
          EXPORTING
            width  = '60%'
          IMPORTING
            column = col2_t1.* Filling columns in row
    Call method doctable->new_row.
        CALL METHOD doctable->add_column
          EXPORTING
            width  = '40%'
          IMPORTING
            column = col1_t2.
    Filling columns in row
        CALL METHOD doctable->add_column
          EXPORTING
            width  = '60%'
          IMPORTING
            column = col2_t2.
    *Now adding the texts
    lw_text1 = 'your first text'
    CALL METHOD col1_t1->add_text
          EXPORTING
            text = lw_text.
    *Similarly add text for other columns
    *Adujust % in width to adjust the column as required
    Endform.
    Hope this will solve your problem .

  • 11g: Contextual Events - How do I fire them on currency change?

    Hi!
    After posting a question here: 11g: Bounded task flows, need help and advice!
    I read the article at http://technology.amis.nl/blog/3365/adf-11g-how-events-in-one-region-cause-other-regions-to-refresh because I need to refresh region B when the user selects in region A.
    Now, the comments in that article suggest that Contextual Events are the built-in mechanism for that use case. So I tried that first. The online help suggests that this is what I need.
    I read the online help and created an event and defined a producer and consumer in the event map in the parent page's page def. Now the help shows how to fire the event when a methodAction binding is executed. But I need to fire the event when the user selects a row in region A's table.
    1. How do I do that? Where do I put the event? The help says it's possible, but does not show how. Add a selection listener to the backing bean and call the event-enabled methodAction binding from there? Or is there a better way?
    2. I get the impression, that - when I use the event to call the consumer's binding ExecuteWithParams method - just the query of the consumer's VO is executed. That's great. But how do I reset the flow to the initial action? Just refreshing the VO is not enough. I need to reset the flow to the initial action (showing a view).
    I read http://www.oracle.com/technology/products/jdev/tips/fnimphius/taskflow_in_popup/taskflow_in_popup.html and now I am completely confused. Use input parameters or use events? If I use events, how do I reset (refresh) the task flows?
    Thanks,
    Sascha
    Edited by: Sascha Herrmann on Oct 19, 2008 3:33 PM

    Sascha,
    are region A and B share the same transaction ? If yes and the content in region B is a dependency of the VO used in A then you don't need contextual events at all. So if i assume that region A contains a list of departments and region B the employee table (where DepartmentsVO is the parent of EmployeeVO) then you can do as follows
    - navigate to the region definition of region B in the pageDef file
    - use the right mouse context menu to add parameters, and then a parameter (e.g. changeIndicator)
    - wire the changeIndicator parameter to the DepartmentsVOIter current row key str (its a method exposed directly on the iterator)
    - set the region binding refresh to ifNeeded
    - set a partial trigger on the regionB to point to the departmentTable so the region is refreshed whenever the table row currency changes
    The parameter that you added just does nothing except that it indicates to the region binding that the region must refresh. You point it to the row row key of the department iterator because it provides the changed value.
    If VO in regionB is not dependent on the DepartmentVO, then you need to create a parameter on the bounded taskflow, which takes the value of changeIndicator to write it to pageFlowScope.currRowKey. Then create a set currentRowWithKey method as a default activity and wire it up to pageFlowScope.currRowKey
    Frank

  • How to add Select event in dynamic ALV

    Hi,
    I have created dynamic ALV and now i want to checked the selected row value.
    If in the selected row contain 'A' value then i have to disable the Button given on the screen.
    If in the selected row contain B' value then i have to enable the Button given on the screen.
    How to add the event once I select the row.
    I have done like this . but it is not
    lw_api_2->do_dynamic_navigation(
              source_window_name          = 'ZWDCHHR_EX_TASK_DELE'
              source_vusage_name          = 'ZWDVHHR_EX_TASK_DELE_USAGE_1'
              source_plug_name            = 'TO_ALV'
              target_component_name       = 'SALV_WD_TABLE'
              target_component_usage      = 'ALV_USAGE1'
              target_view_name            = 'TABLE'
              target_plug_name            = 'DEFAULT'
              target_embedding_position   = 'ZWDVHHR_EX_TASK_DELE/VIEW_DELEG_MY_TASKS' ).
      register event handler
        lw_cmp_usage_2->add_event_handler(
           listener        =  lw_api_2
           handler_name    = 'ONSELECT_TAB1'
           controller_name = 'INTERFACECONTROLLER'
           event_name      = 'ON_SELECT' ).
    Thanks and regards
    Amita Gandhi

    Hi Amita,
    You can try fetch the number of the row which was leadselected through R_PARAM->INDEX. (This would be just a normal integer variable. You can try check this out in debugging mode. ) Now you can just read the data of this row from the context node by saying as GET_ATTRIBUTE up on the nodes reference with the index as R_PARAM->INDEX.
    Regards,
    Uday

  • Lion 10.7.2 On both mac book pro and iMac, both with Lion 10.7.2, obtain repeated iCal event notifications from calendar or address book.  Cannot turn these off.  They repeat several times per session and every time computer is used.  How to diagnose this

    Lion 10.7.2 On both mac book pro and iMac, both with Lion 10.7.2, obtain repeated iCal event notifications from calendar or address book.  Cannot turn these off.  They repeat several times per session and every time computer is used.  How to diagnose this?

    First, uninstall "SuperTV" (whatever that is) according to the developer's instructions. It isn't working and it's filling the log with noise.
    If you have more than one user account, these instructions must be carried out as an administrator.
    Launch the Console application.
    Step 1
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left.
    Enter "BOOT_TIME" (without the quotes) in the search box. Note the timestamps of those log messages, which refer to the times when the system was booted. Now clear the search box and scroll back in the log to the last boot time when you had the problem. Post the messages logged before the boot, while the system was unresponsive or was failing to shut down. Please include the BOOT_TIME message at the end of the log extract.
    Post the log text, please, not a screenshot. If there are runs of repeated messages, post only one example of each. Don’t post many repetitions of the same message. When posting a log extract, be selective. In most cases, a few dozen lines are more than enough.
    PLEASE DO NOT INDISCRIMINATELY DUMP THOUSANDS OF LINES FROM THE LOG INTO A MESSAGE. If you do that, I will not respond.
    Important: Some private information, such as your name, may appear in the log. Edit it out by search-and-replace in a text editor before posting.
    Step 2
    Still in Console, look under System Diagnostic Reports for crash or panic logs, and post the most recent one, if any. In the interest of privacy, I suggest you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if present (it may not be.) Please don’t post shutdownStall, spin, or hang logs — they're very long and not helpful.

  • Why and how to use events in abap objects

    Dear all,
      Please explain me why and how to use events in abap objects with real time example
    regards
    pankaj giri

    Hi Pankaj,
    I will try to explain why to use events... How to use is a different topic.. which others have already answered...
    This is same from your prev. post...
    Events :
    Technically speaking :
    " Events are notifications an object receives from, or transmits to, other objects or applications. Events allow objects to perform actions whenever a specific occurrence takes place. Microsoft Windows is an event-driven operating system, events can come from other objects, applications, or user input such as mouse clicks or key presses. "
    Lets say you have an ALV - An editable one ...
    Lats say - Once you press some button  you want some kind of validation to be done.
    How to do this ?
    Raise an Event - Which is handled by a method and write the validation code.
    Now you might argue, that I can do it in this way : Capture the function code - and call the validate method.
    Yes, in this case it can be done.. But lets say .. you change a field in the ALV and you want the validation to be done as soon as he is done with typing.
    Where is the function code here ? No function code... But there is an event here - The data changed event.
    So you can raise a data changed event that can be handled and will do the validation.
    It is not user friendly that you ask the user to press a button (to get the function code) for validation each time he enters a data.
    The events can be raised by a system, or by a program also. So in this case the data changed event is raised by a system that you can handle.
    Also, Lets say on a particular action you want some code to trigger. (You can take the same example of validation code). In this case the code to trigger is in a separate class. The object of which is not available here at this moment. (This case happens very frequently).
    Advantage with events : Event handlers can be in a separate class also.
    e.g : In the middle of some business logic .. you encounter a error. You want to send this information to the UI (to user - in form of a pop up) and then continue with some processing.
    In many cases - A direct method call to trigger the pop up is not done. Because (in ideal cases) the engine must not interact with UI directly - Because the UI could be some other application - like a windows UI but the error comes from some SAP program.
    So - A event is raised from the engine that is handled in the UI and a pop up is triggered.
    Here -- I would have different classes (lets say for different Operating Systems). And all these classes must register to the event ERROR raised in application.
    And these different classes for different Operation systems will have different code to raise a pop-up.
    Now you can imagine : If you coded a pop-up for Windows (in your application logic) .. it will not work for Mac or Linux. But of you raise a event.. that is handled separately by a different UI classes for Win, Linux or Mac  they will catch this event and process accordingly.
    May be I complicated this explanation .... but I couldn't think of a simpler and concrete example.
    Cheers.
    Varun.

  • How to Update multiple items in other list using event handler?

    Hi All,
    If i update a item in a list, then i should update multiple items in another list need to be update. How to achive using event receivers?

    Hi Sam,
    According to your description, my understanding is that you want to update multiple items in another list when updated a list item.
    In the event receiver, you can update the multiple item using Client Object Model.
    Here is a code snippet for your reference:
    public override void ItemUpdated(SPItemEventProperties properties)
    string siteUrl = "http://sp2013sps/sites/test/";
    ClientContext clientContext = new ClientContext(siteUrl);
    List oList = clientContext.Web.Lists.GetByTitle("another list name");
    ListItem oListItem = oList.GetItemById(1);
    oListItem["Title"] = "Hello World Updated!";
    oListItem.Update();
    clientContext.ExecuteQuery();
    Best regards,<o:p></o:p>
    Zhengyu Guo
    Zhengyu Guo
    TechNet Community Support

  • How to generate a dynamic ALV

    give me some points on how  to generate the dynamic Alv using RTTS and why it is useful to generate this way

    Hi ,
    Please follow this link
    RTTS question
    problem with coloring cells in dynamic fieldcatalog
    Regards,
    Pravin

  • Display ALV GRID Using Dynamic Internal Table

    Hi all,
    I try to display ALV Grid using Dynamic Internal Table, but when i activate my program, i get an error message "DYN_TABLE" is not type-compatible with formal parameter "IT_OUTTAB". ( DYN_TABLE is my Dynamic Itab).
    Anybody can help me how to passing Dynamic Itab into ALV Grid ?? Of ALV Grid only accept static Itab ??
    Thanks,

    Hi Vijay,
    It's doesn't work, and make new error "Formal parameter "IT_OUTTAB[]" does not exist. However, the parameter "IT_OUTTAB" has a similar name."
    Because the method is:
    CALL METHOD <ref. var. to CL_GUI_ALV_GRID>->set_table_for_first_display
    EXPORTING
    I_BUFFER_ACTIVE = <any type (ANY)>
    I_STRUCTURE_NAME = <string of type DD02L-TABNAME>
    IS_VARIANT = <structure of type DISVARIANT>
    I_SAVE = <var. of type CHAR01>
    I_DEFAULT = <var. of type CHAR01>
    IS_LAYOUT = <structure of type LVC_S_LAYO>
    IS_PRINT = <structure of type LVC_S_PRNT>
    IT_SPECIAL_GROUPS = <internal table of type LVC_T_SGRP>
    IT_TOOLBAR_EXCLUDING = <internal table of type UI_FUNCTIONS>
    IT_HYPERLINK = <internal table of type LVC_T_HYPE>
    IT_ALV_GRAPHICS = <internal table of type DTC_T_TC>
    CHANGING
    IT_OUTTAB = <internal table>
    IT_FIELDCATALOG = <internal table of type LVC_T_FCAT>
    IT_SORT = <internal table of type LVC_T_SORT>
    IT_FILTER = <internal table of type LVC_T_FILT>
    Thanks,

  • How can i download dynamic alv report into excel  ?

    when i create dynamic alv report and try to download it
    to my pc ( to excel file ) the data is not set in the
    write position , also i get message in the excel
    "Dynamic List Display " .
    how can i set the data like the alv display ?

    ALV has standard download functionality to Excel. Aren't you able to use this functionality? Have you written your own custom code for DOWNLOAD?

  • How can I call functionality of ALV Grid by event of button outside grid?

    Hello,
    How can I call functionality of ALV Grid by event of button located outside ALV Grid? For example how to fire printing of this ALV Grid by button click elsewhere on the screen (not in toolbar of ALV Grid).
    Best regards,
    Josef Motl

    hi Motl,
    these are steps to create a button in ALV and trigger an event from it..
    1.Use the parameter i_callback_pf_status_set in the function module REUSE_ALV_GRID_DISPLAY
    i_callback_program = gd_repid
    i_callback_pf_status_set = 'SET_PF_STATUS'
    form set_pf_status using rt_extab type slis_t_extab.
    set pf-status 'NEWALVSTATUS'.
    endform.
    You have to copy the standard ALV pf stauts to 'NEWALVSTATUS' and add your button.
    2.You have to do the following to process the new button click.
    i_callback_user_command = 'USER_COMMAND'
    form user_command using i_ucomm like sy-ucomm
    is_selfield type slis_selfield.
    case i_ucomm.
    3. to copy the standard pf status to a new one.go to the ALV screen and take the menu System -> Status.  Then look for the standard pf status. Copy this to Z range and then add your new button.
    reward points if helpful
    regards
    satesh

Maybe you are looking for

  • How i can install the whatspp,facebook,and viber to my i phone 3g?

    How i can install the whatspp,facebook,and viber to my iphone 3g?

  • Extracting data from a tag of  xml file which is(xml) in a  Field of Csv.

    We have a xlm script which is stored in the clob column of the csv file. we have to extract one value from the <tag> and reject remaining data. Sample:- <ROW> <ID>100</ID> <ORDER_DATE>2000.12.20</ORDER_DATE> <SHIPTO_NAME>Adrian Howard</SHIPTO_NAME> <

  • Multiple items in custom form

    I'm new to Service Manager customization and try to do this task ,  I have custom management pack for our configuration items , I added a CI class "ITServer" which would have multiple harddisks, I created a Hard Disk Class and make a relationship (1

  • Microsoft Live Search Engine, visibility to

    Is there an easy way to register with Microsoft (as with Google) to be able to get my site recognized by the Live search engine. I've had some success with Yahoo and more recently with Google, but MS doesn't seem to recognize anything on my site -- n

  • Undervolting startup scripts

    Hi all, it seems a lot of pentium-m processors (most notably banias and dothans) can safely be undervolted. The beyond kernel has the undervolting patch included to do that. I have written a small startup script that automatically undervolts the cpu