Cell length in ALV
Hello everyone.
I know that in standard alv grid (cl_gui_alv_grid) there is a restriction on cell length. You can't display more than 128 characters in a cell. Is this restriction valid for Web Dynpro?
Hi,
I tried creatin an ALV with one of the cells having string content. And it seems like 128 is not the upper limit.
Check this [snapshot|http://picasaweb.google.com/lh/photo/5FJQHSH_1_0e2r6K1owamA?feat=directlink]
Regards
Manas Dua
Similar Messages
-
To display text field with more than 1000 length in ALV
Hi Friends,
I need to display material long text field which is more than 1000 length in ALV or Object oriented ALV.
Please help me to resolve the issue.
Regards,
Jaya.Hi,
U mean to say in a single cell of ALV ??
It is not possible in ALV .. As per OSS note 857823
Below is the reason for same.. I think you should to split in number of columns.
Summary
Symptom
Entries in cells of the type CHAR or string are truncated after 128 characters in the SAP GUI.
Other terms
ALV Grid Control (cl_gui_alv_grid), function module (Full-screen)
Grid (Reuse_alv_grid_display, SAPLSLVC_FULLSCREEN), SAPGUI, back end, front end
Reason 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. -
Problem in cell content of alv grid ...
hi all,
i want to get the cell content of alv grid in the handle method of event data_changed of cl_gui_alv_grid,
i using the following code ...
METHOD on_data_changed.
DATA : lv_value(30) TYPE c.
CALL METHOD ER_DATA_CHANGED->GET_CELL_VALUE
EXPORTING
I_ROW_ID = 3
I_TABIX =
I_FIELDNAME = 'cname' "" my column table
IMPORTING
E_VALUE = lv_value.
MESSAGE lv_value TYPE 'I'.
ENDMETHOD.
endclass.
but i cant get the value of cell content
Edited by: parashuram on Oct 21, 2011 3:49 PMTry this way
method handle_data_changed.
perform handle_data_changed using er_data_changed.
endmethod.
form handle_data_changed using p_data_changed type ref to
cl_alv_changed_data_protocol.
data: ls_mod_cell type lvc_s_modi,
lv_value_dni type lvc_value.
loop at p_data_changed->mt_mod_cells into ls_mod_cell.
call method p_data_changed->get_cell_value
exporting
i_row_id = ls_mod_cell-row_id
i_fieldname = 'FINI_SUST' <== Your field
importing
e_value = lv_value_dni .
endloop.
endform. -
Hi All
I would be greatful if someone could please help...
I am still attempting to get cells painted within a WDA ALV grid display.
I have tried to use the method stated in the WDA sap press book - but this method is for use with TABLE element and I am using a ViewContainerUIElement for my table. There are mentions of wonderful ways to color cells in a list display - but I cannot understand how this can be achieved. I currently have this working appart from the numeric numbers of the design being set into the relavant column cell.
If anyone could help that would be great...
Please see: http://picasaweb.google.co.uk/dave.alexander69/Pictures#5244800978549492338
LOOP AT lt_zdata INTO ls_zdata.
lv_index = sy-tabix.
* set column values
* loop at row data and set colour attributes of individual cells
LOOP AT lt_columns ASSIGNING <fs_column>.
lr_col_header = <fs_column>-r_column->get_header( ).
lr_col_header->set_ddic_binding_field( ).
CREATE OBJECT lr_input_field EXPORTING value_fieldname = <fs_column>-id.
lr_column = lr_column_settings->get_column( <fs_column>-id ).
* for the date columns only...
IF <fs_column>-id(4) = 'CELL'.
* get and set column dates from select option user input
READ TABLE lt_dates INTO ls_dates INDEX 1.
IF lt_dates IS INITIAL.
lr_col_header->set_text( 'Date' ).
ELSE.
ls_dates-low = ls_dates-low + lv_incr_date.
MOVE ls_dates-low+2(2) TO lv_for_col_date+6(2). "Year
MOVE ls_dates-low+4(2) TO lv_for_col_date+3(2). "Month
MOVE ls_dates-low+6(2) TO lv_for_col_date(2). "Day
MOVE lv_for_col_date TO lv_col_date.
lr_col_header->set_text( lv_col_date ).
lv_incr_date = lv_incr_date + 7.
ENDIF.
LOOP AT lt_orgdata_dates INTO ls_orgdata_dates
WHERE crew = ls_zdata-crew
AND position = ls_zdata-position
AND name = ls_zdata-person
AND trip_arr >= ls_dates-low
AND trip_dep <= ls_dates-low.
* column heading settings
lr_field = lr_table->if_salv_wd_field_settings~get_field( <fs_column>-id ).
lr_field->if_salv_wd_sort~set_sort_allowed( abap_false ).
* trying to set cell variants ?@#??!!???
* lr_cv = lr_column->set_key( ls_zdata-variance ).
* lr_cv->set_editor( lr_input_field ).
* lr_cv->set_cell_design( value = '01').
* lr_column->add_cell_variant( lr_cv ).
* current method of seeting the cell colors... (but puts value in cell!)
FIELD-SYMBOLS: <fs> TYPE data.
lr_column->set_cell_design_fieldname( value = <fs_column>-id ).
ASSIGN COMPONENT <fs_column>-id OF STRUCTURE ls_zdata TO <fs>.
WRITE: CL_WD_TABLE_COLUMN=>e_cell_design-one TO <fs>.
MODIFY lt_zdata FROM ls_zdata. " INDEX lv_index.
ENDLOOP.
ENDIF.
Kind Regards
Dave AlexanderHi check this code to set cell colors for ALV grid.
Take a context attribute with type WDUI_TABLE_CELL_DESIGN.
Here i am populating colors based on some condition.Check the loop of the internal table.
method get_flight_details .
data:node_flights type ref to if_wd_context_node,
it_flights type sflight_tab1,
ls_flights type sflight,
it_final type if_componentcontroller=>elements_flights,
ls_final type if_componentcontroller=>element_flights.
select * from sflight into table it_flights
up to 100 rows.
node_flights = wd_context->get_child_node( 'FLIGHTS' ).
loop at it_flights into ls_flights.
move-corresponding ls_flights to ls_final.
if ls_final-price = '185.00'.
ls_final-readonly = abap_true.
ls_final-celldesign =
cl_wd_table_column=>e_cell_design-badvalue_light.
else.
ls_final-readonly = ' '.
ls_final-celldesign =
cl_wd_table_column=>e_cell_design-goodvalue_light.
endif.
append ls_final to it_final.
endloop.
node_flights->bind_table(
new_items = it_final
set_initial_elements = abap_true
* INDEX = INDEX
data: l_ref_cmp_usage type ref to if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
if l_ref_cmp_usage->has_active_component( ) is initial.
l_ref_cmp_usage->create_component( ).
endif.
data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .
l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
data:
l_value type ref to cl_salv_wd_config_table.
l_value = l_ref_interfacecontroller->get_model(
* Make Price column editable
data:l_column type ref to cl_salv_wd_column,
l_column1 type ref to cl_salv_wd_column,
lr_input type ref to cl_salv_wd_uie_input_field,
l_input1 type ref to cl_salv_wd_uie_input_field.
l_column = l_value->if_salv_wd_column_settings~get_column( 'PRICE' ).
create object lr_input
exporting
value_fieldname = 'PRICE'
l_column->set_cell_editor( value = lr_input ).
* to make some cells non editable
lr_input->set_read_only_fieldname( value = 'READONLY' ).
l_value->if_salv_wd_column_settings~delete_column( id = 'READONLY' )
*Set the table Editable
l_value->if_salv_wd_table_settings~set_read_only( value = abap_false ).
*Give colors to cells
l_column1 = l_value->if_salv_wd_column_settings~get_column( 'CARRID' ).
l_column1->set_cell_design_fieldname( value = 'CELLDESIGN' ).
l_value->if_salv_wd_column_settings~delete_column( id = 'CELLDESIGN' )
endmethod.
Thanks
Suman -
How to fix the excel cell length in the sap
hi
i want to fix the excel cell length in the sap. how to fix
perform fill_cell1 using l_row l_col 1 wa_cat-seltext_l.
i want to fix the fill_cell1 how to do.
Regards,
sivakumarhi
good
go through this
The following thread has the code which will put data into multiple sheets
Download to multiple sheets in Excel
FOR COLOR LOGIC JUST REFER THIS PROGRAM
*& Report ZNEGI17 *
REPORT ZNEGI17 NO STANDARD PAGE HEADING.
this report demonstrates how to send some ABAP data to an
EXCEL sheet using OLE automation.
INCLUDE OLE2INCL.
handles for OLE objects
DATA: H_EXCEL TYPE OLE2_OBJECT, " Excel object
H_MAPL TYPE OLE2_OBJECT, " list of workbooks
H_MAP TYPE OLE2_OBJECT, " workbook
H_ZL TYPE OLE2_OBJECT, " cell
H_F TYPE OLE2_OBJECT. " font
TABLES: SPFLI.
DATA H TYPE I.
table of flights
DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
*& Event START-OF-SELECTION
START-OF-SELECTION.
read flights
SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
display header
ULINE (61).
WRITE: / SY-VLINE NO-GAP,
(3) 'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(4) 'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(8) 'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
ULINE /(61).
display flights
LOOP AT IT_SPFLI.
WRITE: / SY-VLINE NO-GAP,
IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
ENDLOOP.
ULINE /(61).
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-007
EXCEPTIONS
OTHERS = 1.
start Excel
CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
PERFORM ERR_HDL.
SET PROPERTY OF H_EXCEL 'Visible' = 1.
CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
PERFORM ERR_HDL.
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-008
EXCEPTIONS
OTHERS = 1.
get list of workbooks, initially empty
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
PERFORM ERR_HDL.
add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP.
PERFORM ERR_HDL.
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
output column headings to active Excel sheet
PERFORM FILL_CELL1 USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL1 USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL1 USING 1 3 1 'Von'(003).
PERFORM FILL_CELL1 USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL1 USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
changes by Kishore - start
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
PERFORM ERR_HDL.
add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP EXPORTING #1 = 2.
PERFORM ERR_HDL.
tell user what is going on
SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
output column headings to active Excel sheet
PERFORM FILL_CELL1 USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL1 USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL1 USING 1 3 1 'Von'(003).
PERFORM FILL_CELL1 USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL1 USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
changes by Kishore - end
disconnect from Excel
CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'C:\SKV.XLS'.
FREE OBJECT H_EXCEL.
PERFORM ERR_HDL.
FORM FILL_CELL *
sets cell at coordinates i,j to value val boldtype bold *
FORM FILL_CELL1 USING I J BOLD VAL.
data : color(5) type x value 'H80000008'.
CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
PERFORM ERR_HDL.
SET PROPERTY OF H_ZL 'Value' = VAL .
PERFORM ERR_HDL.
GET PROPERTY OF H_ZL 'Font' = H_F.
PERFORM ERR_HDL.
SET PROPERTY OF H_F 'Bold' = BOLD .
PERFORM ERR_HDL.
SET PROPERTY OF H_F 'ColorIndex' = 3 .
PERFORM ERR_HDL.
ENDFORM.
*& Form ERR_HDL
outputs OLE error if any *
--> p1 text
<-- p2 text
FORM ERR_HDL.
IF SY-SUBRC <> 0.
WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
*& Form FILL_CELL1
text
-->P_H text
-->P_1 text
-->P_0 text
-->P_IT_SPFLI_CARRID text
form FILL_CELL using I J BOLD VAL.
CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
PERFORM ERR_HDL.
SET PROPERTY OF H_ZL 'Value' = VAL .
PERFORM ERR_HDL.
GET PROPERTY OF H_ZL 'Font' = H_F.
PERFORM ERR_HDL.
endform. " FILL_CELL1
thanks
mrutyun^ -
Vertical Alignment in the cell of a ALV webdynpro
HI Experts,
As per my requirement i have created an ALV in webdynpro, which has several columns few of the columns have check boxes and few have input fields.
Now, if I look at my ALV output i observed in the cell which are input fields all the data is bottom aligned but in the other cells the check boxes are top aligned . ( The vertical alignment i am talking about is with respect to each cell ).
I didnot fins any property either in the ALV or as even in a ordinary table where i can play around with the vertical alignment in a cell.
Do you think we can change the alignment in cell of a ALV? if so how?
Thanks in Advance!!_Go to "Provide Pages Feedback" in the "Pages" menu_, describe what you wish.
Then, cross your fingers, and wait _at least_ for iWork'11
Yvan KOENIG (VALLAURIS, France) samedi 13 mars 2010 23:31:06 -
How to make cell editable in ALV
Hello all,
I have following scenario.
I am using ALV_GRID_DISPLAY.
I have 5 field on output screen say A , B , C , D , E.
In field A i have check box.
In field B i have number like 0 ,1 , 2 , 3 ,4 ,5.
My problem is whenever i get value of field A as 0 i want to make my only check box of that row editable.
So can anyone help me.
Thanks in advance
SachinHi Sachin,
REPORT zalv_editf4display.*Type pools for alv
TYPE-POOLS : slis.*structure for t582a tbale
TYPES : BEGIN OF ty_table,
infty TYPE infty,
pnnnn TYPE pnnnn_d,
zrmkz TYPE dzrmkz,
zeitb TYPE dzeitb,
dname TYPE dianm,
davo TYPE davo,
davoe TYPE davoe,
END OF ty_table.*Structure for infotype text
TYPES : BEGIN OF ty_itext,
infty TYPE infty,
itext TYPE intxt,
sprsl TYPE sprsl,
END OF ty_itext.*Structure for output display
TYPES : BEGIN OF ty_output,
infty TYPE infty,
itext TYPE intxt,
pnnnn TYPE pnnnn_d,
zrmkz TYPE dzrmkz,
zeitb TYPE dzeitb,
dname TYPE dianm,
davo TYPE davo,
davoe TYPE davoe,
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_pbo 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.*Data declarations for dropdown lists for f4
DATA: it_dropdown TYPE lvc_t_drop,
ty_dropdown TYPE lvc_s_drop,
*data declaration for refreshing of alv
stable TYPE lvc_s_stbl.*Global variable declaration
DATA: gstring TYPE c.
*Data declarations for ALV
DATA: 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*ok code declaration
DATA:
ok_code TYPE ui_func.
initialization eventINITIALIZATION.start of selection event
START-OF-SELECTION.*select the infotypes maintained
SELECT infty
pnnnn
zrmkz
zeitb
dname
davo
davoe
FROM t582a UP TO 10 ROWS
INTO CORRESPONDING FIELDS OF TABLE it_table.* *Select the infotype texts
IF it_table[] IS NOT INITIAL.
SELECT itext
infty
sprsl
FROM t582s
INTO CORRESPONDING FIELDS OF TABLE it_ittext
FOR ALL ENTRIES IN it_table
WHERE infty = it_table-infty
AND sprsl = 'E'.
ENDIF.
*Apppending the data to the internal table of ALV output
LOOP AT it_table INTO wa_table. wa_output-infty = wa_table-infty.
wa_output-pnnnn = wa_table-pnnnn.
wa_output-zrmkz = wa_table-zrmkz.
wa_output-zeitb = wa_table-zeitb.
wa_output-dname = wa_table-dname.
wa_output-davo = wa_table-davo.
wa_output-davoe = wa_table-davoe.* For texts READ TABLE it_ittext INTO wa_ittext WITH KEY infty = wa_table-infty.
wa_output-itext = wa_ittext-itext.
APPEND wa_output TO it_output.
CLEAR wa_output. ENDLOOP.* Calling the ALV screen with custom container CALL SCREEN 0600.*On this statement double click it takes you to the screen painter SE51.
*Enter the attributes
*Create a Custom container and name it CCONT 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
*create 2 buttons with function code 'SAVE' and 'EXIT'.
GIVE A SUITABLE TITLE&---------------------------------------------------------------------
*& Module STATUS_0600 OUTPUT
text
MODULE status_0600 OUTPUT.
SET PF-STATUS 'DISP'.
SET TITLEBAR 'ALVF4'.
ENDMODULE. " STATUS_0600 OUTPUT
calling the PBO module ALV_GRID.
*& Module PBO OUTPUT
text
MODULE pbo OUTPUT.*Creating objects of the container
CREATE OBJECT c_ccont
EXPORTING
container_name = 'CCONT'.* create object for alv grid
create object c_alvgd
exporting
i_parent = c_ccont.* SET field for ALV
PERFORM alv_build_fieldcat.* Set 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
i_save = 'A'
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. " PBO OUTPUT&----
*& Form alv_build_fieldcat
text
<--P_IT_FCAT text
*subroutine to build fieldcatFORM 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 = 'INFTY'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 8.
lv_fldcat-scrtext_m = 'Infotype'.
lv_fldcat-icon = 'X'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat. lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '2'.
lv_fldcat-fieldname = 'PNNNN'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Structure'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat. lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '3'.
lv_fldcat-fieldname = 'ITEXT'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 60.
lv_fldcat-scrtext_m = 'Description'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '5'.
lv_fldcat-fieldname = 'ZRMKZ'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 1.
lv_fldcat-scrtext_m = 'PERIOD'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat. lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '6'.
lv_fldcat-fieldname = 'ZEITB'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 5.
lv_fldcat-scrtext_m = 'Time constraint'.
lv_fldcat-edit = 'X'.
*To avail the existing F4 help these are to
*be given in the field catalogue
lv_fldcat-f4availabl = 'X'.
lv_fldcat-ref_table = 'T582A'.
lv_fldcat-ref_field = 'ZEITB'. APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat. lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '7'.
lv_fldcat-fieldname = 'DNAME'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Dialogmodule'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat. lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '8'.
lv_fldcat-fieldname = 'DAVO'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Start'.
lv_fldcat-edit = 'X'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat. lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '9'.
lv_fldcat-fieldname = 'DAVOE'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'End'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
*To create drop down for the field 'DAVO'
with our own f4 help
ty_dropdown-handle = '1'.
ty_dropdown-value = ' '.
APPEND ty_dropdown TO it_dropdown.
ty_dropdown-handle = '1'.
ty_dropdown-value = '1'.
APPEND ty_dropdown TO it_dropdown.
ty_dropdown-handle = '1'.
ty_dropdown-value = '2'.
APPEND ty_dropdown TO it_dropdown.
ty_dropdown-handle = '1'.
ty_dropdown-value = '3'.
APPEND ty_dropdown TO it_dropdown. CALL METHOD c_alvgd->set_drop_down_table
EXPORTING
it_drop_down = it_dropdown.
LOOP AT it_fcat INTO lv_fldcat.
CASE lv_fldcat-fieldname.
To assign dropdown in the fieldcataogue
WHEN 'DAVO'.
lv_fldcat-drdn_hndl = '1'.
lv_fldcat-outputlen = 15.
MODIFY it_fcat FROM lv_fldcat.
ENDCASE.
ENDLOOP.ENDFORM. " alv_build_fieldcat&----
*& Form alv_report_layout
text
<--P_IT_LAYOUT text
*Subroutine for setting alv layout
FORM alv_report_layout.
it_layout-cwidth_opt = 'X'.
it_layout-col_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 PAI INPUT
text
MODULE pai INPUT.*To change the existing values and refresh the grid
*And only values in the dropdown or in the default
*F4 can be given , else no action takes place for the dropdown
*and error is thrown for the default F4 help and font changes to red
and on still saving, value is not changed c_alvgd->check_changed_data( ).Based on the user input
*When user clicks 'SAVE;
CASE ok_code. WHEN 'SAVE'.*A pop up is called to confirm the saving of changed data
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'SAVING DATA'
text_question = 'Continue?'
icon_button_1 = 'icon_booking_ok'
IMPORTING
answer = gstring
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.*When the User clicks 'YES'
IF ( gstring = '1' ).
MESSAGE 'Saved' TYPE 'S'.
*Now the changed data is stored in the it_pbo internal table
it_pbo = it_output.
*Subroutine to display the ALV with changed data.
PERFORM redisplay.
ELSE.
*When user clicks NO or Cancel
MESSAGE 'Not Saved' TYPE 'S'.
ENDIF.
**When the user clicks the 'EXIT; he is out
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE. CLEAR: ok_code.ENDMODULE. " PAI INPUT
*& Form REDISPLAY
text
--> p1 text
<-- p2 text
FORM redisplay .*Cells of the alv are made non editable after entering OK to save CALL METHOD c_alvgd->set_ready_for_input
EXPORTING
i_ready_for_input = 0.*Row and column of the alv are refreshed after changing values stable-row = 'X'.
stable-col = 'X'.*REfreshed ALV display with the changed values
*This ALV is non editable and contains new values
CALL METHOD c_alvgd->refresh_table_display
EXPORTING
is_stable = stable
EXCEPTIONS
finished = 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. " REDISPLAY
Regards,
Flavya -
I am trying to set the field length in ALV
so i wrote
<fs_fcat>-outputlen = 15.
and in layout...
wa_layout-colwidth_optimize = space . tried by commenting this statment also
But it doesnt show any effect
" in fact field length is depend on field lable and on its content..."
so plz help me some buddy.....
Edited by: anurodh_t on Sep 29, 2010 3:58 PMHello,
Try updating the description fields of the Fieldcat records prior to defining the outputlen field. Depending on the way you are implementing your ALV, try updating the following fields:
scrtext_l
scrtext_m
scrtext_s
or
seltext_l
seltext_m
seltext_s
Best regards,
Mário Espinheira -
Colour a particular cell dynamically in ALV
Hi,
What class and method to be used to colour a particular cell dynamically in ALV?
Thanks,
Ronita.U can use the below class to colour a particular cell dynamically in ALV:
class:cl_gui_alv_grid
See below code. It definitely helps u.
Provide Reward Points...:-)
types : begin of ty. include structure MARA.
types : rowcolor(4) TYPE c,
end of ty.
data : itab type standard table of ty,"Output Internal table
i_fieldcat type standard table of lvc_s_fcat,"Field catalog
wa type ty,
w_variant type disvariant,
w_layout TYPE lvc_s_layo,"Layout structure
o_docking type ref to cl_gui_docking_container,"Docking Container
o_grid type ref to cl_gui_alv_grid."Grid
select * from mara into corresponding fields of table itab up to 10 rows.
call screen 9000.
*& Module STATUS_9000 OUTPUT
text
module STATUS_9000 output. if o_docking is initial.
SET PF-STATUS 'ZSTATUS'. "GUI Status
SET TITLEBAR 'ZTITLE'. "TitleCreating Docking Container
CREATE OBJECT o_docking
EXPORTING
RATIO = '95'.
IF sy-subrc eq 0.Creating Grid
CREATE OBJECT o_grid
EXPORTING
i_parent = o_docking.
ENDIF.Filling the fieldcatalog table
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'MARA'
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
w_variant-report = sy-repid.Setting layout
w_layout-info_fname = 'ROWCOLOR'."For row coloringColouring a row
CLEAR wa.
READ TABLE itab INTO wa INDEX 3.
IF sy-subrc EQ 0.
wa-rowcolor = 'C311'.
MODIFY itab FROM wa TRANSPORTING rowcolor WHERE matnr = wa-matnr.
ENDIF.Displaying the output
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
IS_VARIANT = w_variant
I_SAVE = 'A'
is_layout = w_layout
CHANGING
it_outtab = itab
IT_FIELDCATALOG = i_fieldcat
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.endif.endmodule. " STATUS_9000 OUTPUT
*& Module USER_COMMAND_9000 INPUT
PAI
module USER_COMMAND_9000 input.
data lv_ucomm type sy-ucomm.
lv_ucomm = sy-ucomm.
CASE lv_ucomm.
WHEN 'CANCEl' OR 'EXIT'.
perform free_objects.
LEAVE PROGRAM.
when 'BACK'.
perform free_objects.
set screen '0'.
leave screen.
ENDCASE.
endmodule. " USER_COMMAND_9000 INPUT
*& Form free_objects
Free Objects
form free_objects .
CALL METHOD o_grid->free
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD o_docking->free
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " free_objects
Provide Reward Points...:-) -
Hello experts,
I am new to ALV development. I have created an ALV grid report which displays data fetching from DDIC tables.
I want to display tooltip for each individual cell of the ALV, I know about using field category property SELTEXT_M but its used for entire column tooltip. My requirement is to display tooltip for individual cell in the grid.
Please provide me simple explanation to use tooltip for cell in ALV.
Simple example code would be appreciated.
Thanks in advance.
Regards,
Viral PatelHi,
If you are using OOPS ALV then, there is a field available in the field catalogue : TOOLTIP which you can use to display the tooltip for the column header.
try this:
wa_fcat-TOOLTIP = '-tooltip--'.
I hope it helps you.
Thanks & Regards,
Radhika -
Hi ,
How to fix cell length of the Jtable of a particular column.For ex column2 in my JTable accepts only 5 chars.How to do that?
Thanks in advance.I think the OP wants to restrict input, not set the physical width.
You need to provide a TabeCellEditor implementation which provides a restricted JTextField where appropriate - eg a JFormattedTextField or a JTextField with a custom Document. -
Why every cell's max length in ALV is 128
BOTH REUSE_ALV_GRID_DISPLAY
AND ABAP OOSee the notes 857823, 910300 and 959775. All these say there is a limitation of 128 characters but does not explain why.
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.
More Terms
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.
The note is not release-dependent.
Let me know if you could determine the reason. Award points if helpful.
Thanks,
Balaji -
How to display field of 250 character length using ALV Grid display
Hello Experts,
Currently I'm using 4.6 version.
I got to insert a new field of length 250 characters into an existing ALV grid display.
I passed a value of length 250 chars into the field and assigned it to the itab passing to the fn module
'REUSE_ALV_GRID_DISPLAY'.
But in the ALV display I am able to view only 132 chars only. I increased the line-size of the report also accordingly. But I'm unable to view all the 250 chars.
Kindly help me out in fixing this issue.you just can't do that
I suggest that you put the first characters in cell and allow user to double-click on cell in order to view the full value in a popup window -
How to display a field that has more than 136 char length in ALV GRID
Hi Experts,
I have an issue and need to solve ASAP.
I want to display a text of length 400 character in a particular column in ALV GRID DISPLAY. After executing the report it is displaying only 136 length char in the output and when I download the report to an excel it is showing only 255 characters, but my field length is almost 400 char and want to display in the report output.
I checked in SDN and didnt get any answers which will solve this.
Please help me to complete this issue.
Thanks
RetheeshCurrently I'm in a same problem with you.
And this is what I found
Size of data fields: While the list-based ALVList can display only tables of up to 90 columns, the control-based *ALVGrid and ALVFullscreen have a limitation of 128 characters per data cell.*
So it means that maximum for alv grid is only 128.
Please refer to this documentation
[https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/4544e790-0201-0010-c29c-e46c389f5a96]
you can find the statement above in page 5.
Please let me know if you have another solution, because I would like to see it too.
Thanks
Regards
Hadi -
hi,
i need to right allign the cell contents of a column in alv.
can any1 suggest how to do dat?
points will b rewarded....HI,
In your fieldcat use this,
FORM Z_FIELDCAT USING P_I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: I_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
*VBAK-VELN
I_FIELDCAT-COL_POS = '1'. " POSITION OF THE COLUMN.
I_FIELDCAT-FIELDNAME = 'VBELN'. " FIELD FOR WHICH CATALOG ID FILLED.
I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
I_FIELDCAT-KEY = 'X'. " SO THAT THIS FIELD IS NOT SCROLLABLE AND HIDDABLE.
<b> I_FIELDCAT-JUST = 'C'. " (R)ight (L)eft (C)ent.</b>
I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
I_FIELDCAT-SELTEXT_L = 'SALES ORDER'. " LONG TEXT FOR HEADER.
I_FIELDCAT-OUTPUTLEN = 15. " SET THE OUTPUT LENGTH.
I_FIELDCAT-REF_TABNAME = 'VBAK'. " FOR F1 & F4 HELP AS REFERNCED TO THE DDIC TABLE.
APPEND I_FIELDCAT TO P_I_FIELDCAT.
Reagrds,
Pritha.
Maybe you are looking for
-
I just updated my Ipad to the latest rev: 4.3.5(8L1) today. Now I'm not able to see pictures on CL and other browsers liek Opera mini. Can some tell me what happen and how can it be fixed! Thanks
-
How can I change my APP Store account?
How can I change the account I am using on my app store? How do I retreive contacts that I lost when I changed my apple id on my iCloud?
-
How to restrict values displayed using a select-options
Can someone please tell me how to restrict values displayed using a select-options. Example- in my table I have 100 entries. However when the user will click on the required field- I want to be display only 25 options based on a given value of anothe
-
Firefox will not allow me to use the enter button or even tapping the key pad on the go/magnifying glass button in the search window. I can type in a few keywords in the google or yahoo keyword search window in the top right tool bar but it will not
-
Interactive, rotating globe - button problems
I made an interactive rotating globe that shows all the continents (using CS3 and AS3). The globe rotates automatically. When the user mouses over the globe is stops rotating and they can use left/right arrows to rotate it manually to get to a contin