Merging Columns In ALV

Hi
My requitrement is that i want to merge Columns (not Rows) in my ALV layout.
the condition is that i have to merge columns of only 1 row of my layout.
Cell_Merge will Merge Rows but how can i merge columns
suitable points will be awarded.
with regards
Rakshan

Hi rakshan,
could you give some kind of example?
ALV does not allow to change the structure of the table displayed. If your goal is to put the contents of more than one column into one column, you need a destination column.
I could imagine to concatenate all columns into a string:
FORM MERGE_CELLS using ps_itab type any changing pv_string type string.
data:
  lv_tmp(100) type c,
  lv_string type string.
field-symbols: <f> type any.
do.
  assign component sy-index of ps_itab to <f>.
  if sy-subrc <> 0.
  exit.
  endif.
  write <f> to lv_tmp left-justified.
  concatenate lv_string lv_tmp into lv_string separated by space.
enddo.
pv_string = lv_string.
endform.
Note: ABAP does not allow (yet) the use of write to <string variable>, that's why we use a temporary CHAR field.
Regards,
Clemens

Similar Messages

  • Merge columns in an ALV Table

    Hi colleagues,
    is it possible to merge two or more columns in ALV Table (like ColSpan in the Matrix-Layout) to write a text over more than one column?
    I haven't found any solution for it until now.
    Best regards
    Stefan

    Although it may not be exactly what you were looking for, you can create a table ColumnGroup:
    http://help.sap.com/saphelp_nw70/helpdata/EN/f0/5d9041d3c72e7be10000000a1550b0/frameset.htm

  • Merging Two Columns in ALV

    Hi Experts,
    I have a requirement, and I need to merge the the two columns in ALV. How can I do this?
    Points will be rewarded for helpful answers.
    Thanks in advance...

    Hi Salem
    Check this sample code
    LOOP AT itab.
    CONCATENATE itab-amount itab-currency INTO itab-combined.
    MODIFY itab.
    ENDLOOP.
    You will probably need to embellish just that concat command as all fields will be treated as TYPE C.
    Then inhibit the display of the original fields ‘amount’ and ‘currency’ by setting NO_OUT=’X in the fieldcat loop (or other method).
    There may be a FM to merge/format amounts and currency but I couldn’t find one on quick search.
    The option 'USING EDIT MASK' from WRITE command is also available in ALV structure IT_FIELDCAT.
    I have only used it in write and for simple stuff, but it may have some options for you.
    Check '==conv' for output conversion routine...
    Reward all helpfull answers
    Regards
    Pavan

  • Merge row in ALV

    hello everyone, im having a problem woth my ALV, how can i merge rows in ALV,
    example i want to merge row 3 and row 4?
    Another 1 how can I format a certain row in ALV?
    example row 5, I want the displayed value be centered, or right aligned, or left aligned...
    thank you very much

    Christopher,
    I am not sure what is the functionality you are trying to achieve by merging rows. If you SORT the rows, there should be a option (Iam not sure whether it is in the field catalog or the layout most probably in the layout), where the rows with the same for specific columns will automatically get merged. However, it does not make sense if the entire row is duplicated. You probably can delete the adjacent duplicates by sorting the table even before displaying the data.
    I am not sure the formatting that you are asking, but you can trying passing different values to LVC_T_STYLE type table which has to be a part of you data internal table. So, for a specific row, you append the column names and the specific style that you want for individual columns.
    Regards,
    Ravi
    Note : Please reward points if this helps you.

  • How can i suppress columns in ALV ?? Will reward points.

    Hello Gurus, how can i suppress column in ALV when i`m using the transparent table:
    CALL METHOD grid->set_table_for_first_display
          EXPORTING
            i_structure_name = 'ZIANEXE'
            is_layout        = wa_layout
            is_variant       = wa_variant
            i_save           = 'U'
            IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
          CHANGING
            it_outtab        = itab[]
            it_fieldcatalog  = fieldcat.
    Please help.

    in the fieldcatalog you are providing there is a field NO_OUT use this.
    Loop over internal table and check fieldname. If fieldname = column you want to hide, NO_OUT = 'X'.
    Edited by: Micky Oestreich on May 8, 2008 12:06 PM

  • How to Change the position of Column in ALV report

    Hi Follks,
        Is is possible to change the position of column in ALV report?.If yes then how?
        Basically my requirement is, that user want afacility where , he should be able to change the position
        of column aftre he runs the report.
        Eg: After running the report , user felt that column 5 should be at position 2 , in that case he should   
               be able to drag column 5 at position 2 and vice versa.
        Please help me, how to solve this issue.
        Note : I am using NW 7.0 SP 9
        Regards
        PG
    Edited by: PG on Apr 13, 2009 11:10 AM

    HI PG,
    do below whie filling the filed catlog
    wa_fieldcat-fieldname        = 'Field1".
    wa_fieldcat-COL_POS = '1',
    append wa_fieldcat to it_fieldcat.
    wa_fieldcat-fieldname         = 'Field2".
    wa_fieldcat-COL_POS = '2',
    wa_fieldcat-fieldname         = 'Field3".
    wa_fieldcat-COL_POS = '3',
    Thanks!

  • How to display subtotals in separate column in alv report?

    hi,
    I am displayed the subtotals  for QUantity field BDMNG in Reuse_alv_grid_display  in the same column.
    but I want to display subtotal in separate column.
    How to display subtotals in separate column in alv report?
    thanks&regards.
    samba.k

    Hi
    As far as i know you can't do this,the option you have is to create one more column (subtotal) and populate it by manual calculation at every subtotal (not alv subtotal but yours) .
    Best Regards
    Yossi

  • Mulitple Line column headers for a column in ALV using Web Dynpro for ABAP

    Hi WD4A Gurus,
           I have requirement to display the header name in multiple lines for a single column using ALV. How to achieve this, do I need to do some custom code? Please help me with sample code.
    Example:
    existing column name :
                Name   |  Date (mm/dd/yyyy) | Amount
    required column name:
                Name   |    Date               | Amount
    (mm/dd/yyyy)
    Thanks
    Ketan

    Displaying header in multiple lines is not possible in alv
    Regards
    Tamil

  • Hiding empty columns in ALV

    Hi all,
    I want to hide some columns in ALV which are empty on display when calling
    cl_gui_alv_grid->set_table_for_first_display
    That is to say the internaltable will contain empty columns.
    I know that using the "no_out" attribute of field catalog we can hide columns.
    But the question is how to find these columns which are empty - should I have to loop through the itab to find it out OR
    Can we set it in ALV LAYOUT or field catalog attributes so that it wont display empty columns.
    any help is appreciated....
    Thanks
    P
    Edited by: pazzuzu on Mar 12, 2010 5:14 PM

    Hi,
    If i understood your question correctly,
    The you can try this
    TYPE-POOLS:slis,abap.
    TYPES:BEGIN OF ty,
          f1 TYPE c,
          f2 TYPE c,
          f3 TYPE c,
          f4 TYPE c,
          END OF ty.
    DATA:it TYPE TABLE OF ty,
         wa TYPE ty,
         wa_field TYPE slis_fieldcat_alv,
         i_fieldcat TYPE TABLE OF slis_fieldcat_alv,
         i_details TYPE abap_compdescr_tab,
         wa_comp TYPE abap_compdescr,
         ref_descr TYPE REF TO cl_abap_structdescr,
         lv_field TYPE abap_compname.
    FIELD-SYMBOLS:<fs>,
                  <fs1>.
    ref_descr ?= cl_abap_typedescr=>describe_by_data( wa ).
    i_details[] = ref_descr->components[].
    wa-f1 = 'A'.
    wa-f3 = 'C'.
    APPEND wa TO it.
    wa-f1 = 'X'.
    wa-f3 = 'Y'.
    APPEND wa TO it.
    if it[] is not initial.
    LOOP AT i_details INTO wa_comp.
      ASSIGN wa_comp-name TO <fs>.
      SORT it BY (<fs>) DESCENDING.
      CONCATENATE 'WA' '-' <fs> INTO lv_field .
      ASSIGN (lv_field) TO <fs1>.
        READ TABLE it INTO wa INDEX 1 transporting (<fs>).
      IF sy-subrc = 0 AND <fs1> IS NOT INITIAL.
        wa_field-fieldname = wa_comp-name.
        wa_field-seltext_m = wa_comp-name.
        APPEND wa_field TO i_fieldcat.
      ENDIF.
    ENDLOOP.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program = sy-repid
        it_fieldcat        = i_fieldcat[]
      TABLES
        t_outtab           = it[].
    endif.

  • Dynamically Merging Columns in a table

    Hello All,
    Is it possible to merge columns in table based on some set of condition.
    The current output is as follows:
    Column 1 Column 2 Column 3 Column 4 Column 5
    Row1            ""               ""              ""                 ""
    SubRow1      ""               ""              ""                 ""
    Value 1       Value 2      Value 3     Value 4         Value 5
    The output which we need is as follows:
    Column 1 Column 2 Column 3 Column 4 Column 5
    Merged Row 1 (merged columns)
    Sub Row 1 (merged columns)
    Value 1 Value 2 Value 3 Value 4 Value 5
    Merged Row 2 (merged columns)
    Sub Row 2 (merged columns)
    Value 1 Value 2 Value 3 Value 4 Value 5
    Merged Row 3 (merged columns)
    Sub Row 3 (merged columns)
    Value 1 Value 2 Value 3 Value 4 Value 5
    Thanks.
    Kiran

    The merge is simple if you do not think about it as in word:))
    The merge can be done using scripting: just concatenate the values of the fields into one variable, fill in the value to the first column, change its width (to the width of the previous 4 cols) and hide te remaining/ blank cols.
    Have fun, Otto

  • Dynamically assign value to a column in ALV LIST Display

    Hi all,
    How can I dynamically assign value to a column in ALV LIST Display without using classes and methods?
    Thanks,
    Ridhima

    Hi Vikranth,
    I am displaying one ALV list say with columns A and B.
    I have value in A but not in B. Now at runtime user selects one row, clicks on push button in application toolbar, then i have to display value in column B in the already displayed list.
    I searched and came to know it can be done with oops concept. but i am not using classes and methods.
    so how can i do this?
    Thanks,
    Ridhima.

  • Is it technically possible to merge columns on the fly?

    I want to merge two columns only when null AND display data from a separate column in that newly merged column. Is this technically possible?

    Possible :)
    Drop me the requirement/template/xml to my id in profile.

  • SAPGUI JAVA 7.10 (OSX 10.5.1): cannot select multiple columns in ALV

    Hi,
    in sapgui java 7.10 (on mac osx 10.5.1) I cannot select multiple columns in ALV reports.
    I can do it only in some transactions (like SE16). But on all our custom reports (REUSE_ALV_GRID_DISPLAY) in does not work.
    Any hint?
    Many thanks,
    Lorenzo

    Hi Lorenzo,
    did you double check if selecting multiple columns works with SAP GUI for Windows in the same report?
    If yes, I suggest to file a bug report so we can do a remote logon to run your custom report.
    If not it might be because of REUSE_ALV_GRID_DISPLAY itself or your parameters calling REUSE_ALV_GRID_DISPLAY.
    Best regards
    Rolf-Martin

  • Maximum number of character we can print in a column uing ALV grid display

    Hi frnds,
    My requirment is to print 500 charcter data in a column using ALV grid display.
    Could any body tell me is it possible and the maximum character it can i print in a column using ALV grid dispaly.
    Regards,
    Sandipan

    Hi Sandipan,
    refer notes 857823, 910300 and 959775. All these say there is a limitation of 128 characters.
    857823 - ALV grid: Strings with a maximum of 128 characters
    Symptom
    Entries in cells of the type CHAR or string are truncated after 128
    characters in the SAP GUI.
    also refer,
    ALV Grid Control (cl_gui_alv_grid), function module (Full-screen) Grid
    (Reuse_alv_grid_display, SAPLSLVC_FULLSCREEN), SAPGUI, back end, front end
    Cause and Prerequisites
    The data table that is sent to the front end only allows character values
    with the length 128.
    Solution
    This is the standard system behavior and cannot be changed.

  • Hide a Column in ALV Grid Output

    Hi,
    I want to hide a column in ALV Grid Output through program.
    I am using   lwa_fieldcat-NO_OUT = 'X'. to hide the column in output but it is not working, column in not hided in the output.
    Kindly suggest.

    It should work..
    see the code :
    d_fieldcat_wa-fieldname = 'MATNR'.
    d_fieldcat_wa-seltext_l = 'material number'.
    d_fieldcat_wa-no_out = 'X'. * hide particular field
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    if not please paste your code here.
    Thanks
    Seshu

Maybe you are looking for