Concatenate columns in ALV
Hi All
I am using CL_SALV_GRID class to cretae ALV. Column size limit in this alv is 128. my daya data is of size 255 chars.
Can we concatenate 2 columns of 128-128 length each in ALV display with single column header.
Please suggest.
Thanks and Regards
Aditya
Hi Aditya,
when ever u design a layout just provide the attribute to the ALV layout
p_it_layout-colwidth_optimize = 'X'.
where p_it_layout is the internal table of layout type i.e. slis_layout_alv.
this shall optimised the col width, auto ,.....
or have a look at the link
[Alv column problem.]
i hope this works !!!
Best of Luck !!
Regards
Ravi
Similar Messages
-
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 PMHi,
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. -
Display more than 1023 Columns in alv
can we display more than 1023 columns in alv. please provide inputs on any approach that can be followed to achieve this.
Thanks.Hi,
just for the record. Here's the code to create a table with 10000 columns, in this example all of type vendor. It could be modified a little to create any dynamic table. Without any visible limits and can be displayed in SALV.
DATA:
lv_lifnr TYPE lifnr,
lv_numc7 TYPE numc7,
lt_components TYPE cl_abap_structdescr=>component_table,
lo_struc_descr TYPE REF TO cl_abap_structdescr,
lo_tdescr TYPE REF TO cl_abap_tabledescr,
lr_tab TYPE REF TO data.
FIELD-SYMBOLS:
<component> TYPE LINE OF abap_component_tab,
<range_tab> TYPE STANDARD TABLE,
<tab> TYPE table.
* build dynamic table
DO 10000 TIMES.
APPEND INITIAL LINE TO lt_components ASSIGNING <component>.
<component>-type ?= cl_abap_datadescr=>describe_by_data( lv_lifnr ).
lv_numc7 = sy-index.
CONCATENATE 'FIELD' lv_numc7 INTO <component>-name.
ENDDO.
lo_struc_descr ?= cl_abap_structdescr=>create( lt_components ).
lo_tdescr = cl_abap_tabledescr=>create( lo_struc_descr ).
CREATE DATA lr_tab TYPE HANDLE lo_tdescr.
ASSIGN lr_tab->* TO <tab>.
APPEND INITIAL LINE TO <tab>.
I discovered that it takes some time (15 seconds or more) to create, even F1 and F4 in the SALV table use considerable time to pop up, I think (SAP never imagined
But it works - and the code is so simple!
Kind regards,
Clemens -
To increase dynamically columns in ALV report
hi everyone,
Could any one give me a sample code ,to increase columns in ALV report output dynamically as record increase, i need to increase columns so that i can keep all the years data of a particular project in one rowPlease refer to the code piece
*& Report ZTEST_DYNAMIC_ALV
REPORT ztest_dynamic_alv.
DATA: gt_fcat TYPE lvc_t_fcat,
gw_grid TYPE REF TO cl_gui_alv_grid.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-s01.
PARAMETERS: p_number TYPE i.
SELECTION-SCREEN : END OF BLOCK b1.
** Start of Selection
START-OF-SELECTION.
*1) Create Base Catalog
PERFORM sub_create_base_catalog.
*2) Add additional fields
PERFORM sub_fill_addtional.
*3) Display output data.
PERFORM sub_display_output.
*& Form SUB_CREATE_BASE_CATALOG
* Create Base catalog for display
FORM sub_create_base_catalog .
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZSTRCT'
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
ENDFORM. " SUB_CREATE_BASE_CATALOG
*& Form SUB_FILL_ADDTIONAL
* text
FORM sub_fill_addtional .
DATA: lw_fcat TYPE lvc_s_fcat,
lw_from TYPE i,
lw_data TYPE REF TO data,
lw_fname TYPE stfna,
lw_index(2) TYPE n.
FIELD-SYMBOLS: <l_output> TYPE table.
DESCRIBE TABLE gt_fcat LINES lw_from.
DO p_number TIMES.
lw_from = lw_from + 1.
lw_index = sy-index.
CONCATENATE 'DYNA' lw_index INTO lw_fname SEPARATED BY '-'.
lw_fcat-col_pos = lw_from.
lw_fcat-fieldname = lw_fname.
lw_fcat-tabname = '1'.
lw_fcat-scrtext_l = lw_fcat-scrtext_m = lw_fcat-scrtext_s = lw_fname.
APPEND lw_fcat TO gt_fcat.
CLEAR lw_fcat.
ENDDO.
** Convert gt_fcat to internal table.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fcat
IMPORTING
ep_table = lw_data
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc = 0.
** Create the internal table form field catalog.
ASSIGN lw_data->* TO <l_output>.
** display the ALV data.
CREATE OBJECT gw_grid
EXPORTING
i_parent = cl_gui_container=>screen0
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc = 0.
CALL METHOD gw_grid->set_table_for_first_display
CHANGING
it_outtab = <l_output>
it_fieldcatalog = gt_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc = 0.
MESSAGE s000(zrak) WITH p_number 'DISPLAYED DYNAMICALLY'.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " SUB_FILL_ADDTIONAL
*& Form SUB_DISPLAY_OUTPUT
* text
FORM sub_display_output .
CALL SCREEN '9001'.
ENDFORM. " SUB_DISPLAY_OUTPUT
*& Module STATUS_9001 OUTPUT
* text
MODULE status_9001 OUTPUT.
SET PF-STATUS ' '.
SET TITLEBAR 'MAIN00'.
ENDMODULE. " STATUS_9001 OUTPUT
*& Module USER_COMMAND_9001 INPUT
* text
MODULE user_command_9001 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR
'CANC' OR
'%EX'.
SET SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_9001 INPUT -
Display concatenad fields under one column in alv.
How can I concatenate three or four fields(Taken from different tables) and can display under one column in ALV report?
I want to display:
final_column = production orderStatusmaterial type+maintenance status (concatenation of four fields).
production order: caufvd-aufnr
status: tj02t-txt04
material type: mara-mtart
maintenance status:mara-pstat
I want to display only final_column in my alv output screen.
Kindly guide.
Thanks and regards.
Thanks and regards.
Message was edited by:
cinthia nazneenPlease go through the below code and do the same for appearing the four fields of different table into One Field catalog at Display by Concatenating .
DATA :v_tmp type string .
Loop at itab1.
Read table itab2 key field1 = itab1-field1 .
Read table itab3 key field1 = itab1-field1 .
Read table itab4 key field1 = itab1-field1 .
Concatenate itab1-field1 itab2-field1 itab3-field1 itab4-field1 into v_tmp.
fieldcatalog-fieldname = 'V_TMP'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endloop.
Reward points if it is usefull .....
Girish -
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 couldnt 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 -
How To Concatenate Column Values from Multiple Rows into a Single Column?
How do I create a SQL query that will concatenate column values from multiple rows into a single column?
Last First Code
Lesand Danny 1
Lesand Danny 2
Lesand Danny 3
Benedi Eric 7
Benedi Eric 14
Result should look like:
Last First Codes
Lesand Danny 1,2,3
Benedi Eric 7,14
Thanks,
David JohnsonStarting with Oracle 9i
select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
from
(select last, first, code, row_number() over(partition by last, first order by code) rn
from a)
connect by last = prior last and first = prior first and prior rn = rn -1
start with rn = 1
group by last, first
LAST FIRST CODES
Lesand Danny 1,2,3
Benedi Eric 7,14Regards
Dmytro -
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 AMHI 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®ards.
samba.kHi
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
KetanDisplaying header in multiple lines is not possible in alv
Regards
Tamil -
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,
RidhimaHi 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. -
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,
LorenzoHi 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,
SandipanHi 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
-
How do I find the name of the server?
Hi all, I've finished a server program that returns a hard-coded html page via a socket but was hoping to make it as authentic as possible. Therefore is there a way of retrieving the server's name that I'm conecting to without using servlets? My code
-
I have an IMAC and a MacBook Pro, both recent and both running LION and both located in the same WiFi network. I don't grasp how AirDrop works. I had expected to be at one of the two computers, open a window in the Finder, go to AirDrop in the sideba
-
Using local session bean interface from web container using EJB 3.0
Hi, How can you use a local session bean interface from Java (rather than data controls) in a web container using EJB 3.0? I can use a remote interface by looking up InitialContext, but I can't find a local interface this way (even from another sessi
-
I've had the iPhone 5 for about 3 or 4 months and today I noticed that no sound comes out of the left side of the speaker when I'm listening to music or watching something on Netflix Is it a problem with the actual phone or is it some sort of glitch?
-
How to Transfer Colletions from Bridge CS5 to Bridge CS6?
How to Transfer collections from Bridge in CS5 to CS6? I tried to copy my collections to the new Bridge but for some reason I do not see an option. I tried putting on Keywords on my collections so that I can pull them up again but for some reason i