Editable ALV- I need to increase curr to be 12 chars from 8 chars in o/p.
I am getting problem in Editable ALV, I wanted to increase the currency field from 8 chars to 12 chars at the output.
But after the output i am able to enter only eight chars.
I want '123456789012' but i am able to put only '12345678'.
Plz have alook.
hi !
check the length of field in your data declaration
you can set the length of o/p field in alv for that just check
intlen or outputlen in fieldcat
but by using these you can not update these in your internal table b'coz of your type declaration for that field
Similar Messages
-
OOPS ALV size need to increase
Hi Friends -
Am using OOPS ALV for report display and the display is devided in two parts
one is header info
second is general info
am facing a prob is even if four or five reords are only there in both the section even then its coming with scroll bar RO in a shrink way then i have to drag and increase the size then only i can see other records how can we resolve this issue ?
am using structure lvc_t_fcat .
also can anybody pls tell me the correct Function Module to sent mail using this ALV header as subject and ALV general part as content of mail ..
Thanks
SmeetaI Really Appriciate your immd response on this issue , but even trying this also no luck ,
see my report is devided like this
This will create a container
CREATE OBJECT ob_custom
EXPORTING
container_name = 'CONTAINER'
style = cl_gui_custom_container=>ws_maximizebox.
CREATE OBJECT ob_split1
EXPORTING
parent = ob_custom
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
CREATE OBJECT ob_split3
EXPORTING
parent = ob_split1->top_left_container
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
CREATE OBJECT ob_split2
EXPORTING
parent = ob_split1->bottom_right_container
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
CREATE OBJECT ob_grid1
EXPORTING
i_parent = ob_split3->top_left_container.
CREATE OBJECT ob_grid2
EXPORTING
i_parent = ob_split3->bottom_right_container. -
Hello Experts,
We have a requirement of showing F4 help for a editable field of ALV Grid. I'm able to register the on_f4 event, but I do have a problem while implementing the method, as the pop up values are not appearing. I have used following logic for implementing the class(PFB the code I have used for implementing the method). Can you please suggest the corrections in the following code or suggest a new method, if the following will not work.
METHOD on_f4.
TYPE-POOLS: slis.
DATA: gs_selfield TYPE slis_selfield,
gs_private TYPE slis_data_caller_exit,
g_exit(1) TYPE c,
gs_fieldcat_popup TYPE slis_fieldcat_alv.
DATA: gt_fieldcat_popup TYPE TABLE OF slis_fieldcat_alv,
pt_value type standard table of ztable.
SELECT * FROM ztable
INTO TABLE pt_value.
gs_fieldcat_popup-fieldname = 'Z_SALES'.
gs_fieldcat_popup-seltext_l = 'Sales'.
gs_fieldcat_popup-col_pos = 1.
gs_fieldcat_popup-outputlen = 34.
gs_fieldcat_popup-datatype = 'CHAR'.
APPEND gs_fieldcat_popup TO gt_fieldcat_popup .
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE =
I_SELECTION = 'X'
I_ZEBRA = ' '
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_CHECKBOX_FIELDNAME =
I_LINEMARK_FIELDNAME =
I_SCROLL_TO_SEL_LINE = 'X'
i_tabname = '1'
I_STRUCTURE_NAME =
IT_FIELDCAT = gt_fieldcat_popup[]
IT_EXCLUDING =
I_CALLBACK_PROGRAM =
I_CALLBACK_USER_COMMAND =
IS_PRIVATE =
IMPORTING
ES_SELFIELD =
E_EXIT =
tables
t_outtab = pt_value
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.
ENDMETHOD.
Best Regards,
Bharath.Hello ,
while implementing F4 for Editable ALV , you need to make sure follwing steps.
1. Field Catalog.
gs_fieldcat-f4availabl = 'X '.
2.Register f4 event.
gs_f4-fieldname = 'CONNID'.
gs_f4-getbefore = check.
gs_f4-chngeafter = change.
append gs_f4 to gt_f4.
call method grid->register_f4_for_fields
exporting
it_f4 = gt_f4.
3.Implementing F4 Method. -
Editable ALVs - How to update DB?
Hi Experts,
Out of my curiosity, wuld like to know,
How the Editable ALVs do updation of DB? I mean, prog. flow?
thanq.ThanQ Sarda,
OK, I got it.
Actually, I dont hv much idea abt Editable ALVs! My thinking is like,
Supose,
the user changed from 4.63 to 5.63 on ALV grid,
then, the user either pressed the SAVE(Floppy) or used the programmer defined push button on the front end screen, say the push button name is, UPDATE.
So,
1 - Now, How I hv to pull( I mean, How I hv to read the ALV grid?) the (front end value of) 5.63 value to back end, which is to b used for passing to either BAPI/FM or BDC etc. in the prog. for DB updation?
2 - If the user used the FLOPPY button i.e. SAVE, How to track it ( I know, if the user defined push button is there, we can track by using SY-UCOMM)?
thanq. -
Need to increase font size of header in ALV
Hi,
I have a requirement to increase the font-size of header in the output ALV report. Also, i need to remove some of the standard icons from the output ALV using IT_EXCLUDING ?...Could any of you help me with this ?Hi friend,
first, to increase font size of ALV header you can build a header manually as below:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
* EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
* I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET '
I_CALLBACK_USER_COMMAND = 'HTML_TOP_OF_PAGE'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
* IT_FIELDCAT =
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab =
* 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.
in your code, write 2 subroutines name: HTML_TOP_OF_PAGE and PF_STATUS_SET
FORM html_top_of_page USING r_top TYPE REF TO cl_dd_document.
DATA: text TYPE sdydo_text_element.
DATA: s_table TYPE REF TO cl_dd_table_element.
DATA: col_key TYPE REF TO cl_dd_area.
DATA: col_info TYPE REF TO cl_dd_area.
** split TOP-Document
CALL METHOD r_top->vertical_split
EXPORTING
split_area = r_top
split_width = '50%'.
* IMPORTING
* right_area = a_logo.
** fill TOP-Document
text = 'Example of a Heading'(201).
CALL METHOD r_top->add_text
EXPORTING
text = text
sap_style = 'HEADING'.
CALL METHOD r_top->new_line.
CALL METHOD r_top->new_line.
CALL METHOD r_top->new_line.
CALL METHOD r_top->new_line.
CALL METHOD r_top->add_table
EXPORTING
no_of_columns = 2
with_heading = ' '
border = '0'
IMPORTING
table = s_table.
CALL METHOD s_table->add_column
IMPORTING
column = col_key.
CALL METHOD s_table->add_column
IMPORTING
column = col_info.
text = 'A key value marked'(202).
CALL METHOD col_key->add_text
EXPORTING
text = text
sap_emphasis = 'Strong'.
CALL METHOD col_info->add_gap
EXPORTING
width = 6.
text = '600' .
CALL METHOD col_info->add_text
EXPORTING
text = text
sap_style = 'Key'.
CALL METHOD col_info->add_gap
EXPORTING
width = 3.
text = 'Test'.
CALL METHOD col_info->add_text
EXPORTING
sap_fontsize = cl_dd_area=>large "set font size
text = text.
endform.
*& Form pf_status_set
* Set pf status for alv list
* -->PT_EXTAB tab for excluding fcode
FORM pf_status_set USING pt_extab TYPE slis_t_extab.
DATA:
ls_extab TYPE slis_extab.
*-sort up
ls_extab-fcode = '&OUP'.
APPEND ls_extab TO pt_extab.
*-- sort down
ls_extab-fcode = '&ODN'.
APPEND ls_extab TO pt_extab.
SET PF-STATUS 'STANDARD' EXCLUDING pt_extab. "change standard as your status
ENDFORM. "pf_status_set
You can refer the set font size in report DD_STYLE_TABLE.
regards, -
Doubt regarding editable ALV report using Classes
I need to create an ALV report and make few fields editable
and i need to update the changes to the corresponding database tables
for that please suggest me some idea or provide me sample code for that
urgentHi ramesh,
Please check this example program. I think it will help for some extent.
[code]&----
*& Report ZSUMA_INTERACTIVEREPORT *
report zsuma_interactivereport.
tables: vbak.
data :gr_alvgrid type ref to cl_gui_alv_grid,
gr_cc_name type scrfname value 'CC_ALV',
gr_ccontainer type ref to cl_gui_custom_container,
gr_fieldcat type lvc_t_fcat,
gr_layout type lvc_s_layo,
gr_sort type lvc_t_sort,
gr_get_cell type lvc_t_cell,
gr_set_cell type lvc_t_cell,
gr_hyper type lvc_t_hype,
gr_drop_down type lvc_t_drop,
is_variant type disvariant,
line_number type lvc_s_roid-row_id,
line(5) type c ,
cell_value type lvc_value.
data: begin of it_vbak occurs 0,
vbeln type vbak-vbeln,
erdat like vbak-erdat,
erzet like vbak-erzet,
netwr like vbak-netwr,
waerk like vbak-waerk,
*Below field is useful for making the entire row with different colors.
it must be a char of 4.and layout-info_fname should populate with
*this field.
rowcolor(4) type c,
*Below field is useful for making the INDIVIDUAL CELL with different
*colors.for this we have to include structure of type lvc_t_scol.
*layout-ctab_fname should be populate with this field.
cellcolor type lvc_t_scol,
*below field is added for for providing the hyperlinks to perticular
*field. at the time of field catalog , it_fcatalog-web_field should be
*populate with this field.
vbeln_hyper type int4,
*For displaying one cell as button.we have to declare one styles
*internal table .it has to be populate.at layout structure this table
*name has to be populate at layout-stylename.
cellstyle type lvc_t_styl,
end of it_vbak.
*& SELECTION SCREEN
selection-screen begin of block b1 with frame title text-001.
select-options s_vbeln for vbak-vbeln.
selection-screen end of block b1.
start-of-selection.
select vbeln
erdat
erzet
netwr
waerk
from vbak
into corresponding fields of table it_vbak
where vbeln in s_vbeln.
data: wa_cellcolor type lvc_s_scol,
wa_style type lvc_s_styl.
loop at it_vbak.
FOR ROW COLORING
if sy-tabix = 1.
it_vbak-rowcolor = 'C511'.
FOR PUTTING THE HYPERLINKS ON VBELN FIELD
it_vbak-vbeln_hyper = '1'.
modify it_vbak.
endif.
FOR CELL COLORING
if sy-tabix = 2.
wa_cellcolor-fname = 'ERZET'.
wa_cellcolor-color-col = '6'.
wa_cellcolor-color-int = '1'.
wa_cellcolor-color-inv = '1'.
append wa_cellcolor to it_vbak-cellcolor.
modify it_vbak index 2.
endif.
FOR DISPLAYING THE CELL AS A BUTTON
clear it_vbak-cellstyle.
at last.
read table it_vbak index sy-tabix.
wa_style-fieldname = 'NETWR'.
wa_style-style = cl_gui_alv_grid=>mc_style_button.
append wa_style to it_vbak-cellstyle .
modify it_vbak .
endat.
endloop.
if not it_vbak[] is initial.
call screen 100.
endif.
*CLASS DEFINITION FOR HANDLING THE EVENTS IN ALV GRID
class gr_event_handler definition.
public section.
methods:handle_hotspot_click
for event hotspot_click of cl_gui_alv_grid
importing e_row_id e_column_id es_row_no.
endclass.
*CLASS IMPLEMENTATIONFOR HANDLING THE EVENTS IN ALV GRID
class gr_event_handler implementation.
method handle_hotspot_click.
perform handle_hotspot_click using e_row_id e_column_id es_row_no.
endmethod.
endclass.
*& Form BUILDING_FIELDCATALOG
text
<--P_GR_FIELDCAT text
form building_fieldcatalog changing p_gr_fieldcat type lvc_t_fcat.
data s_fieldcat type lvc_s_fcat.
s_fieldcat-fieldname = 'VBELN'.
s_fieldcat-outputlen = '15'.
s_fieldcat-col_pos = '1'.
s_fieldcat-coltext = 'DOCCUMENT NO.'.
s_fieldcat-key = ' '.
s_fieldcat-emphasize = 'C511'.
s_fieldcat-web_field = 'VBELN_HYPER'.
append s_fieldcat to p_gr_fieldcat .
clear s_fieldcat.
s_fieldcat-fieldname = 'ERDAT'.
s_fieldcat-outputlen = '15'.
s_fieldcat-col_pos = '2'.
s_fieldcat-coltext = 'REC CREATE DATE.'.
s_fieldcat-emphasize = 'C311'.
s_fieldcat-hotspot = 'X'.
append s_fieldcat to p_gr_fieldcat .
clear s_fieldcat.
s_fieldcat-fieldname = 'ERZET'.
s_fieldcat-outputlen = '15'.
s_fieldcat-col_pos = '3'.
s_fieldcat-coltext = 'TIME ENTRY.'.
*S_FIELDCAT-EMPHASIZE = 'C311'.
append s_fieldcat to p_gr_fieldcat .
clear s_fieldcat.
s_fieldcat-fieldname = 'NETWR'.
s_fieldcat-outputlen = '15'.
s_fieldcat-col_pos = '4'.
s_fieldcat-emphasize = 'C311'.
s_fieldcat-coltext = 'NET WEIGHT.'.
s_fieldcat-do_sum = 'X'.
append s_fieldcat to p_gr_fieldcat .
clear s_fieldcat.
s_fieldcat-fieldname = 'WAERK'.
s_fieldcat-outputlen = '5'.
s_fieldcat-col_pos = '5'.
s_fieldcat-emphasize = 'C511'.
s_fieldcat-coltext = 'CURR.'.
FOR PUTTING THE DROP DOWN BOX.
s_fieldcat-drdn_hndl = '1'.
s_fieldcat-edit = 'X'.
append s_fieldcat to p_gr_fieldcat .
clear s_fieldcat.
endform. " BUILDING_FIELDCATALOG
*& Form CREATE_CCONTAINER_INSTANCE
text
--> p1 text
<-- p2 text
form create_ccontainer_instance .
create object gr_ccontainer
exporting
container_name = gr_cc_name
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6
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. " CREATE_CCONTAINER_INSTANCE
*& Form CREATE_ALVGRID_INSTANCE
text
--> p1 text
<-- p2 text
form create_alvgrid_instance .
create object gr_alvgrid
exporting
i_parent = gr_ccontainer
exceptions
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5
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. " CREATE_ALVGRID_INSTANCE
*& Form DISPLAYING_ALVGRID
text
--> p1 text
<-- p2 text
form displaying_alvgrid .
call method gr_alvgrid->set_table_for_first_display
exporting
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
is_variant = is_variant
i_save = 'A'
I_DEFAULT = 'X'
is_layout = gr_layout
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
it_hyperlink = gr_hyper
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
changing
it_outtab = it_vbak[]
it_fieldcatalog = gr_fieldcat
it_sort = gr_sort
IT_FILTER =
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.
*CALL METHOD GR_ALVGRID->GET_FRONTEND_LAYOUT
IMPORTING
ES_LAYOUT = GR_LAYOUT
*GR_LAYOUT-GRID_TITLE = 'HAI ALV'.
*CALL METHOD GR_ALVGRID->SET_FRONTEND_LAYOUT
EXPORTING
IS_LAYOUT = GR_LAYOUT
endform. " DISPLAYING_ALVGRID
*& Form REFRESH_DISPLAY_TABLE
text
--> p1 text
<-- p2 text
form refresh_display_table .
call method gr_alvgrid->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.
endform. " REFRESH_DISPLAY_TABLE
*& Form SETTING_LAYOUT
text
<--P_GR_LAYOUT text
form setting_layout changing p_gr_layout type lvc_s_layo.
p_gr_layout-grid_title = 'ALV GRID USING ABAP OBJECTS'.
p_gr_layout-zebra = 'X'.
p_gr_layout-no_toolbar = ''.
p_gr_layout-sel_mode = 'D'.
p_gr_layout-info_fname = 'ROWCOLOR'.
p_gr_layout-ctab_fname = 'CELLCOLOR'.
p_gr_layout-stylefname = 'CELLSTYLE'.
endform. " SETTING_LAYOUT
*& Module STATUS_0100 OUTPUT
text
module status_0100 output.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
set pf-status 'MENU'.
if gr_alvgrid is initial.
*CREATING THE CONTAINER INSTANCE BY SENDING THE CONTAINER NAME( IT HAS
*TO COINSIDE WITH COSTUM CONTROL NAME OF TRANSACTION SCREEN
perform create_ccontainer_instance.
perform create_alvgrid_instance.
*VARIANT POPULATION.
perform setting_variants changing is_variant.
*BELOW FORM IS USEFUL TO FILL THE HYPER LINK TABLE AND WE PASS THAT
*TABLE TO 'IT_HYPERLINK' PARAMETER IN FIRST DISPLAY METHOD.
perform setting_hyperlinks_field changing gr_hyper.
*TO MAKE THE COLOUMN AS DROP DOWN.
perform setting_dropdown_column changing gr_drop_down.
perform building_fieldcatalog changing gr_fieldcat.
perform setting_layout changing gr_layout.
perform setting_sorting changing gr_sort.
perform setting_cells changing gr_set_cell.
perform displaying_alvgrid.
*PERFORM GETTING_CELL_DETAILS CHANGING GR_GET_CELL. " IT IS NOT WORKING
FOR ME AND I HAVE DOUBT .
perform creating_event_object.
*PERFORM REFRESH_DISPLAY_TABLE.
endif.
endmodule. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
module user_command_0100 input.
case sy-ucomm.
when 'BACK'.
leave to screen 000.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
*& Form SETTING_SORTING
text
<--P_GR_SORT text
form setting_sorting changing p_gr_sort type lvc_t_sort.
data: lr_sort type lvc_s_sort.
lr_sort-spos = '1'.
lr_sort-fieldname = 'VBELN'.
lr_sort-up = 'X'.
append lr_sort to p_gr_sort.
lr_sort-spos = '2'.
lr_sort-fieldname = 'ERDAT'.
lr_sort-up = 'X'.
append lr_sort to p_gr_sort.
endform. " SETTING_SORTING
*& Form GETTING_CELL_DETAILS
text
<--P_GR_GET_CELL text
form getting_cell_details changing p_gr_get_cell.
call method gr_alvgrid->get_selected_cells
importing
et_cell = p_gr_get_cell
*CELL_VALUE = P_GR_GET_CELL-VALUE.
endform. " GETTING_CELL_DETAILS
*& Form SETTING_CELLS
text
<--P_GR_SET_CELL text
form setting_cells changing p_gr_set_cell type lvc_t_cell.
data:s_gr_set_cell type lvc_s_cell.
s_gr_set_cell-col_id-fieldname = 'NETWR'.
s_gr_set_cell-row_id-index = '3'.
append s_gr_set_cell to p_gr_set_cell.
call method gr_alvgrid->set_selected_cells
exporting
it_cells = p_gr_set_cell.
endform. " SETTING_CELLS
*& Form SETTING_HYPERLINKS_FIELD
text
<--P_GR_HYPER text
form setting_hyperlinks_field changing p_gr_hyper type lvc_t_hype.
data: is_hype type lvc_s_hype.
is_hype-handle = '1'.
is_hype-href = 'HTTP://WWW.GOOGLE.CO.IN'.
append is_hype to p_gr_hyper.
is_hype-handle = '2'.
is_hype-href = 'HTTP://SDN.SAP.COM'.
append is_hype to p_gr_hyper.
endform. " SETTING_HYPERLINKS_FIELD
*& Form SETTING_DROPDOWN_COLUMN
text
<--P_GR_DROP_DOWN text
form setting_dropdown_column changing p_gr_drop_down type lvc_t_drop.
data: wa_drop type lvc_s_drop.
wa_drop-handle = '1'.
wa_drop-value = '$'.
append wa_drop to p_gr_drop_down.
wa_drop-handle = '1'.
wa_drop-value = 'Rs'.
append wa_drop to p_gr_drop_down.
wa_drop-handle = '1'.
wa_drop-value = 'CUR'.
append wa_drop to p_gr_drop_down.
call method gr_alvgrid->set_drop_down_table
exporting
it_drop_down = p_gr_drop_down
IT_DROP_DOWN_ALIAS =
endform. " SETTING_DROPDOWN_COLUMN
*& Form SETTING_VARIANTS
text
<--P_IS_VARIANT text
form setting_variants changing p_is_variant type disvariant.
p_is_variant-report = sy-repid.
endform. " SETTING_VARIANTS
*& Form HANDLE_HOTSPOT_CLICK
text
-->P_E_ROW text
-->P_E_COLUMN text
-->P_E_ROW_NO text
form handle_hotspot_click using p_e_row_id type lvc_s_row
p_e_column_id type lvc_s_col
p_es_row_no type lvc_s_roid.
read table it_vbak index p_es_row_no-row_id.
if sy-subrc = 0 and p_e_column_id-fieldname = 'ERDAT'.
line = p_es_row_no-row_id.
line_number = p_es_row_no-row_id.
leave to screen 200.
endif.
endform. " HANDLE_HOTSPOT_CLICK
*& Form CREATING_EVENT_OBJECT
text
--> p1 text
<-- p2 text
form creating_event_object .
data event_handle type ref to gr_event_handler.
create object event_handle.
set handler event_handle->handle_hotspot_click for gr_alvgrid.
endform. " CREATING_EVENT_OBJECT
*& Module STATUS_0200 OUTPUT
text
module status_0200 output.
set pf-status 'BB'.
SET TITLEBAR 'xxx'.
*LINE = LINE_NUMBER.
endmodule. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
text
module user_command_0200 input.
if sy-ucomm = 'BACK'.
leave to screen 100.
endif.
endmodule. " USER_COMMAND_0200 INPUT[/code]
Reward points if helpful
Thanks,
Suma. -
How to create an editable ALV?
How to create an editable ALV?
The follow program demonstrates how to make individual fields of an ALV grid editable (NetPR greater than 10).
Changes required from a basic ALV grid include adding a new field to ALV grid data table(it_ekko), Populating this
field with style attribute and adding an entry to layout control table. Also from the previous examples used on
this website you will also need to change the data type of the fieldcatalog, the layout and use a different function
module for displaying the report.
*& Report ZDEMO_ALVGRID_EDIT *
*& Example of a simple ALV Grid Report *
*& The basic ALV grid, Enhanced to display specific fields as *
*& editable depending on field value *
REPORT ZDEMO_ALVGRID_EDIT .
TABLES: ekko.
TYPE-POOLS: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
field_style TYPE lvc_t_styl, "FOR DISABLE
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA: it_fieldcat TYPE lvc_t_fcat, "slis_t_fieldcat_alv WITH HEADER LINE,
wa_fieldcat TYPE lvc_s_fcat,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE lvc_s_layo, "slis_layout_alv,
gd_repid LIKE sy-repid.
*Start-of-selection.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM set_specific_field_attributes.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-scrtext_m = 'Purchase Order'.
wa_fieldcat-col_pos = 0.
wa_fieldcat-outputlen = 10.
wa_fieldcat-emphasize = 'X'.
wa_fieldcat-key = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'EBELP'.
wa_fieldcat-scrtext_m = 'PO Item'.
wa_fieldcat-col_pos = 1.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'STATU'.
wa_fieldcat-scrtext_m = 'Status'.
wa_fieldcat-col_pos = 2.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'AEDAT'.
wa_fieldcat-scrtext_m = 'Item change date'.
wa_fieldcat-col_pos = 3.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-scrtext_m = 'Material Number'.
wa_fieldcat-col_pos = 4.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MENGE'.
wa_fieldcat-scrtext_m = 'PO quantity'.
wa_fieldcat-col_pos = 5.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MEINS'.
wa_fieldcat-scrtext_m = 'Order Unit'.
wa_fieldcat-col_pos = 6.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'NETPR'.
wa_fieldcat-scrtext_m = 'Net Price'.
wa_fieldcat-edit = 'X'. "sets whole column to be editable
wa_fieldcat-col_pos = 7.
wa_fieldcat-outputlen = 15.
wa_fieldcat-datatype = 'CURR'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'PEINH'.
wa_fieldcat-scrtext_m = 'Price Unit'.
wa_fieldcat-col_pos = 8.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
Set layout field for field attributes(i.e. input/output)
gd_layout-stylefname = 'FIELD_STYLE'.
gd_layout-zebra = 'X'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
FORM display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = gd_repid
i_callback_user_command = 'USER_COMMAND'
is_layout_lvc = gd_layout
it_fieldcat_lvc = it_fieldcat
i_save = 'X'
TABLES
t_outtab = it_ekko
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.
ENDFORM. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO CORRESPONDING FIELDS OF TABLE it_ekko.
ENDFORM. " DATA_RETRIEVAL
*& Form set_specific_field_attributes
populate FIELD_STYLE table with specific field attributes
form set_specific_field_attributes .
DATA ls_stylerow TYPE lvc_s_styl .
DATA lt_styletab TYPE lvc_t_styl .
Populate style variable (FIELD_STYLE) with style properties
The NETPR field/column has been set to editable in the fieldcatalog...
The following code sets it to be disabled(display only) if 'NETPR'
is gt than 10.
LOOP AT it_ekko INTO wa_ekko.
IF wa_ekko-netpr GT 10.
ls_stylerow-fieldname = 'NETPR' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
"set field to disabled
APPEND ls_stylerow TO wa_ekko-field_style.
MODIFY it_ekko FROM wa_ekko.
ENDIF.
ENDLOOP.
endform. " set_specific_field_attributes -
Update the Billing orders after display/ modifiy in the Editable ALV
Hi Experts,
I have created one Editable ALV to display theBilling order with BP details,
Once user get the ALV output he can modify the content and same will be updated once he hits UPDATE button.
my requirement is after user hits the UPDATE button a background should be created and update of BO should happen also user user should able to see the status by checking the SPOOL.
currently i am using the FM crm_order_maintain to update, kindly guide me how to process this step in background for all the entries which are selected in ALV by user.
i think i can use SUBMIT with JOB_OPEN and JOB_CLOSE, but i need some same code & guidance.
Thanks in Advance.
Regards,
Pradeepproblem solved
-
Row wise total in editable ALV
hello all,
I am workin on editable alv, the user need to enter the values in the editable fields and in the last column(non-editable) i need to populate the total row wise,as soon as user enters a value and goes to next editable cell or on entering a vale and press enter.how to accomplish this task...
with regards,
sandeep akella.
Edited by: sandeep akella on Aug 20, 2009 1:58 PMYou need to Implement the OnCellAction event.follow these steps;
1. Goto WDDOMODIFYVIEW and place the following code
IF first_time IS INITIAL.
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_usg_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_usg_alv( ).
DATA lo_value TYPE REF TO cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model(
CALL METHOD lo_value->if_salv_wd_table_settings~set_cell_action_event_enabled
EXPORTING
value = abap_true.
ENDIF.
2. Implement the onCellAction event as follows;
Goto Methods tab, create a new method. Method Type- Event Handler , Event - ON_CELL_ACTION
3. Now in this method retrive the contents of the row and calculate the value as follows.
DATA: l_element TYPE REF TO if_wd_context_element.
DATA:ls_stru TYPE wd_this->element_cn_alv.
DATA: l_node TYPE REF TO if_wd_context_node.
l_node = wd_context->get_child_node( 'CN_ALV' ).
l_element = l_node->get_element( r_param->index ).
l_element->get_static_attributes( IMPORTING static_attributes = ls_stru ).
ls_stru-last_col = ls_stru-col1+ls_stru-col2....+ ls_stru-col5. " add all the cells data
l_element->set_static_attributes( exporting static_attributes = ls_stru ). -
Date field not updated when select on F4 value on editable ALV Grid
Can some one look into this to see what was wrong.
I have a report that display fields extracted from a ZTable and display on an ALV Editable Grid.
The data are displayed as read only mode for these fields:
Field A - type char20 and have a search help available.
Start Date - type dats
End Date - type dats.
Field B
Field C ...
When user select to add new record, Field A, Start Date and End Date must be editable, the rest are read only.
On field A because there is search help available, I have no problem select data on F4 pull down menu and the data is updated on the grid.
But on field start date and end date, there is F4 menu and when you pull down, it shows the calendar date. But when I select the date to change, it acts like nothing happens. I run the debug mode and found out that in function module 'F4IF_FIELD_VALUE_REQUEST', after you select the date field, I got the return code irc = 8 from line 305 of this FM.
Here is what I did.
I build field catalog similar like BCALV_EDIT04 (add table type lvc_t_styl to each extracted record to indicate which field will be editable.
In the PBO, I build field catalog and set style as enable for these fields:
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_struct
CHANGING
ct_fieldcat = p_t_fieldcat.
LOOP AT p_t_fieldcat INTO ls_fcat.
CASE ls_fcat-fieldname.
when 'Field_A'.
ls_fcat-ref_table = 'ZTABNAME'.
ls_fcat-ref_field = 'FIELD_A'.
ls_fcat-edit = 'X'.
MODIFY p_t_fieldcat FROM ls_fcat.
when 'START_DATE' or 'END_DATE'.
ls_fcat-style = CL_GUI_ALV_GRID=>MC_STYLE_enabled.
MODIFY p_t_fieldcat FROM ls_fcat.
endcase.
Just curious, I copied program BCALV_EDIT_08 to ZBCALV_EDIT08 and make field booking date as editable to test. When I select to change booking date from F4 menu pull down, the new date is populated to the screen field. So what was wrong between my program and BCALV_EDIT_08? Thanks for your help. I am stuck on this problem for 2 days and could not figure out what was wrong.not sure why you use that FM for date filed , you just need in the field catalog make sure that are use a date field of reference , anyway check program BCALV_EDIT_01
-
Hi guys,
I use the following method (register_edit_event) in the PBO soon after first display of an editable ALV grid to register enter as an event to do validations on fields like qty. If user enters some character like 'abc' for qty and hits enter on keyboard, ALV grid pop's up a standard message ( I haven't coded for this.Since I use DDIC structure in field catalog, the Std. ALV program takes care of it. ). THis takes care of the validation before I click on save.
call method alv_grid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
This works fine. But I want this validation to run when I also click the SAVE button of the screen. Is it possible to run this standard validation in my PAI event eg. SAVE ? I thought I will be, by calling the method check_changed_data in my PAI event. But this is doing nothing. Does this method conflict with register_edit_event or something ? So , basically what I am looking for is to trigger the event or call the method which does the same work as the "check" button on ALV grid.
Any advice or tips or sample code is greatly appreciated.
Thanks,
ShareenHi Shareen,
Handle the data_changed event in the grid.
Whenever you make changes in the data in ALV Grid this event would be triggered. Here you can perform additional validations that you may need to perform.
METHODS handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
Implementation:
METHOD handle_data_changed.
PERFORM validations USING er_data_changed.
ENDMETHOD.
FORM validations USING er_data_changed TYPE REF TO cl_alv_changed_data_protocol.
DATA: ls_good TYPE lvc_s_modi.
DATA wa LIKE LINE OF lt_good_cells.
CALL METHOD g_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
CASE ls_good-fieldname.
WHEN 'FIELDNAME'. "Your fieldname
CALL METHOD er_data_changed->get_cell_value "Get the changed value
EXPORTING
i_row_id = ls_good-row_id
i_fieldname = ls_good-fieldname
IMPORTING
e_value = temp. "Your temp variable
"Make your validations here.
ENDCASE.
Ps: Reward points if helpful.
Regards,
Wenceslaus. -
Capture contents from an editable alv
I'm trying to capture fields from an editable alv. I have an update button in the application toolbar. So when i press this button, whatever changes I have done on the screen, the internal table should get updated. I'm using the function module REUSE_ALV_GRID_DISPLAY.
Can anybody help me out??Yes you can,
If you have access to the element in the context that is bound to the row in the ALV then you can connect the message. Marking a * is not possible by default with the WD message manager and you willl need to do it manually. Use the element method of the message manager API for this purpose. -
Get data in editable ALV back to internal table without data_changed ev?
Hi,
I have an editable ALV using classes to whch I have users the option to edit directly on the screen or upload data from an excel. The event data_changed gets triggered when users edit the table on the screen.
However when EXCEL is uploaded, I refresh the table display. So, I need a way to get the data from the ALV into a internal table to check which rows were update using the excel and save them into the db table.
PrakashHi!
For more information, inspect programs suiting the mask "BCALVEDIT*" and the thread with header "How to make a row of ALV editable " (I know this is some more steps further from your demand but it may be useful) at URL " How to make a row of ALV editable " .
If you want to study more BC412 "EnjoySAP Controls" may help you.
*--Serdar -
Hi Leads,
I am working on Editable ALV using REUSE_ALV_GRID_DISPLAY_LVC.
But, my requirement is I need to track the changes in Report.
After editing the ALV report, I need to update the data base with the changed records and Need to display them as One more Report.
Can you please suggest me any to resolve my issue?
Thanks,
SandeepYou may need to check
http://wiki.sdn.sap.com/wiki/display/Snippets/UpdatingtheInternalTable-AfterEditinALVusingFunctionModules
a® -
Update out_tab data in editable ALV
Hi,
I am working on editable ALV using oops. I want to insert the data into database tables after user insert the data in ALV based on the application tool bar button action.
How to refresh the data in out_tab, If user click the application tool bar button then I need to save the ALV grid data in database table.
Please give me the valuable suggestions.
- Rayudusolved my self
Maybe you are looking for
-
My lines on most of my websites I need overlap even after I updated to Firefox 8.
November 18, 2011. I use Humana and CVS drug store on line. When I open the windows the lines and words overlap since I upgraded to Firefox 8. When this happens, I have to go IE 8, copy and past the sites so that I can read the page. [http://www.cvs.
-
F4 help for timestamp on selection screen
Hi experts! I have this code in custom ALV report: selection-screen: begin of block b1 with frame title text-t01. DATA: w_aux_sc_created_at like ztable-sc_created_at. SELECT-OPTIONS s_sc_c02 for w_aux_sc_created_at. Ztable-sc_created_at is COMT_CREAT
-
Hi Friends, Plz help me how to disable single Screen field in Module pool. I have a scenario where One of the field is drop down box,in that options if i select 1 option the next Input/outputfield and Group of radio buttons(2buttons) should be disabl
-
Hi all, is it possible to add validation in an adapter ? If we want a bad message not to enter in XI, can we use modules ? I mean, we define a Java class which validate the input file. Thx.
-
hi, in my report some items are in main section,i want to refer that iteams to header section without change the position in main section,and without create new objects in header.i am new for reports.so plz guide me.