How to make the editable col. in alv grid scrollable?
friends,
i have made the last col. in my alv grid editable..even though i have declared it as char of length 255, it's showing only 50 characters in the grid..but when i try to type beyond 50 characters, it's not allowing...how to make it scrollable so that it extends beyond 50 char. and capture all the characters typed in that col.? pl suggest..thanks all..
Sathish. R
Hi, u can extend the length of your last field.
LOOP AT t_fieldcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN text-001.
ls_fcat-outputlen = c_10. "10
WHEN text-002.
ls_fcat-outputlen = c_20. "20
WHEN text-003. "your lastfield
ls_fcat-outputlen = c_255. "255
"do nothing
ENDCASE.
*fixed column
ls_fcat-fix_column = c_x.
*changes to take effect
MODIFY t_fieldcat FROM ls_fcat.
IF sy-subrc = 0.
"do nothing
ENDIF.
CLEAR ls_fcat.
ENDLOOP.
Similar Messages
-
How to find the selected item in alv grid or table control
can any one tell me please
how to find the selected item in alv grid or table controlIn table control, If you goto screen painter and goto table control properties ( f2 ), there is one check-box w/selColumn check that and give column name. Then add that column to your internal table.
IN PAI
LOOP AT it_tkhdr.
FIELD it_tkhdr-sel_row
MODULE tab_tkhdr_mark ON REQUEST.
ENDLOOP.
MODULE tab_tkhdr_mark INPUT.
MODIFY it_tkhdr INDEX tc_tkhdr-current_line.
ENDMODULE. " tab_tkhdr_mark INPUT
here it_TKHDR is internal table sel_row is field for selection
After that, you can loop at it_tkhdr where sel_row is 'X' to get selected rows.
regards,
Gagan -
How to make fields editable in an alv tree
hi
there is an alv grid for which tree view shud also be made. The cells that are editable in the grid should also be editable in the tree.
please let me know how to make the specific cells of the tree editableafter setting the edit field in the field catalogue its bot working.
i am posting the code snippet.
please let me know what else should be done and how to add INPUT field to the fieldcat.
field-symbols: <fs_fieldcat> type lvc_s_fcat.
data: l_tabix type sy-tabix.
data: g_fieldcatalog type lvc_t_fcat,
wa_fcat like line of g_fieldcatalog.
data : hide type c value 'X'.
call function 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'RSTHIE_M'
i_client_never_display = 'X'
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = g_fieldcatalog.
***-set table header on middle width
LOOP AT g_fieldcatalog ASSIGNING <fs_fieldcat>.
<fs_fieldcat>-FIX_COLUMN = 'X'.
<fs_fieldcat>-edit = 'X'.
ENDLOOP. -
HOW TO READ THE EDITABLE FIELD IN ALV
CAN ANYONE HELP ME IN READING THE EDITABLE FIELD IN ALV.
I AM DOING THE FOLLOWING.
BUT STILL THE EDITABLE FIELD IN NOT READ.
WHEN 'EXE' OR 'EXEC'.
LOOP AT I_RB1 INTO L_WA_STRU.
L_WA_STRU-LIFSK = L_WA_STRU-LIFSK1.
MODIFY I_RB1 FROM L_WA_STRU.
CLEAR L_WA_STRU.
ENDLOOP.
I_RB1 IS MY TABLE WHICH I PASSED IN TABLES OF REUSE_ALV_GRID_DISPLAY.LIFSK1 IS MY EDITABLE FIELD.
AND LIFSK IS THE FIELD WHERE THE DATA SHOULD GET TRANSFERRED WHEN I HIT EXECUTE BUTTON.DATA: lt_display LIKE TABLE OF gt_display.
REFRESH lt_display.
CLEAR lt_display.
lt_display[] = gt_display[].
CLEAR ref_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
IF lt_display[] NE gt_display[].
gv_tosave = 'X'.
ENDIF.
Check this program. It will help you.
awrd points if helpful
Bhupal -
How to make a field manadatory within ALV Grid using methods and classes
Hi,
I am using ALV Grid using set_table_for_first_display
inside my dialog programming. I have a field called project number inside my grid which has to be made as mandatory field.
I have defined a method called catch_data_changed inside my class lcl_event_receiver. This method captures the changes made to one of the fields inside my ALV grid and displays all the default values of the other fields from the grid.
Now, i have to make project number which is one of my fields inside my ALV grid as mandatory. At the field catalog level i did not find any such option for making a field as required field.
Is there any other way, i can accomplish this within the ALV grid?from my understanding from ur question, i understood that u want the editable field inside alvgrid to be mandatory.
i dont know anthing in fieldcat, but u can try the following logic.
FORM DATA_CHANGED USING P_ER_DATA_CHANGED TYPE REF TO
CL_ALV_CHANGED_DATA_PROTOCOL .
DATA: L_VALUE TYPE LVC_VALUE,
ls_mod_cell type lvc_s_modi.
READ TABLE P_ER_DATA_CHANGED->MT_MOD_CELLS INTO LS_MOD_CELL.
if sy-subrc = 0.
CALL METHOD P_ER_DATA_CHANGED->GET_CELL_VALUE
EXPORTING
I_ROW_ID = LS_MOD_CELL-row_id
I_FIELDNAME = LS_MOD_CELL-fieldname
IMPORTING
E_VALUE = L_VALUE.
IF LS_MOD_CELL-FIELDNAME <> 'fieldname what u want'
MESSAGE 'ENTER VALUE INTO (fieldname u want) ' TYPE 'I'.
ENDIF.
ELSE.
MESSAGE 'ENTER VALUE INTO (fieldname u want) ' TYPE 'I'.
ENDIF. -
How to identify the modified rows in ALV grid in OO
Hello All,
I have strange problem and i don't know how to solve it?
I have ALV grid and in that ALV grid i have two buttons 'CONT' and 'ALLOC', when the user press 'ALLOC' button i will give a popup to make the user to enter some value.
After entering the value i will do some calicualtions and i will distribute the amount in the fields of ALV grid and i should update the ALVGRID.
Normally we can use CALL METHOD ME->REFRESH_TABLE_DISPLAY.( I have already checked by using this method and it worked fine)
Here is the way my program look like
ALVTREE1
ALVTREE2
|----
ALVGRID
The problem is when i press the other button CONT i am unable to know what values exist in ALVGRID.
How can i find these distributed amount in ALV?
I hope i am clear while explaining problem.
Here is the required code:
method handle_user_command.
data: lt_fields type table of sval,
ls_field type sval,
ls_fieldcatalog type lvc_s_fcat,
ls_merkpl type zvhf_merkpl,
lv_month(2) type n ,
lv_year(4) type n ,
lv_spmon type zvhf_allocation-spmon,
lv_value type p.
field-symbols: <fs> type any,
<ls_merkpl> type zvhf_merkpl.
case e_ucomm.
when 'CNT'.
call method gcl_gui_alv_grid->check_changed_data.
call method dailogbox_container->set_visible
exporting
visible = space.
call method gcl_gui_alv_tree2->frontend_update.
call method gcl_gui_alv_tree2->update_calculations.
clear: gt_merkpl.
when 'ALCT'.
Popup to get the values enterd by the user
ls_field-tabname = 'DD02V'.
ls_field-fieldname = 'DDTEXT'.
append ls_field to lt_fields.
call function 'POPUP_GET_VALUES'
exporting
popup_title = 'Enter value'
start_column = '1'
start_row = '1'
tables
fields = lt_fields
exceptions
error_in_fields = 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.
elseif sy-subrc = 0.
read table lt_fields into ls_field index 1.
if sy-subrc = 0.
gv_value = ls_field-value.
Read the table zvhf_allocation with nodekey in order to get percentages
select * from zvhf_allocation into table gt_allocation
where dvkbur = gs_node_info-nodename.
Read gt_merkpl in order to get existing line in ALV grid
loop at gt_merkpl into ls_merkpl.
*Read FCAT inorder to find the field and move proprtinate value
loop at gt_fieldcatlog3 into ls_fieldcatalog.
*Split is required to match ZVHF_ALLOCATION-SPMON with screen text and to proprtinate the value
split ls_fieldcatalog-scrtext_l at '.' into
lv_month lv_year.
concatenate lv_year lv_month into lv_spmon.
Check whether an entry exist or not in ZVHF_allocation
read table gt_allocation into gs_allocation
with key spmon = lv_spmon binary search.
*If an entry exist proprtinate the value as enterd in table
if sy-subrc = 0.
lv_value = gv_value * gs_allocation-prozent.
lv_value = lv_value / 100.
perform assign_value using ls_fieldcatalog-fieldname lv_value
changing ls_merkpl.
modify gt_merkpl from ls_merkpl.
endif.
endloop.
CALL METHOD gcl_gui_alv_grid->frontend_update.
call method gcl_gui_alv_grid->refresh_table_display
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.
endloop.
endif.
endif.
endcase.
endmethod. "handle_user_command
If you have any further questions please let me know.
Regards,
LisaHello Vijay,
Thanks for you reply,
The event data_changed is not working because i called method refresh_table_display. So the event changed will not be raised after i press button CONT
If i didn't call this method then i can see the value enterd by the user in ALV grid.
So, do you have an more ideas.
Regards,
Lisa -
How to save the edited fields in ALV list
Hi
hope you could help me find a solution, I made my fields editable in ALV grid display as you can see in the code ZID_NUM, ZLAST_NAME and ZMIDDLE_NAME is editable..
an example scenario would be if I execute the program it will show me 5 lines, all the fields can be edited by the user...(example he edited all data in the result). When he press save, it will automatically update the ztable (ZMEMPLIST in this case). How do you go about the saving?
thanks!!
select * from zmemplist client specified
into corresponding fields of table it_ztable.
it_fieldcat-fieldname = 'ZID_NUM'.
it_fieldcat-seltext_m = ' ID Number '.
it_fieldcat-col_pos = 1.
it_fieldcat-input = 'X'.
it_fieldcat-edit = 'X'.
append it_fieldcat to it_fieldcat.
clear it_fieldcat.
it_fieldcat-fieldname = 'ZLAST_NAME'.
it_fieldcat-seltext_m = ' Last Name '.
it_fieldcat-col_pos = 2.
it_fieldcat-input = 'X'.
it_fieldcat-edit = 'X'.
append it_fieldcat to it_fieldcat.
clear it_fieldcat.
it_fieldcat-fieldname = 'ZFIRST_NAME'.
it_fieldcat-seltext_m = ' First Name '.
it_fieldcat-col_pos = 3.
it_fieldcat-input = 'X'.
it_fieldcat-edit = 'X'.
append it_fieldcat to it_fieldcat.
clear it_fieldcat.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
it_fieldcat = it_fieldcat[]
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
tables
t_outtab = it_ztable.
*& Form user_command
Handling custom function codes
-->R_UCOMM Function code value
-->RS_SELFIELD Info. of cursor position in ALV
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when 'SAVE'.
endformHi Lawrence,
Include follwoing code on your user command for 'SAVE'.
*& Form user_command
* Handling custom function codes
* -->R_UCOMM Function code value
* -->RS_SELFIELD Info. of cursor position in ALV
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when 'SAVE'.
DATA ref1 TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.
CALL METHOD ref1->check_changed_data.
............... " your action
* endform
Hope this will sovle your query.
Pratik Vora -
How to make column editable in Normal ALV report
Hi experts,
I Have one push button In ALV tool bar like Fields to be change..when i click this..i need to get one pop up with all fields which is having in Filedcatalog..so i need to doule click on any field which i want to be midified..then in ALV that particular entire column should be editable.Can anybody please help me what is procedure to get pop up with fields..
Thanks & regards,
Veena..here is the required code
type-pools: slis.
types: BEGIN OF TY_MKPF,
MBLNR TYPE MKPF-MBLNR,
MJAHR TYPE MKPF-MJAHR,
VGART TYPE MKPF-VGART,
BLART TYPE MKPF-BLART,
BLAUM TYPE MKPF-BLAUM,
END OF TY_MKPF.
TYPES: BEGIN OF TY_WA, "STRUCTURE FOR POP UP ALV
CHECK TYPE C,
FIELDNAME TYPE DFIES-FIELDNAME,
FIELDTEXT TYPE DFIES-FIELDTEXT,
END OF TY_WA.
data: lt_mkpf type table of ty_mkpf,
ls_mkpf type mkpf,
IT TYPE TABLE OF TY_WA, "INTERNAL TABLE FOR POP UP ALV
WA TYPE TY_WA, "WA FOR POP UP ALV
IT_FCATP TYPE SLIS_T_FIELDCAT_ALV, "FCAT FOR POP UP ALV
WA_FCATP LIKE LINE OF IT_FCATP, "WA FOR POP UP ALV
ok_code type sy-ucomm,
lt_fcat type lvc_t_fcat,
ls_fcat type lvc_s_fcat.
data: o_alv type ref to cl_gui_alv_grid,
o_doc type ref to cl_gui_docking_container.
start-of-selection.
select MBLNR
MJAHR
VGART
BLART
BLAUM
into corresponding fields of table lt_mkpf from mkpf up to 100 rows.
*---create fieldcatalog
clear ls_fcat.
ls_FCAT-FIELDNAME = 'MBLNR'.
*WA_FCAT-TABNAME = WA-TABNAME.
ls_FCAT-REF_TABLE = 'MPKPF'.
ls_FCAT-REF_FIELD = 'MBLNR'.
APPEND ls_FCAT TO lT_FCAT.
clear ls_fcat.
ls_FCAT-FIELDNAME = 'MJAHR'.
*WA_FCAT-TABNAME = WA-TABNAME.
ls_FCAT-REF_TABLE = 'MPKPF'.
ls_FCAT-REF_FIELD = 'MJAHR'.
APPEND ls_FCAT TO lT_FCAT.
clear ls_fcat.
ls_FCAT-FIELDNAME = 'VGART'.
*WA_FCAT-TABNAME = WA-TABNAME.
ls_FCAT-REF_TABLE = 'MPKPF'.
ls_FCAT-REF_FIELD = 'VGART'.
APPEND ls_FCAT TO lT_FCAT.
clear ls_fcat.
ls_FCAT-FIELDNAME = 'BLART'.
*WA_FCAT-TABNAME = WA-TABNAME.
ls_FCAT-REF_TABLE = 'MPKPF'.
ls_FCAT-REF_FIELD = 'BLART'.
APPEND ls_FCAT TO lT_FCAT.
clear ls_fcat.
ls_FCAT-FIELDNAME = 'BLAUM'.
*WA_FCAT-TABNAME = WA-TABNAME.
ls_FCAT-REF_TABLE = 'MPKPF'.
ls_FCAT-REF_FIELD = 'BLAUM'.
APPEND ls_FCAT TO lT_FCAT.
*---collect the field names of alv in a itab
clear wa.
WA-FIELDNAME = 'MBLNR'.
WA-FIELDTEXT = 'Number of Material Document'.
APPEND WA TO IT.
clear wa.
WA-FIELDNAME = 'MJAHR'.
WA-FIELDTEXT = 'fiscical year'.
APPEND WA TO IT.
clear wa.
WA-FIELDNAME = 'VGART'.
WA-FIELDTEXT = 'Transaction/Event Type'.
APPEND WA TO IT.
clear wa.
WA-FIELDNAME = 'BLART'.
WA-FIELDTEXT = 'Document Type'.
APPEND WA TO IT.
clear wa.
WA-FIELDNAME = 'BLAUM'.
WA-FIELDTEXT = 'Document type of revaluation document'.
APPEND WA TO IT.
*----------create field catalog
CLEAR WA_FCATP.
WA_FCATP-FIELDNAME = 'CHECK'.
WA_FCATP-SELTEXT_M = 'Selection Field'.
WA_FCATP-TABNAME = 'IT'.
APPEND WA_FCATP TO IT_FCATP.
CLEAR WA_FCATP.
WA_FCATP-FIELDNAME = 'FIELDNAME'.
WA_FCATP-TABNAME = 'IT'.
WA_FCATP-REF_TABNAME = 'DFIES'. "CHECK IN SE11 TYPE GROUP SLIS
WA_FCATP-REF_FIELDNAME = 'FIELDNAME'. "CHECK IN SE11 TYPE GROUPB u201CSLIS
APPEND WA_FCATP TO IT_FCATP.
CLEAR WA_FCATP.
WA_FCATP-FIELDNAME = 'FIELDTEXT'.
WA_FCATP-TABNAME = 'IT'.
WA_FCATP-REF_TABNAME = 'DFIES'. "CHECK IN SE11 TYPE GROUP SLIS
WA_FCATP-REF_FIELDNAME = 'FIELDNAME'. "CHECK IN SE11 TYPE GROUPB SLIS
APPEND WA_FCATP TO IT_FCATP.
CLEAR WA_FCATP.
call screen 100.
*& Module STATUS_0100 OUTPUT
* text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '100'.
* SET TITLEBAR 'xxx'.
if o_doc is not bound.
CREATE OBJECT O_DOC
EXPORTING
RATIO = 95.
CREATE OBJECT O_ALV
EXPORTING
I_PARENT = o_doc.
endif.
CALL METHOD O_ALV->SET_TABLE_FOR_FIRST_DISPLAY
CHANGING
IT_OUTTAB = lt_mkpf
IT_FIELDCATALOG = lt_fcat.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'BACK'.
CLEAR :O_ALV,
O_DOC.
LEAVE TO SCREEN 0.
when 'CHNG'.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE = 'select fields to make it editable'
I_ZEBRA = 'X'
I_CHECKBOX_FIELDNAME = 'CHECK'
I_TABNAME = 'IT'
IT_FIELDCAT = IT_FCATP
TABLES
T_OUTTAB = it.
loop at it into wa where check = 'X'.
*---change fieldcatalog dynamacally
case wa-fieldname.
when 'MBLNR'.
read table lt_fcat into ls_fcat with key fieldname = wa-fieldname.
if sy-subrc = 0.
ls_fcat-edit = 'X'.
endif.
when 'MJAHR'.
read table lt_fcat into ls_fcat with key fieldname = wa-fieldname.
if sy-subrc = 0.
ls_fcat-edit = 'X'.
endif.
when 'VGART'.
read table lt_fcat into ls_fcat with key fieldname = wa-fieldname.
if sy-subrc = 0.
ls_fcat-edit = 'X'.
endif.
when 'BLART'.
read table lt_fcat into ls_fcat with key fieldname = wa-fieldname.
if sy-subrc = 0.
ls_fcat-edit = 'X'.
endif.
when 'BLAUM'.
read table lt_fcat into ls_fcat with key fieldname = wa-fieldname.
if sy-subrc = 0.
ls_fcat-edit = 'X'.
endif.
endcase.
modify lt_fcat from ls_fcat index sy-tabix transporting edit.
clear ls_fcat.
endloop.
*---change fieldcatalog dynamically
CALL METHOD O_ALV->SET_FRONTEND_FIELDCATALOG
EXPORTING
IT_FIELDCATALOG = lt_fcat
*CALL METHOD O_ALV->REFRESH_TABLE_DISPLAY
** EXPORTING
** IS_STABLE =
** I_SOFT_REFRESH =
** 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.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Edited by: zjason on Dec 29, 2010 7:47 AM
Edited by: zjason on Dec 29, 2010 7:52 AM
Edited by: zjason on Dec 29, 2010 7:54 AM -
How to capture the checkbox status in ALV Grid display
I need some immediate help regarding Grid ALV.
My Requirement: I need to display an ALV grid report along with checkboxes. Further, I need to provide an option wherein the user can checkboxes and select the records that I need to process further (by clicking the process button on the ALV Report).
My Query: The problem here is that I am not able to capture the status of the checkboxes. This means that I am not able to capture which of the records have been selected by checking their resp checkboxes.
Solutions that I have tried: I have tried capturing the same at user command by checking the value in slis_selfield. But all the records show the value as 1 for the checkbox field.
Kinldy suggest how to go about it.
I am not using Object Oriented ALV. Please suggest something to be used in ALV Grid display in 4.6C version.
Regards,
NamrataHere is a Sample code , it might help you
TABLES : sflight.
TYPE-POOLS: slis.
DATA : w_repid LIKE sy-repid.
w_repid = sy-repid.
DATA: BEGIN OF it_sflight OCCURS 0,
checkbox(1),
carrid LIKE sflight-carrid,
END OF it_sflight.
*layout
DATA: wa_layout TYPE slis_layout_alv.
*field catalog
DATA: it_fieldcatalog TYPE slis_t_fieldcat_alv,
wa_fieldcatalog TYPE slis_fieldcat_alv.
START-OF-SELECTION.
SELECT carrid FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_sflight.
END-OF-SELECTION.
CLEAR it_fieldcatalog.
REFRESH it_fieldcatalog.
wa_fieldcatalog-fieldname = 'CHECKBOX'.
wa_fieldcatalog-outputlen = '3'.
wa_fieldcatalog-col_pos = '1'.
wa_fieldcatalog-seltext_m = 'Chk'.
wa_fieldcatalog-checkbox = 'X'.
wa_fieldcatalog-edit = 'X'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'CARRID'.
wa_fieldcatalog-outputlen = '10'.
wa_fieldcatalog-col_pos = '2'.
wa_fieldcatalog-seltext_m = 'Carrid'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
is_layout = wa_layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcatalog
TABLES
t_outtab = it_sflight
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form USER_COMMAND
FORM user_command USING p_ucomm TYPE sy-ucomm
p_selfld TYPE slis_selfield.
CASE p_ucomm.
WHEN '&DATA_SAVE'.
DATA ref1 TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.
CALL METHOD ref1->check_changed_data.
LOOP AT it_sflight WHERE checkbox = 'X'.
DELETE it_sflight INDEX sy-tabix.
ENDLOOP.
p_selfld-refresh = 'X'.
ENDCASE.
ENDFORM. "user_command -
How to decrease the row height in ALV Grid (OOPS).
HI Experts,
I have displayed ALV Grid using CL_GUI_ALV_GRID=>SET_TABLE_FOR_DISPLAY.
I want to decrease the row height and width.
Can any one suggest how to do this?
Regards,
Kumar.Hi Kumar,
Row height it predefined and you won't change it, but you can adjust column width.
For that use field COL_OPT of layout structure ( type LVC_SLAYO ) to optimize all columns width, or set explicit width using field catalog, setting field OUTPUTLEN for certain column.
Regards
Marcin -
How to validate the columns in dynamic alv grid
Hi Friends,
I want to validatethe value of all the columens (min 1 and max 40) which i create dynamically in alv grid.
value must be between 0 and 1 only.
Please help ,, need urgently.method handle_data_changed.
data: ls_good type lvc_s_modi,
li_diff type i,
value type p DECIMALS 3,
old_value type p DECIMALS 3,
lw_outtab1 type gt_tab.
clear value.
loop at er_data_changed->mt_good_cells into ls_good.
value = ls_good-value.
old_value = ls_good-value.
if value lt 0 or value gt 1.
MESSAGE 'Value is out of range' TYPE 'I'.
Read table gt_outtab1 into lw_outtab1 index ls_good-row_id .
perform show_alv.
clear ls_good.
ENDIF.
ENDCASE.
ENDLOOP.
I again created the table.. actually data is not changed in the internal table but still it shows the changed value in the alv grid. even in build the table again and call the refersh alv grid method.. -
How to make cell editable in new alv
hi experts:
i'm use cl_salv_table=>factory to display data,
but I can't make some cell or column editable,does any body can help me?thanks!hI,
With this class editing is not possible.
Check the documentation for CL_SALV_TABLE it says
"Tables displayed with ALV are not available for input."
Regards -
How to merge the 2 field in alv gride display
Tables for ALV display
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
wa_layout TYPE slis_layout_alv,
it_exclude TYPE slis_t_extab,
wa_exclude TYPE slis_extab,
it_header TYPE STANDARD TABLE OF zqm_imir_hdr,
wa_header LIKE LINE OF it_header,
it_final TYPE STANDARD TABLE OF zqm_imir_itm,
wa_final LIKE LINE OF it_final,
it_vcode TYPE RANGE OF zqm_wtr_itm-vcode,
wa_vcode LIKE LINE OF it_vcode.
DEFINE m_fieldcat.
wa_fieldcat-fieldname = &1.
wa_fieldcat-tabname = &2.
wa_fieldcat-seltext_m = &3.
wa_fieldcat-outputlen = &4.
wa_fieldcat-col_pos = &5.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
END-OF-DEFINITION.
DEFINE m_vcode.
wa_vcode-option = &1.
wa_vcode-sign = &2.
wa_vcode-low = &3.
wa_vcode-high = ''.
append wa_vcode to it_vcode.
clear wa_vcode.
END-OF-DEFINITION.
START-OF-SELECTION.
PERFORM data_retrival.
PERFORM lead_time_calculation.
IF it_final[] IS NOT INITIAL.
PERFORM alv_display.
ENDIF.
Display ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = wa_layout
it_fieldcat = it_fieldcat
i_save = c_x
it_excluding = it_exclude
TABLES
t_outtab = IT_OUTPUT[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
m_fieldcat: 'ZIMIRNO' 'IT_OUTPUT' text-003 21 0,
'PRUEFLOS' 'IT_OUTPUT' text-004 21 1,
'ZCRDAT' 'IT_OUTPUT' text-030 9 2,
'INITS' 'IT_OUTPUT' text-031 6 3,
'SPLIT' 'IT_OUTPUT' text-005 12 4,
'WERK' 'IT_OUTPUT' text-006 5 5,
'LOSMENGE' 'IT_OUTPUT' text-007 24 6,
'MENGENEINH' 'IT_OUTPUT' text-008 15 7,
'NAMEVEND' 'IT_OUTPUT' text-009 11 8,
*& Hypercare - 721600 - IMIR Changes - Start
'KONT_PSPNR' 'IT_OUTPUT' text-023 15 7,
'POSID' 'IT_OUTPUT' text-023 15 9,
*& Hypercare - 721600 - IMIR Changes - End
'LTEX1' 'IT_OUTPUT' text-024 24 10,
'EBELN' 'IT_OUTPUT' text-010 26 11,
'MBLNR' 'IT_OUTPUT' text-011 24 12,
'ANZGEB' 'IT_OUTPUT' text-012 17 13,
'GEBEH' 'IT_OUTPUT' text-013 4 14,
'MATNR' 'IT_OUTPUT' text-014 18 15,
'TXZ01' 'IT_OUTPUT' text-015 128 16,
'SPECE' 'IT_OUTPUT' text-016 23 17,
'VCODE' 'IT_OUTPUT' text-017 24 18,
'TAGNO' 'IT_OUTPUT' text-018 10 19,
'HEATNO' 'IT_OUTPUT' text-019 11 20,
'IDCODE' 'IT_OUTPUT' text-020 7 21,
'TCNO' 'IT_OUTPUT' text-021 9 22,
'REMARKS' 'IT_OUTPUT' text-022 30 23,
'BUDAT' 'IT_OUTPUT' text-025 30 24,
'CPUTM' 'IT_OUTPUT' text-026 30 25,
'VDATUM' 'IT_OUTPUT' text-027 30 26,
'VEZEITERF' 'IT_OUTPUT' text-028 30 27,
'ZLTIME' 'IT_OUTPUT' text-029 30 26,
'LEADTIME' 'IT_OUTPUT' text-029 30 28.
DATA : v_unit like T006-MSEHI VALUE 'HR',
v_FCALID like SCAL-FCALID,
v_zltim TYPE f,
v_zltime TYPE p LENGTH 8 DECIMALS 2.
SELECT SINGLE FABKL INTO v_FCALID FROM T001W WHERE WERKS = s_werks.
SELECT zcrdat INTO TABLE it_zqm_imir_hdr
from zqm_imir_hdr
FOR ALL ENTRIES IN it_final
where zcrdat EQ it_final-zcrdat.
SELECT mblnr mjahr budat cputm
INTO TABLE it_mkpf
from mkpf
FOR ALL ENTRIES IN it_final
where mblnr EQ it_final-mblnr
AND mjahr EQ it_final-mjahr.
SELECT prueflos vdatum vezeiterf
INTO TABLE it_qave
from qave
FOR ALL ENTRIES IN it_final
where prueflos EQ it_final-prueflos.
SORT it_mkpf BY mblnr mjahr.
SORT it_qave by prueflos.
SORT it_zqm_imir_hdr BY zcrdat.
LOOP AT it_final into wa_final.
CLEAR: wa_output,wa_mkpf,wa_qave,wa_zqm_imir_hdr.
MOVE-CORRESPONDING wa_final to wa_output.
READ TABLE it_zqm_imir_hdr INTO wa_zqm_imir_hdr WITH KEY zcrdat = wa_final-zcrdat
BINARY SEARCH.
READ TABLE it_mkpf INTO wa_mkpf WITH KEY mblnr = wa_final-mblnr
mjahr = wa_final-mjahr
BINARY SEARCH.
MOVE wa_zqm_imir_hdr-zcrdat TO wa_output-zcrdat.
MOVE wa_mkpf-budat TO wa_output-budat.
MOVE wa_mkpf-cputm TO wa_output-cputm.
READ TABLE it_qave INTO wa_qave WITH KEY prueflos = wa_final-PRUEFLOS
BINARY SEARCH.
MOVE wa_qave-vdatum TO wa_output-vdatum.
MOVE wa_qave-vezeiterf TO wa_output-vezeiterf.
LV_START_DATE = wa_zqm_imir_hdr-zcrdat.
LV_START_DATE = wa_mkpf-budat.
LV_START_TIME = wa_mkpf-cputm.
LV_END_TIME = wa_qave-vezeiterf.
LV_END_DATE = wa_qave-vdatum.
IF LV_START_DATE IS NOT INITIAL.
IF LV_END_DATE IS NOT INITIAL.
CALL FUNCTION 'SD_CALC_DURATION_FROM_DATETIME'
EXPORTING
i_date1 = LV_START_DATE
i_time1 = LV_START_TIME
i_date2 = LV_END_DATE
i_time2 = LV_END_TIME
IMPORTING
E_TDIFF = LV_DIFF
E_DATE2_EARLY = E_DATE2_EARLY
EXCEPTIONS
INVALID_DATETIME = 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.
eNDFORM.}
This is my code unable to merge the to tabs position is on 3rd and 4th.
need help ......
thanks,Hi,
From Your code I saw that you called Macro of fieldcat after Calling the ALV Function Did You Check That One.
Following links may be useful for you ,
ALV report: How to merge 2 columns into 1 column?
Hope this information helps You
Regards,
Raghava Channooru -
How to make cell editable alv in WebDynpro for ABAP?
I make Column editable ALV.(See under source code)
But I can't make Cell editable ALV.
How to make Cell editable ALV in WebDynpro for ABAP?
and..how to get changed data?
DATA: l_value TYPE REF TO cl_salv_wd_config_table.
l_value = l_ref_interfacecontroller->get_model( ).
* { EDITABLE
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_input_field TYPE REF TO cl_salv_wd_uie_input_field,
lr_column TYPE REF TO cl_salv_wd_column.
lr_column_settings ?= l_value.
lr_column = lr_column_settings->get_column( 'TOTAL_COUNT' ).
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = 'TOTAL_COUNT'.
lr_column->set_cell_editor( lr_input_field ).
DATA: lr_table_settings TYPE REF TO if_salv_wd_table_settings.
lr_table_settings ?= l_value.
lr_table_settings->set_read_only( abap_false ).the code seems to be correct....but where are you writing it?
put the code in the wddoinit method and it should work.
have a look at this article..
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1 -
How to make a entire column editable in an ALV grid
Hi all,
I am trying to make a column editable in an ALV grid. For that I wrote the following code. In the below code I have set the 'edit' field of ls_fcat to 'X'. But Iam getting Runtime error. Can anyone help in resolving this problem or suggest any method to make a column editable in an ALV grid.
form prepare_fc changing go_fieldcat type lvc_t_fcat.
data: ls_fcat type lvc_s_fcat.
refresh: go_fieldcat.
clear: ls_fcat.
ls_fcat-reptext = ' Safety Stock Figures'.
ls_fcat-coltext = 'Safety Stock Figures'.
ls_fcat-fieldname = 'EISBE'.
ls_fcat-ref_table = 'IMAT'.
ls_fcat-edit = 'X'.
modify go_fieldcat from ls_fcat.
APPEND LS_FCAT TO GO_FIELDCAT.
endform.
Thanks & Regards,
Vishnu Priya.ls_fcat-edit = 'X'.
is correct only.
have a look into this code
struct_grid_lset TYPE lvc_s_layo,
i_grid_fcat TYPE lvc_t_fcat
DATA ls_fcat TYPE lvc_s_fcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'MONTH'.
ls_fcat-ref_table = 'TYPE'.
ls_fcat-ref_field = 'C'.
<b> ls_fcat-edit = 'X'.</b>
ls_fcat-coltext = text-030."Month
ls_fcat-seltext = text-030.
APPEND ls_fcat TO p_i_grid_fcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'YEAR'.
ls_fcat-ref_table = 'TYPE'.
ls_fcat-ref_field = 'C'.
ls_fcat-coltext = text-031."Year
ls_fcat-seltext = text-031.
APPEND ls_fcat TO p_i_grid_fcat.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = space
is_variant = ws_f_grid_disvar
i_save = ws_c_grid_save
is_layout = struct_grid_lset
CHANGING
it_outtab = i_grid_outs[]
<b>it_fieldcatalog = i_grid_fcat[]</b>
it_sort = i_sort_fcat. " Period
Also Check this code.Another way using field symbols.
i_fieldcat TYPE lvc_t_fcat,
w_layout TYPE lvc_s_layo ,
w_variant TYPE disvariant.
FIELD-SYMBOLS : <lfs_fieldcat> TYPE lvc_s_fcat.
*Default display
LOOP AT p_fieldcat ASSIGNING <lfs_fieldcat>.
CASE <lfs_fieldcat>-fieldname.
WHEN 'GL_ACCT'.
<lfs_fieldcat>-coltext = text-050.
<lfs_fieldcat>-no_out = ' '.
<lfs_fieldcat>-scrtext_l = text-050.
<b> <lfs_fieldcat>-edit = 'X'.</b>
WHEN OTHERS.
ENDCASE.
ENDLOOP.
Hope this helps.
Maybe you are looking for
-
Linking of vendor payments to Purchase order
Hi My requirement is that i want to link payments ( vendor ) to PO i.e how much payment has been made to particular vendor for a particular vendor . I have placed several orders to a single vendor for the supply of different material. In my scenerai
-
Filter Simple List to show only 1 record per employee
All, I'm looking for a very simple OOTB way to filer a list. I've used InfoPath form to create a simple test form which is published to form library on submission. My list columns are: Employee Name, Pass/Fail,Test Score, Test Attempt (Count). The li
-
I have a curve 8900 and I can't unlock the keyboard so basically can't use it at all I charge the phone or take it out of the holster and can see it is on an locked. I then try and press the unlock button but nothing happens and then the screen just
-
Sizing SOl Man and number/impact of Alerts
We are trying to access our sizing for a Sol man implementation. We have read the sizing document and it proposes not to have more then 40 alterts per server. Is this 40 limitation at the alert group level or the alert name level? Example: Is the 40
-
Need help with report generation toolkit
I'm having a really hard time finding a solution for my problem. I'm measuring a distance and a diameter simultaneously. The outcoming values have a depency and are stored in a 2-D array. I want to export this array to an excel table and x-y-chart (