ALV Row Separator

Hello,
Can any one tell me is it possible to insert a separator in between the ALV rows ?
This will be used for identifiy & classify some categories of the rows values.
Please advice. rewards assured
Thanks!!
rgds,
Vishal

Hi
Refer this thread
ALV HELP
Regards
Raj

Similar Messages

  • Fixed lenght file and row separator

    Hi experts.
    Im using open data set and close datd set commands to create a text file in background.
    It is separated by comma.when a field is blank it just displays , , .
    I want the file to be a fixed length file. I want to see as many spaces as the length on the field if it is initial.
    Also i see a smaal box as the row separator. I want a new line separator ( ASCII char) as the row separator.
    Any suggestions ?
    Thank You
    Radhika.

    Hi,
    Instead of assigning the work area to file, use MOVE command :
    gt_file = gt_data.  " Comment this line
    Move gt_data to gt_file. " Add this line
    Use cl_abap_char_utilities=>NEWLINE for line seaparator.
    Best regards,
    Prashant

  • Modify ALV row properties

    Hi everyone. I'm working on this ALV report wich rows must be editable or not depending on a field's value. This is: if a certain field is different from 0, the ALV row should be editable. Otherwise, it shouldn't.
    Is this possible? If it is, how can I do it?
    Thans a lot,
    Fernando.

    Hi,
    You need to check for the following
    " to status editable
       l_mode = cl_gui_alv_grid=>mc_style_enabled.
    " to status non-editable
        l_mode = cl_gui_alv_grid=>mc_style_disabled.
    Please check standard demo program BCALV_EDIT_02

  • Put a checkbon with a text in alv row

    Hy everyone, I have to put a checkbon in alv with a little text.
    col1 | col2 | col3 |
    ____________________________|
    10 | 00001 | ☑ text1 |
    20 | 00101 | ☑ text2 |
    30 | 01233 | ☑ text3 |
    40 | 04539 | ☑ text4 |
    |
    thank you so much.
    Alvaro Tejada G...  Moderator  SAP Mentor      
    Posts: 3,274
    Registered: 5/25/05
    Forum Points: 3,692
         Re: put a checkbon with a text in alv row 
    Posted: Jan 13, 2010 10:07 PM   in response to: marco.bugno@lib... in response to: marco.bugno@lib...           
    Click to report abuse...      E-mail this message
      gs_fieldcat-tabname = 'T_ZESTBWAPO_P_ALV'.
      gs_fieldcat-fieldname = 'FISCPER'.
      gs_fieldcat-reptext = 'Campaña'.
      gs_fieldcat-checkbox = 'X'.   "--this is a checkbox
      gs_fieldcat-col_pos = 1.
      APPEND gs_fieldcat TO gt_fieldcat.
    This question should be answered by searching the forums...locking it...
    Greetings,
    Blag.

    I try with your code but it doesn't work, maybe i write something wrong in my code.
    What Fiscper 's type ?
    Thank's..... .. ..

  • WPF: How to make the Column and Row separator more wide and different color in datagrid?

    Our application uses WPF.
    One of request is make the DataGrid column separator and row separator more wide and use different color and remove original black separator of rows and columns.
    Which template we need to modify to make it? Thx!
    JaneC

    Hi Magnus,
    Thanks for replying our question and provide your suggestions!
    Now we know modify both HorizontalGridLinesBrush and VerticalGridLinesBrush we can change the DataGrid cell separator color.
    Following your suggested, we modify the DataGridCell as following:
    <Style x:Key="Body_Content_DataGrid_Centering"
    TargetType="{x:Type DataGridCell}">
    <Setter Property="Padding" Value="2,0" />
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="{x:Type DataGridCell}">
    <Border BorderThickness="2" BorderBrush="{StaticResource PageBorderBackground}" Margin="-1">
    <Grid Background="{TemplateBinding Background}" VerticalAlignment="Center" Height="42">
    <ContentPresenter VerticalAlignment="Center"/>
    </Grid>
    </Border>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>
    <Style x:Key="DataGridStyle1" TargetType="{x:Type DataGrid}">
    <Setter Property="HorizontalGridLinesBrush" Value="{x:Null}"/>
    <Setter Property="VerticalGridLinesBrush" Value="{x:Null}"/>
    </Style
    JaneC

  • Preventing selection for specific ALV rows

    In WD ABAP, does anyone know the technique for using the SET_ROW_SELECTABLE / SET_ROW_SELECTABLE_FIELDNAME methods to shut off the row selection button for specific ALV
    rows?  I'm not wanting to completely hide the buttons a la the SET_SELECTION_MODE method, just make some rows unselectable while leaving others intact.
    The "Preventing Selection" section of the online help
    (http://help.sap.com/saphelp_nw2004s/helpdata/en/74/fd4142646ab46be10000000a155106/frameset.htm)
    says this should be possible, but doesn't give an example of how to do it.
    Any ideas?
    Thanks in advance for your help!
    - Jason Block

    Hi,
    see the method documentation in the system, for IF_SALV_WD_TABLE_SETTINGS     SET_ROW_SELECTABLE
    Regards, Heidi

  • Adding a button to ALV row (OO ALV)

    Hi,
       I am able to add a button to the ALV row but I am not able to capture which button is pressed. I am defining the button as below :
      l_f_colpos = l_f_colpos + 1.
      l_r_fcat-tabname = 'G_T_GLALV'.
      l_r_fcat-fieldname = 'BUTTON1'.
      l_r_fcat-col_pos = l_f_colpos.
      l_r_fcat-scrtext_m = text-008.
      l_r_fcat-style = cl_gui_alv_grid=>mc_style_button.
      l_r_fcat-just = 'X'.
      APPEND l_r_fcat TO gt_glfcat.
      CLEAR l_r_fcat.
    My requirement is when the user presses the button on the ALV row , I have to display something depending on the row.
    Please give some inputs of how to capture the button which is pressed.
    Thanks in advance,
    Nilanjan Dey

    Hi Nilajan,
    take Reference of folowing program.
    REPORT zalv_toolbar.*type pools declaratins for icon and alv
    TYPE-POOLS : slis,icon.*Structure declaration for tcodes
    TYPES : BEGIN OF ty_table,
            tcode TYPE tcode,
            pgmna TYPE progname,
            END OF ty_table.*Structure for tocde text
    TYPES : BEGIN OF ty_itext,
            tcode TYPE tcode,
            ttext TYPE ttext_stct,
            sprsl TYPE sprsl,
            END OF ty_itext.*Structure for output display
    TYPES : BEGIN OF ty_output,
            tcode TYPE tcode,
            pgmna TYPE progname,
            ttext TYPE ttext_stct,
           END OF ty_output.*internal table and work area declarations
    DATA : it_table TYPE STANDARD TABLE OF ty_table INITIAL SIZE 0,
           it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
           it_ittext TYPE STANDARD TABLE OF ty_itext INITIAL SIZE 0,
           wa_table TYPE ty_table,
           wa_output TYPE ty_output,
           wa_ittext TYPE ty_itext.*Class definition for ALV toolbar
    CLASS:      lcl_alv_toolbar   DEFINITION DEFERRED.*Declaration for toolbar buttons
    DATA : ty_toolbar TYPE stb_button.* Data declarations for ALVDATA: c_ccont TYPE REF TO cl_gui_custom_container,   "Custom container object
          c_alvgd         TYPE REF TO cl_gui_alv_grid,   "ALV grid object
          it_fcat            TYPE lvc_t_fcat,            "Field catalogue
          it_layout          TYPE lvc_s_layo,            "Layout
          c_alv_toolbar    TYPE REF TO lcl_alv_toolbar,           "Alv toolbar
          c_alv_toolbarmanager TYPE REF TO cl_alv_grid_toolbar_manager.  "Toolbar manager*Initialization event
    INITIALIZATION.*Start of selection event
    START-OF-SELECTION.*Subroutine to get values from tstc table
      PERFORM fetch_data.*subroutine for alv display
      PERFORM alv_output.*---------------------------------------------------------------------*
    *       CLASS lcl_alv_toolbar DEFINITION
    *       ALV event handler
    CLASS lcl_alv_toolbar DEFINITION.
      PUBLIC SECTION.*Constructor
        METHODS: constructor
                   IMPORTING
                     io_alv_grid TYPE REF TO cl_gui_alv_grid,*Event for toolbar
        on_toolbar
           FOR EVENT toolbar
           OF  cl_gui_alv_grid
           IMPORTING
             e_object.ENDCLASS.                    "lcl_alv_toolbar DEFINITION*---------------------------------------------------------------------*
    *       CLASS lcl_alv_toolbar IMPLEMENTATION
    *       ALV event handler
    CLASS lcl_alv_toolbar IMPLEMENTATION.
      METHOD constructor.*   Create ALV toolbar manager instance
        CREATE OBJECT c_alv_toolbarmanager
          EXPORTING
            io_alv_grid      = io_alv_grid.  ENDMETHOD.                    "constructor  METHOD on_toolbar.*   Add customized toolbar buttons.
    *   variable for Toolbar Button    ty_toolbar-icon      =  icon_generate.
        ty_toolbar-butn_type = 0.
        ty_toolbar-text = 'Button1'.    APPEND ty_toolbar TO e_object->mt_toolbar.    ty_toolbar-icon      =  icon_voice_output.
        ty_toolbar-butn_type = 0.
        ty_toolbar-text = 'Button2'.
        APPEND ty_toolbar TO e_object->mt_toolbar.    ty_toolbar-icon      =  icon_phone.
        ty_toolbar-butn_type = 0.
        ty_toolbar-text = 'Button3'.
        APPEND ty_toolbar TO e_object->mt_toolbar.    ty_toolbar-icon      =  icon_mail.
        ty_toolbar-butn_type = 0.
        ty_toolbar-text = 'Button4'.    APPEND ty_toolbar TO e_object->mt_toolbar.    ty_toolbar-icon      =  icon_voice_input.
        ty_toolbar-butn_type = 0.
        ty_toolbar-text = 'Button5'.    APPEND ty_toolbar TO e_object->mt_toolbar.**   Call reorganize method of toolbar manager to
    **   display the toolbar    CALL METHOD c_alv_toolbarmanager->reorganize
          EXPORTING
            io_alv_toolbar = e_object.  ENDMETHOD.                    "on_toolbarENDCLASS.                    "lcl_alv_toolbar IMPLEMENTATION*&---------------------------------------------------------------------*
    *&      Form  fetch_data
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM fetch_data .* Select the tcodes upto 200 rows from TSTC  SELECT   tcode
               pgmna
               FROM tstc
               INTO CORRESPONDING FIELDS OF TABLE it_table
               UP TO 200 ROWS
               WHERE dypno NE '0000'.*Select the tcode textx  IF it_table[] IS NOT INITIAL.    SELECT ttext
               tcode
               sprsl
               FROM tstct
               INTO CORRESPONDING FIELDS OF TABLE it_ittext
               FOR ALL ENTRIES IN it_table
               WHERE tcode = it_table-tcode
               AND sprsl = 'E'.  ENDIF.* Apppending the data to the internal table of ALV output  LOOP AT it_table INTO wa_table.
        wa_output-tcode = wa_table-tcode.
        wa_output-pgmna = wa_table-pgmna.*    For texts
        READ TABLE it_ittext INTO wa_ittext WITH KEY tcode = wa_table-tcode.
        wa_output-ttext = wa_ittext-ttext.    APPEND wa_output TO it_output.
        CLEAR wa_output.  ENDLOOP.ENDFORM.                    " fetch_data
    *&      Form  alv_output
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM alv_output .*Calling the ALV
      CALL SCREEN 0600.ENDFORM.                    " alv_output** Calling the ALV screen with custom container
    *On this statement double click  it takes you to the screen painter SE51.*Enter the attributes
    *Create a Custom container and name it CC_CONT and OK code as OK_CODE.
    *Save check and Activate the screen painter.
    *Now a normal screen with number 600 is created which holds the ALV grid.* PBO of the actual screen , Here we can give a title and customized menus
    *&      Module  STATUS_0600  OUTPUT
    *       text
    MODULE status_0600 OUTPUT.
    *  SET PF-STATUS 'xxxxxxxx'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0600  OUTPUT
    * calling the PBO module ALV_GRID.
    *&      Module  ALV_GRID  OUTPUT
    *       text
    MODULE alv_grid OUTPUT.*create object for custom container
      CREATE OBJECT c_ccont
           EXPORTING
              container_name = 'CC_CONT'.*create object of alv grid
      CREATE OBJECT c_alvgd
          EXPORTING
              i_parent = c_ccont.* create ALV event handler
      CREATE OBJECT c_alv_toolbar
        EXPORTING
          io_alv_grid = c_alvgd.* Register event handler
      SET HANDLER c_alv_toolbar->on_toolbar FOR c_alvgd.* Fieldcatalogue for ALV  PERFORM alv_build_fieldcat.* ALV attributes FOR LAYOUT
      PERFORM alv_report_layout.  CHECK NOT c_alvgd IS INITIAL.* Call ALV GRID  CALL METHOD c_alvgd->set_table_for_first_display
        EXPORTING
          is_layout                     = it_layout
        CHANGING
          it_outtab                     = it_output
          it_fieldcatalog               = it_fcat
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 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.ENDMODULE.                 " ALV_GRID  OUTPUT*&---------------------------------------------------------------------*
    *&      Form  alv_build_fieldcat
    *       text
    *      <--P_IT_FCAT  text
    *----------------------------------------------------------------------*FORM alv_build_fieldcat.  DATA lv_fldcat TYPE lvc_s_fcat.
      CLEAR lv_fldcat.  lv_fldcat-row_pos   = '1'.
      lv_fldcat-col_pos   = '1'.
      lv_fldcat-fieldname = 'TCODE'.
      lv_fldcat-tabname   = 'IT_OUTPUT'.
      lv_fldcat-outputlen = 8.
      lv_fldcat-scrtext_m = 'TCODE'.  APPEND lv_fldcat TO it_fcat.
      CLEAR lv_fldcat.  lv_fldcat-row_pos   = '1'.
      lv_fldcat-col_pos   = '2'.
      lv_fldcat-fieldname = 'PGMNA'.
      lv_fldcat-tabname   = 'IT_OUTPUT'.
      lv_fldcat-outputlen = 15.
      lv_fldcat-scrtext_m = 'PROGNAME'.  APPEND lv_fldcat TO it_fcat.
      CLEAR lv_fldcat.  lv_fldcat-row_pos   = '1'.
      lv_fldcat-col_pos   = '3'.
      lv_fldcat-fieldname = 'TTEXT'.
      lv_fldcat-tabname   = 'IT_OUTPUT'.
      lv_fldcat-outputlen = 60.
      lv_fldcat-scrtext_m = 'Description'.  APPEND lv_fldcat TO it_fcat.
      CLEAR lv_fldcat.ENDFORM.                    " alv_build_fieldcat*&---------------------------------------------------------------------*
    *&      Form  alv_report_layout
    *       text
    *      <--P_IT_LAYOUT  text
    *----------------------------------------------------------------------*FORM alv_report_layout.  it_layout-cwidth_opt = 'X'.
      it_layout-zebra = 'X'.ENDFORM.                    " alv_report_layout* PAI module of the screen created. In case we use an interactive ALV or
    *for additional functionalities we can create OK codes
    *and based on the user command we can do the coding.
    *&      Module  USER_COMMAND_0600  INPUT
    *       text
    MODULE user_command_0600 INPUT.
    ENDMODULE.                 " USER_COMMAND_0600  INPUTOutput:
    Regards,
    Pravin

  • In the app "Numbers" I want to paste in many rows in to columns. And each row separated. Now it's getting all in one column

    In the app "Numbers" I want to paste in many rows in to columns. And each row separated. Now it's getting all in one column when I try to paste.
    Fact is that I have a 4 pages list with about 50 rows of single words and I want all that in columns

    Hey joshuafromisr,
    If you resintall iTunes, it should fix the issue. The following document will go over how to remove iTunes fully and then reinstall. Depending on what version of Windows you're running you'll either follow the directions here:
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    http://support.apple.com/kb/HT1925
    or here:
    Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7
    http://support.apple.com/kb/HT1923
    Best,
    David

  • WPF: How to make the first column does not show row separator and Left column separator in DataGrid?

    Our WPF application uses DataGrid.
    One of request is that first column of DataGrid does not show row separator and also does not show Left column separator. So it looks like the first column does not belong to the DataGrid. However, when select a row, the cell of first column still get selected.
    How do we make it? Thx!
    JaneC

    Hi Magnus,
    Thanks for replying our question and provide your solution!
    Your solution works by setting "HorizontalGridLinesBrush" and "VerticalGridLinesBrush" to {x:Null} in the DataGrid style and modify "CellStyle" in first column as following:
    <DataGridTextColumn MinWidth="32"
    Binding="{Binding CellName}"
    CanUserReorder="False"
    CanUserSort="False"
    Header="Cell}"
    IsReadOnly="true" >
    <DataGridTextColumn.CellStyle>
    <Style TargetType="DataGridCell">
    <Setter Property="IsEnabled" Value="False"></Setter>
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="{x:Type DataGridCell}">
    <Border BorderThickness="0" BorderBrush="{x:Null}"
    Background="{Binding Background, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Margin="-1">
    <Grid Background="{TemplateBinding Background}" VerticalAlignment="Center" Height="42">
    <ContentPresenter VerticalAlignment="Center"/>
    </Grid>
    </Border>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>
    </DataGridTextColumn.CellStyle>
    </DataGridTextColumn>
    We found another way to achieve it by using DataGridRowHeader. The good way to use DataGridRowHeader is that we do not need to make the first column ReadOnly (click on first column does not select whole row anymore). Select RowHeader in a row will select
    whole row. Move scroll bar horizontally, the row header still keep in visible area.
    <Style TargetType="{x:Type DataGridRowHeader}" x:Key="dataGridRowHeaderStyle">
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalAlignment" Value="Center" />
    <Setter Property="Height" Value="42" />
    <Setter Property="SeparatorBrush" Value="{x:Null}" />
    <Setter Property="FontSize" Value="16" />
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="{x:Type DataGridRowHeader}">
    <Grid>
    <Border x:Name="rowHeaderBorder"
    BorderThickness="0"
    Padding="3,0,3,0"
    Background="{Binding Background, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
    BorderBrush="{x:Null}">
    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
    </Border>
    </Grid>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>
    <DataGrid>
    <DataGrid.RowHeaderStyle>
    <Style TargetType="DataGridRowHeader" BasedOn="{StaticResource dataGridRowHeaderStyle}">
    <Setter Property="Content" Value="{Binding CellName}" />
    <Setter Property="Width" Value="35"/>
    </Style>
    </DataGrid.RowHeaderStyle>
    </<DataGrid>
    JaneC

  • Multiline field in ALV row

    Hello.
    Is it possible to have  a multiline field in an ALV control (cl_gui_alv_grid or cl_salv_table). I already searched the documentation but I could not find anything about multiline fields in a single row.
    Thanks in advance.

    No, you can not wrap text within the cell.
    Regards,
    RIch Heilman

  • ALV Row should apper in BOLD when order type is "ZSTP1" in the cloumn

    Hi ,
    CAn you please provide the solution ,
    I am using ALV  GRID function module.
    When perticluar value like order type is 'ZSTP1', I need to bold that row (all the values in that row should be bold).
    Thanks ,
    veerendra.

    Hi veerendara,
    1. BOLD is not possible.
    2. However, We can CHANGE THE COLORS,
       based upon the condition.
    3. Not only the full row color,
      we can also manipulate the color in each cell.
    4.
    IMPORTANT THINGS
    a. Extra field in internal table
    clr TYPE slis_t_specialcol_alv,
    (this field will contain the colour codes)
    b. assign fieldname to alv layout
    alvly-coltab_fieldname = 'CLR'
    c. work area for colour
    DATA : clrwa TYPE slis_specialcol_alv.
    d. Populating the color
    Once again
    Loop at ITAB.
    *********logic
    if itab-field < 0 "---negative
    clrwa-fieldname = 'FIELDNAME'. "<--- FIELDNAME FOR COLOR
    clrwa-color-col = 6. <------- COLOUR 0-9
    APPEND clrwa TO itab-clr.
    MODIFY ITAB.
    endif.
    ENDLOOP.
    5. just copy paste in new program
    6.
    REPORT abc .
    NECESSARY / MUST
    TYPE-POOLS : slis.
    DATA : alvfc TYPE slis_t_fieldcat_alv.
    DATA : alvly TYPE slis_layout_alv.
    ITAB DECLARATION
    DATA : prg TYPE sy-repid.
    DATA : BEGIN OF itab OCCURS 0.
    INCLUDE STRUCTURE t001.
    DATA : clname(3) TYPE c,
    clr TYPE slis_t_specialcol_alv,
    END OF itab.
    DATA : clrwa TYPE slis_specialcol_alv.
    PARAMETERS : a TYPE c.
    DATA : flname TYPE slis_fieldname.
    SELECT
    START-OF-SELECTION.
    SELECT * FROM t001
    INTO CORRESPONDING FIELDS OF TABLE itab..
    LOOP AT itab..
    IF SY-TABIX <= 5.
    itab-clname = 'C50'.
    ELSE.
    itab-clname = 'C30'.
    ENDIF.
    MODIFY itab.
    ENDLOOP.
    LOOP AT ITAB.
    check itab-bukrs = '1000'
    clrwa-fieldname = 'BUTXT'.
    clrwa-color-col = 6.
    APPEND clrwa TO itab-clr.
    MODIFY ITAB.
    clrwa-fieldname = 'LAND1'.
    clrwa-color-col = 4.
    APPEND clrwa TO itab-clr.
    MODIFY ITAB.
    ENDLOOP.
    prg = sy-repid.
    flname = 'CLNAME'.
    alvly-info_fieldname = 'CLNAME'.
    alvly-coltab_fieldname = 'CLR'.
    LOOP AT ITAB.
    if sy-tabix = 3.
    clrwa-fieldname = 'BUTXT'.
    clrwa-color-col = 6.
    APPEND clrwa TO itab-clr.
    MODIFY ITAB.
    clrwa-fieldname = 'LAND1'.
    clrwa-color-col = 1.
    APPEND clrwa TO itab-clr.
    MODIFY ITAB.
    endif.
    ENDLOOP
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = prg
    i_internal_tabname = 'ITAB'
    i_inclname = prg
    CHANGING
    ct_fieldcat = alvfc
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    minimum
    *CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    it_fieldcat = alvfc
    TABLES
    t_outtab = itab
    EXCEPTIONS
    program_error = 1
    OTHERS = 2
    extra
    sy-uname = 'XYZAB'.
    prg = sy-repid.
    Excluding
    DATA : excl TYPE slis_t_extab.
    DATA : exclwa TYPE slis_extab.
    exclwa = '&OUP'.
    APPEND exclwa TO excl.
    exclwa = '&ODN'.
    APPEND exclwa TO excl.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    it_fieldcat = alvfc
    i_callback_program = sy-repid
    is_layout = alvly
    i_callback_user_command = 'ITAB_USER_COMMAND'
    it_excluding =
    excl
    i_save = 'A'
    TABLES
    t_outtab = itab
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    *& Form itab_user_command
    text
    -->WHATCOMM text
    -->WHATROW text
    FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
    slis_selfield.
    BREAK-POINT.
    ENDFORM. "itab_user_command
    regards,
    amit m.

  • Dynamic table with alv rows & colums

    Hey,
    How to create dynamic internal table with alv grid rows & columns with data .

    TYPE-POOLS : abap.
    FIELD-SYMBOLS: <f_dyn_table> TYPE STANDARD TABLE,
                 <f_dyn_wa>.
    DATA: t_dy_table TYPE REF TO data,
          dy_line  TYPE REF TO data,
          wa_xfc TYPE lvc_s_fcat,
          t_ifc TYPE lvc_t_fcat.
    *get the structure
      DATA: $field        TYPE lvc_fname,
            $counter(2)   TYPE n.
      DATA: $output_field(25) TYPE c,
            $fld_len      TYPE i.
      FIELD-SYMBOLS: <f_out_field> TYPE ANY.
      DATA : $t_idetails  TYPE abap_compdescr_tab,
             $wa_xdetails TYPE abap_compdescr.
      DATA : $ref_table_des TYPE REF TO cl_abap_structdescr.
    get the structure of the table.*
      $ref_table_des ?=
          cl_abap_typedescr=>describe_by_name( c_struc ).
      $t_idetails[] = $ref_table_des->components[].
      LOOP AT $t_idetails INTO $wa_xdetails.
        CLEAR: wa_xfc, $output_field, $fld_len.
        wa_xfc-fieldname = $wa_xdetails-name .
        wa_xfc-datatype  = $wa_xdetails-type_kind.
        wa_xfc-inttype   = $wa_xdetails-type_kind.
        IF $wa_xdetails-type_kind EQ 'C'
           OR $wa_xdetails-type_kind EQ 'N'.
          CONCATENATE 'WA_OUTTAB' '-' $wa_xdetails-name
                                         INTO $output_field.
          ASSIGN ($output_field) TO <f_out_field>.
          IF <f_out_field> IS ASSIGNED.
            DESCRIBE FIELD <f_out_field> LENGTH $fld_len
                                           IN CHARACTER MODE.
            wa_xfc-intlen    = $fld_len.
          ENDIF.
        ELSE.
          wa_xfc-intlen    = $wa_xdetails-length.
        ENDIF.
        wa_xfc-decimals  = $wa_xdetails-decimals.
        APPEND wa_xfc TO t_ifc.
        CLEAR $wa_xdetails.
      ENDLOOP.
    here if you have any other fields to be added to the dynamic structure based on your requirement, you can add then and apped them to t_ifc. There is a special handling for unicode conversion- so for the numc and char fields the length is passed in a different mothed.
    create dynamic internal table and assign to fs*
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = t_ifc
          i_length_in_byte          = 'X'
        IMPORTING
          ep_table                  = t_dy_table
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
      IF sy-subrc <> 0.
      ELSE.
        ASSIGN t_dy_table->* TO <f_dyn_table>.
    create dynamic work area and assign to fs
        CREATE DATA dy_line LIKE LINE OF <f_dyn_table>.
        ASSIGN dy_line->* TO <f_dyn_wa>.
      ENDIF.
    *move the data into <f_dyn_wa> and then append this to output table <f_dyn_table>.
    example:-
        IF <f_dyn_wa> IS ASSIGNED AND <f_dyn_table> IS ASSIGNED.
          MOVE-CORRESPONDING wa_outtab TO <f_dyn_wa>.
    APPEND <f_dyn_wa> TO <f_dyn_table>.
    endif.
    Edited by: Krishna Adabala on Dec 2, 2008 7:57 AM

  • ALV totals separated by currency type

    Hi, I´m using ALV non OO, I need to totalize the amount NETWR but I have many currencies, so I need to separete it by USD, VEB, EUR...
    So at the end of the alv I will have something like this:
    USD          1220,00
    EUR            200,30
    GBP            120,35
    VEB       100000,00
    I use the fieldcat-DO_SUM to totalize but it gets all cell and dont separate by currency.
    I use too ls_sort-subtot, this show the subtotals down each money type but the total it's still global, not separated.
    Help...
    Daniel

    If the subtotal option works for you and you just don't want to see the grand totals line, set the WS_LAYOUT-NO_TOTALLINE = 'X'. This should give you the subtotal by currency types but no grand totals of all the records.
    BTW, the subtotal option can be done by setting WS_SORT-SUBTOT = 'X' for the field you want to subtotal by.
    Please reward points if helpful.
    Regards,
    Minami
    Message was edited by:
            Minami Akana

  • ALV rows coloring based on condition

    Hai ,
    I want Color the rows in the list based on some condition ..
    Hope to get the helpful suggestion s on this asap
    regards,

    Hi shishupalreddy,
    1. Not only the full row color,
      we can also manipulate the color in each cell,
      based upon conditions.
    2.
    IMPORTANT THINGS
    a. Extra field in internal table
    clr TYPE slis_t_specialcol_alv,
    (this field will contain the colour codes)
    b. assign fieldname to alv layout
    alvly-coltab_fieldname = 'CLR'
    c. work area for colour
    DATA : clrwa TYPE slis_specialcol_alv.
    d. Populating the color
    Once again
    Loop at ITAB.
    *********logic
    if itab-field < 0 "---negative
    clrwa-fieldname = 'FIELDNAME'. "<--- FIELDNAME FOR COLOR
    clrwa-color-col = 6. <------- COLOUR 0-9
    APPEND clrwa TO itab-clr.
    MODIFY ITAB.
    endif.
    ENDLOOP.
    5. just copy paste in new program
    6.
    REPORT abc .
    NECESSARY / MUST
    TYPE-POOLS : slis.
    DATA : alvfc TYPE slis_t_fieldcat_alv.
    DATA : alvly TYPE slis_layout_alv.
    ITAB DECLARATION
    DATA : prg TYPE sy-repid.
    DATA : BEGIN OF itab OCCURS 0.
    INCLUDE STRUCTURE t001.
    DATA : clname(3) TYPE c,
    clr TYPE slis_t_specialcol_alv,
    END OF itab.
    DATA : clrwa TYPE slis_specialcol_alv.
    PARAMETERS : a TYPE c.
    DATA : flname TYPE slis_fieldname.
    SELECT
    START-OF-SELECTION.
    SELECT * FROM t001
    INTO CORRESPONDING FIELDS OF TABLE itab..
    LOOP AT itab..
    IF SY-TABIX <= 5.
    itab-clname = 'C50'.
    ELSE.
    itab-clname = 'C30'.
    ENDIF.
    MODIFY itab.
    ENDLOOP.
    LOOP AT ITAB.
    check itab-bukrs = '1000'
    clrwa-fieldname = 'BUTXT'.
    clrwa-color-col = 6.
    APPEND clrwa TO itab-clr.
    MODIFY ITAB.
    clrwa-fieldname = 'LAND1'.
    clrwa-color-col = 4.
    APPEND clrwa TO itab-clr.
    MODIFY ITAB.
    ENDLOOP.
    prg = sy-repid.
    flname = 'CLNAME'.
    alvly-info_fieldname = 'CLNAME'.
    alvly-coltab_fieldname = 'CLR'.
    LOOP AT ITAB.
    if sy-tabix = 3.
    clrwa-fieldname = 'BUTXT'.
    clrwa-color-col = 6.
    APPEND clrwa TO itab-clr.
    MODIFY ITAB.
    clrwa-fieldname = 'LAND1'.
    clrwa-color-col = 1.
    APPEND clrwa TO itab-clr.
    MODIFY ITAB.
    endif.
    ENDLOOP
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = prg
    i_internal_tabname = 'ITAB'
    i_inclname = prg
    CHANGING
    ct_fieldcat = alvfc
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    minimum
    *CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    it_fieldcat = alvfc
    TABLES
    t_outtab = itab
    EXCEPTIONS
    program_error = 1
    OTHERS = 2
    extra
    sy-uname = 'XYZAB'.
    prg = sy-repid.
    Excluding
    DATA : excl TYPE slis_t_extab.
    DATA : exclwa TYPE slis_extab.
    exclwa = '&OUP'.
    APPEND exclwa TO excl.
    exclwa = '&ODN'.
    APPEND exclwa TO excl.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    it_fieldcat = alvfc
    i_callback_program = sy-repid
    is_layout = alvly
    i_callback_user_command = 'ITAB_USER_COMMAND'
    it_excluding =
    excl
    i_save = 'A'
    TABLES
    t_outtab = itab
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    *& Form itab_user_command
    text
    -->WHATCOMM text
    -->WHATROW text
    FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
    slis_selfield.
    BREAK-POINT.
    ENDFORM. "itab_user_command
    regards,
    amit m.

  • ALV Row Editable for specific column

    Hi,
      I am creating a transaction using ALV  - Webdynpro. I would like to enable or disable the row ,(specific column in that row ).
    Problem is very similar to the thread posted in the below link.
    enable or disable row in alv
    Please let me know how to achive the scenario.
    Thanks,
    Kumar

    Hi Kumar,
    Have a look at [this thread|How to set some rows in ALV to be editable or some non editable.; in which I have given the complete code to solve your problem. There is one post which explains how to set the cell editor, and one more post explains setting the cell as editable or read only.
    You need to bind the read_only property of your node attribute (i.e, whichever column you want this behavior on), to another attribute (say FLD_READ_ONLY) in the same context node. And based on the value in attribute FLD_READ_ONLY, the cell property would be changed. Define this attribute of type char01. So based on your business logic, if you want the cell to be read only, set X in the attribute, and if you want it to be editable, set space.
    I hope that would be clear enough. Please revert for any clarifications. Depending on your requirement, if you want the read_only property to change on lead selection, you can get the lead selection index and set the attribute FLD_READ_ONLY = X / space only for that element. This would make only one cell editable at a time.
    You could also refer to this recent [thread|ABAP WebDynpro: Can edit a cell in a column?; for the same issue, where you would have some additional pointers.
    Regards,
    Nithya

Maybe you are looking for