Color a row with ALV GRID

Hi my friends,
I have written a small ALV Grid where some rows should be colored, dependend on their status in a table. But it's not working and I can't find out, why it is not working. I've already studied all the topics in this forum, which are related to 'row color alv grid', but I can't find the mistake in my code. Is anyone able to find out what is wrong here?
Thanks a lot for your help!
*& Report  /BMC_TST_SHOWLOG
REPORT  /BMC_TST_SHOWLOG.
TYPES: BEGIN OF log_table.
  TYPES:  log_level TYPE /bmc_log_message,
          cr_date TYPE /bmc_cr_date,
          message TYPE /bmc_log_message,
          linecolor(4) TYPE c.
TYPES: END OF log_table.
DATA: lt_log TYPE TABLE OF log_table with HEADER LINE,
      lt_log2 TYPE TABLE OF log_table with HEADER LINE,
      lt_log_list TYPE TABLE OF log_table,
      lt_line LIKE LINE OF lt_log_list,
      container_r TYPE REF TO cl_gui_custom_container,
      grid_r TYPE REF TO cl_gui_alv_grid,
      gc_custom_control_name TYPE scrfname VALUE 'CONTAINER_LOG',
      fieldcat_r TYPE lvc_t_fcat,
      layout_r TYPE lvc_s_layo,
      logA TYPE /bmc_log_level,
      logB TYPE /bmc_log_level,
      logC TYPE /bmc_log_level,
      logD TYPE /bmc_log_level,
      logE TYPE /bmc_log_level,
      ls_ct TYPE lvc_s_scol,
      ok_code LIKE sy-ucomm.
*DATA BEGIN OF ls_log_list OCCURS 0.
*DATA: log_level TYPE /bmc_log_message,
*      cr_date TYPE /bmc_cr_date,
*      message TYPE /bmc_log_message,
*      rowcolor(4) TYPE c.
*DATA END OF ls_log_list.
*DATA: lt_log_list TYPE TABLE OF log_table.
PARAMETERS: loglevlA  TYPE c AS CHECKBOX,
            loglevlB  TYPE c as CHECKBOX,
            loglevlC  TYPE c As CHECKBOX,
            loglevlD  TYPE c aS CHECKBOX,
            loglevlE  TYPE c AS CHECKBOX,
            dateA     TYPE /bmc_cr_date OBLIGATORY,
            dateB     TYPE /bmc_cr_date.
CALL SCREEN 0200.
MODULE user_command_0200 INPUT.
  CASE ok_code.
    WHEN 'BACK'.
      SET SCREEN 0.
      MESSAGE ID 'BC400' TYPE 'S' NUMBER '057'.
    WHEN OTHERS.
  ENDCASE.
ENDMODULE.
MODULE clear_ok_code OUTPUT.
  CLEAR ok_code.
ENDMODULE.
MODULE status_0200 OUTPUT.
  SET PF-STATUS 'DYNPRO200'.
  SET TITLEBAR 'D0200'.
ENDMODULE.
MODULE display_alv OUTPUT.
  PERFORM display_alv.
ENDMODULE.
FORM display_alv.
  IF grid_r IS INITIAL.
*----Creating custom container instance
  CREATE OBJECT container_r
  EXPORTING
    container_name = gc_custom_control_name
  EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    others = 6.
    IF sy-subrc <> 0.
*--Exception handling
    ENDIF.
*----Creating ALV Grid instance
    CREATE OBJECT grid_r
    EXPORTING
      i_parent = container_r
    EXCEPTIONS
      error_cntl_create = 1
      error_cntl_init = 2
      error_cntl_link = 3
      error_dp_create = 4
      others = 5.
      IF sy-subrc <> 0.
*--Exception handling
      ENDIF.
      PERFORM get_log_data.
*----Preparing field catalog.
      PERFORM prepare_field_catalog CHANGING fieldcat_r.
*----Preparing layout structure
      PERFORM prepare_layout CHANGING layout_r.
*----Here will be additional preparations
*--e.g. initial sorting criteria, initial filtering criteria, excluding
*--functions
      CALL METHOD grid_r->set_table_for_first_display
      EXPORTING
        is_layout = layout_r
      CHANGING
        it_outtab = lt_log2[]
        it_fieldcatalog = fieldcat_r
      EXCEPTIONS
        invalid_parameter_combination = 1
        program_error = 2
        too_many_lines = 3
        OTHERS = 4.
      IF sy-subrc <> 0.
*--Exception handling
      ENDIF.
      ELSE.
        CALL METHOD grid_r->refresh_table_display
      EXCEPTIONS
        finished = 1
        OTHERS = 2.
      IF sy-subrc <> 0.
*--Exception handling
      ENDIF.
    ENDIF.
    CALL METHOD grid_r->register_edit_event
      EXPORTING
        i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    CALL METHOD grid_r->register_edit_event
      EXPORTING
        i_event_id = cl_gui_alv_grid=>mc_evt_modified.
ENDFORM.
FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
    DATA ls_fcat TYPE lvc_s_fcat.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
  EXPORTING
    i_structure_name = '/BMC_LOG'
  CHANGING
    ct_fieldcat = pt_fieldcat[]
  EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
  IF sy-subrc ne 0.
*--Exception handling
  ENDIF.
  LOOP AT pt_fieldcat INTO ls_fcat.
    CASE ls_fcat-fieldname.
      WHEN 'UUID'.
        ls_fcat-no_out = 'X'.
        MODIFY pt_fieldcat FROM ls_fcat.
      WHEN 'LOG_LEVEL'.
        ls_fcat-coltext = 'Meldungsart'.
        ls_fcat-outputlen = '25'.
        MODIFY pt_fieldcat FROM ls_fcat.
      WHEN 'CR_DATE'.
        ls_fcat-coltext = 'Erstellungsdatum'.
        ls_fcat-outputlen = '20'.
        MODIFY pt_fieldcat FROM ls_fcat.
      WHEN 'CR_TIME'.
        ls_fcat-no_out = 'X'.
        MODIFY pt_fieldcat FROM ls_fcat.
      WHEN 'MESSAGE'.
        ls_fcat-coltext = 'Nachricht'.
        ls_fcat-outputlen = '50'.
        MODIFY pt_fieldcat FROM ls_fcat.
    ENDCASE.
*    CASE ls_fcat-value.
*      WHEN '1'.
*        ls_fcat-line_color = 'c100'.
*    ENDCASE.
  ENDLOOP.
ENDFORM.
FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo.
  ps_layout-zebra = 'X'.
  ps_layout-grid_title = 'Log'.
  ps_layout-smalltitle = 'X'.
  ps_layout-info_fname = 'linecolor'.
ENDFORM.
FORM get_log_data.
  if loglevlA = 'X'.
    logA = '1'.
  ENDIF.
  if loglevlB = 'X'.
    logB = '2'.
  ENDIF.
  if loglevlC = 'X'.
    logC = '3'.
  ENDIF.
  if loglevlD = 'X'.
    logD = '4'.
  ENDIF.
  if loglevlE = 'X'.
    logE = '5'.
  ENDIF.
  IF dateB ne 0.
    SELECT log_level cr_date message FROM /bmc_log INTO CORRESPONDING FIELDS OF TABLE lt_log_list WHERE log_level = logA
      OR log_level = logB OR log_level = logC OR log_level = logD OR log_level = logE and cr_date >= dateA and cr_date <= dateB.
  ELSE.
    SELECT log_level cr_date message FROM /bmc_log INTO CORRESPONDING FIELDS OF TABLE lt_log_list WHERE log_level = logA
      OR log_level = logB OR log_level = logC OR log_level = logD OR log_level = logE and cr_date >= dateA.
  ENDIF.
*    and cr_date >= dateA.
    SORT lt_log_list ASCENDING.
    LOOP AT lt_log_list INTO lt_line.
    IF lt_line-log_level = '1'.
      lt_line-log_level = 'Info'.
      lt_line-linecolor = 'C100'.
    ENDIF.
    IF lt_line-log_level = '2'.
      lt_line-log_level = 'Warning'.
      lt_line-linecolor = 'C200'.
    ENDIF.
    IF lt_line-log_level = '3'.
      lt_line-log_level = 'Error'.
      lt_line-linecolor = 'C300'.
    ENDIF.
    IF lt_line-log_level = '4'.
      lt_line-log_level = 'Debug'.
      lt_line-linecolor = 'C400'.
    ENDIF.
    IF lt_line-log_level = '5'.
      lt_line-log_level = 'Trace'.
      lt_line-linecolor = 'C500'.
    ENDIF.
    APPEND lt_line TO lt_log2.
    ENDLOOP.
ENDFORM.
SELECTION-SCREEN BEGIN OF SCREEN 0100 TITLE text-001 AS WINDOW.
SELECTION-SCREEN END OF SCREEN 0100.

> change to this
>
> <b>ps_layout-stylefname = 'LINECOLOR'.</b>
>
> sorry ignore the above line
>
> just debug and check what is happening
>
> Message was edited by:
>         Chandrasekhar Jagarlamudi
Hi,
I've changed the line to <b>ps_layout-stylefname = 'LINECOLOR'.</b>, but then I'm getting a runtime error 'ASSIGN_TYPE_CONFLICT' in program 'SAPLSLVC in line 2975'...
I don't have any idea what is causing that.

Similar Messages

  • How to color a row in ALV grid display

    Hi,
    A few rows in the output of ALV grid display should be shown in different color.How can I achieve this?

    Hi,
    Try out this code
    DATA : BEGIN OF G_T_CASH OCCURS 0,
           PARTICULARS TYPE CHAR120,
           AMOUNT1 TYPE CHAR20,
           AMOUNT2 TYPE CHAR20,
           AMOUNT3 TYPE CHAR20,    
           ROW_COLOR TYPE CHAR4,----
    add this in the internal table for alv
          END OF G_T_CASH.
      CLEAR G_WA_CASH.
      G_WA_CASH-PARTICULARS = 'Opening Cash Balance'.
      G_WA_CASH-AMOUNT1 = G_DMBTR.
      G_WA_CASH-AMOUNT2 = ''.
      G_WA_CASH-AMOUNT3 = ''.
    while appending other values also add the following code
      G_WA_CASH-ROW_COLOR = 'C200'.----- C200 depicts light gray color
      APPEND G_WA_CASH TO G_T_CASH.
    add the following code in layout
    MOVE 'ROW_COLOR' TO WA_LS_LAYOUT-INFO_FIELDNAME.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_BYPASSING_BUFFER = ' '
          I_SAVE             = 'A'
        I_CALLBACK_PROGRAM                = SY-REPID
      I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
       I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         IS_LAYOUT                        = WA_LS_LAYOUT
         IT_FIELDCAT                      = G_T_CATALOG
         IT_EVENTS                         = GT_EVENTS
         TABLES
           T_OUTTAB                       = G_T_CASH[]
    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.
    Let me know if the problem still persist.
    Regards,
    Janaki

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

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

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

  • Changing font size(bold) or color of a particular row in ALV Grid Digplay

    Hi Experts ,
    I am having a requirment to highlight some particular rows in ALV Grid Display . To achieve this i need to change font size or make it bold or change color of that row .
    Please give me some inputs .
    Thanks in Advance.
    Vijyeta

    Hi
    Coloring An Entire Row
    Coloring a row is a bit (really a bit) more complicated. , you should add an additional field to your list data table. It should be of character type and length at least 4. This field will contain the color code for the row.
    First you have to declaration of our list data table u201Cgt_listu201D.
    DATA BEGIN OF gt_list OCCURS 0 .
    INCLUDE STRUCTURE SFLIGHT .
    DATA rowcolor(4) TYPE c .
    DATA END OF gt_list .
    Adding the field that will contain row color data
    As you guess, you should fill the color code to this field.  But how will ALV Grid know that you have loaded the color data for the row to this field. So, you make it know this by passing the name of the field containing color codes to the field u201CINFO_FNAMEu201D of the layout structure.
    e.g.
    ps_layout-info_fname = <field_name_containing_color_codes>. u201Ce.g. u2018ROWCOLORu2019
    You can fill that field anytime during execution. But, of course, due to the flow logic of screens, it will be reflected to your list display as soon as an ALV refresh occurs.
    Try this link also:
    Possible functionalities in ALV
    Regards
    Neha

  • Display 2 rows per entry with ALV Grid

    Hi Experts,
    I need to display the results of a report with ALV Grid. The Problem is: I need to display the resultdata (some numbers etc..) in one row and then add a second row with the longtext.
    The ALV should look somthing like this:
    resultdata1 resultdata2 resultdata3
    longtext1
    resultdata1 resultdata2 resultdata3
    longtext1
    resultdata1 resultdata2 resultdata3
    longtext1
    Can anyone of you give me hint on how to do that?
    (The row_pos and col_pos ind the fieldcat do not do the trick )
    Thanx
    Felix

    hi ,
    You can do this
    resultdata1 resultdata2 resultdata3
    longtext1
    resultdata1 resultdata2 resultdata3
    longtext1
    resultdata1 resultdata2 resultdata3
    longtext1
    Create two internal table  .
    one for : resultdata1 resultdata2 resultdata3
    second for   longtext1
    see that both tables have matching primary key   .
    then can  match the data and  append in another third table   .
    regards
    Deepak.

  • About inserting color to rows in alv

    hi ,
        could any one tell me how to insert colors to rows in alv.
    regards,
    pavan.

    hi,
    try like 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
    reward if usefull....

  • Default 10 rows in ALV grid

    Hi Group,
    My requirement is to show 10 default rows in ALV grid (with 4 fields in ALV grid), whenever Create radio button is selected in Selection Screen.
    Please could you help me with this.
    Thanks and Regards,
    Kumar.

    Thanks for your reply.
    Sorry I forgot to mention earlier.
    I have to show default 10 empty rows (editable) whenever the Create radio button is selected on the Sel Screen.
    Kindly assist with this regard.
    Thanks and Regards,
    Kumar.

  • Set specific rows in ALV grid ready for input

    Hi everyone,
      I have a question about how to set specific rows in ALV grid ready for input.
      I know that I can make some columns ready for input before the ALV displayed,but I have no idea how to make specific rows displayed in the ALV ready for input.

    Hello Aaron
    For editable columns we can use the fieldcatalog (LVC_S_FCAT-EDIT = 'X') but for rows you need to define editability on cell level.
    The required steps are documented in sample report BCALV_EDIT_02. Below I point out a few crucial points:
    *§1.Extend your output table for a field, e.g., CELLTAB, that holds
    *   information about the edit status of each cell for the
    *   corresponding row (the table type is SORTED!).
    DATA: BEGIN OF gt_outtab occurs 0.  "with header line
            include structure sflight.
    DATA: celltab type LVC_T_STYL.
    DATA: END OF gt_outtab.
    *§3.Provide the fieldname of the celltab field by using field
    *   STYLEFNAME of the layout structure.
       gs_layout-stylefname = 'CELLTAB'.
       CALL METHOD grid1->set_table_for_first_display
             EXPORTING i_structure_name = 'SFLIGHT'
                       is_layout        = gs_layout
             CHANGING  it_outtab        = gt_outtab[].
    Note: in the sample report only field SEATSMAX is editable. In your case you need
    to fill CELLTAB for all fields in a row.
    *§2.After selecting data, set edit status for each row in a loop
    *   according to field SEATSMAX.
      LOOP AT gt_outtab.
        l_index = sy-tabix.
        refresh lt_celltab.
        if gt_outtab-seatsmax ge 300.
            perform fill_celltab using 'RW'
                                 changing lt_celltab.
        else.
            perform fill_celltab using 'RO'
                                 changing lt_celltab.
        endif.
    *§2c.Copy your celltab to the celltab of the current row of gt_outtab.
        INSERT LINES OF lt_celltab INTO TABLE gt_outtab-celltab.
        MODIFY gt_outtab INDEX l_index.
      ENDLOOP.
    ENDFORM.                               " SELECT_DATA_AND_INIT_STYLE
    NOTE: LVC_T_STYL is a SORTED table type. Thus, take care that you are using the
    INSERT ... INTO TABLE statement and not APPEND (because then nothing is appended
    to the CELLTAB itab).
      IF p_mode EQ 'RW'.
    *§2a.Use attribute CL_GUI_ALV_GRID=>MC_STYLE_ENABLED to set a cell
    *    to status "editable".
        l_mode = cl_gui_alv_grid=>mc_style_enabled.
      ELSE. "p_mode eq 'RO'
    *§2b.Use attribute CL_GUI_ALV_GRID=>MC_STYLE_DISABLED to set a cell
    *    to status "non-editable".
        l_mode = cl_gui_alv_grid=>mc_style_disabled.
      ENDIF.
      ls_celltab-fieldname = 'SEATSMAX'.
      ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
      INSERT ls_celltab INTO TABLE pt_celltab.
    Regards
      Uwe

  • Deactivate the double click/ hot spot for a particular row in alv grid.

    Hello,
       As per a certain condition how to deactivate the double click/ hot spot for a particular row in alv grid.
    Regards,
    Saroj

    where u define layout there is a field hotspot.like
    data: var.
    if con is true
    var = 'X'. (show hotspot)
    else.
    var = ' '. (deactive hotspot)
    elseif ws_fieldcat-fieldname = 'DMBTR'
                    AND ws_fieldcat-tabname = 'T_MTAB'.
          ws_fieldcat-do_sum = C_X.
          <b>ws_fieldcat-hotsopts = var.</b>
          MODIFY Wt_fieldcat FROM ws_fieldcat
                  TRANSPORTING   DO_SUM.
    It is helpful for u. if any problen send me ur coding i will change it.
    Regards
    Manish Kumar

  • Issue with ALV grid print preview/spool

    Hello everyone,
    I am working on a report and I am having some issues with ALV grid. Currently in our DEV and QA environments the user can run the report, view the ALV grid, and print the grid without any issues.
    However this isn't the case in the Prod environment. The user is able to run the report and view the grid without any issues. But when they click print preview or click print, the spool is incorrect. It shows the proper values from the grid, but the first field is reduced in length. Rather than showing a numeric field of length 10 it shows 99999999# or 99999999...
    The programs are identical through every environment, including user parameters, formats, and spool settings. I have been told printing grids may have some issues, does anyone have any advice or dealt with this issue before?
    I appreciate the help.
    Thanks,
    C

    I was waiting to hear from the functional team on the matter and no one has mentioned any more issues.  I am assuming the problem is solved.  I just noticed the thread was still un-answered and wanted to give an update. 
    Thank you for you help Vijay.
    Regards
    C

  • I have a problem with ALV Grid User Command?

    Hi Experts,
    I have a problem with ALV GRID User Command.
    I am calling TCODE IW33 (Order Display) from the ALV output at first time by selecting an order. But, User command is calling IW33 Initial screen with blank value of order. Even I checked in debugging the value what I selected is passing properly, but once that screen (IW33 Initial) displays, value doesn't appear. Then, Manually, I  created another session and gone to TCODE IW33 and displayed an order. After that I came out from that order. Then again run my ALV program and selected another order, now order is displaying, but not what I selected current order instead of displaying previous order what I just displayed manually. If I selected any other order, system will display the same order what I dislayed manually.
    Here is my code.
    FORM user_command_alv  USING u_ucomm TYPE sy-ucomm
                           us_self_field TYPE slis_selfield.
    CASE u_ucomm.
    WHEN '&IC1'.
    READ TABLE it_final INDEX us_self_field-tabindex INTO wa_final.
            WHEN 'ORDER'.
              IF NOT wa_final-order IS INITIAL.
                SET PARAMETER ID 'COK' FIELD wa_final-order.
                CALL TRANSACTION 'IW33' AND SKIP FIRST SCREEN.
              ENDIF.
    endform.
    PARAMETER ID 'COK'  also the standard one.
    Could you please help me out, Where I did wrong?
    If I select any order, that order only should display.
    Thanks in advance.
    Regards,
    Sarayu.
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 2:33 PM

    hi,
    Please check it once the Paramater ID is 'ANR' for IW33 order number.
    Hope this may help.
    Regards,
    Sravanthi

  • Problem with ALV grid in edit mode

    Hello, gurus!
    I have a problem with ALV-grid. Sometimes when I call F4 help for a cell, data is inserted in a different cell.  And when I call check_changed_data method, my internal table (passed to ALV-control in set_table_for_first_display) does not updates properly. In what can be a problem?
    Thanks,
    Mikhail

    Hi Prabhu,
    MODULE pbo_100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      title_of_report = text-010.
      SET TITLEBAR '0100' WITH title_of_report.
      DATA: g_event_receiver TYPE REF TO lcl_event_handler.
      IF z_custom_container IS INITIAL .
        CREATE OBJECT z_custom_container
          EXPORTING
            container_name = 'ALV_ZAC'.
        CREATE OBJECT alv_grid
          EXPORTING
            i_parent = z_custom_container.
        g_repid = sy-repid.
        gs_variant-report = g_repid.
        x_save = 'A'.
        PERFORM check_alv_grid_fields.
        ps_layout-cwidth_opt = 'X'.
        ps_layout-edit = 'X'.
        CALL METHOD alv_grid->set_ready_for_input
          EXPORTING
            i_ready_for_input = '1'.
    *    CALL METHOD alv_grid->register_edit_event
    *      EXPORTING
    *        i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        APPEND   s_list_rec   to it_list_rec.
        CALL METHOD alv_grid->set_table_for_first_display
          EXPORTING
            is_layout       = ps_layout
            is_variant      = gs_variant
            i_save          = x_save
          CHANGING
            it_fieldcatalog = pt_fieldcat
            it_outtab       = it_list_rec[].
        CALL METHOD alv_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        CALL METHOD alv_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    ENDIF.
    FORM check_alv_grid_fields .
      DATA: ls_fcat LIKE LINE OF pt_fieldcat.
    REFRESH pt_fieldcat .
    CLEAR: ps_layout, ls_fcat.
      ls_fcat-fieldname = 'VBELN'.
      ls_fcat-ref_field = 'VBELN'. ls_fcat-ref_table =  'LIPS'. " .
      ls_fcat-outputlen = 9.
    *  ls_fcat-datatype   = 'CHAR'.
    *  ls_fcat-inttype    = 'C'.
      APPEND  ls_fcat TO pt_fieldcat.
      CLEAR: ls_fcat.
      ls_fcat-fieldname = 'ERDAT'.
      ls_fcat-ref_field = 'ERDAT'. ls_fcat-ref_table = 'LIPS'.
      ls_fcat-outputlen = 9.
    *  ls_fcat-f4availabl = 'X' .
    *  ls_fcat-datatype   = 'DATS'.
    *  ls_fcat-inttype    = 'D'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR: ls_fcat.
    ENDFORM.                    " check_alv_grid_fields
    FORM save_p .
      CLEAR l_valid.
      CALL METHOD alv_grid->check_changed_data
        IMPORTING
          e_valid = l_valid.
      IF l_valid IS INITIAL.
        CALL FUNCTION 'POPUP_TO_INFORM'
          EXPORTING
            titel = text-i01
            txt1  = text-i02
            txt2  = text-i03
            txt3  = text-i04.
      ELSE.
        i_dat_reg = zrumm_prr-cdprr.
        CLEAR is_temp_otc.
        freshit i_prrpus_fax.
        freshit i_list2_ot.
        LOOP AT it_list_rec INTO s_list_rec.
          MOVE-CORRESPONDING s_list_rec TO i_list2_ot.
          i_list2_ot-fgrup = 'RECE'.
          i_list2_ot-prrnu = i_num_prr.
          APPEND i_list2_ot.
          MOVE-CORRESPONDING s_list_rec TO i_prrpus_fax.
          APPEND i_prrpus_fax.
        ENDLOOP.
      ENDIF.
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:41 AM
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM

  • HOW CAN I HAVE THE NUMBER OF SELECTED ROWS IN ALV GRID?

    HI.
    HOW CAN I HAVE THE NUMBER OF SELECTED ROWS IN ALV GRID????
    GABRY =)

    You need to use
    data : grid1  type ref to cl_gui_alv_grid.
      call method grid1->get_selected_rows
        importing
          et_index_rows = i_sel_alvrows[].

  • Grey out(disable) a row in ALV grid

    Hi,
    I want to know how to grey out(disable) row wise in ALV grid display.
    i..e.. Few rows in ALV grid display shoud be editable and few rows non editable based on certain condition.
    How do we do that....Please help.
    Thanks in advance.

    Hi,
    Since fieldcatalog is used to modify coloum and not the row, the fieldcatalog would not solve the problem.
    Thankyou.

  • Handling Double click on a Pop-up screen with ALV Grid

    Hello Experts,
    I have an issue handling double click on ALV Pop-up screen. I tried to achive this using following steps.
    1. I defined a local class in Top-include to handle double click and implemented it in the following way.
    CLASS lcl_alv_event_handler DEFINITION.
    PUBLIC SECTION.
    CLASS-METHODS:
    on_double_click FOR EVENT double_click
    OF cl_gui_alv_grid
    IMPORTING e_row
    e_column
    es_row_no.
    ENDCLASS. "lcl_alv_event_handler DEFINITION
    *~~~ Implementation code
    CLASS lcl_alv_event_handler IMPLEMENTATION.
    To handle Selection of Issue data on Screen 100
    METHOD on_double_click.
    DATA: lt_row_no TYPE lvc_t_roid,
    ls_req TYPE zcst_zirt_seltab.
    READ TABLE gt_req
    INTO ls_req
    INDEX e_row-index.
    g_req_id = ls_req-zzrequest_id.
    gv_selected = true.
    CALL METHOD go_alv->dispatch
    EXPORTING
    cargo = 'OK'
    eventid = 3
    is_shellevent = ' '
    is_systemdispatch = 'X'
    EXCEPTIONS
    cntl_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.
    ENDMETHOD. "on_double_click
    ENDCLASS. "lcl_alv_event_handler IMPLEMENTATION
    2. Registered the event in the PBO module of the screen
    ls_events-eventid = 3.
    ls_events-appl_event = gc_true.
    APPEND ls_events TO lt_events.
    CALL METHOD co_alv->set_registered_events
    EXPORTING
    events = lt_events
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    illegal_event_combination = 3
    OTHERS = 4.
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CREATE OBJECT co_alv_event_handler.
    SET HANDLER: co_alv_event_handler->on_double_click FOR co_alv.
    CALL METHOD co_alv->set_toolbar_interactive.
    3. In the PAI module of Screen, tried to handle the event 'OK' that waqs registred in PBO.
    CASE save_ok.
    WHEN 'OK'.
    Get selected line
    CALL METHOD io_alv->get_selected_rows
    IMPORTING
    et_index_rows = lt_rows
    et_row_no = lt_rows_no.
    IF NOT lt_rows IS INITIAL.
    READ TABLE lt_rows INTO ls_rows INDEX 1.
    IF sy-subrc EQ 0.
    gv_selected = 'X'.
    READ TABLE it_req
    INTO ls_req
    INDEX ls_rows-index.
    e_req_id = ls_req-zzrequest_id.
    SET SCREEN 0.
    ENDIF.
    ELSE.
    SET SCREEN 0.
    ENDIF.
    With this code what is happening is, when user double clicks a line on Pop-up screen with ALV grid data, the program is able to successfully get into the class implementation but the control is not going to PAI module to execute the OK_code handling part.
    Am I doing this in the right way? Appreciate quick suggestions. Proper posts will be thoroughly awarded with points.
    Thx.
    Minni

    Put your code into the Event handler Implementation of Double Click which is there in the PAI Module.
    Regards,
    Naimesh Patel

Maybe you are looking for

  • MSI kt3 ultra aru sound problems

    i have this board (kt3 ultra aru) and i can't make the center/sub outputs on the audio bracket to work. the rear outputs are ok, but center/sub... dead. I only have that channels when I don't use the bracket. Is my bracket damaged? or maybe a softwar

  • Connectiong an external thunderbolt hard drive to an older iMac via firewire to thunderbolt adapter, as my Mac doesn't have any thunderbolt entry?

    Is there a possibility to connect an external thunderbolt hard drive to my iMac (originally Leopard 10.5.8. upgraded to Snow Leopard 10.6.3) via firewire to thunderbolt adapter, as my Mac doesn't have any thunderbolt, but has two firewire entries? Wo

  • Payment Advise - Email issue

    hi For payment advise ,  i have done configurtion in BTE to send mail to vendor. When i chkd the mail , there is no attachment found. Is it necessary to apply note 1033893 . If nt necessary what may be problem? Is there any changes to be done in FM  

  • SO_NEW_DOCUMENT_ATT_SEND_API1 sending pdf with wrong special characters

    Hi Experts, Im using the fm SO_NEW_DOCUMENT_ATT_SEND_API1 to send out a pdf (into sap office box). But when I open it I get totally wrong special characters (Chinese for instance, and ' is replaced by #). I have already applied the note 1430123 but i

  • Constant crashes iPhoto '09

    Last month or so, iPhoto '09 totally unstable (was always fine before!) Now crashes on opening or with the very first try. Couldn't import a .avi file either. I'm wondering if it's memory related. I trashed the preference file and rebooted, but didn'