How to display a row after a subtotal field in ALV Grid

Hi All,
My requirement is to print a extra row with values and constant text after printing subtotal values in ALV Grid.
e.g.      TOTAL      12.23       ---> Subtotal field
             Tax            5.2         ---> extra row after subtotal field.
Please help me....
Thanks in advance.
Regards
Ajay

Hi
You can try using INSERT <WA> OR INSERT INITIAL LINE .
fill the wa with tax value.
INSERT  <wa> into table < internal table > 
A row will be inserted into internal table with the values.
Try this  and let me know.
Thanks
Hariharan

Similar Messages

  • How to display summary details at then end of a alv grid?

    Hi.
    i have a ALV grid with 4 columns.
    also i need to print summary details at the end of the grid..
    eg..
    Total material cost  15.111
    total labor cost        5.4444
    total material burden 267.88
    toal labor burden    253.66
    How do i prinbt these details at then eend of a grid?/

    Hi
    Populate event END_OF_LIST into IT_EVENTS tab and use in the fun module
    see the doc for population of different events to display the totals after grid
    REUSE_ALV_EVENTS_GET
    Description
    This table tells ALV which events are processed by the caller by CALLBACK.
    The table of possible events per list type can be initialized using the module REUSE_ALV_EVENTS_GET.
    You can display the names of the constants in the type pools SLIS which represent the individual events using the individual test function in the function module
    REUSE_ALV_EVENT_NAMES_GET. Only events with a form routine name are processed.
    The table structure contains the fields:
    •     IT_EVENTS-NAME
    Name of the Callback event.
    Possible Callback events:
    •     Action
    USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD
    Process actions on the list
    As this is a frequently-used Callback event, the form routine can also be passed directly in the interface in the IMPORTING parameter I_CALLBACK_USER_COMMAND.
    PF_STATUS_SET USING RT_EXTAB TYPE SLIS_T_EXTAB
    If a user list status is to be set, it must be done in the form routine assigned to this event. The ALV function codes, which must not be active, are in the Parameter RT_EXTAB. This table must be passed with the SET PF-STATUS command (with inactive user function codes as well, if necessary).
    The STANDARD status of the function group SALV should be used as a template for a user-specific status.
    As this is a frequently-used Callback event, its form routine can also be passed directly in the interface in the IMPORTING parameter I_CALLBACK_PF_STATUS_SET.
    ITEM_DATA_EXPAND USING RS_SELFIELD TYPE SLIS_SELFIELD RFLG_ALL TYPE C
    Only relevant for hierarchical-sequential lists using the layout parameter IS_LAYOUT-EXPAND_FIELDNAME of the structure IS_LAYOUT.
    Exit for passing item entries (ITEM table) for a header record which was expanded interactively by the user.
    RS_SELFIELD-TABINDEX contains the header table index for which the item entries are to be put in the global item output table (T_OUTTAB_SLAVE). The Callback is only called if ALV has no items for a header which is to be expanded.
    RFLG_ALL is passed with 'X' if the user shows all items. The application must ensure that entries are not repeated in the item table. RS_SELFIELD is initial in this case.
    CALLER_EXIT USING RS_DATA Is called at the beginning of the function module to make special settings. It is not usually used.
    •     List processing events
    IMPORTANT: The application Callback routine must not manipulate the internal output table and/or its header record. This restriction applies to all Callbacks which are called in the list output and run under the 'List processing events'.
    TOP_OF_LIST no USING parameter. Information output at the start of the list
    END_OF_LIST no USING parameter. Information output at the end of the list
    TOP_OF_PAGE no USING parameter
    Equivalent to the list processing TOP-OF-PAGE event
    END_OF_PAGE no USING parameter. Not available for hierarchical-sequential lists.
    Information output at the end of a page. This is only called for printing.
    TOP_OF_COVERPAGE no USING parameter
    The selection information and list status are output together (if they exist) on a separate page by default. See also the documentation of the parameters:
    IS_PRINT-NO_COVERPAGE
    IS_PRINT-NO_PRINT_SELINFOS
    IS_PRINT-NO_PRINT_LISTINFOS
    IS_LAYOUT-GET_SELINFOS
    The user can format the header area of the 'cover page' himself or herself by specifying a Callback routine for this event.
    END_OF_COVERPAGE no USING parameter
    Analogously to TOP_OF_COVERPAGE the user can add other information to the information output by ALV (selection information, list status) at this event.
    FOREIGN_TOP_OF_PAGE no USING parameter
    The Top-of-page event is always processed in ALV and is only passed to the caller via the Callback mechanism. This is still the case if the caller, e.g. by a user action, processes a branch list which was not formatted by ALV (e.g. a popup with additional information about the list record selected and displayed by ALV).
    In this case, top-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event top-of-page still occurs in ALV. When ALV notices a top-of-page which was not caused by an ALV output, the form routine in FOREIGN_TOP_OF_PAGE is called.
    FOREIGN_END_OF_PAGE no USING parameter
    The event end-of-page is always processed in ALV and only passed to the caller via callback. This is still the case, e.g. when the caller processes a details list which was not formatted by ALV (e.g. a popup with further information about selected list records which were displayed by ALV).
    In this case, end-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event end-of-page still occurs in ALV. When ALV notices an end-of-page that was not caused by an ALV output, the form routine in FOREIGN_END_OF_PAGE is called.
    BEFORE_LINE_OUTPUT USING RS_LINEINFO TYPE SLIS_LINEINFO
    Output information before each output line. Should only be used in justified cases because it costs a lot of performance.
    AFTER_LINE_OUTPUT USING RS_LINEINFO TYPE SLIS_LINEINFO
    Output information after each output line. Should only be used in justified cases because it costs a lot of performance.
    •     Internal use only
    LIST_MODIFY USING R_TABNAME TYPE SLIS_TABNAME
    R_INDEX LIKE SY-TABIX
    R_INDEX_ITEM LIKE SY-TABIX
    R_INDEX_SUM LIKE SY-TABIX
    •     IT_EVENTS-FORM
    Name of the form routine which should be called in the calling program at the event.
    Field_catalog:
    Field catalog with field descriptions
    2.7.1.     Description
    Field catalog containing descriptions of the list output fields (usually a subset of the internal output table fields). A field catalog is required for every ALV list output.
    The field catalog for the output table is built-up in the caller's coding. The build-up can be completely or partially automated by calling the REUSE_ALV_FIELDCATALOG_MERGE module
    See also the documentation of the function module REUSE_ALV_FIELDCATALOG_MERGE.
    The minimal field catalog is documented under 'default'. The caller can use the other optional parameters to assign output attributes to a field which differ from the default.
    A field catalog need not be built-up and passed explicitly only under the following conditions:
    •     The internal table to be output has the same structure as a Data Dictionary structure which is referred to in the internal table declaration using LIKE or INCLUDE STRUCTURE.
    •     all fields in this structure are to be output
    •     the structure name is passed to ALV in the parameter I_STRUCTURE_NAME.
    See also the documentation of the IMPORTING paramter I_STRUCTURE_NAME.
    Positioning
    •     row_pos (row position)
    value set: 0, 1 - 3
    Only relevant if the list output is to be multi-line (two or three lines) by default.
    A multi-line list can also be defined by the user interactively if the default list is one-line.
    The parameter specifies the relative output line of the column in a multi-line list.
    •     col_pos (column position)
    value set: 0, 1 - 60
    only relevant when the default relative column positions differ from the field catalog field sequence. The parameter specifies the relative column position of the field in the list output. The column order can be changed interactively by the user. If this parameter is initial for all field catalog entries, columns appear in the field catalog field sequence.
    Identification
    •     fieldname (field name)
    value set: internal output table field name (required parameter)
    Name of the internal output table field which is described by this field catalog entry
    •     tabname (internal output table)
    value set: SPACE, internal output table name
    This parameter is used in 'manual' field catalog build-up only for hierarchical-sequential lists.
    Name of the internal output table which contains the field FIELDCAT-FIELDNAME.
    Data Dictionary reference
    •     ref_fieldname (reference field name)
    value set: SPACE, Data Dictionary field name
    Name of the Data Dictionary field referred to.
    This parameter is only used when the internal output table field described by the current field catalog entry has a reference to the Data Dictionary (not a program field), and the field name in the internal output table is different from the name of the field in the Data Dictionary. If the field names are identical, naming the Data Dictionary structure or table in the FIELDCAT-REF_TABNAME parameter is sufficient.
    •     ref_tabname (reference table/structure field name)
    value set: SPACE, name of a Data Dictionary structure or table
    Structure or table name of the referred Data Dictionary field.
    This parameter is only used when the internal output table field described by the current field catalog entry has a Data Dictionary reference (not a program field).
    Reference to fields with currency/measurement unit
    Each internal output table sum or quantity field whose decimal places are to be formatted appropriately for the unit in the list must follow the convention:
    •     the field is of data type QUAN or CURR (internal type P) (the field must really have this physical data type. Overwriting the physical data type with the parameter FIELDCAT-DATATYPE has no effect)
    •     There is a field in the internal output table which contains the associated unit.
    •     There is also an entry in the field catalog for the unit field.
    (If the unit is not to appear as a column in the list, and cannot be interactively displayed as a column, e.g. because it is always unambiguous and is therefore explicitly output by the caller in the list header, the field catalog units field entry can take the parameter FIELDCAT-TECH = 'X'.
    The association of a value field to a unit affects the output as follows:
    •     appropriate decimal places display for the unit
    •     an initialized field with a link to a non-initial unit is output as '0' for the unit (if FIELDCAT-NO_ZERO is initial). When this field is summed, this unit affects whether the units are homogeneous.
    •     an initialized field with a link to an initial unit is output as SPACE. When this field is summed, the unit SPACE does not affect the homogeneity of the units.
    •     When non-initial fields with an initial unit are summed, the unit SPACE is considered to be a unit.
    Link to currency unit
    •     cfieldname (currency unit field name)
    value set: SPACE, output table field name
    Only relevant for amount columns with associated unit.
    Name of the internal output table field containing the currency unit associated with the amount field FIELDCAT-FIELDNAME. The field in FIELDCAT-CFIELDNAME must have its own field catalog entry.
    •     ctabname (internal currency unit field output table)
    value set: SPACE, output table field name
    only relevant for hierarchical-sequential lists
    Name of the internal output table containing the FIELDCAT-CFIELDNAME field.
    Link to measurement unit
    •     qfieldname (measurement unit field name)
    value set: SPACE, output table field name
    only relevant for quantity columns with unit link.
    Name of the internal output table field containing the measurement unit associated with the quantity field FIELDCAT-FIELDNAME.
    The field in FIELDCAT-QFIELDNAME must have its own field catalog entry.
    •     qtabname (internal measurement unit field output table)
    value set: SPACE, output table field name
    only relevant for hierarchical-sequential lists
    Name of the internal output table containing the FIELDCAT-QFIELDNAME field.
    Column output options
    •     outputlen (column width)
    value set: 0 (initial), n
    For fields with a Data Dictionary link this parameter can be left initial.
    For fields without a Data Dictionary link (program field) the parameter must be given the value of the desired field list output length (column width).
    initial = column width is the output length of the referred Data Dictionary field (domain).
    n = column width is n characters
    •     key (key column)
    value set: SPACE, 'X'           'X' = kex field (key field output in color)
    Key fields can not be interactively hidden. Parameter FIELDCAT-NO_OUT must be left initial.
    For exceptions see the documentation of the FIELDCAT-KEY_SEL parameter.
    •     key_sel (hideable key column)
    value set: SPACE, 'X'
    only relevant when FIELDCAT-KEY = 'X'
    Key field which can be hidden interactively.
    The key column sequence cannot be changed interactively by the user.
    The output is controlled by the FIELDCAT-NO_OUT parameter analogously to non-key fields.
    •     no_out (field in field list)
    value set: SPACE, 'X'          'X' = field is not displayed in the current list.
    The user can interactively choose the field for output from the field list.
    The user can display the contents of these fields at line level using the 'Detail' function.
    See also the 'Detail screen' documentation of the parameter IS_LAYOUT.
    •     tech (technical field)
    value set: SPACE, 'X'          'X' = technical field
    Field cannot be output in the list and cannot be displayed interactively.
    Field can only be used in the field catalog (not in IT_SORT, ...).
    •     emphasize (highlight columns in color)
    value set: SPACE, 'X' or 'Cxyz' (x:'1'-'9'; y,z: '0'=off '1'=on)
    'X' = column is colored with the default column highlight color.
    'Cxyz' = column is colored with a coded color:
    •     C: Color (coding must begin with C)
    •     x: color number
    •     y: bold
    •     z: inverse
    •     hotspot (column as hotspot)
    value set: SPACE, 'X'
    'X' = column cells are output as hotspots
    •     fix_column (fix column)
    value set: SPACE, 'X'
    Not relevant for block lists (output of several lists consecutively)
    'X' = column fixed (does not scroll horizontally)
    All columns to be fixed must have this flag, starting from the left. If a column without this flag is output, only the columns to the left of this column are fixed. The user can change the column fixing interactively. See also the documentation of the Layout parameter
    IS_LAYOUT-NO_KEYFIX of the IMPORTING paramter IS_LAYOUT.
    •     do_sum (sum over column)
    value set: SPACE, 'X'           'X' = a sum is to be calculated over this internal output table field.
    This function can also be called by the user interactively.
    •     no_sum (sums forbidden)
    value set: SPACE, 'X'          'X' = no sum can be calculated over this field, although the data type of the field would allow summing.
    •     input (column ready for input)
    Function not available
    Format column contents
    •     icon
    value set: SPACE, 'X'           'X' = column contents to be output as an icon.
    The caller must consider the printability of icons.
    •     symbol
    value set: SPACE, 'X'          'X' = column contents are to be output as a symbol.
    The internal output table column must be a valid symbol character.
    The caller must consider the printability of symbols.
    Symbols can usually be printed, but may not always be output correctly, depending on the printer configuration.
    •     just (justification)
    value set: SPACE, 'R', 'L', 'C'
    Only relevant for fields of data type CHAR or NUMC
    ' ' = default justification for this data type
    'R' = right-justified output
    'L' = left-justified output
    'C' = centered output
    The justification of the column header always follows the justification of the columns. Independent justification of the column neader is not possible.
    •     lzero (leading zeros)
    value set: SPACE, 'X'
    Only relevant for fields of data type NUMC
    ALV outputs NUMC fields right-justified without leading zeros by default.
    'X' = output with leading zeros
    Note: If a NUMC field is output left-justified or centered by FIELDCAT-JUST, leading zeros are output. If the output of leading zeros is suppressed by a Data Dictionary reference ALPHA conversion exit, the output is always left-justified.
    •     no_sign (no +/- sign)           Only relevant for value fields
    value set: SPACE, 'X'     'X' = value output without +/ sign
    •     no_zero (suppress zeros)           Only relevant for value fields
    value set: SPACE, 'X'          'X' = suppress zeros
    •     edit_mask (field formatting)
    value set: SPACE, template
    template = see documentation of WRITE formatting option USING EDIT MASK template
    The output conversion conv can be made by template = '== conv'.
    Texts
    The following text parameters should be specified for program fields without a Data Dictionary reference. The texts are taken from the Data Dictionary for fields with a Data Dictionary reference. If this is not desired, the text parameters can also be specified. The Data Dictionary texts are then ignored. If the user changes the column width interactively, the column header text with the appropriate length is always used. The interactive function 'Optimize column width' takes account of both the field contents and the column headers: if all field contents are shorter than the shortest column header, the column width depends on the column header.
    The 'long field label' is also used in display variant definition, sort, etc. popups.
    •     seltext_l (long field label)
    •     seltext_m (medium field label)
    •     seltext_s (short field label)
    •     reptext_ddic (header)
    analogous to the Data element maintenance 'Header'
    The specified text is not necessarily output in the list, an optimum among all texts is sought.
    •     ddictxt (specify text)
    value set: SPACE, 'L', 'M', 'S'
    You can specify with values 'L', 'M', and 'S', the keyword that should always be used as column header. If the column width changes, no attempt is made in this case to find an appropriate header for the new output width.
    Parameters for program fields without Data Dictionary reference
    see also 'Text' parameters
    •     datatype (data type)
    value set: SPACE, Data Dictionary data type (CHAR, NUMC,...)
    Only relevant for fields without Data Dictionary reference
    Program field data type
    •     ddic_outputlen (external output length)
    value set: 0 (initial), n
    Only relevant for fields without Data Dictionary reference whose output is nevertheless to be modified by a conversion exit.
    Prerequisites:
    •     FIELDCAT-EDIT_MASK = '==conv'
    see also the documentation of the parameter FIELDCAT-EDIT_MASK
    •     FIELDCAT-INTLEN = n
    see also the documentation of the parameter FIELDCAT-INTLEN
    n = external format field output length
    The column width FIELDCAT-OUTPUTLEN need not be the same as the external format output length (FIELDCAT-DDIC_OUTPUTLEN).
    •     intlen (internal output length)
    value set: 0 (initial), n
    Only relevant for fields without Data Dictionary reference whose output is nevertheless to be modified by a conversion exit.
    Prerequisites:
    •     FIELDCAT-EDIT_MASK = '==conv'
    see also the documentation of the parameter FIELDCAT-EDIT_MASK
    •     FIELDCAT-DDIC_OUTPUTLEN = n
    see also the documentation of the parameter FIELDCAT-DDIC_OUTPUTLEN
    n = internal format field output length
    •     rollname (data element)
    value set: SPACE, Data Dictionary data element name
    F1 help can be provided for a program field without a Data Dictionary reference, or F1 help which differs from the Data Dictionary help can be provided for a field with a Data Dictionary reference, using this parameter.
    When F1 help is called for this field, the documentation of the specified data element is displayed.
    If the FIELDCAT-ROLLNAME is initial for fields with a Data Dictionary reference, the documentation of the data element of the referred Data Dictionary field is output.
    Others
    •     sp_group (field group key)
    value set: SPACE, CHAR(1)
    Field group key.
    Keys are assigned to group names in the IT_SPECIAL_GROUPS parameter (see also the documentation of the parameter IT_SPECIAL_GROUPS).
    When such an assignment is made in the field catalog and in IT_SPECIAL_GROUPS, the fields are grouped correspondingly in the display variant popup.
    •     reprep (Report/Report interface selection criterion)
    value set: SPACE, 'X'
    Prerequisites:
    •     The system contains the Report/Report interface (function group RSTI, table TRSTI)
    •     Parameter LAYOUT-REPREP = 'X'
    (see also the documentation of the parameter LAYOUT-REPREP of the IMPORTING parameter IS_LAYOUT )
    'X' = When the Report/Report interface is called, the value of this field is passed in the selected interface start record as a selection criterion.
    2.7.2.     Default
    •     The following entries are usually sufficient for internal table fields with a reference to a field defined in the Data Dictionary :
    •     fieldname
    •     ref_tabname
    Notes:
    ALV gets the remaining information from the Data Dictionary.
    If no relative column position (COL_POS) is specified, the fields are output in the list in the order in which they were added to the field catalog.
    REF_FIELDNAME need only be specifid when the name of the internal table field differs from the name of the referred Data Dictionary field.
    Information which is explicitly entered in the field catalog is not overwritten by information from the Data Dictionary.
    Priority rule:
    Entries in the field catalog have priority over differing entries in the Data Dictionary.
    •     The following entries are usually sufficient for internal table fields without a reference to the Data Dictionary (program fields):
    •     fieldname
    •     outputlen
    •     datatype
    •     seltext_s
    •     seltext_m
    •     seltext_l
    Notes:
    F1 help can be provided for program fields by assigning a data element to the parameter ROLLNAME.
    If the parameters SELTEXT_S, SELTEXT_M, SELTEXT_L, and REPTEXT_DDIC contain appropriate field labels, the program field column headers are also adjusted appropriately when the column width changes.
    Reward points for useful Answers
    Regards
    Anji

  • How to display Various currency categories in same column in ALV grid?

    hi..
    i wanted to display currency field in a column which has the currency value of different currency categories like US dollar, EURO, Indian Rupees. The thing is,
    1. for US dollar it should contain ONLY last 2 decimal pts.
    2. for Euro, it should hav contain last 3 decimal pts.
    3. For Indian, it should hav contain last 2 decimal pts.
    how to achieve this in one column and how to declare it, because it all in same field.
    This report is in ALV GRID.
    and important is , i also wanted to do the SUM for the total amount which has combinations of all above specified currencies.
    how to achieve it.
    any answer will be rewarded.?
    reply soon.

    You need two columns amount and currency code in your internal table, the fields must be of type CURR and CUKY, and the field catalog must link the amount and the currency code. (CFIELDNAME of the amount column contains the name of the currency code column)
    The amount will be displayed according to the currency code definition in customizing, and will be summed by currency code.
    Regards

  • Display value and description of one field in alv grid

    Hi Folks,
       I want to display value and description of one field as one column in alv grid.
    for example iam having Xfield = 01,02,03.
    and 01 iam having text value as xxx,
    01 xxx
    02 yyy
    03 zzz
    Im report display the values are displaying as 01,02,03..
    but i want to display it as 01 xxx,02 yyy, 03 zzz.
    Please do needful.
    Thx.

    Hi, swetha
    You can do this with "concatenate".
    example:
    In you code check where you final internal table is getting filled up before that do this concatenate and then append it.
    data t_text type string.
    t_text = textfield
    CONCATENATE 'Xfield'
                     t_text
                      INTO wa_workarea SEPARATED BY space.
    cheers,
    Bhavana

  • How to display first row value returened from a query as checked as default in a report

    How to display first row value returned from a query as checked as default in a report
    Example
    Parameter 1
    Paramerter2
    ABD
    x(checked)
    Test
    DEF
    JMG
    Mudassar

    Hi Mudassar,
    The issue is caused by the order in which the parameters appear in the report data tab can be difference between our report execution and it failing. In other words, “Parameter2” is execution before parameter “A” due to this issue. We can adjust the parameter’s
    order to solve the issue.
    If “Parameter2” is parameter “A”, we cannot use that expression. Because fields cannot be used in report parameter expression, if we want to display the first value returned from a query as default value, we have to fill the “Specify values” text box with
    the specific value in Default Values dialog box.
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • How to display alternate row colors in struts form?

    hi,
    I am using struts lib to display data in jsp page.
    <logic:iterate id="result" name="listofPorjetcts" indexId = "i">
    <tr>
    <td ><bean:write name="result" property="projectName"/></td>
    </tr>
    how to display alternaternate row colors ?
    any one can help?

    hey i not sure abt structs, what i did for jsp was using a boolean.
    declare boolean red=true;
    <tr
    <%
    if(red){%>
    class="red" >
    <%
    red=false;
    }else{%>
    class="white">
    <%
    red=true;
    %>
    take note that the class is a predefined css. I think u can use style="background-color:#red "
    You can seearch the web for more info.

  • How to insert the checkbox as a separate column  in alv grid display

    Hi
    How to insert the checkboxes as a separate column  in alv grid display with using the reuse_alv_fieldcatlog_mege.
    example
    matnr    maktx  ersda                 checkbox
    10        books  28/03/2009          checkbox
    Thanks
    chinnu

    Hi,
        Check the following code.
    TYPE-POOLS: slis.
    TYPES:
          BEGIN OF ty_output,
          chk TYPE c,
          number TYPE i,
          name(20) TYPE c,
          END OF ty_output.
    DATA: gt_output TYPE STANDARD TABLE OF ty_output,
          gs_output TYPE ty_output.
    DATA: wa_layout           TYPE slis_layout_alv.
    DATA: it_fieldcatalog TYPE slis_t_fieldcat_alv,
    After you populate the data, build the field catlog like shown below.
    wa_fieldcatalog TYPE slis_fieldcat_alv.
    wa_fieldcatalog-fieldname = 'CHK'.
      wa_fieldcatalog-outputlen = '3'.
      wa_fieldcatalog-col_pos = '1'.
      wa_fieldcatalog-seltext_m   = 'CHK'.
      wa_fieldcatalog-checkbox = 'X'.
      wa_fieldcatalog-edit = 'X'.
      APPEND  wa_fieldcatalog TO it_fieldcatalog.
    wa_fieldcatalog-fieldname = 'NUMBER'.
      wa_fieldcatalog-outputlen = '10'.
      wa_fieldcatalog-col_pos = '2'.
      wa_fieldcatalog-seltext_m   = 'NUMBER'.
      APPEND  wa_fieldcatalog TO it_fieldcatalog.
      CLEAR  wa_fieldcatalog.
      wa_fieldcatalog-fieldname = 'NAME'.
      wa_fieldcatalog-outputlen = '10'.
      wa_fieldcatalog-col_pos = '3'.
      wa_fieldcatalog-seltext_m   = 'NAME'.
      APPEND  wa_fieldcatalog TO it_fieldcatalog.
      CLEAR  wa_fieldcatalog.
      wa_layout-box_fieldname     = 'CHK' .
      wa_layout-box_tabname       = 'GT_OUTPUT' .
    Now call the FM
      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          = 'PF_STATUS'
          i_callback_user_command           = 'USER_COMMAND_GRID'
    *   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                      =
    *   I_GRID_SETTINGS                   =
          is_layout                         = wa_layout
          it_fieldcat                       = it_fieldcatalog
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
    *   IT_SORT                           =
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
    *   IS_VARIANT                        =
    *   IT_EVENTS                         =
    *   IT_EVENT_EXIT                     =
    *   IS_PRINT                          =
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   I_HTML_HEIGHT_TOP                 =
    *   I_HTML_HEIGHT_END                 =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = gt_output
    * 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.

  • How Alternate rows to be colored  in an ALV Grid report?

    How Alternate rows to be colored  in an ALV Grid report?

    hi,
    try this
    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
      line_color(4) TYPE c,     "Used to store row color attributes
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE slis_layout_alv,
          gd_repid     LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    FORM build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-info_fieldname =      'LINE_COLOR'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    FORM display_alv_report.
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = gd_repid
          is_layout          = gd_layout
          it_fieldcat        = fieldcatalog[]
          i_save             = 'X'
        TABLES
          t_outtab           = it_ekko
        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  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      DATA: ld_color(1) TYPE c.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekko.
    *Populate field with color attributes
      LOOP AT it_ekko INTO wa_ekko.
    Populate color variable with colour properties
    Char 1 = C (This is a color property)
    Char 2 = 3 (Color codes: 1 - 7)
    Char 3 = Intensified on/off ( 1 or 0 )
    Char 4 = Inverse display on/off ( 1 or 0 )
              i.e. wa_ekko-line_color = 'C410'
        ld_color = ld_color + 1.
    Only 7 colours so need to reset color value
        IF ld_color = 8.
          ld_color = 1.
        ENDIF.
        CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
    wa_ekko-line_color = 'C410'.
        MODIFY it_ekko FROM wa_ekko.
      ENDLOOP.
    ENDFORM.                    " DATA_RETRIEVAL

  • Display one or more rows for a particular column in alv grid display

    Hi,
    My requirement in the report is to display users for a particular workitem id.If a workitem is in the inbox of one or more users(approvers) i have to display all the user names in one field in alv grid output (output-approver id).There are other fields which display details of the workitem also.
    Is there a way to populate multiple rows for a single column or creating one more internal table for users in the alv output table.
    Please suggest.
    regards,
    Sravanthi Chilal

    ALV only can show flat internal table data.
    you should set a sort on the field which you want to show only once.
    Then on the output of the ALV, the field with the same value will show only once.

  • How to display the header data on different position in alv report

    hi all,
    how to display the header data on different position in alv report.
    for example ,
    customer                                                   name
      xxxx                                                         xxxx
                     vendor        name     street 
                      xxxx         xxxx      xxxxx
    pls   help me .

    hi
    as per my understanding you need to trnasfer header internal table data  to pdf..
    please check the following links for internal table to pdf..
    Convertion of Internal table data to PDF
    This link is related to ur issue
    Re: how to insert the calling of the FM: OTF to PDF
    Thanks

  • How to display negative values in a screen field of a screen

    Hi All,
    Please let me know how to display negative values in a screen field of a screen.
    thanks

    Hi Kishore,
    You can do this method. In the screen , create a text field of CHAR instead fo creating an INT4 field.
    I have created a field of CHAR of name say TEXT.
    In the main program,
    declare a variable of the same name ie. TEXT.
    data: TEXT(5) TYPE C.
    In PBO, just assign the negative values.
    It will work.Since there is automatic conversion between character and integer data types, it will work for positive values as well.
    Regards,
    Sylendra.

  • SUBTOTAL TEXT IN ALV GRID

    HI ALL,
    could any one  send me how to display the subtotal Text  in ALV grid output with code sample.
    with thanks.
    kannan

    hi,
    means u want to print some text instead of star ( coming in subtotal) ?
    If so than try like,
    *& Report  ZALV_LIST
    REPORT  zalv_list.
    TABLES : mseg.
    TYPE-POOLS : slis.
    DATA : BEGIN OF itab OCCURS 0,
            mblnr LIKE mseg-mblnr,
            matnr LIKE mseg-matnr,
            werks LIKE mseg-werks,
            menge LIKE mseg-menge,
            line_color(4) TYPE c,
           END OF itab.
    DATA : BEGIN OF itab1 OCCURS 0,
            mblnr LIKE mseg-mblnr,
            matnr LIKE mseg-matnr,
            werks LIKE mseg-werks,
            menge LIKE mseg-menge,
            line_color(4) TYPE c,
           END OF itab1.
    DATA : t_fcat TYPE slis_t_fieldcat_alv,
           t_eve TYPE slis_t_event,
           t_subtot TYPE slis_t_sortinfo_alv,
           subtot LIKE LINE OF t_subtot,
           wa_fcat LIKE LINE OF t_fcat,
           gd_layout    TYPE slis_layout_alv.
    DATA : gt_menge LIKE mseg-menge,
           st_menge LIKE mseg-menge.
    SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : doc FOR mseg-mblnr.
    SELECTION-SCREEN : END OF BLOCK blk1.
    INITIALIZATION.
      PERFORM build_cat USING t_fcat.
      PERFORM build_eve.
      PERFORM build_layout.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM display.
    *&      Form  build_cat
          text
         -->TEMP_FCAT  text
    FORM build_cat USING temp_fcat TYPE slis_t_fieldcat_alv.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MBLNR'.
      wa_fcat-seltext_m = 'Material Doc.'.
      APPEND wa_fcat TO temp_fcat.
      CLEAR wa_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MATNR'.
      wa_fcat-seltext_m = 'Material'.
      APPEND wa_fcat TO temp_fcat.
      CLEAR wa_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'WERKS'.
      wa_fcat-seltext_m = 'Plant'.
      APPEND wa_fcat TO temp_fcat.
      CLEAR wa_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MENGE'.
      wa_fcat-seltext_m = 'Quantity'.
    wa_fcat-do_sum = 'Y'.
      APPEND wa_fcat TO temp_fcat.
      CLEAR wa_fcat.
    subtot-spos = 1.
    subtot-fieldname = 'MBLNR'.
    subtot-tabname = 'ITAB'.
    subtot-up = 'X'.
    subtot-group = 'X'.
    subtot-subtot = 'X'.
    subtot-expa = 'X'.
    APPEND subtot TO t_subtot.
    ENDFORM.                    "build_cat
    *&      Form  build_eve
          text
    FORM build_eve.
      DATA : wa_eve TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = t_eve
        EXCEPTIONS
          list_type_wrong = 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.
      READ TABLE t_eve WITH KEY name =  slis_ev_top_of_page
                             INTO wa_eve.
      IF sy-subrc = 0.
        MOVE 'TOP_OF_PAGE' TO wa_eve-form.
        APPEND wa_eve TO t_eve.
      ENDIF.
    ENDFORM.                    "build_eve
    *&      Form  build_layout
          text
    FORM build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-info_fieldname =      'LINE_COLOR'.
      gd_layout-subtotals_text = 'Sub Total'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  get_data
          text
    FORM get_data.
      SELECT mblnr matnr werks menge FROM mseg INTO CORRESPONDING FIELDS OF TABLE itab
      WHERE mblnr IN doc.
      SORT itab BY mblnr.
      LOOP AT itab.
        AT NEW mblnr.
          LOOP AT itab WHERE mblnr = itab-mblnr.
            st_menge = st_menge + itab-menge.
            itab1-mblnr = itab-mblnr.
            itab1-matnr = itab-matnr.
            itab1-werks = itab-werks.
            itab1-menge = itab-menge.
            APPEND itab1.
          ENDLOOP.
          itab1-mblnr = 'Sub_Total'.
          itab1-matnr = ''.
          itab1-werks = ''.
          itab1-menge = st_menge.
          itab1-line_color = 'C710'.
          APPEND itab1.
          itab1-line_color = ''.
          CLEAR st_menge.
        ENDAT.
      ENDLOOP.
      LOOP AT itab.
        gt_menge = gt_menge + itab-menge.
      ENDLOOP.
      itab1-mblnr = 'Total'.
      itab1-matnr = ''.
      itab1-werks = ''.
      itab1-menge = gt_menge.
      itab1-line_color = 'C310'.
      APPEND itab1.
    ENDFORM.                    "get_data
    *&      Form  display
          text
    FORM display.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
         i_callback_program             = 'ZALV_LIST'
         is_layout                      = gd_layout
         it_fieldcat                    = t_fcat
        it_sort                        = t_subtot
         it_events                      = t_eve
        TABLES
          t_outtab                       = itab1
    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
    *&      Form  top_of_page
          text
    FORM top_of_page.
      WRITE:/ 'Data'.
    ENDFORM.                    "top_of_page
    reward if useful....
    Edited by: Dhwani shah on Dec 20, 2007 1:20 PM

  • How can we sort up currency field in alv grid??

    Hi GUrus,
    Can any one suggest me how to sort the currency field in alv grid...Please help me out of this issue..
    Thanks in advance!!!
    regards,
    Kranthi.

    hii,
    SAP provides a set of ALV (ABAP List Viewer) & function modules, which can be used to enhance the readability and functionality of any report output.
    ALV is a flexible tool used for displaying lists.The tool provides common list functions & can be enhanced by self-defined options.
    so u will get the option for sorting in your alv report.
    Thanks

  • Total for a Numeric field in ALV Grid display

    Hi all,
    I am not getting the Total for a Numeric field in ALV Grid output. What might be the problem.
    Regards,
    Balavardhan.K

    Check this code for subtotals and totals..
    REPORT ZYFI_REPT007
           NO STANDARD PAGE HEADING
           LINE-SIZE 300
           LINE-COUNT 50
           MESSAGE-ID ZYFI.
    TABLES : COOI, " Commitments Management: Line Items
             LFA1,                         " Vendor master (general section)
             VBEP,
             RKPLN.
          TABLE TYPES AND INTERNAL TABLES                                *
    DATA : BEGIN OF TYP_COOI ,
           OBJNR LIKE COOI-OBJNR,
           SAKTO LIKE COOI-SAKTO,
           MEGBTR LIKE COOI-MEGBTR,
           MEINH LIKE COOI-MEINH,
           WKGBTR LIKE COOI-WKGBTR,
           REFBN LIKE COOI-REFBN,
           RFPOS LIKE COOI-RFPOS,
           SGTXT LIKE COOI-SGTXT,
           BUDAT LIKE COOI-BUDAT,
           LIFNR LIKE COOI-LIFNR,
           END OF TYP_COOI.
    DATA : BEGIN OF TYP_LFA1 ,
            LIFNR LIKE LFA1-LIFNR,
            NAME1 LIKE LFA1-NAME1,
           END OF TYP_LFA1.
    DATA : BEGIN OF IT_OUTTAB OCCURS 0,
             OBJNR LIKE COOI-OBJNR,
             SAKTO LIKE COOI-SAKTO,
             MEGBTR LIKE COOI-MEGBTR,
             MEINH LIKE COOI-MEINH,
             WKGBTR LIKE COOI-WKGBTR,
             REFBN LIKE COOI-REFBN,
             RFPOS LIKE COOI-RFPOS,
             SGTXT LIKE COOI-SGTXT,
             BUDAT LIKE COOI-BUDAT,
             LIFNR LIKE COOI-LIFNR,
             NAME1 LIKE LFA1-NAME1,
           END OF IT_OUTTAB.
    DATA : IT_COOI LIKE TYP_COOI OCCURS 0 WITH HEADER LINE,
           IT_LFA1 LIKE TYP_LFA1 OCCURS 0 WITH HEADER LINE.
    *-- ALV Declarations
    TYPE-POOLS SLIS.
    DATA: IT_EVENTS            TYPE SLIS_T_EVENT,
          GS_EVENT             TYPE SLIS_ALV_EVENT,
          wa_fldcat            type slis_fieldcat_alv.
    DATA: S_LAYOUT TYPE SLIS_LAYOUT_ALV,
          GT_PRINT TYPE SLIS_PRINT_ALV.
    DATA: IT_FLDCAT       TYPE SLIS_T_FIELDCAT_ALV.
    DATA: IT_SORT             TYPE SLIS_T_SORTINFO_ALV.
    DATA: V_REPID LIKE SY-REPID.
                        SELECTION SCREEN                                 *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_KOKRS FOR COOI-KOKRS NO-EXTENSION NO INTERVALS,
                                           " Controlling Area
                     S_BUKRS FOR COOI-BUKRS NO-EXTENSION NO INTERVALS,
                                           " Company code
                     S_GJAHR FOR COOI-GJAHR NO-EXTENSION NO INTERVALS,
                                           " Fiscal Year
                     S_OBJNR FOR RKPLN-AUFNR MATCHCODE OBJECT ORDE,
                                                            " Internal order
                     S_SAKTO FOR COOI-SAKTO MATCHCODE OBJECT KART,
                                                              " Cost Element
                     S_BUDAT FOR COOI-BUDAT, " Debit Date
                     S_LIFNR FOR COOI-LIFNR. " Vendor
    SELECTION-SCREEN END OF BLOCK B1.
           S T A R T   O F   S E L E C T I O N                           *
    START-OF-SELECTION.
    *-- Read data
      PERFORM GET_DATA.
           E N D   O F   S E L E C T I O N                               *
    END-OF-SELECTION.
    *-- Process the data and prepare the output data
      PERFORM CALCULATE_FINAL_INFO.
    *--Display Report output
      PERFORM DISPLAY_REPORT.
          FORM CALCULATE_FINAL_INFO                                     *
        Process the data and prepare final internal table               *
    FORM CALCULATE_FINAL_INFO.
      DATA : L_OBJNR LIKE COOI-OBJNR.
      SORT IT_LFA1 BY LIFNR.
      DELETE ADJACENT DUPLICATES FROM IT_LFA1 COMPARING LIFNR.
      LOOP AT IT_COOI.
        L_OBJNR = IT_COOI-OBJNR+2(20).
        SHIFT L_OBJNR LEFT DELETING LEADING '0'.
        IF L_OBJNR IN S_OBJNR.
          READ TABLE IT_LFA1 WITH KEY LIFNR  = IT_COOI-LIFNR.
          IF SY-SUBRC EQ 0.
            IT_OUTTAB-NAME1 = IT_LFA1-NAME1.
          ENDIF.
          MOVE-CORRESPONDING IT_COOI TO IT_OUTTAB.
          CLEAR IT_OUTTAB-OBJNR.
          IT_OUTTAB-OBJNR = L_OBJNR.
          APPEND IT_OUTTAB.
          CLEAR IT_OUTTAB.
          CLEAR IT_LFA1.
          CLEAR L_OBJNR.
        ENDIF.
      ENDLOOP.
    ENDFORM.
    *&      Form  GET_DATA
         Fetch the Data from the table COOI and LFA1
    FORM GET_DATA.
      SELECT OBJNR
            SAKTO
            MEGBTR
            MEINH
            WKGBTR
            REFBN
            RFPOS
            SGTXT
            BUDAT
            LIFNR
            FROM COOI
            INTO TABLE IT_COOI
            WHERE   BUDAT IN S_BUDAT
            AND LIFNR IN S_LIFNR
            AND KOKRS IN S_KOKRS
            AND BUKRS IN S_BUKRS
            AND GJAHR IN S_GJAHR
            AND SAKTO IN S_SAKTO.
      IF SY-SUBRC EQ 0 .
    Get the Vendor name from LFA1
        SELECT LIFNR
               NAME1
               FROM LFA1
               INTO TABLE IT_LFA1
               FOR ALL ENTRIES IN IT_COOI
               WHERE LIFNR EQ IT_COOI-LIFNR.
      ELSE.
        MESSAGE I999 WITH TEXT-013.
      ENDIF.
    ENDFORM.                               " GET_DATA
    *&      Form  DISPLAY_REPORT
           Display the output
    FORM DISPLAY_REPORT.
      PERFORM BUILD_CATALOG.
      PERFORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS.
      IF NOT IT_OUTTAB[] IS INITIAL.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
             EXPORTING
                  I_CALLBACK_PROGRAM      = V_REPID
                  I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
                  IT_FIELDCAT             = IT_FLDCAT
                  IT_SORT                 = IT_SORT
                  IT_EVENTS               = IT_EVENTS
             TABLES
                  T_OUTTAB                = IT_OUTTAB
             EXCEPTIONS
                  PROGRAM_ERROR           = 1
                  OTHERS                  = 2.
      ELSE.
        MESSAGE I999 WITH TEXT-013.
      ENDIF.
    ENDFORM.                               " DISPLAY_REPORT
    *&      Form  BUILD_CATALOG
          Build the Field catalog for the ALV Report
    FORM BUILD_CATALOG.
      DATA: V_INDEX LIKE SY-TABIX.
      V_REPID = SY-REPID.
      DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME         = V_REPID
                I_INTERNAL_TABNAME     = 'IT_OUTTAB'
                I_INCLNAME             = V_REPID
           CHANGING
                CT_FIELDCAT            = IT_FLDCAT
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'WKGBTR'
                             TABNAME = 'IT_OUTTAB' INTO WA_FLDCAT.
      IF SY-SUBRC  EQ 0.
        WA_FLDCAT-DO_SUM  = 'X'.
        MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
      ENDIF.
      READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'OBJNR'
                                TABNAME =  'IT_OUTTAB' INTO WA_FLDCAT.
      IF SY-SUBRC EQ 0.
         WA_FLDCAT-SELTEXT_L = 'Order'.
         WA_FLDCAT-COL_POS = 1.
         WA_FLDCAT-DDICTXT = 'L'.
        MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
      ENDIF.
      LS_SORT-FIELDNAME = 'OBJNR'.
      LS_SORT-SPOS      = 1.
      LS_SORT-UP        = 'X'.
      LS_SORT-SUBTOT    = 'X'.
      APPEND LS_SORT TO IT_SORT.
    ENDFORM.                               " BUILD_CATALOG
    *&      Form  FRM_PREPARE_EVENT_LIST
          Build the Events
    FORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS TYPE SLIS_T_EVENT.
      CLEAR GS_EVENT.
      GS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
      GS_EVENT-FORM = 'TOP_OF_PAGE_REPORT'.
      APPEND GS_EVENT TO IT_EVENTS.
    ENDFORM.                               " FRM_PREPARE_EVENT_LIST
         TOP OF PAGE
    FORM TOP_OF_PAGE_REPORT.
      CALL FUNCTION 'Z_YREPORT_HEADER'
           EXPORTING
                DL_TITLE = SY-TITLE
                DL_REPID = SY-CPROG
                DL_LINSZ = SY-LINSZ
           EXCEPTIONS
                OTHERS   = 1.
    ENDFORM.                               " FRM_TOP_OF_PAGE_REPORT
    *&      Form  USER_COMMAND
      Drill Down Functionality to Call the Transaction ME23
    FORM USER_COMMAND USING    P_UCOMM    LIKE SY-UCOMM
                               P_SELFIELD TYPE SLIS_SELFIELD.
      DATA : L_INDEX LIKE SY-INDEX,
             L_REFBN LIKE COOI-REFBN.
      L_INDEX = P_SELFIELD-TABINDEX.       " holds the selected table index
      CLEAR L_REFBN.
      CASE P_UCOMM.
    *-- On Double Click
        WHEN '&IC1'.
          CLEAR L_REFBN.
    *-- Read the Current Line
          READ TABLE IT_OUTTAB INDEX L_INDEX.
          IF SY-SUBRC EQ 0.
            L_REFBN = IT_OUTTAB-REFBN.
            IF NOT L_REFBN IS INITIAL.
    *-- Set the BES Paramater Id to the Current line Purchase Order Number
              SET PARAMETER ID 'BES' FIELD L_REFBN.
    *-- Call the Transaction Purchase Order Display with the above PO Number
              CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
            ENDIF.
          ELSE.
            MESSAGE E999 WITH TEXT-014.
          ENDIF.
      ENDCASE.
    ENDFORM.                               " USER_COMMAND

  • How to give colors to the top-of-page in ALV Grid

    How to give colors to the top-of-page in ALV Grid
    in table GT_LIST_TOP_OF_PAGE i am filling 3 rows ,i need 3 different colors to be displyed on top-of-page(one color to one row)
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    I_LOGO = 'ENJOYSAP_LOGO'
    IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
    please help mee

    HI Kranthi,
    Check out teh foll. link,
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    Hope this helps.

Maybe you are looking for

  • Java Servlet BUG (Possibly)-Servlet classname replaces retrieved doc name

    I created a test servlet (TestServlet.java) which reads data from a file which could be pdf/doc/xls/zip etc and presents the file to the user for download. When the user clicks on the save option to save the file the default name before the file exte

  • Error in setDataVariable in Java Embedding

    Hi All, I am trying to write a simple java embedding---- Here is the code. try{                             String firstName = ((oracle.xml.parser.v2.XMLElement)getVariableData("inputVariable","payload","/client:JavaEmbeddingBpelProcessRequest/client

  • Importing word tables into ID

    I need to import a table from word to ID. The cols run several pages each in Word. How do I import the table so that cols break neatly within the frames? I've tried "help" but I couldn't make it work. I just need to know how to make the table flow. T

  • Dowloading Music onto iPod from different computers

    I have a PC & a laptop, each having different music on them...my question is, I had downloaded songs to my iPod mini & then later on plugged it into the laptop to download different songs & it erased all my music that was downloaded from the pc! Is i

  • I have a problem with books downloaded in ibooks to my ipad.  Full chapters are missing.

    I have a problem with books downloaded in ibooks to my ipad.  Full chapters are missing.  Do others have the same problem?