No_zero attribute in ALV
Is there a way to set the no_zero attribute just for a particular row?
The requirement is just to display blank when the value of the field is zero but just for the first two rows. How can I do this? Thanks.
Hi Giscard Rous ,
<b>1</b>.
NO_ZERO attribute is there.If u set that for Column,that is applicable for Entire COLUMN not for ROW.
<b>2</b>.
Better to set W_FIELDCATALOG-NO_ZERO = 'X' for all Columns while Fieldcatalog table is being built.So that If entire has ZERO values ,It does not display ZERO's.
<b>3</b>.
If u r using REUSE_ALV_FIELDCATALOG_MERGE to build Fieldcatalog table ,Modify that table by setting
W_FIELDCATALOG-NO_ZERO = 'X' .
I think that u can solve like that
<b>Thanks,
Venkat.O</b>
Similar Messages
-
The Visible attribute on alv grid column is not changed after Change Layout
Setup:
I have a program that displays output in an ALV grid (using cl_salv_table).
The ALV grid is displayed within a custom control on a subscreen.
I have 4 subscreens being used on a tabstrip control. So I have 4 ALV grids total (one on each subscreen).
On each ALV grid, I have set the set_layout_change function to true so that the user can hide and unhide columns etc. on each grid via the button on the alv grid toolbar.
I also allow the user to dowload the contents of all 4 grids to excel. To do this I have a custom button that when clicked goes to each ALV grid - gets the column metadata (via cl_salv_columns_table-get() ) and checks the visibility to determine if the column should be downloaded or not (via cl_salv_column-is_visible() ) to excel.
The Problem:
As I said I have 4 grids being displayed via a tab control. Let's say the user is on tab 1 and unhides some columns on the alv grid 1 via the Change Layout... button. And then the user navigates to tab 2. If they click the download button at that point - when the download code is run and it checks the visibility of the columns on alv grid 1 - the changes that were made via the Change Layout... button have not synchronized yet. When I call is_visible() for a column that was unhid it still comes back as false.
The only way I have found to remedy this is to make the user click on a button on the alv grid's toolbar before navigating to a different tab to force the synchronization between the changes made and the backend column metadata. However, this is not the best option and requires training for the user that they have to do this for the download to work correctly.
The Question:
1) why is the Change Layout... button not automatically synchronizing the changes it made to the back end? Is there a way to make it do this?
2) OR, is there a way that I can force the synchronization within the code and not force the user to click a button on the alv grid? If there is a way to force the synchronization - where do I put that code? As far as I can tell, when I switch between tabs - I am unable to catch that action in my PAI events.
Thanks in advance for any help.I was able to resolve this issue with a satisfactory solution.
In my program I had a local class definition to handle the grids' events. When the synchronization wasn't working I only had two events defined: for link_click and added_functions.
I created another definition for event after_salv_function:
on_after_salv_function for event after_salv_function of cl_salv_events importing e_salv_function
There is no code in the method implementation - but adding this event handler now causes a synchronization to occur after the Change Layout is done. -
Dynamic context attributes and ALV
Hi all,
I already posted my question in this [thread|WD4A Dynamic ALV Table with dynamic tables;,
but in the ABAP UI programming forum, but I think it fits better in the WD4A forum.
It's dazzling that there are two forums for WD4A.
Maybe a moderator with the authorization can move my thread into this forum and delete this new thread.
Best Regards,
MarcelHi
I use the SALV_WD_TABLE component. I have bind my static MTX node to the INTERFACECONTROLLER_USAGE Data node in design time.
At runtime, when I modify my demo table structure, for example the number of colums or rows, in the view can I see it. But the data no. I have found a tutorial, where I can made a dynamic node from DDIC, and in this case can I show the data in the ALV table.
My big problem was, that my table is not in DDIC.
If this road is not possible, can You show me an other solution?
Thanks
Krisztian -
Hide some column of the node in ALV
Hi experts,
I have one requirement in which the node contains 10 attribute,but i have to show only 5 attribute in ALV Table.
Can u plz tell me how i can do this.
Thanks
MaheshHi,
Try like this..
Declare ALV config table
data: ALV_CONFIG_TABLE type REF TO CL_SALV_WD_CONFIG_TABLE.
DATA: wd_table_usage TYPE REF TO if_wd_component_usage.
Create an instance of ALV component created ALV_COMP is usage name
wd_table_usage = wd_this->wd_cpuse_alv_comp( ).
IF wd_table_usage->has_active_component( ) IS INITIAL.
wd_table_usage->create_component( ).
ENDIF.
Get ALV component
DATA: wd_table TYPE REF TO iwci_salv_wd_table.
wd_table = wd_this->wd_cpifc_alv_comp( ).
alv_config_table = wd_table->get_model( ).
Declare variable to store column details
DATA: column_settings TYPE REF TO if_salv_wd_column_settings,
column TYPE REF TO cl_salv_wd_column.
column_settings ?= alv_config_table.
*HIDE COLUMNS *
column = column_settings->get_column( 'MANDT' ).
column->set_visible( if_wdl_core=>visibility_none ).
OR
If you want Delete Columns.
From the refernc eof CL_SALV_WD_CONFIG_TABLE you can access the method
CALL METHOD LR_FUNCTION_SETTINGS->IF_SALV_WD_COLUMN_SETTINGS~DELETE_COLUMN
EXPORTING
ID = ls_column-id.
Cheers,
Kris. -
Alv using class In list format
Hi,
I am using a method set_table_for_first_display in class cl_gui_alv_grid to display ALV. but by default the output appears in grid format, I want to change the output in LIST format.
What can I do to change the output in list format.
Kind Regards,
Abhishek.try this.... this is an example code.... don't use set_table_for_first_display rather use CL_SALV_TABLE and execute the below code
*& Report ZAMIT_TEST
REPORT zamit_test MESSAGE-ID z_zzz_ca_messages.
* constants for icons
TYPE-POOLS: icon, col.
* type for internal table
TYPES: BEGIN OF x_sflight.
* selfld TYPE char1.
INCLUDE STRUCTURE sflight.
TYPES: seatsfree TYPE sflight-seatsocc,
usage TYPE n, " exception
icon_future TYPE icon-id, " icon for future / past
line_counter TYPE i, " line counter
it_colors TYPE lvc_t_scol, " internal tab for cell color info
END OF x_sflight.
* Internal table
DATA: i_sflight TYPE STANDARD TABLE OF x_sflight,
wa_sflight TYPE x_sflight,
wa_colors TYPE lvc_s_scol,
list_display TYPE sap_bool,
vref_cont TYPE REF TO cl_gui_custom_container,
vref_alv TYPE REF TO cl_salv_table, " ALV instance
oref_error TYPE REF TO cx_salv_error, " Error instance
l_text_alv_e TYPE string,
ok_code TYPE syucomm.
SELECT-OPTIONS: so_car FOR wa_sflight-carrid MEMORY ID car,
so_con FOR wa_sflight-connid.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK alv WITH FRAME TITLE text-alv.
PARAMETERS: pa_full RADIOBUTTON GROUP alvd DEFAULT 'X',
pa_cont RADIOBUTTON GROUP alvd,
pa_list RADIOBUTTON GROUP alvd.
SELECTION-SCREEN END OF BLOCK alv.
PARAMETERS: p_layout TYPE slis_vari.
* CLASS lcl_handler DEFINITION
CLASS lcl_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
on_added_function FOR EVENT added_function OF cl_salv_events_table
IMPORTING e_salv_function, " type salv_de_function
on_double_click FOR EVENT double_click OF cl_salv_events_table
IMPORTING row, " type salv_de_row = int4
on_link_click FOR EVENT link_click OF cl_salv_events_table
IMPORTING row " type salv_de_row = int4
column." type salv_de_column = char(30)
ENDCLASS. "lcl_handler definition
* CLASS lcl_handler IMPLEMENTATION
CLASS lcl_handler IMPLEMENTATION.
METHOD on_added_function.
DATA: l_oref_columns TYPE REF TO cl_salv_columns_table,
l_oref_column TYPE REF TO cl_salv_column_table,
l_oref_column1 TYPE REF TO cl_salv_column,
l_except1 TYPE REF TO cx_salv_not_found, "Exception
l_text1 TYPE string, "Exception msg
l_lvc_s_colo TYPE lvc_s_colo.
CASE e_salv_function.
WHEN 'REORDER'.
* get the COLUMNS object
l_oref_columns = vref_alv->get_columns( ).
* positions: (MANDT column + 3 key colums)
l_oref_columns->set_column_position( columnname = 'SEATSOCC'
position = 5 ).
l_oref_columns->set_column_position( columnname = 'SEATSOCC_B'
position = 6 ).
l_oref_columns->set_column_position( columnname = 'SEATSOCC_F'
position = 7 ).
* prepare color info
* column SEATSOCC
TRY.
CALL METHOD l_oref_columns->get_column
EXPORTING
columnname = 'SEATSOCC'
RECEIVING
value = l_oref_column1.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
l_oref_column ?= l_oref_column1.
l_oref_column->set_color( value = l_lvc_s_colo ).
* column SEATSOCC_B
TRY.
CALL METHOD l_oref_columns->get_column
EXPORTING
columnname = 'SEATSOCC_B'
RECEIVING
value = l_oref_column1.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
l_oref_column ?= l_oref_column1.
l_oref_column->set_color( value = l_lvc_s_colo ).
* column SEATSOCC_F
TRY.
CALL METHOD l_oref_columns->get_column
EXPORTING
columnname = 'SEATSOCC_F'
RECEIVING
value = l_oref_column1.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
l_oref_column ?= l_oref_column1.
l_oref_column->set_color( value = l_lvc_s_colo ).
ENDCASE.
ENDMETHOD. "on_added_function
METHOD on_double_click.
DATA: message_text(70),
lc_seatsfree_e(10),
lc_seatsfree_b(10),
lc_seatsfree_f(10).
READ TABLE i_sflight INTO wa_sflight INDEX row.
CHECK sy-subrc EQ 0.
lc_seatsfree_e = wa_sflight-seatsmax - wa_sflight-seatsocc.
lc_seatsfree_b = wa_sflight-seatsmax_b - wa_sflight-seatsocc_b.
lc_seatsfree_f = wa_sflight-seatsmax_f - wa_sflight-seatsocc_f.
CONCATENATE 'FREE SEATS:'(frs) 'ECONOMY:'(eco) lc_seatsfree_e
'BUSINESS'(bus) lc_seatsfree_b 'FIRST'(fst) lc_seatsfree_f
INTO message_text SEPARATED BY space.
MESSAGE message_text TYPE 'I'.
ENDMETHOD. "on_double_click
METHOD on_link_click.
DATA: lc_carrname TYPE scarr-carrname,
lc_currcode TYPE scarr-currcode,
message_text(70).
READ TABLE i_sflight INTO wa_sflight INDEX row.
CHECK sy-subrc EQ 0.
CASE column.
WHEN 'CARRID'.
SELECT SINGLE carrname currcode
INTO (lc_carrname, lc_currcode)
FROM scarr
WHERE carrid = wa_sflight-carrid.
IF sy-subrc EQ 0.
CONCATENATE 'AIRLINE:'(air) wa_sflight-carrid
'NAME:'(nme) lc_carrname
'CURRENCY:' lc_currcode
INTO message_text
SEPARATED BY space.
MESSAGE message_text TYPE 'I'.
ENDIF.
WHEN 'SELFLD'.
MESSAGE i000 with 'Checkbox Clicked'.
ENDCASE.
ENDMETHOD. "on_link_click
ENDCLASS. "lcl_handler IMPLEMENTATION
START-OF-SELECTION.
* retrieve data into internal table
SELECT * FROM sflight
INTO CORRESPONDING FIELDS OF TABLE i_sflight
WHERE carrid IN so_car
AND connid IN so_con.
END-OF-SELECTION.
* fill additional data fields
LOOP AT i_sflight INTO wa_sflight.
* seats free
wa_sflight-seatsfree =
wa_sflight-seatsmax + wa_sflight-seatsmax_b
+ wa_sflight-seatsmax_f
- wa_sflight-seatsocc - wa_sflight-seatsocc_b
- wa_sflight-seatsocc_f.
* usage (exception light)
IF wa_sflight-seatsfree = 0.
wa_sflight-usage = '1'.
ELSEIF wa_sflight-seatsfree <= 20.
wa_sflight-usage = '2'.
ELSE.
wa_sflight-usage = '3'.
ENDIF.
* icon "in the future/not in the future"
IF wa_sflight-fldate > sy-datum.
wa_sflight-icon_future = icon_positive.
ELSE.
wa_sflight-icon_future = icon_negative.
ENDIF.
* cell colors
* single cell if planetype is 747-400
IF wa_sflight-planetype = '747-400'.
CLEAR wa_colors.
wa_colors-fname = 'PLANETYPE'.
wa_colors-color-col = col_positive.
wa_colors-color-int = 1.
APPEND wa_colors TO wa_sflight-it_colors.
ENDIF.
* whole line if seatsfree gt 200
IF wa_sflight-seatsfree >= 200.
CLEAR wa_colors.
wa_colors-color-col = col_heading.
wa_colors-color-int = 1.
APPEND wa_colors TO wa_sflight-it_colors.
ENDIF.
MODIFY i_sflight
FROM wa_sflight
TRANSPORTING
seatsfree
usage
icon_future
it_colors.
ENDLOOP.
CASE 'X'.
WHEN pa_full OR pa_list.
IF pa_list IS NOT INITIAL.
list_display = if_salv_c_bool_sap=>true.
ELSE.
list_display = if_salv_c_bool_sap=>false.
ENDIF.
TRY.
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display = list_display
IMPORTING
r_salv_table = vref_alv
CHANGING
t_table = i_sflight.
CATCH cx_salv_msg INTO oref_error.
l_text_alv_e = oref_error->get_text( ).
MESSAGE i000 WITH l_text_alv_e.
LEAVE LIST-PROCESSING.
ENDTRY.
* define settings
PERFORM define_settings USING vref_alv.
* display ALV
vref_alv->display( ).
WHEN pa_cont.
CALL SCREEN 100.
ENDCASE.
*& Form define_settings
* text
* -->P_ALV ALV object
FORM define_settings USING p_alv TYPE REF TO cl_salv_table.
PERFORM: sub_set_display USING p_alv,
sub_set_columns USING p_alv,
sub_set_sorts USING p_alv,
sub_set_aggregs USING p_alv,
sub_set_selections USING p_alv,
sub_set_layout USING p_alv,
sub_set_functions USING p_alv,
sub_set_events USING p_alv,
sub_set_header USING p_alv.
ENDFORM. " define_settings
*& Form sub_set_display
* set general display attributs
* -->P_ALV ALV object
FORM sub_set_display USING p_alv TYPE REF TO cl_salv_table.
DATA: lr_display TYPE REF TO cl_salv_display_settings,
l_title TYPE lvc_title.
* get display settings object
lr_display = p_alv->get_display_settings( ).
* set header
l_title = text-ttl.
lr_display->set_list_header( value = text-ttl ).
* set horizontal lines off
lr_display->set_horizontal_lines( value = ' ' ).
* set striped pattern
lr_display->set_striped_pattern( value = 'X' ).
ENDFORM. " sub_set_display
*& Form sub_set_columns
* text
* -->P_ALV text
FORM sub_set_columns USING p_alv TYPE REF TO cl_salv_table.
DATA: l_oref_columns TYPE REF TO cl_salv_columns_table,
l_oref_column TYPE REF TO cl_salv_column_table,
l_oref_column1 TYPE REF TO cl_salv_column,
l_except1 TYPE REF TO cx_salv_not_found, "Exception
l_except2 TYPE REF TO cx_salv_data_error, "Exception
l_text1 TYPE string, "Exception msg
l_scrtext_s TYPE scrtext_s,
l_scrtext_m TYPE scrtext_m,
l_scrtext_l TYPE scrtext_l,
l_lvc_tip TYPE lvc_tip, " for tooltip
l_pos TYPE i, " column position
l_lvc_s_colo TYPE lvc_s_colo. " column color
l_oref_columns = p_alv->get_columns( ). " get columns object
* set exception column
TRY.
CALL METHOD l_oref_columns->set_exception_column
EXPORTING
value = 'USAGE'.
CATCH cx_salv_data_error INTO l_except2.
l_text1 = l_except2->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
* set count column
TRY.
CALL METHOD l_oref_columns->set_count_column
EXPORTING
value = 'LINE_COUNTER'.
CATCH cx_salv_data_error INTO l_except2.
l_text1 = l_except2->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
* set cell colors / line colors column
TRY.
CALL METHOD l_oref_columns->set_color_column
EXPORTING
value = 'IT_COLORS'.
CATCH cx_salv_data_error INTO l_except2.
l_text1 = l_except2->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
* column ICON_FUTURE
TRY.
CALL METHOD l_oref_columns->get_column
EXPORTING
columnname = 'ICON_FUTURE'
RECEIVING
value = l_oref_column1.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
l_oref_column ?= l_oref_column1.
l_oref_column->set_icon( ).
l_scrtext_s = text-fut.
l_oref_column->set_short_text( value = l_scrtext_s ).
l_oref_column->set_row( value = 2 ).
* Column SEATSFREE
TRY.
CALL METHOD l_oref_columns->get_column
EXPORTING
columnname = 'SEATSFREE'
RECEIVING
value = l_oref_column1.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
l_oref_column ?= l_oref_column1.
* set color to COL_GROUP
l_lvc_s_colo-col = col_group.
l_lvc_s_colo-int = 1.
l_oref_column->set_color( value = l_lvc_s_colo ).
** Column SELFLD
* TRY.
* CALL METHOD l_oref_columns->get_column
* EXPORTING
* columnname = 'SELFLD'
* RECEIVING
* value = l_oref_column1.
* CATCH cx_salv_not_found INTO l_except1.
* l_text1 = l_except1->get_text( ).
* MESSAGE i000 WITH l_text1.
* LEAVE LIST-PROCESSING.
* ENDTRY.
* l_oref_column ?= l_oref_column1.
** set color to COL_GROUP
* if pa_list = 'X'.
* l_oref_column->set_cell_type( value =
* if_salv_c_cell_type=>CHECKBOX ).
* ELSEIF pa_full = 'X'.
* l_oref_column->set_cell_type( value =
* if_salv_c_cell_type=>CHECKBOX_HOTSPOT ).
* endif.
ENDFORM. "sub_set_columns
*& Form sub_set_sorts
* -->P_ALV text
FORM sub_set_sorts USING p_alv TYPE REF TO cl_salv_table.
DATA: l_oref_sorts TYPE REF TO cl_salv_sorts,
l_except1 TYPE REF TO cx_salv_not_found, "Exception
l_except2 TYPE REF TO cx_salv_existing, "Exception
l_except3 TYPE REF TO cx_salv_data_error, "Exception
l_text1 TYPE string. "Exception msg
* get the SORTS object
l_oref_sorts = p_alv->get_sorts( ).
* add sorts
TRY.
CALL METHOD l_oref_sorts->add_sort
EXPORTING
columnname = 'CARRID'
position = 1.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_existing INTO l_except2.
l_text1 = l_except2->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_data_error INTO l_except3.
l_text1 = l_except3->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
TRY.
CALL METHOD l_oref_sorts->add_sort
EXPORTING
columnname = 'CONNID'
position = 2
subtotal = if_salv_c_bool_sap=>true.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_existing INTO l_except2.
l_text1 = l_except2->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_data_error INTO l_except3.
l_text1 = l_except3->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
TRY.
CALL METHOD l_oref_sorts->add_sort
EXPORTING
columnname = 'FLDATE'
position = 3.
CATCH cx_salv_not_found INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_existing INTO l_except2.
l_text1 = l_except2->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_data_error INTO l_except3.
l_text1 = l_except3->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
ENDFORM. " sub_set_sorts
*& Form sub_set_aggregs
* -->P_ALV text
FORM sub_set_aggregs USING p_alv TYPE REF TO cl_salv_table.
DATA: l_oref_aggregs TYPE REF TO cl_salv_aggregations,
l_except1 TYPE REF TO cx_salv_data_error, "Exception
l_except2 TYPE REF TO cx_salv_not_found, "Exception
l_except3 TYPE REF TO cx_salv_existing, "Exception
l_text1 TYPE string. "Exception msg
l_oref_aggregs = p_alv->get_aggregations( ).
TRY.
CALL METHOD l_oref_aggregs->add_aggregation
EXPORTING
columnname = 'SEATSFREE'
aggregation = if_salv_c_aggregation=>total.
CATCH cx_salv_data_error INTO l_except1.
l_text1 = l_except1->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_not_found INTO l_except2.
l_text1 = l_except2->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
CATCH cx_salv_existing INTO l_except3.
l_text1 = l_except3->get_text( ).
MESSAGE i000 WITH l_text1.
LEAVE LIST-PROCESSING.
ENDTRY.
ENDFORM. " sub_set_aggregs
*& Form sub_set_selections
* -->P_ALV text
FORM sub_set_selections USING p_alv TYPE REF TO cl_salv_table.
DATA: lr_selections TYPE REF TO cl_salv_selections.
* get the SELECTIONS object
lr_selections = p_alv->get_selections( ).
* set the selection mode
lr_selections->set_selection_mode(
value = if_salv_c_selection_mode=>cell ).
ENDFORM. " sub_set_selections
*& Form sub_set_layout
* -->P_ALV text
FORM sub_set_layout USING p_alv TYPE REF TO cl_salv_table.
DATA: lr_layout TYPE REF TO cl_salv_layout,
ls_key TYPE salv_s_layout_key.
* get the LAYOUT object
lr_layout = p_alv->get_layout( ).
* set the layout key
ls_key-report = sy-cprog.
lr_layout->set_key( value = ls_key ).
* set save restriction
* (restriction "none" is intended,
* so we may use the default)
lr_layout->set_save_restriction(
* VALUE = IF_SALV_C_LAYOUT=>RESTRICT_NONE
* allow setting a default layout
lr_layout->set_default( value = 'X' ).
* set initial layout
lr_layout->set_initial_layout( value = p_layout ).
ENDFORM. " sub_set_layout
*& Form sub_set_functions
* -->P_ALV text
FORM sub_set_functions USING p_alv TYPE REF TO cl_salv_table.
DATA: lr_functions TYPE REF TO cl_salv_functions_list,
l_except1 TYPE REF TO cx_salv_existing,
l_except2 TYPE REF TO cx_salv_wrong_call,
l_text1 TYPE string,
* help variables for method call ADD_FUNCTION
l_icon TYPE string,
l_text TYPE string,
l_tooltip TYPE string.
IF pa_full = 'X' or pa_list = 'X'.
p_alv->set_screen_status( pfstatus = 'SALV_TABLE_STANDARD'
report = sy-repid
set_functions = p_alv->c_functions_all ).
ENDIF.
* get the FUNCTIONS object
lr_functions = p_alv->get_functions( ).
* offer all generic functions
lr_functions->set_all( value = if_salv_c_bool_sap=>true ).
* subtract average
lr_functions->set_aggregation_average(
value = if_salv_c_bool_sap=>false ).
* subtract all export functions
lr_functions->set_group_export(
value = if_salv_c_bool_sap=>false ).
* enable exort to local file
lr_functions->set_export_localfile(
value = if_salv_c_bool_sap=>true ).
* subtract transfer to lotus
lr_functions->set_view_lotus(
value = if_salv_c_bool_sap=>false ).
* customer defined function:
* display occupied seats columns most left
* and highlight them
* IF pa_cont = 'X'.
* l_icon = icon_insert_row.
* l_text = text-tot.
* l_tooltip = text-ttt.
* TRY.
* CALL METHOD lr_functions->add_function
* EXPORTING
* name = 'REORDER'
* icon = l_icon
* text = l_text
* tooltip = l_tooltip
* position = if_salv_c_function_position=>right_of_salv_functions.
* CATCH cx_salv_existing INTO l_except1.
* l_text1 = l_except1->get_text( ).
* MESSAGE i000 WITH l_text1.
* LEAVE LIST-PROCESSING.
* CATCH cx_salv_wrong_call INTO l_except2.
* l_text1 = l_except2->get_text( ).
* MESSAGE i000 WITH l_text1.
* LEAVE LIST-PROCESSING.
* ENDTRY.
* ENDIF.
ENDFORM. " sub_set_functions
*& Form sub_set_events
* text
* -->P_ALV text
FORM sub_set_events USING p_alv TYPE REF TO cl_salv_table.
DATA: lr_event TYPE REF TO cl_salv_events_table.
* get the EVENT object
lr_event = p_alv->get_event( ).
SET HANDLER :
lcl_handler=>on_added_function FOR lr_event,
lcl_handler=>on_double_click FOR lr_event,
lcl_handler=>on_link_click FOR lr_event.
ENDFORM. " sub_set_events
*& Form sub_set_header
* -->P_ALV text
FORM sub_set_header
USING p_alv TYPE REF TO cl_salv_table.
DATA: lr_grid TYPE REF TO cl_salv_form_layout_grid.
* 1st step: create the grid object
CREATE OBJECT lr_grid.
* 2nd step: add some text items
lr_grid->create_header_information( row = 1 column = 1
text = 'Flight List Grp ##'(fll) ).
lr_grid->create_text( row = 2 column = 1
text = 'Please check utilization'(uti) ).
* 3rd step: declare grid as header of list
p_alv->set_top_of_list( value = lr_grid ).
ENDFORM. " sub_set_header
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SALV_TABLE_STANDARD'.
SET TITLEBAR 'T100'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module create_control OUTPUT
* text
MODULE create_control OUTPUT.
IF vref_cont IS NOT BOUND.
* create container control
* and link it to the dynpro
CREATE OBJECT vref_cont
EXPORTING
container_name = 'MY_CONTAINER'
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'Error when creating the container object'.
ENDIF.
* create ALV and
* link it to the container control
TRY.
cl_salv_table=>factory(
EXPORTING
r_container = vref_cont
IMPORTING
r_salv_table = vref_alv
CHANGING
t_table = i_sflight ).
CATCH cx_salv_msg INTO oref_error.
l_text_alv_e = oref_error->get_text( ).
MESSAGE i000 WITH l_text_alv_e.
LEAVE LIST-PROCESSING.
ENDTRY.
* display ALV
vref_alv->display( ).
ENDIF.
ENDMODULE. " create_control OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
SET SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module exit INPUT
* text
MODULE exit INPUT.
SET SCREEN 0.
ENDMODULE. " exit INPUT -
Problem with ALV search help Dictionary Search Help
Hello experts
I have a problem with ALV search help.
I use DDIC table ZXXX with text table ZXXX_T. I created DDIC search help form table ZXXX. In my WD application, in context on COMPONENTCONTROLLER i set on attribute: 'Input help mode' as 'Dictionary Search Help' and in 'Dictionary Search Help' I pass name of new created DDIC search help.
I create a input field from that atrribute and search help works fine (there was a value and description for value from text table). So I created ALV witch contains that attribute too.
Next I set column for this attribute in ALV as editable but on Serch help for this collumn I have only value. I DON'T HAVE TEXT DESCRIPTION FOR VALUE.
Please help me and tell me what I do wrong?
MikoHello,
Thank's for your help. I create DDic Search help for all fields from my ALV. Next I changed 'TYPE' for all ALV fields in COMPONENTCONTROLLER from ZXXX-Zfield to Zfield, and I changed 'Input help mode' from 'Automatic' to 'Dictionary Search Help'. Now I see Value and Description for value in Search Help in my ALV.
Regards
Miko -
Webdyn Pro - Grey out certain rows in ALV?
Hi guys,
I'm quite new to webdyn pro. So please bear with me
I've a webdyn pro component which displays a simple alv output on screen.
I have a requirement where I need to check if lets say Status = 1 or 2 or 3 or 4.
If its either one of those status, grey out those row.
How I'm displaying it is
node_searchinfo = wd_context->get_child_node( name = `SEARCH_DATA` ).
node_searchinfo->bind_table( it_searchdata ).Hi,
You can add new attribute "CellDesign" of type WDUI_TABLE_CELL_DESIGN to your structure.
bind this attribute to alv columns cell design. Something like this
field-symbols <wa_colum> like line of lt_columns.
lt_columns = l_table->if_salv_wd_column_settings~get_columns( ).
loop at lt_columns[] assigning <wa_colum>.
<wa_colum>-r_column->set_cell_design_fieldname( value = 'CELLDESIGN' ).
endloop.
fill the celldesign value 00 (standard) and according to your status fill celldesign value (see domain WDUI_TABLE_CELL_DESIGN ).
This has been discussed many times in SCN , so you could easily find resources if you do a search. -
Hi All,
I need to display three tables using alv.
i have used one alv component in my application.
In my context i have three nodes ( for three tables )
when i am trying to map one node of my component control to 'DATA' of alv component
its working fine. i am getting the data of one table .
Now , my problem is for the remainig two tables . how these two nodes are mapped for the same alv 'DATA' attribute of alv component.
Whether i need to create two more alv components or Is there any possible to dynamic mapping ?
Thanks and Regards,
sravan.Hi Sravan,
Now , my problem is for the remainig two tables . how these two nodes are mapped for the same alv 'DATA' attribute of alv component
You cann't map the multiple context nodes to the DATA node of interface controller.You have to declare 3 component usages.
or
you want to set the map the dynamically then use this code.
data:l_ref_interfacecontroller type ref to iwci_salv_wd_table.
l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
l_ref_interfacecontroller->set_data( lo_node ). -
Saving AVL view settings for all users
Hi,
I am working on web dynpro abap application which shows alv results of more reports (you will select report and it will show the alv table result).
I have to use some standard reports for this, so I copied it to Z report and modify it so this is possible. Problem I have is that is standard report the output have maybe 10 columns, but the table I got from the report has maybe 26. I want to limit shown columns on the ALV with settings of view for alv, but the assignment is only possible for the user.
Is there any way how to create one view settings and make it initial for all users?
I know there is a way of modifying the standard view via abap code, but I want to keep the possibility to show all fields if required.
Thanks for your help very much.
MartinHi,
another problem, I was expecting the newly created variant / layout / settings for view would be tied to the displayed table (which sounds kind of wired as I wrote it down).
But since I am displaying different tables in the same UI element and binding the tables and their structures dynamically the created variant applies to all of the tables (or thats how it seems) so the table which have all fields different then the layout shows nothing.
Do you have any ideas how to get around it?
My idea would be to store the layout (but i have no idea how it looks at db level) and identification of the report to some customer table and fill attribute of alv table dynamically according to used report. But thats just my idea, I have no idea if it si possible to do it like this.
Is there some other way how to accomplish this functionality?
I have also tried to do it on fieldcatalog level of the alv table, but it seems to show first, let's say, 8 fields if there is 8 fields in the fieldcatalog.
Any help or ideas please??
Thanks
Martin
Edited by: Martin Gabris on May 6, 2011 4:11 PM -
Dynamic ALV with Static and Dynamic attributes
Hi All,
In my requirement we have some 5 static attributes and rest attributes needs needs to be dynamically created based upon the input selections. for eg my input for start date and end date is between 201023 to 201152 then weeks between this range should apear as dynamic columns.
i am able to create a dummy alv table display with out populating data into it but unable to set the data to it . Kindly help me in solving this issue.
Regards,
Sana.You might have created a dynamic node, bind the data to this node and after that use the SET_DATA method of ALV interface controller to set the data by passing the dynamically created node.
-
Saving Layout's attributes after refresh ALV
Hello,
I use CL_SALV_TABLE class for ALV printing.
I start the ALV with Layout variant which has sort & other attributes.
From the ALV screen I run other screens and when I go back to ALV screen,
I refresh the ALV table --> gr_table->refresh( ), to have updated data.
The problem is that after refreshing the table, it forgets the Layout attributes and
Don't sort as it requires in the specified layout.
What I have to do for save the layout attributes?
Thank you for your help,
FaribaIf you set
wa_layout-NO_TOOLBAR = 1.
it won't work
but try
wa_layout-NO_TOOLBAR = 'X'.
- it works -
Oops alv no_zero and 'word wrap' in fieldcatalog
Hi All,
I have 2 queations
1) Can I have word wrap option in alv, ie any option to display the same cell information in multiple lines and
2) I am trying to use no_zero of fieldcatalog as shown in below code
wa_billets_fcat-fieldname = 'ACTUAL_QTY'.
wa_billets_fcat-inttype = 'C'.
wa_billets_fcat-outputlen = '13'.
wa_billets_fcat-coltext = 'Actual Qty'.
wa_billets_fcat-seltext = 'Actual Qty'.
wa_billets_fcat-edit = 'X'.
wa_billets-no_zero = 'X'.
APPEND wa_billets_fcat TO billet_fcat.
CLEAR wa_billets_fcat.
but it is giving the error as bellow
Field "WA_BILLETS-NO_ZERO" is unknow. it is neither is one of the specified tables nor defined by a 'DATA" statement.
Please help me
Thanks in advance.hi check this....
wa_billets_fcat-fieldname = 'ACTUAL_QTY'.
wa_billets_fcat-reptext_ddic = 'Actual quantity'.
wa_billets_fcat-no_zero = 'X'.
APPEND wa_billets_fcat TO billet_fcat.
CLEAR wa_billets_fcat.
hope this will help for the word wrap..
http://www.sap-img.com/fu037.htm
regards,
venkat
Edited by: venkat appikonda on May 10, 2008 4:46 PM -
Attribute text_fieldname of alv field catalog
Hi all,
There is a attribute called text_fieldname in alv fieldcatalog(slis_fieldcat_alv) . Has anyone used it ? Or does anyone know its purpose?
Regards,
KavithaHai Kavitha,
TEXT_FIELDNAME : Field name of internal table field. You can use this field to define a reference to a field that is used as the description for the current field. If a subtotal is calculated for the current field, the ALV Grid Control displays the descriptions in the field assigned.
Example: Your output table contains one column for material numbers and one column for the description of what these numbers mean (such as clockwork). If you calculate subtotals for the material numbers, only these numbers are usually displayed as the subtotals text. Based on the link to TXT_FIELD , you can refer to the corresponding column with the material description. This description is then used as the subtotals text. -
Hello Experts,
we have upgraded our Dev System to ERP 6.0 EHP 7 SPS5 (coming from SPS4).
We had implement an example with an IDA ALV. On SPS4 we could make a "drill-down" to the single lines of grouped attributes. Now with SPS5 this is not possible anymore if the grouping is done for more than one attribute.
On the following screenshot it scan be seen that the grouping is done over a Peril attribute and the Currency. I can only make a drill-down via the peril attribute, so that the aggregated values per currency are displayed. ON SPS4 it was possible to make a further drill-down for the currency attribute, so that the different single lines were visible which were part of the grouping/aggregation.
SPS5 behavior:
SPS4 behavior:
I did not found any new settings which steers the behavior. Also I did not found any note which gives a hint that this is a bug.
Does anyone know if the behavior for that was changed and why?
Thx & Best regards,
FlorianHi Florian,
it is related with the currency field and it seems to be a bug. Please open a ticket to get the problem fixed. The component is BC-WD-CMP-ALV.
Cheers
Jens -
Editable ALV Dump: at setting non editable attribute
I have a problem with the ALV.
I have 2 fields in the ALV: a editable Key field and a non editable dependent text field.
I have binded a free programmed F4-Help at the key field.
In the F4Component I set the Key-field AND the text-field via :
lr_f4_context_element TYPE REF TO if_wd_context_element.
lr_f4_context_element = wd_comp_controller->listener->f4_context_element.
... set_static attribute.
The values are visible in the two alv columns.
But If I change the key after this manually I want to change the text field too.
I change at on eventhandler ON_DATA_CHECK trough set_static_attribute.
But I get later a dump for not assigned fieldsymbol:
Der Abbruch trat im ABAP-Programm "CL_SALV_WD_DATA_TABLE========
zwar in
"SET_TABLE_CELL_REF". Das Hauptprogramm war "SAPMHTTP ".
Im Quelltext befindet sich die Abbruchstelle in Zeile 8
des (Include-)Programms "CL_SALV_WD_DATA_TABLE=========CM00J".
1 method set_table_cell_ref.
2
3 field-symbols:
4 <l_value> type any.
5
6 assign r_value->* to <l_value>.
7
>>> me->set_table_cell(
9 index = index
10 attribute = attribute
11 value = <l_value> ).
12
13 endmethod.
How I can avoid the dump, but change the not editable text field, when the key field is changed?I could solve the problem with the context-mapping between the F4-component and the main-component.
The Approach to set data from the F4-Component to the main component directly was wrong!
Maybe you are looking for
-
Save for Web: line artifact at right edge
I've searched the forums and the Web for this one, but I can't find any answer. I'm currently in CS5, but I believe this was happening in CS4 and maybe earlier. When in the Save for Web dialogue (it doesn't matter what format I'm saving to or if tran
-
How Can I Get Rid Of This?
I've just downloaded a new toolbar and on my browser it doesn't show the top part of the page and there's a big line on the bottom and parts of the toolbar aren't showing up. It looks just like this: http://i.imgur.com/uRjCb6p.png Also whenever i scr
-
Can't hear playback with USB audio interface plugged in
I start Logic Pro 8 and then plug in Lexicon Lambda for a USB interface between guitar and macbook pro. With the Lambda plugged in I hear nothing from mac or headphone input on Lambda. If I unplug Lambda I can hear playback from mac just fine thru sp
-
Transfer Postings (350)
Hello QM gurus, I have a QM managed material. Is it possible to do transfer posting for this material in txn MIGO via movement type 350 (QI to Blocked stock)? Regards, @rul
-
HI All, I have installed oracle 10g r2. I would like to install OWB on my desktop. Could anybody share any installation document for that? Regards, sri