ALV Grid Display Editable Field Disables Zebra Style
Hi all,
First of all, I want to say: "I did my research." I found a post with a very similar question but not identically my case, or at least I can't solve it the same way. [Here is the reference post.|Re: Check box impact on ALV grid (Using OOPS)]
My Goal: I have an ALV Grid which I want to display using the ZEBRA style in the layout and also make one field in the field catalog editable.
My Issue: As soon as you make one field editable in the field catalog using the EDIT option, the ZEBRA style in the layout does not works. I also have key fields in the ALV Grid which I want to keep as KEY and which get painted dark blue.
I can't use the individual row coloring method used in the reference link above since this overrides the blue coloring of the key fields in the ALV. I haven't gone through all the effort of individually painting each cell on the grid, and honestly I don't think it is efficient.
My Question: Is there a way to have editable fields in the ALV Grid and keep the ZEBRA setting working?
Please, I will really appreciate if you can read and try to understand my issue before posting incoherent solutions or answers. I don't want to waste anybody's time nor mine.
Shiva,
Thanks for your reply; it someway addresses what I am looking for. Unfortunately, I've already went through that reference code; it has exactly the same problem that I am facing.
If you take that code for example, and you throw it u201Cas-isu201D in your ABAP editor you'll see that even when the ZEBRA style is being used in the layout, since the EDIT option in the field catalog is being set for field NETPR, the ZEBRA style gets lost; only the whole editable column gets white. You can go ahead and play a little bit with that piece of code and you will see what I am saying.
Regards
Similar Messages
-
Dear Colleagues,
I develop an ALV grid with OO standard methods. Before the first display of the table I define the editable fields. It works fine.
I have a problem : if the table is empty and I press the standard icons "Append a line" or "Insert a line", the new line don't have the defined editable characteristics.for fields. Is there a standard method which I have forgotten ?
Thanks a lot and kind regards
Petervs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_delete_row.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_append_row.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy_row.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_insert_row.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_cut.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_undo.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
* Displaying the output in ALV Grid
vs_layout_grid-no_rowmark = 'X'.
vs_layout_grid-zebra = 'X'.
vs_layout_grid-cwidth_opt = 'X'.
vs_layout_grid-edit = 'X'.
vs_layout_grid-ctab_fname = 'CT'.
vs_layout_grid-stylefname = 'CELLTAB'.
CALL METHOD v_grid->set_table_for_first_display
EXPORTING
i_save = 'X'
is_layout = vs_layout_grid
it_toolbar_excluding = i_toolbar_excluding[]
CHANGING
it_outtab = itab[]
it_fieldcatalog = it_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc NE 0.
MESSAGE 'ALV Grid display unsuccessful' TYPE 'I'.
STOP.
ENDIF. " IF sy-subrc NE 0
ELSE. " IF w_custom_container...
* Refresh the container if it already exists
CALL METHOD v_grid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE 'Refreshing the container is not successful' TYPE 'I'.
STOP.
ENDIF. -
Field Catolgue in alv grid display
Hi Abapers,
I need to display the percentage rows with decimals and other rows without decimal . Is their any option in field catalog to do like this. Or tell me any other alternative to achieve this.
sno total col1 col2 col3
1 220 100 20 100
2 320 120 50 150
tot 540 220 70 250
per 40.74 1.87 and so on
or ,
I have two different internal tables how can i put it in one field catalog to pass it to alv grid display.
Regards,
PriyaDon't do total by your self in the Pogram.
in the Fieldcatalog there is an Attribute which will do total & Average .
Enable it so that from one internal table data it self it will do good.
example program
Below is an example ABAP program which will populate a simple internal table(it_ekpo) with data and
display it using the basic ALV grid functionality(including column total). The example details the main
sections of coding required to implement the ALV grid functionality:
Data declaration
Data retrieval
Build fieldcatalog
Build layout setup
REPORT zdemo_alvgrid .
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,
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,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
* Build Fieldcatalog for ALV Report
form build_fieldcatalog.
* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you more control of the final product.
* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
* I.e. Field type may be required in-order for
* the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
* Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
* gd_layout-totals_only = 'X'.
* gd_layout-f2code = 'DISP'. "Sets fcode for when double
* "click(press f2)
* gd_layout-zebra = 'X'.
* gd_layout-group_change_edit = 'X'.
* gd_layout-header_text = 'helllllo'.
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'
exporting
i_callback_program = gd_repid
* i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
* i_callback_user_command = 'USER_COMMAND'
* i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
* it_special_groups = gd_tabgroup
* IT_EVENTS = GT_XEVENTS
i_save = 'X'
* is_variant = z_template
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 table it_ekko.
endform. " DATA_RETRIEVAL
gowri
Message was edited by:
Gowri Krishna -
Dump when summing up CURR field in ALV GRID display
Hi All,
I am getting dump when I try to sum the CURR field in my ALV Grid Display. The field is of CURR 23. I am using classes and methods to display alv grid.
I tried passing <fs_fieldcat>-do_sum = 'X'. When I did this, it is dumping without even displaying the alv grid.
Here is the part it is throwing dump:
ls_lvc_data-value = space.
clear ls_lvc_data-style.
loop at it_fcat_local assigning <ls_fcat>
where tech ne 'X' and no_out ne 'X'.
if l_invisible eq 'X'.
clear l_invisible.
if <ls_fcat>-do_sum is initial.
continue.
else.
clear ls_lvc_data-col_pos.
endif.
endif.
add 1 to ls_lvc_data-col_pos.
assign component <ls_fcat>-fieldname
of structure <ls_data> to <l_field_value>.
_if sy-subrc ne 0.
message x000(0k).
endif._
Regards,
GuruThomas,
Here is the dump:
Runtime Errors MESSAGE_TYPE_X
Date and Time 10/22/2010 23:30:53
Short text
The current application triggered a termination with a short dump.
What happened?
The current application program detected a situation which really
should not occur. Therefore, a termination with a short dump was
triggered on purpose by the key word MESSAGE (type X).
Error analysis
Short text of error message:
Long text of error message:
Technical information about the message:
Message class....... "0K"
Number.............. 000
Variable 1.......... " "
Variable 2.......... " "
Variable 3.......... " "
Variable 4.......... " "
How to correct the error
Probably the only way to eliminate the error is to correct the program.
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"MESSAGE_TYPE_X" " "
"SAPLSLVC" or "LSLVCF36"
"FILL_DATA_TABLE"
If you cannot solve the problem yourself and want to send an error
notification to SAP, include the following information:
1. The description of the current problem (short dump)
To save the description, choose "System->List->Save->Local File
(Unconverted)".
2. Corresponding system log
Display the system log by calling transaction SM21.
Restrict the time interval to 10 minutes before and five minutes
after the short dump. Then choose "System->List->Save->Local File
(Unconverted)".
3. If the problem occurs in a problem of your own or a modified SAP
program: The source code of the program
In the editor, choose "Utilities->More
Utilities->Upload/Download->Download".
4. Details about the conditions under which the error occurred or which
actions and input led to the error.
Source Code Extract
Line
SourceCde
2708
is_subtottxt_info = ls_subtot_info
2709
ip_subtot_line = lr_data
2710
changing
2711
c_subtottxt = l_subtottxt.
2712
ls_lvc_data-value = l_subtottxt.
2713
2714
append ls_lvc_data to ct_lvc_data.
2715
endif.
2716
2717
2718
Column per Fieldcat Entry
2719
2720
ls_lvc_data-value = space.
2721
clear ls_lvc_data-style.
2722
loop at it_fcat_local assigning <ls_fcat>
2723
where tech ne 'X' and no_out ne 'X'.
2724
if l_invisible eq 'X'.
2725
clear l_invisible.
2726
if <ls_fcat>-do_sum is initial.
2727
continue.
2728
else.
2729
clear ls_lvc_data-col_pos.
2730
endif.
2731
endif.
2732
2733
add 1 to ls_lvc_data-col_pos.
2734
2735
assign component <ls_fcat>-fieldname
2736
of structure <ls_data> to <l_field_value>.
2737
if sy-subrc ne 0.
>>>>>
message x000(0k).
2739
endif.
2740
2741
*... work on average
2742
if <ls_fcat>-do_sum eq 'C'.
2743
Initialize average result and entries
2744
<l_field_value> = 0.
2745
clear l_entries.
2746
2747
retrive unit from fieldcatalog
2748
assign space to <l_unit>.
2749
if not <ls_fcat>-cfieldname is initial.
2750
assign component <ls_fcat>-cfieldname
2751
of structure <ls_data> to <l_unit>.
2752
endif.
2753
if not <ls_fcat>-qfieldname is initial.
2754
assign component <ls_fcat>-qfieldname
2755
of structure <ls_data> to <l_unit>.
2756
endif.
2757 -
EDIT THE FIELV VALUE IN ALV GRID DISPLAY
Hi Guru ,
How can I edit the value of a particular one or two fields in ALV GRID DISPLAY .
Please reply mehi,
1.Set status of all cells to editable using the layout structure.
2.Use SET_READY_FOR_INPUT to activate the edit feature initially.
(state "editable activated").
3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.
4.Use SET_READY_FOR_INPUT to switch between the substates.
CALL METHOD g_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING it_outtab = gt_outtab.
*§2.Use SET_READY_FOR_INPUT to allow editing initially.
* (state "editable and ready for input").
CALL METHOD g_grid->set_ready_for_input
EXPORTING i_ready_for_input = 1.
*Use IS_READY_FOR_INPUT to fetch current substate of editable cells.
IF g_grid->is_ready_for_input( ) EQ 0.
*Use SET_READY_FOR_INPUT to switch between the substates.
CALL METHOD g_grid->set_ready_for_input
EXPORTING i_ready_for_input = 1.
ELSE.
CALL METHOD g_grid->set_ready_for_input
EXPORTING i_ready_for_input = 0.
ENDIF. -
Disabling "Default layout setting" in ALV grid display
Hello,
We have a requirement where we need to disable layout default settings in ALV grid display.
Only certain users should be able to save the report layout as default.
We would be creating an authorization group for this and then based on the Authority check we would need to enable or disable Default layout save option.
I found that using I_SAVE in the FM "REUSE_ALV_GRID_DISPLAY", we can either enable or disable layout save option.
But our requirement is to disable Default layout save option based on the authority check.
We will find this option next to User specific option when we save the report layout.
Can anyone guide me on this?
Thanks,
Regards,
AnidHi Anid,
First of all check if you can do this excluding the buttons from the ALV with the excluding tab. If not, here is the code for the ALV OO to exclude the buttons.
FORM F_DISPLAY_ALV.
* Layout
PERFORM f_layout.
* Exclude Buttons
DATA: gt_excl TYPE ttb_button
REFRESH gt_excl.
* Append those you want to exclude. These are some of them. Check Class in SE24 -> Atributes of class cl_gui_alv_grid.
APPEND: cl_gui_alv_grid=>mc_fc_loc_cut TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_undo TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_copy TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_paste TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_copy_row TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_move_row TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_delete_row TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_insert_row TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_append_row TO gt_excl,
cl_gui_alv_grid=>mc_fc_loc_paste_new_row TO gt_excl,
cl_gui_alv_grid=>mc_fc_to_office TO gt_excl,
cl_gui_alv_grid=>mc_fc_expcrdesig TO gt_excl.
CALL METHOD gv_alv_grid->set_table_for_first_display
EXPORTING
it_toolbar_excluding = gt_excl[]
is_layout = wa_layout_main
is_variant = wa_variant
i_save = 'A'
CHANGING
it_outtab = gt_alv[]
it_fieldcatalog = gt_fieldcat[]
it_sort = gt_sort[].
Edited by: Ernesto Caballero on Mar 11, 2010 5:59 PM
Edited by: Ernesto Caballero on Mar 11, 2010 6:03 PM -
Currency field in alv grid display
Hi,
I am using alv grid display.I am having one currency field netprice.I want it to be displayed as blank when i am not passing any value.But it gives 0.00 when it is not having any value.How to make it blank instead of 0.00.
Points will be rewarded.
Regards,
Sowmya.HI,
If itab-curr = '0.00' .
itab-curr = ''.
modify itab.
endif. -
Field symbol has not yet been defined-ALV Grid Display in Report
Hi all,
Iam calling a Function module for ALV grid display in Report programming. Its throwing the Error message Field Symbol has not yet defined. Can any one suggest what i have to do regarding it?Hi,
<li> This is problem with fieldcatalog.
<li> Check field names or table name in small letters in quotes while building fieldcatalog internal table
<li> Check the fieldcatalog internal table , whether it has same fields as in data table which is shown using GRID_DISPLAY function module.
Thanks
Venkat.O -
Error in field catalog in ALV grid display using classes at do_sum = "X'.
Hi,
I'm using classes in ALV Grid display.
the code for the field catalog is going to dump because of the statement in the field catalog for field 'netwr',do_sum = 'X'.
that do_sum = 'X' is not working and going to dump when executed.with out that do_sum it is working fine. the error in dump analysys is showing sap standard incude LSLVCF01.
assign component
<ls_fieldcat>-fieldname of structure rt_data to <g_field>.
if sy-subrc ne 0.
message x000(0k).
endif.
sy-subrc is 4 when the program is being executed.
CODE:
FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
ls_fcat-fieldname = 'VBELN1'.
ls_fcat-ref_field = 'VBELN'.
ls_fcat-ref_table = 'VBRK'.
ls_fcat-coltext = 'Invoice No'.
ls_fcat-seltext = 'Invoice No'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'BUDAT'.
ls_fcat-ref_table = 'BKPF'.
ls_fcat-coltext = 'Invoice Date'.
ls_fcat-seltext = 'Invoice Date'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'NETWR'.
ls_fcat-ref_field = 'NETWR'.
ls_fcat-ref_table = 'VBRK'.
ls_fcat-coltext = 'Value of Invoice'.
ls_fcat-seltext = 'Value of Invoice'.
ls_fcat-datatype = 'CURR'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ENDFORM.
can u please look in the code and rectify the error,
would appeciate ur response.
regards,
veera.Hi,
try this..
ls_fcat-fieldname = 'NETWR'.
ls_fcat-ref_field = 'NETWR'.
ls_fcat-ref_table = 'VBRK'.
ls_fcat-coltext = 'Value of Invoice'.
ls_fcat-seltext = 'Value of Invoice'.
ls_fcat-datatype = 'CURR'.
ls_fcat-do_sum = 'X'.
<b>ls_fcat-cfieldname = 'WAERS'.</b>
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
Regards
vijay -
How change standard field lable in alv grid display
Hi Experts,
How are you doing! I am having some doubts in the alv grid display, I am new to this concepts.
I want to display field lable manually, actually its taking from table field discription but I want to display one field name manually.
example code.
ls_fldcat-fieldname = 'BPKIND'.
ls_fldcat-ref_tabname = 'BUT000'.
ls_fldcat-ref_fieldname = 'BPKIND'.
APPEND ls_fldcat TO lt_fldcat.
ls_fldcat-fieldname = 'PARTNER2'.
ls_fldcat-ref_tabname = 'BUT051'.
ls_fldcat-ref_fieldname = 'PARTNER2'.
Here I dont want to display 'PARTNER2' I need 'KEY ACCOUNT MANAGER'.
Please send me how to do this.
Surya Ramireddy.Hi
Please check out this program.
Type-pools: slis.
Tables: likp.
Data: Begin of i_likp occurs 0,
vbeln like likp-vbeln,
ernam like likp-ernam,
erzet like likp-erzet,
erdat like likp-erdat,
End of i_likp.
Data: it_fieldcat type slis_t_fieldcat_alv,
wa_fieldcat type SLIS_FIELDCAT_ALV,
it_events type slis_t_event.
Selection-screen: Begin of block b1 with frame title text-001.
select-options: s_vbeln for likp-vbeln.
Selection-screen: End of block b1.
start-of-selection.
perform get_sales_header_data.
end-of-selection.
perform field_catalogue.
perform modify_field_catalogue.
perform display_alv_grid_display.
*& Form get_sales_header_data
text
--> p1 text
<-- p2 text
form get_sales_header_data .
select vbeln
ernam
erzet
erdat
into table i_likp
from likp
where vbeln in s_vbeln.
endform. " get_sales_header_data
*& Form field_catalogue
text
--> p1 text
<-- p2 text
form field_catalogue .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_INTERNAL_TABNAME = 'I_LIKP'
I_INCLNAME = sy-repid
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
endform. " field_catalogue
*& Form modify_field_catalogue
text
--> p1 text
<-- p2 text
form modify_field_catalogue .
loop at it_fieldcat into wa_fieldcat.
case wa_fieldcat-fieldname.
when 'VBELN'.
wa_fieldcat-col_pos = 1.
wa_fieldcat-seltext_l = 'Sales Doc Header No'.
wa_fieldcat-emphasize = 'C100'.
when 'ERNAM'.
wa_fieldcat-col_pos = 2.
wa_fieldcat-seltext_l = 'Created By'.
wa_fieldcat-emphasize = 'C200'.
when 'ERZET'.
wa_fieldcat-col_pos = 3.
wa_fieldcat-seltext_l = 'Entry Time'.
wa_fieldcat-emphasize = 'C300'.
when 'ERDAT'.
wa_fieldcat-col_pos = 4.
wa_fieldcat-seltext_l = 'Created On'.
wa_fieldcat-emphasize = 'C400'.
endcase.
modify it_fieldcat from wa_fieldcat.
endloop.
endform. " modify_field_catalogue
*& Form display_alv_grid_display
text
--> p1 text
<-- p2 text
form display_alv_grid_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IT_FIELDCAT = IT_FIELDCAT
TABLES
t_outtab = i_likp
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
endform. " display_alv_grid_display
Regards
Haritha. -
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 -
Drill down capabilities for an alv grid display field using oops concept
Hi All,
could anyone help me in how to achieve the drill down capabilities for an alv grid display field using oops concept.
Thanks & Regards,
padmasri.padmasri,
Hope your requirement is something like, when you click on a sales order number it should display that order (VA03), in a grid output displayed using set_table_for_first_display.
you can acheive it using event double click.
*& L O C A L C L A S S E S - D E F I N I T O N *
class lcl_event_receiver: local class to handle event DOUBLE_CLICK
CLASS LCL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS:
HANDLE_DOUBLE_CLICK
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN.
PRIVATE SECTION.
ENDCLASS. "lcl_event_receiver DEFINITION
*& L O C A L C L A S S E S - I M P L E M E N T A T I O N *
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
METHOD HANDLE_DOUBLE_CLICK.
PERFORM HANDLE_DOUBLE_CLICK USING E_ROW
E_COLUMN.
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
FORM HANDLE_DOUBLE_CLICK USING E_ROW TYPE LVC_S_ROW
E_COLUMN TYPE LVC_S_COL.
DATA: LS_DETAIL LIKE LINE OF T_OUTPUT.
WHEN 'T_OUTPUT'.
READ TABLE T_OUTPUT INDEX E_ROW-INDEX INTO LS_DETAIL.
If clicked on PO Number or PO Item, call ME23
IF E_COLUMN-FIELDNAME = 'EBELN' OR
E_COLUMN-FIELDNAME = 'EBELP' .
SET PARAMETER ID 'BES' FIELD LS_DETAIL-EBELN.
SET PARAMETER ID 'BSP' FIELD LS_DETAIL-EBELP.
CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
If clicked on sales order number or item, call VA03
ELSEIF E_COLUMN-FIELDNAME = 'VBELN' OR
E_COLUMN-FIELDNAME = 'POSNR'.
SET PARAMETER ID 'AUN' FIELD LS_DETAIL-VBELN.
SET PARAMETER ID 'APO' FIELD LS_DETAIL-POSNR.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
Hope this helps -
Re: alv grid display.
Hi All,
I have a final alv grid display and i have two fields which are edited by clicking the EDIT button given on the output PF-Status.
now i want to disable this EDIT button when the user changes the value of these two fields. after which user presses the save button to save the updated list.
Please let me know any method or any parameter which has to be passed or any SAMPLE CODE to do this.
satisfactory answers will be rewarded.
Thanks,
NaveenTry this to deactivate the button..
Set pf-status 'STATUS' excluding itab. <---Populate the itab with EDIT Button
double click on STATUS, goto -> attributes -> push button assignment -> display all.
Now when you use the excluding itab the buton gets deactivated but not completely removed
As your requirement is when the field gets changed
IF ... <---------------Write the condition here if the field get changed
Set pf-status 'STATUS' excluding itab
else.
Set pf-status 'STATUS'.
endif. -
Kindly help to develop alv grid display
Hi ,
I have a requirement in which I need to display ALV GRID display and in its tool bar 4 butons are required. In the same view down to alv display i want to develop a tabstrip and its functionalities.I have designed classic alv using SALV_WD_TABLE component. I want a good GRID Display, not like flat field names that comes in list display, looking for bulged fields(like what comes for ALV GRID in normal abap) display with print version etc hidden and buttons at the top of ALV. Kindly help
Highly rewarded
Kindly help
Regards,
Lakshmi
Edited by: Lakshmi Menon on Nov 27, 2008 4:49 PMWell Web Dynpro is generally output in HTML so the output formatting is never going to quite look like a desktop application (which is the case with the ALV Grid). You have very little control over the look of the column headers. In fact you can only manipulate what is available via the Portal Theme.
There is a new Tradeshow Plus theme available in NetWeaver 7.01 which uses a gradiant background for the column headers. This gives them a little more depth:
http://www.flickr.com/photos/tjung/3068850120/
The other option is next year when NetWeaver Business Client version 3.0 comes out, you will be able to render Web Dynpro applications using the NWBC Smart Client Rendering. This will render Web Dynpro applications using desktop libraries instead of HTML/Browser. This gives Web Dynpro a more SAPGUI/Desktop appears of course.
http://www.flickr.com/photos/tjung/2685619882/in/set-72157606418550143/ -
Update values in AlV grid display after entering value
Hi,
I have an issue in ALV grid display.
Let me explain.
i have 8 fields to display in which one is editiable.
Fields are: date
material,
material Description,
Opening Stock,
Closing stock- ( this field is editiable)
Closing stock,
Received Stock,
Actual production.
Actual production = Closing stock + removal stock
- receipt stock - opening stock.
when i change the value of closing stock and press enter, actual production should get update, the new values should display.
Thany you in advance.Hi,
Please refer the code below:
REPORT z_demo_alv_jg.*******************************************************************
* TYPE-POOLS *
TYPE-POOLS: slis. *******************************************************************
* INTERNAL TABLES/WORK AREAS/VARIABLES *
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
w_field TYPE slis_fieldcat_alv,
p_table LIKE dd02l-tabname,
dy_table TYPE REF TO data,
dy_tab TYPE REF TO data,
dy_line TYPE REF TO data.*******************************************************************
* FIELD-SYMBOLS *
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa> TYPE ANY,
<dyn_field> TYPE ANY,
<dyn_tab_temp> TYPE STANDARD TABLE.*******************************************************************
* SELECTION SCREEN *
PARAMETERS: tabname(30) TYPE c,
lines(5) TYPE n.*******************************************************************
* START-OF-SELECTION *
START-OF-SELECTION.* Storing table name
p_table = tabname.* Create internal table dynamically with the stucture of table name
* entered in the selection screen
CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_table->* TO <dyn_table>.
IF sy-subrc <> 0.
MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'. LEAVE TO LIST-PROCESSING.
ENDIF.
* Create workarea for the table
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.* Create another temp. table
CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_tab->* TO <dyn_tab_temp>. SORT i_fieldcat BY col_pos.* Select data from table
SELECT * FROM (p_table)
INTO TABLE <dyn_table>
UP TO lines ROWS. REFRESH <dyn_tab_temp>.* Display report
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
TABLES
t_outtab = <dyn_table>
EXCEPTIONS
program_error = 1
OTHERS = 2. IF sy-subrc <> 0. ENDIF.*&-----------------------------------------------------------------*
*& Form SET_PF_STATUS
* Setting custom PF-Status
* -->RT_EXTAB Excluding table
FORM set_pf_status USING rt_extab TYPE slis_t_extab. SET PF-STATUS 'Z_STANDARD'.ENDFORM. "SET_PF_STATUS*&----------------------------------------------------------------*
*& 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.* Local data declaration
DATA: li_tab TYPE REF TO data,
l_line TYPE REF TO data.* Local field-symbols
FIELD-SYMBOLS:<l_tab> TYPE table,
<l_wa> TYPE ANY.* Create table
CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN li_tab->* TO <l_tab>.* Create workarea
CREATE DATA l_line LIKE LINE OF <l_tab>.
ASSIGN l_line->* TO <l_wa>. CASE r_ucomm.* When a record is selected
WHEN '&IC1'.* Read the selected record
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
rs_selfield-tabindex. IF sy-subrc = 0.* Store the record in an internal table
APPEND <dyn_wa> TO <l_tab>.* Fetch the field catalog info
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'Z_DEMO_PDF_JG'
i_structure_name = p_table
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.* Make all the fields input enabled except key fields
w_field-input = 'X'. MODIFY i_fieldcat FROM w_field TRANSPORTING input
WHERE key IS INITIAL. ENDIF.* Display the record for editing purpose
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
it_fieldcat = i_fieldcat
i_screen_start_column = 10
i_screen_start_line = 15
i_screen_end_column = 200
i_screen_end_line = 20
TABLES
t_outtab = <l_tab>
EXCEPTIONS
program_error = 1
OTHERS = 2. IF sy-subrc = 0.* Read the modified data
READ TABLE <l_tab> INDEX 1 INTO <l_wa>.* If the record is changed then track its index no.
* and populate it in an internal table for future
* action
IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
<dyn_wa> = <l_wa>.
i_index = rs_selfield-tabindex.
APPEND i_index.
ENDIF.
ENDIF. ENDIF.* When save button is pressed
WHEN 'SAVE'.* Sort the index table
SORT i_index.* Delete all duplicate records
DELETE ADJACENT DUPLICATES FROM i_index. LOOP AT i_index.* Find out the changes in the internal table
* and populate these changes in another internal table
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
IF sy-subrc = 0.
APPEND <dyn_wa> TO <dyn_tab_temp>.
ENDIF. ENDLOOP.* Lock the table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3. IF sy-subrc = 0.* Modify the database table with these changes
MODIFY (p_table) FROM TABLE <dyn_tab_temp>. REFRESH <dyn_tab_temp>.* Unlock the table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table. ENDIF.
ENDCASE. rs_selfield-refresh = 'X'.ENDFORM. "user_command
Thanks,
Sriram Ponna.
Maybe you are looking for
-
Adjust volume via iTunes for multiple speakers
I upgraded my iTunes to 6.02 and finally it is possible to select multiple AE and my PC at the same time to stream music to them. It works almost perfect for me! Just one thing bugs me: I can't adjust the volume on my AE via Airtunes if I selected my
-
Goods return field in BSET or any other FI Table
Dear Expert, I need to make a report for Purchase Return and Subsequent Debit or Credit for a period. I am not finding any field in BSET or BKPF to filter the document. Can anyone suggest how to get this data if not from the above table also fine. MS
-
Ipad gets stuck in "backing up" during sync. How do i get sync to work?
I updated my version of Itunes. I plugged in my Ipad to sync and it also needed an update to its software. It extracted the software and then moves to "backing up", but gets stuck for hours w/ only appx. 5% of back up complete. I have cancelled sy
-
OSX 10.9.5
-
Hi PP Guru's , I have BOM for FERT in which I have included 2 other Assembly Boms after MRP when I checked in MD04 the quantity for FERT is coming correct to 2 Pcs But for Assembly it is coming 0.002 Pcs , Please give me your suggestion where I need