2007 May 24 8:04 PM
I have a grid embedded in a custom control. I have
inserted some code in a PBO event to modify
several column attributes of the grid. The code
does not throw any exceptions, but the changes are
not reflected in the rendered grid.
2007 May 24 9:30 PM
I think it has to do with this:
I am not using a table from the dictionary. Instead I am defining my own
table type within code.
And I believe there is some parameter that needs to be set to identify
the table as not coming from the dictionary.
I will do some more looking, but I am pretty sure this is the problem.
I think it has to do with this:
I am not using a table from the dictionary. Instead I am defining my own
table type within code.
And I believe there is some parameter that needs to be set to identify
the table as not coming from the dictionary.
I will do some more looking, but I am pretty sure this is the problem.
2007 May 24 8:25 PM
Cant say much about the error without seeing the code, but it is not activating somehow, so best will be refer to any BCALV_* report in SAP only and check for it.
Regards,
Amit
<b><REMOVED BY MODERATOR></b>
Message was edited by:
Alvaro Tejada Galindo
2007 May 24 8:25 PM
Hi,
I mean you are describing about table control i.e., GRID which u r referring, what kind of attributes you are changing ? elaborate.
thanks,
sksingh
2007 May 24 8:32 PM
2007 May 24 8:40 PM
Usually we used to modify the fieldcatalog for changing the attributes. Are doing the same ?
aRs
2007 May 24 8:41 PM
Here is some of the code in the PBO.
data salv_columns type ref to cl_salv_columns_table.
data salv_column type ref to cl_salv_column.
salv_columns = processed_salv_table->get_columns( ).
TRY.
salv_column = salv_columns->get_column( 'LINE_NUMBER' ).
salv_column->set_visible( if_salv_c_bool_sap=>false ).
salv_column->set_technical( if_salv_c_bool_sap=>false ).
CATCH cx_salv_not_found.
ENDTRY.
2007 May 24 8:56 PM
2007 May 24 9:05 PM
As you can see in this simple example program, the setting of the attributes works fine. I have a screen 100 here with a single container in the dynpro called "CONTAINER'.
REPORT zrich_001.
DATA: ispfli TYPE TABLE OF spfli.
DATA: container TYPE REF TO cl_gui_custom_container.
DATA: gr_table TYPE REF TO cl_salv_table.
DATA: gr_functions TYPE REF TO cl_salv_functions.
DATA: gr_display TYPE REF TO cl_salv_display_settings.
DATA: gr_columns TYPE REF TO cl_salv_columns_table.
DATA: gr_column TYPE REF TO cl_salv_column.
START-OF-SELECTION.
SELECT * INTO TABLE ispfli FROM spfli.
CALL SCREEN 100.
*
*&---------------------------------------------------------------------*
*& Module PBO OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE pbo OUTPUT.
CREATE OBJECT container
EXPORTING container_name = 'CONTAINER'.
cl_salv_table=>factory( EXPORTING r_container = container
IMPORTING r_salv_table = gr_table
CHANGING t_table = ispfli ).
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ).
gr_columns = gr_table->get_columns( ).
gr_column = gr_columns->get_column( 'CITYTO' ).
gr_column->set_visible( if_salv_c_bool_sap=>false ).
gr_column->set_technical( if_salv_c_bool_sap=>false ).
gr_table->display( ).
ENDMODULE. " PBO OUTPUT
*&---------------------------------------------------------------------*
*& Module PAI INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE pai INPUT.
ENDMODULE. " PAI INPUT
REgards,
RIch Heilman
2007 May 24 9:11 PM
I have used the code in another application with no problems.
The problem arises when putting the grid
into a container. The grid is created in the PBO event, and I have
tried setting the column attributes inside the same PBO event, but
with no luck.
I have stepped into the code and see that the changelist is properly
updated with the coded requests. I have also tried putting the requested
changes in a PAI event just to test it. But again no luck here either.
2007 May 24 9:18 PM
2007 May 24 9:30 PM
I think it has to do with this:
I am not using a table from the dictionary. Instead I am defining my own
table type within code.
And I believe there is some parameter that needs to be set to identify
the table as not coming from the dictionary.
I will do some more looking, but I am pretty sure this is the problem.
2007 May 24 9:43 PM
That senario seems to be working for me too.
REPORT zrich_001.
Types: begin of tspfli.
include type spfli.
Types: line_number(6) type n.
Types: end of tspfli.
DATA: ispfli TYPE TABLE OF tspfli.
data: xspfli like line of ispfli.
DATA: container TYPE REF TO cl_gui_custom_container.
DATA: gr_table TYPE REF TO cl_salv_table.
DATA: gr_functions TYPE REF TO cl_salv_functions.
DATA: gr_display TYPE REF TO cl_salv_display_settings.
DATA: gr_columns TYPE REF TO cl_salv_columns_table.
DATA: gr_column TYPE REF TO cl_salv_column_table.
START-OF-SELECTION.
SELECT * INTO TABLE ispfli FROM spfli.
Loop at ispfli into xspfli.
xspfli-line_number = sy-tabix.
modify ispfli from xspfli index sy-tabix.
endloop.
CALL SCREEN 100.
*
*&---------------------------------------------------------------------*
*& Module PBO OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE pbo OUTPUT.
CREATE OBJECT container
EXPORTING container_name = 'CONTAINER'.
cl_salv_table=>factory( EXPORTING r_container = container
IMPORTING r_salv_table = gr_table
CHANGING t_table = ispfli ).
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ).
gr_columns = gr_table->get_columns( ).
gr_column ?= gr_columns->get_column( 'LINE_NUMBER' ).
gr_column->set_long_text( 'Line Number' ).
gr_column->set_visible( if_salv_c_bool_sap=>false ).
gr_column->set_technical( if_salv_c_bool_sap=>false ).
gr_table->display( ).
ENDMODULE. " PBO OUTPUT
*&---------------------------------------------------------------------*
*& Module PAI INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE pai INPUT.
ENDMODULE. " PAI INPUT
Regards,
Rich Heilman
2007 May 24 9:32 PM
Hi,
Make force triiggering of PBO using
call method cl_gui_cfw=>set_new_ok_code
exporting
new_code = 'DUMY'.
Thanks
aRs
2007 May 24 10:40 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |