Problem with grid display in ALV for dynamic internal tables
Hi,
I am using dynamic internal tables in my program. To display it in grid format after populating it, I have used the following class and method. Here Im getting sy-subrc = 0 but, the grid is not getting displayed. Can some one pls help me with this.,
DATA: W_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: w_tabname TYPE w_tabname.
CREATE OBJECT W_GRID
EXPORTING I_PARENT = CL_GUI_CONTAINER=>SCREEN0.
CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = W_TABNAME
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = <FS_1>
IT_FIELDCATALOG = LT_FIELDCATALOG2
IT_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.
Here, <FS_1> is the field symbol of table type and it holds all my data. and LT_FIELDCATALOG2 is the structure of my fieldcatalog
Thanks and Regards,
Avinash
Hi Avinash,
Either use parameter
I_STRUCTURE_NAME = W_TABNAME
or
IT_FIELDCATALOG = LT_FIELDCATALOG2
Both are not required.
At the end of ur program simply use a write statement like below. Your program will work.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Write /. <----
Thanks,
Edited by: Sap Fan on Oct 6, 2009 7:17 AM
Similar Messages
-
Help on ALV GRID display outputting format for 2 internal tables
Hi,
I have requirement in ALV GRID where I need to display the data from 2 internal tables. The first internal table has the content of Delivery due list data and second the internal table has the corresponding stock transfer data of the Delivery Due list. I have a checbox on my selection screen, when unchecked it should output the 1st internal table data, i.e for Delivery due list. When it is checked then it should output 1st Internal table data + 2nd internal table data of stock transfer. For example, 1 document delivery due list data and 2nd line for that document should show the stock transfer data. You can also check the transaction code VL10E for that will show a delivery due list...and for stock tranfer,you need to check with Purchase order in in the USer Role tabstrip. Pls suggest.
Regards,
MiraHi,
U can try out this code
REPORT zzz_test NO STANDARD PAGE HEADING
MESSAGE-ID zz.
The Data Declarations
INCLUDE zzm_test_alv_data.
The Selection Screen Definition
INCLUDE zzm_test_alv_selscrn.
The definition and implementation of the event reciever class
INCLUDE zzm_test_alv_class.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM f1000_load_itabs.
END-OF-SELECTION
END-OF-SELECTION.
IF NOT cb_disp IS INITIAL.
CALL SCREEN 9001.
ENDIF.
Include for getting data
INCLUDE zzm_test_alv_forms.
Include for PAI and PBO of screen
INCLUDE zzm_test_alv_screen.
INCLUDE ZZM_TEST_ALV_DATA *
This include has all the data declaration defined
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
Table Declarations:
TABLES: mara,
makt.
Internal Tables:
The following structure type must be defined in the data dictionary
DATA: i_fieldcat TYPE lvc_t_fcat,
i_fieldcat1 TYPE lvc_t_fcat,
i_output1 TYPE STANDARD TABLE OF mara,
i_output2 TYPE STANDARD TABLE OF makt,
Work Areas:
w_output1 TYPE STANDARD TABLE OF mara,
w_output2 TYPE STANDARD TABLE OF makt.
Variable:
DATA: lv_repid LIKE sy-repid.
lv_repid = sy-repid.
INCLUDE ZZM_TEST_ALV_SELSCRN *
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
SELECTION-SCREEN BEGIN OF BLOCK b_main WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 1.
PARAMETERS: cb_disp AS CHECKBOX.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN END OF BLOCK b_main.
INCLUDE ZZM_TEST_ALV_CLASS *
This include has all the data declaration defined for ALV
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
INCLUDE <icon>.
Predefine a local class for event handling to allow the
declaration of a reference variable before the class is defined.
DATA : o_alvgrid1 TYPE REF TO cl_gui_alv_grid ,
o_alvgrid2 TYPE REF TO cl_gui_alv_grid ,
cont_for_cognos1 TYPE scrfname VALUE 'BCALC_GRID_01_9100',
cont_for_cognos2 TYPE scrfname VALUE 'BCALC_GRID_01_9200',
custom_container1 TYPE REF TO cl_gui_custom_container,
custom_container2 TYPE REF TO cl_gui_custom_container,
Work Area
w_layout TYPE lvc_s_layo ,
w_variant TYPE disvariant.
Constants
CONSTANTS : c_lay(1) TYPE c VALUE 'A' . " All Layouts
CONSTANTS: BEGIN OF c_main_tab,
tab1 LIKE sy-ucomm VALUE 'MAIN_TAB_FC1', "
tab2 LIKE sy-ucomm VALUE 'MAIN_TAB_FC2', "
END OF c_main_tab.
INCLUDE ZZM_TEST_ALV_FORMS *
This Include has the various forms used in the program
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
*& Form f9001_build_field_cat
To Build Field Catalog
-->P_I_FIELDCAT text
-->P_0021 text
FORM f9001_build_field_cat TABLES p_fieldcat STRUCTURE lvc_s_fcat
USING value(p_structure).
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_structure
CHANGING
ct_fieldcat = p_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE i005 WITH 'Error in ALV field catalogue creation'.
" text-e05.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " f9001_build_field_cat
*& Form f9000_objects_create
For creating Custom Containers
--> p1 text
<-- p2 text
FORM f9000_objects_create.
CREATE OBJECT custom_container1
EXPORTING
container_name = cont_for_cognos1
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
CREATE OBJECT custom_container2
EXPORTING
container_name = cont_for_cognos2
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = lv_repid
txt2 = sy-subrc
txt1 = 'The control could not be created'(510).
ENDIF.
CREATE OBJECT o_alvgrid1
EXPORTING i_parent = custom_container1.
CREATE OBJECT o_alvgrid2
EXPORTING i_parent = custom_container2.
ENDFORM. " f9000_objects_create
*& Form f9003_layout
To define the layout
-->P_SY_TITLE text
-->P_0030 text
-->P_0031 text
-->P_0032 text
FORM f9003_layout USING value(ptitle)
value(pzebra)
value(pmode)
value(pwidth).
w_layout-grid_title = ptitle.
w_layout-zebra = pzebra.
w_layout-sel_mode = pmode.
w_layout-cwidth_opt = pwidth.
w_variant-report = sy-repid.
ENDFORM. " f9003_layout
*& Form f9006_error_handle
To handle event
-->P_PTEXT text
FORM f9006_error_handle USING value(ptext).
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = text-e03 " Error Note
txt2 = sy-subrc
txt1 = ptext.
ENDIF.
ENDFORM. " f9006_error_handle
FORM EXIT_PROGRAM *
FORM exit_program.
CALL METHOD custom_container1->free.
CALL METHOD custom_container2->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = lv_repid
txt2 = sy-subrc
txt1 = 'Error in FLush'(500).
ENDIF.
ENDFORM.
*& Form f1000_load_itabs
Select from Database
--> p1 text
<-- p2 text
form f1000_load_itabs.
SELECT * FROM mara
INTO TABLE i_output1
UP TO 50 rows.
SELECT * FROM makt
INTO TABLE i_output2
UP TO 50 rows.
endform. " f1000_load_itabs
INCLUDE ZZM_TEST_ALV_SCREEN *
2/ Description / Include functions
This include contains PBO and PAI events for the screen of report
ZZZJJ_TEST_ALV
3/ Responsibility
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
DATA FOR TABSTRIP 'MAIN_TAB'
CONTROLS: main_tab TYPE TABSTRIP.
DATA: BEGIN OF i_main_tab,
subscreen LIKE sy-dynnr,
prog LIKE sy-repid VALUE
'ZZZ_TEST',
pressed_tab LIKE sy-ucomm VALUE c_main_tab-tab1,
END OF i_main_tab.
*& Module STATUS_9001 OUTPUT
text
MODULE status_9001 OUTPUT.
IF custom_container1 IS INITIAL.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'ZTITLE'.
Creating Object
PERFORM f9000_objects_create.
Building the field catalog
PERFORM f9001_build_field_cat TABLES i_fieldcat
USING 'MARA'.
PERFORM f9001_build_field_cat TABLES i_fieldcat1
USING 'MAKT'.
Modifying the field catalog
PERFORM f9002_modify_field_cat TABLES i_fieldcat.
For Layout
PERFORM f9003_layout USING sy-title 'X' 'B' 'X'.
ENDIF.
ENDMODULE. " STATUS_9001 OUTPUT
*& Module MAIN_TAB_ACTIVE_TAB_SET OUTPUT
Call method to display in the output grid
MODULE main_tab_active_tab_set OUTPUT.
main_tab-activetab = i_main_tab-pressed_tab.
CASE i_main_tab-pressed_tab.
WHEN c_main_tab-tab1.
To display report
i_main_tab-subscreen = '9100'.
CALL METHOD o_alvgrid1->set_table_for_first_display
EXPORTING
is_variant = w_variant
i_save = c_lay
is_layout = w_layout
CHANGING
it_outtab = i_output1[]
it_fieldcatalog = i_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i000 WITH text-e06."Error in ALV report display
LEAVE LIST-PROCESSING.
ENDIF.
WHEN c_main_tab-tab2.
To display report
i_main_tab-subscreen = '9200'.
CALL METHOD o_alvgrid2->set_table_for_first_display
EXPORTING
is_variant = w_variant
i_save = c_lay
is_layout = w_layout
CHANGING
it_outtab = i_output2[]
it_fieldcatalog = i_fieldcat1[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i005 WITH text-e06."Error in ALV report display
LEAVE LIST-PROCESSING.
ENDIF.
WHEN OTHERS.
DO NOTHING
ENDCASE.
ENDMODULE. MAIN_TAB_ACTIVE_TAB_SET OUTPUT
*& Module MAIN_TAB_ACTIVE_TAB_GET INPUT
Check & Process the selected Tab
MODULE main_tab_active_tab_get INPUT.
CASE sy-ucomm.
WHEN c_main_tab-tab1.
i_main_tab-pressed_tab = c_main_tab-tab1.
WHEN c_main_tab-tab2.
i_main_tab-pressed_tab = c_main_tab-tab2.
WHEN OTHERS.
DO NOTHING
ENDCASE.
ENDMODULE. MAIN_TAB_ACTIVE_TAB_GET INPUT
*& Module USER_COMMAND_9001 INPUT
User Command
MODULE user_command_9001 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
PERFORM exit_program.
SET SCREEN '0'.
WHEN 'EXIT' OR 'CANC'.
PERFORM exit_program.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. USER_COMMAND_9000 INPUT
*& Module MAIN_TAB_ACTIVE_TAB_SET INPUT
Set sunscreen
MODULE main_tab_active_tab_set INPUT.
main_tab-activetab = i_main_tab-pressed_tab.
CASE i_main_tab-pressed_tab.
WHEN c_main_tab-tab1.
i_main_tab-subscreen = '9100'.
WHEN c_main_tab-tab2.
i_main_tab-subscreen = '9200'.
WHEN OTHERS.
DO NOTHING
ENDCASE.
ENDMODULE. MAIN_TAB_ACTIVE_TAB_SET INPUT
Thanks & Regards,
Judith. -
Dynamic Alv for Dynamic Internal Table
Hi All,
I am new for abap dynpro.
How can i create a dynamic alv table in abap dynpro withoud ddic structure??
My requirement is as follows:
I have a table having some field e.g MATNR WERKS NETWR.
I want to pivot data werks and to display in webdynpro alv.
Thnx:
N. N. TiwariYou can use the RTTI to build up a dynamic structure in memory:
Something like this - where both the data and its structure and meta data all come from an external source (which happens to be MDM in this case):
****ALV
data:
rootnode_info type ref to if_wd_context_node_info,
dyn_node type ref to if_wd_context_node,
dyn_node_info type ref to if_wd_context_node_info,
tabname_node type ref to if_wd_context_node,
current_tablename type string,
tablename type string,
struct_type type ref to cl_abap_structdescr,
table_type type ref to cl_abap_tabledescr,
comp_tab type cl_abap_structdescr=>component_table,
comp like line of comp_tab,
my_table type ref to data,
my_row type ref to data.
field-symbols: <table> type table,
<row> type data,
<f> type any,
<wa_string> type string,
<wa_date_time> type mdm_cdt_date_time,
<wa_integer> type mdm_gdt_integervalue.
rootnode_info = wd_context->get_node_info( ).
* create subnode_info
try.
rootnode_info->remove_child_node( 'MDM_DATA' ).
catch cx_wd_context.
endtry.
field-symbols <wa_detail> like line of field_details.
field-symbols <wa_result> like line of result_set.
field-symbols <wa_pair> type mdm_name_value_pair.
read table result_set assigning <wa_result> index 1.
loop at field_details assigning <wa_detail>.
* build a structure description from the list of single fields
if strlen( <wa_detail>-field_code ) > 30.
comp-name = <wa_detail>-field_code+0(30).
else.
comp-name = <wa_detail>-field_code.
endif.
if <wa_result> is assigned.
read table <wa_result>-name_value_pairs assigning <wa_pair>
with key code = <wa_detail>-field_code.
if sy-subrc = 0.
case <wa_pair>-type.
when `MDM_CDT_DATE_TIME`.
comp-type ?= cl_abap_datadescr=>describe_by_name( 'TZNTSTMPL' ).
when `MDM_GDT_INTEGERVALUE`.
if <wa_detail>-field_lookup_table is not initial.
comp-type ?= cl_abap_datadescr=>describe_by_name( 'STRING' ).
else.
comp-type ?= cl_abap_datadescr=>describe_by_name( 'INT4' ).
endif.
when others.
comp-type ?= cl_abap_datadescr=>describe_by_name( <wa_pair>-type ).
endcase.
else.
comp-type ?= cl_abap_datadescr=>describe_by_name( 'STRING' ).
endif.
else.
comp-type ?= cl_abap_datadescr=>describe_by_name( 'STRING' ).
endif.
append comp to comp_tab.
endloop.
struct_type = cl_abap_structdescr=>create( comp_tab ).
dyn_node_info = rootnode_info->add_new_child_node(
name = 'MDM_DATA'
is_mandatory = abap_false
is_mandatory_selection = abap_false
static_element_rtti = struct_type
is_multiple = abap_true
is_static = abap_false ).
* get instance of new node
dyn_node = wd_context->get_child_node( name = 'MDM_DATA' ).
****Process Table Data
data content_string type string.
data l_tabix type sytabix.
table_type = cl_abap_tabledescr=>create( p_line_type = struct_type ).
create data my_table type handle table_type.
assign my_table->* to <table>.
loop at result_set assigning <wa_result>.
create data my_row type handle struct_type.
assign my_row->* to <row>.
loop at field_details assigning <wa_detail>.
l_tabix = sy-tabix.
read table <wa_result>-name_value_pairs assigning <wa_pair>
with key code = <wa_detail>-field_code.
* loop at <wa_result>-name_value_pairs assigning <wa_pair>.
if sy-subrc = 0 and <wa_pair>-value is not initial.
assign component l_tabix of structure <row> to <f>.
* READ TABLE field_details ASSIGNING <wa_detail> INDEX sy-tabix.
case <wa_pair>-type.
when 'STRING'.
assign <wa_pair>-value->* to <wa_string>.
if <wa_string> is assigned.
* DATA: int TYPE i VALUE 258.
* DATA: buffer TYPE xstring,
* text_buffer TYPE string,
* conv TYPE REF TO cl_abap_conv_out_ce.
* conv = cl_abap_conv_out_ce=>create(
* encoding = 'UTF-8'
* endian = 'L' ).
* CALL METHOD conv->write( data = <wa_string> ).
* buffer = conv->get_buffer( ).
* DATA: convin TYPE REF TO cl_abap_conv_in_ce.
* CALL METHOD cl_abap_conv_in_ce=>create
* EXPORTING
* input = buffer
* RECEIVING
* conv = convin.
* CALL METHOD convin->read
* IMPORTING
* data = text_buffer.
* MOVE text_buffer TO <f>.
move <wa_string> to <f>.
endif.
when 'MDM_CDT_DATE_TIME'.
assign <wa_pair>-value->* to <wa_date_time>.
if <wa_date_time> is assigned.
move <wa_date_time>-content to <f>.
endif.
when 'MDM_GDT_INTEGERVALUE'.
assign <wa_pair>-value->* to <wa_integer>.
if <wa_integer> is assigned.
if <wa_detail>-field_lookup_table is not initial.
content_string = wd_assist->perform_value_lookup(
i_lookup_table = <wa_detail>-field_lookup_table
i_lookup_key = <wa_integer> ).
move content_string to <f>.
else.
move <wa_integer> to <f>.
endif.
endif.
endcase.
endif.
endloop.
append <row> to <table>.
endloop.
dyn_node->bind_table( <table> ).
* Connect to the component Usage of the ALV
data: l_ref_cmp_usage type ref to if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
if l_ref_cmp_usage->has_active_component( ) is initial.
l_ref_cmp_usage->create_component( ).
endif.
* Through the interface controller of the ALV Component set the DATA node dynamically
data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .
l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
l_ref_interfacecontroller->set_data(
r_node_data = dyn_node ).
data alv_model type ref to cl_salv_wd_config_table.
alv_model = l_ref_interfacecontroller->get_model( ).
data columns type salv_wd_t_column_ref.
field-symbols <wa_column> like line of columns.
columns = alv_model->if_salv_wd_column_settings~get_columns( ).
data column_id type string.
data header type ref to cl_salv_wd_column_header.
data l_text type string.
loop at field_details assigning <wa_detail>.
* build a structure description from the list of single fields
if strlen( <wa_detail>-field_code ) > 30.
column_id = <wa_detail>-field_code+0(30).
else.
column_id = <wa_detail>-field_code.
endif.
translate column_id to upper case.
read table columns assigning <wa_column> with table key id = column_id.
if sy-subrc = 0.
header = <wa_column>-r_column->get_header( ).
header->set_ddic_binding_field( if_salv_wd_c_column_settings=>ddic_bind_none ).
* if <wa_detail>-field_lookup_table is initial.
header->set_text( <wa_detail>-field_name1 ).
* else.
* l_text = wd_assist->read_table_desc_for_lookup( <wa_detail>-field_lookup_table ).
* header->set_text( l_text ).
* endif.
endif.
endloop.
catch cx_root into o_except.
data: l_current_controller type ref to if_wd_controller,
l_message_manager type ref to if_wd_message_manager.
l_current_controller ?= wd_this->wd_get_api( ).
l_message_manager = l_current_controller->get_message_manager( ).
l_message_manager->report_exception(
message_object = o_except ).
endtry. -
How to populate field catalogue fields in ALV using dynamic internal table
Hi All,
Please let me know how to populate field catalogue fields in ALV using dynamic internal table.
I have created <dyn_table> using code below.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = g_t_ifc
it_fieldcatalog = g_t_fieldcat
IMPORTING
ep_table = dy_table.
ASSIGN dy_table->* TO <dyn_table>.
Create dynamic work area and assign to FS
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
Now this <dyn_table> has fields like idoc no.,creation date ,
segment field 1, segment field 2 etc..Now idoc no.,creation date are static fields from table EDIDC. And segment field 1, segment field 2 etc are dynamic fields from table EDSAPPL.
In my ALV report I am getting the final layout properly but I am unable to move values to corresponding fields in the final layout shown.Please let me know how to populate these fields from different tables.
I tried this way but its not working.
SORT g_t_edid4 BY docnum.
LOOP AT g_t_edidc INTO g_r_edidc.
READ TABLE g_t_edid4 into g_r_edid4
WITH KEY docnum = g_r_edidc-docnum
BINARY SEARCH.
IF sy-subrc = 0.
<dyn_wa> = g_r_edid4-sdata.
MOVE-CORRESPONDING g_r_edid4 to <dyn_wa>.
CLEAR g_r_edid4.
ENDIF.
MOVE-CORRESPONDING g_r_edidc to <dyn_wa>.
APPEND <dyn_wa> TO <dyn_table>.You have to assign each field to field symbol and then assign the value to that field symbol and asssign that field symbol to workarea field symbol.
LOOP AT g_t_edidc INTO g_r_edidc.
READ TABLE g_t_edid4 into g_r_edid4
WITH KEY docnum = g_r_edidc-docnum
BINARY SEARCH.
IF sy-subrc = 0.
ASSIGN COMPONENT 'SDATA' OF STRUCTURE <DYN_WA> TO <DYN_FLD>.
<DYN_FLD> = g_r_edid4-sdata.
" <dyn_wa> = g_r_edid4-sdata.
" Assign each fields like this.
" MOVE-CORRESPONDING g_r_edid4 to <dyn_wa>.
CLEAR g_r_edid4.
ENDIF.
" MOVE-CORRESPONDING g_r_edidc to <dyn_wa>.
APPEND <dyn_wa> TO <dyn_table>.
Regards,
Naimesh Patel -
How to get the NameTab Structure(X031L) for Dynamic internal table?
when we pass standard table to the FM 'DD_GET_NAMETAB' we will get the
nametab structure(x031l), like this i want to get the same structure for
dynamic internal table . how can I achieve this
please help me...Hi,
try this method
REPORT zmaschl_create_data_dynamic .
TYPE-POOLS: slis.
DATA: it_fcat TYPE slis_t_fieldcat_alv,
is_fcat LIKE LINE OF it_fcat.
DATA: it_fieldcat TYPE lvc_t_fcat,
is_fieldcat LIKE LINE OF it_fieldcat.
DATA: new_table TYPE REF TO data.
DATA: new_line TYPE REF TO data.
FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
Build fieldcat
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' EXPORTING i_structure_name = 'SYST' CHANGING ct_fieldcat = it_fcat[]. LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial. MOVE-CORRESPONDING is_fcat TO is_fieldcat. is_fieldcat-fieldname = is_fcat-fieldname. is_fieldcat-ref_field = is_fcat-fieldname. is_fieldcat-ref_table = is_fcat-ref_tabname. APPEND is_fieldcat TO it_fieldcat. ENDLOOP.
Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table EXPORTING it_fieldcatalog = it_fieldcat IMPORTING ep_table = new_table.
Create a new Line with the same structure of the table.
ASSIGN new_table->* TO <l_table>.CREATE DATA new_line LIKE LINE OF <l_table>.ASSIGN new_line->* TO <l_line>.
Test it...
DO 30 TIMES.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
<l_field> = sy-index.
INSERT <l_line> INTO TABLE <l_table>.
ENDDO.
LOOP AT <l_table> ASSIGNING <l_line>.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
WRITE <l_field>.
ENDLOOP. -
Problem disalying alv using dynamic internal table
Hi All,
I have 4 radiobutton for each radiobutton there is one internaltable to be displayed in alv.
My requirement is intead of calling the function module reuse_alv_grid_display everytime for
each of the internal table I want to create a dynamic internal tble for the function module.
My question is how to create a dynamic internal table which will hold the fields & data of
different interna table when diffrent radiobuttons are checked.
Areciate your time to help.
Thank you very much.Hi follow following logic:
field-symbols: <i_table> type standard table.
when rb1 is checked.
assign itab1 to <i_table>.
perform alv_disp using <i_table>
when rb2 is checked.
assign itab2 to <i_table>.
perform alv_disp using <i_table>
when rb3 is checked.
assign itab3 to <i_table>.
perform alv_disp using <i_table>
when rb4 is checked.
assign itab4 to <i_table>.
perform alv_disp using <i_table>
<<<<<<<<<<form alv_disp
form alv_disp using p_i_table type standard table.
perform create fieldcatelog changing i_fc
call the fm and pass the table p_i_table and i_fc
<<<<<<<<<< form create fieldcaelog
here create field catelog ..either by fm reuse_alv_fieldcatelog_merge ...in this just pass the structure name based on the radiobutton
hope its useful -
To create a deep structure for dynamic internal table.
Hello
My ALV has fields which are defined dynamically during execution.
so, i did it in the following way,
Declared Field symbolds, DREF and fieldcatalog as,
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,
<fs_dyntable>.
DATA: dref_dyntab TYPE REF TO data,
dref_dynwa TYPE REF TO data.
DATA: ts_fieldcatalog TYPE lvc_t_fcat.
DATA: wa_fieldcatalog TYPE lvc_s_fcat.
Updated Fieldcatalog dynamically as,
*function module to read segment structure
CALL FUNCTION 'SEGMENT_READ'
EXPORTING
segmenttyp = v_segment_name
TABLES
segmentstructure = ts_seg_structure
EXCEPTIONS
no_authority = 1
segment_not_existing = 2
OTHERS = 3.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN '1'.
MESSAGE e024.
STOP.
WHEN '2'.
MESSAGE e025 WITH v_segment_name.
STOP.
WHEN OTHERS.
MESSAGE e023.
ENDCASE.
ENDIF.
*FETCH FIELDS FROM STRUCTURE OF SEGMENT AND CREATE FIELDCATALOG FOR
EACH FIELD OF SEGMENT (DYNAMIC FIELD CATALOG)
LOOP AT ts_seg_structure INTO wa_seg_structure.
ADD 1 TO v_counter.
wa_fieldcatalog-fieldname = wa_seg_structure-fieldname.
wa_fieldcatalog-col_pos = v_counter.
wa_fieldcatalog-ref_table = wa_seg_structure-segtyp.
APPEND wa_fieldcatalog TO ts_fieldcatalog.
CLEAR wa_fieldcatalog.
ENDLOOP.
and generated dynamic internal table using fieldcatalog as,
*--Method to get the structure of table using fieldcatalog.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = ts_fieldcatalog
IMPORTING
*--Variable of type REF TO DATA.
ep_table = dref_dyntab.
IF sy-subrc <> 0.
MESSAGE e023.
ENDIF.
*--Dynamic internal tables required when show segments selected
IF p_selseg IS NOT INITIAL.
ASSIGN dref_dyntab->* TO <t_dyntable>.
*--Create dynamic work area and assign to FS
CREATE DATA dref_dynwa LIKE LINE OF <t_dyntable>.
ASSIGN dref_dynwa->* TO <fs_dyntable>.
And then i populated this <t_dyntable> which is being passed as data-table to method
CL_GUI_ALV_GRID => SET_TABLE_FOR_FIRST_DISPLAY
for ALV grid Display along with above used filedcatalog ts_fieldcatalog.
Things are fine till here, but now i have the requirement to edit selected rows of the ALV display..
As you might be aware, we need a field
TS_STYLEROW TYPE lvc_t_styl, (i.e, a field of type 'h' and we can say as an internal table inside an internal table or else as a deep structure)
in the output internal table <t_dyntable> to meet our requirement.
My issue is about declaring one such field of type 'h' in this dynamically created internal table ''<t_dyntable>".
I tried in the following way by adding one such field to fieldcatalog :
*Field for Styling
ADD 1 TO v_counter.
wa_fieldcatalog-fieldname = 'TS_STYLEROW'.
wa_fieldcatalog-tabname = 'TS_STYLE'.
wa_fieldcatalog-col_pos = v_counter.
wa_fieldcatalog-no_out = 'X'.
wa_fieldcatalog-inttype = 'h'. " I even mentioned this
APPEND wa_fieldcatalog TO ts_fieldcatalog.
CLEAR wa_fieldcatalog.
But this is creating a field of type 'C' in the table <t_dyntable> instead of what i was expecting
Guyz and respected,
Please advice me with the solution or ur ideas....
Note : The overall requirement is create a deep structure for dynamically generated internal table.
Your help is highly appreciated and unforgettable..!!!!!!!hi,
Dynamic append
Dynamic internal table
Dynamic internal table
dynamic columns in ALV
Variant for dynamic selection
thanks -
Create a deep structure for dynamic internal table
Hi All,
I am creating a dynamic table using method cl_alv_table_create=>create_dynamic_table.
The normal structure gets created. but now I want to creat a Deep structure for having information of colors also for each column. So I want to add a COLTAB type LVC_T_SCOL for colors information .
How should I create this using above method?
Rgds,
MadhuriI created a zcelltab structure as below. But while creating dynamic internal table, I received the error with
'Type "ZCELLTAB" is unknown 68 ZCELLTAB-CELLTAB
Here is the code.
DATA: BEGIN OF ZCELLTAB,
CELLTAB LIKE LVC_S_STYL,
END OF ZCELLTAB.
FIELD-SYMBOLS <T_CELLTAB> TYPE LVC_T_STYL.
DATA : LT_CELLTAB TYPE LVC_T_STYL.
DATA: WA_CELLTAB TYPE LINE OF LVC_T_STYL.
DATA: GT_FCAT1 TYPE LVC_T_FCAT,
GW_FCAT1 TYPE LVC_S_FCAT,
GT_FCAT2 TYPE LVC_T_FCAT,
GW_FCAT2 TYPE LVC_S_FCAT.
After filling the FCAT1, I added the field in FCAT2 like below
GT_FCAT2[ ] = GT_FCAT1[ ].
G_TABIX = G_TABIX + 1.
GW_FCAT2-INTTYPE = 'C'.
MOVE G_TABIX TO GW_FCAT2-COL_POS.
GW_FCAT2-OUTPUTLEN = '10'.
GW_FCAT2-FIELDNAME = 'T_CELLTAB'.
GW_FCAT2-TABNAME = 'ZCELLTAB'.
GW_FCAT2-REF_FIELD = 'CELLTAB'.
GW_FCAT2-REF_TABLE = 'ZCELLTAB'.
APPEND GW_FCAT2 TO GT_FCAT2
CLEAR GW_FCAT2.
While calling the below method, the error with
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = GT_FCAT2
IMPORTING
EP_TABLE = GT_REQ.
ASSIGN GT_REQ->* TO <F_TAB>.
CREATE DATA GWA_REQ LIKE LINE OF <F_TAB>.
ASSIGN GWA_REQ->* TO <F_WA>.
LOOP AT ITAB.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <F_WA> TO <F_VAL>
<F_VAL> = ITAB-MATNR.
IF ITAB-MATNR IS INITIAL.
ASSIGN COMPONENT 'T_CELLTAB' OF STRUCTURE <F_WA> TO <T_CELLTAB>
CLEAR WA_CELLTAB.
WA_CELLTAB-FIELDNAME = 'MATNR'.
WA_CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
INSERT WA_CELLTAB INTO TABLE <T_CELLTAB>.
ENDIF.
APPEND <F_WA> TO <F_TAB>
ENDLOOP.
CALL METHOD GR_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_CONSISTENCY_CHECK = G_CONSISTENCY_CHECK
IT_TOOLBAR_EXCLUDING = G_EXCLUDE
I_SAVE = G_SAVE
I_DEFAULT = 'X'
IS_LAYOUT = G_LAYOUT
CHANGING
IT_OUTTAB = <F_TAB>
IT_FIELDCATALOG = F_CAT1.
Please let me know where I was wrong.
Should I remove the T_CELLTAB as the field name is not mentioned in the structure 'ZCELLTAB'.
Thanks,
Kumar.
Edited by: venn e on May 7, 2010 4:10 PM -
At end of field, for dynamic internal table entries ?
Dear All,
I've data in my dynamic internal table.
But, to understand in a better way I created a test program with static entries.
Case 1 -->
DATA: BEGIN OF itab OCCURS 0,
year TYPE char4,
name TYPE char10,
END OF itab.
DATA: BEGIN OF itab2 OCCURS 0 ,
year TYPE char4,
name TYPE char10,
count TYPE i,
END OF itab2.
DATA: gv_count TYPE i,
gv_flag TYPE char1.
itab-name = 'AAAA'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'AAAB'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'AAAC'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'AAAD'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBB'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBA'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBC'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBD'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCC'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCA'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCB'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCD'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCE'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCf'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDD'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDA'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDB'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDC'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDE'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
SORT itab BY year.
LOOP AT itab.
* Counter
gv_count = gv_count + 1.
AT END OF year.
itab2-count = gv_count.
MOVE-CORRESPONDING itab TO itab2.
APPEND itab2.
CLEAR gv_count.
WRITE:/ itab2-name,
itab2-year,
itab2-count.
CLEAR itab2.
CLEAR gv_flag.
ENDAT.
ENDLOOP.
Now for the above program the Output is :
Name Year Count
********** 2005 5
********** 2006 6
********** 2007 4
********** 2008 4
" Forget about the asterisk values as it's an example !
The above output is correct, But in my real case the table structure is not like the above .
The order of the field are in reverse.
i.e. The internal table is like this :
Case 2 -->
DATA: BEGIN OF itab OCCURS 0,
name TYPE char10,
year TYPE char4,
END OF itab.
DATA: BEGIN OF itab2 OCCURS 0 ,
name TYPE char10,
year TYPE char4,
count TYPE i,
END OF itab2.
In this case if I'm using at end of year the output is coming wrong.
Even on change of is also not working.
Request you guys to help me out so that I can achieve the same output as of case 1 with the table declaration as of CASE 2.
Regards,
Deepu.kHello Rich Heilman,
Again you came for my rescue ............
My code for this scenario is like this :
DATA: BEGIN OF itab OCCURS 0,
name TYPE char10,
year TYPE char4,
END OF itab.
DATA: BEGIN OF itab2 OCCURS 0 ,
name TYPE char10,
year TYPE char4,
count TYPE i,
END OF itab2.
DATA: gv_count TYPE i,
gv_flag TYPE char1.
itab-name = 'AAAA'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'AAAB'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'AAAC'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'AAAD'.
itab-year = '2008'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBB'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBA'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBC'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'BBBD'.
itab-year = '2007'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCC'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCA'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCB'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCD'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCE'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'CCCf'.
itab-year = '2006'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDD'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDA'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDB'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDC'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
itab-name = 'DDDE'.
itab-year = '2005'.
APPEND itab.
CLEAR itab.
SORT itab BY year.
LOOP AT itab.
* Counter
gv_count = gv_count + 1.
IF sy-tabix GT 1.
ON CHANGE OF itab-year.
itab2-count = gv_count.
MOVE-CORRESPONDING itab TO itab2.
APPEND itab2.
CLEAR gv_count.
WRITE:/ itab2-name,
itab2-year,
itab2-count.
CLEAR itab2.
CLEAR gv_flag.
ENDON.
ENDIF.
ENDLOOP.
The Output is :
DDDC 2005 2
CCCf 2006 4
BBBD 2007 6
AAAD 2008 4
The above output is wrong.
Can u correct me where I'm doing wrong ?
Regards,
Deepu.K -
Usage of 'Select for all entries' for dynamic internal tables..
Hi all,
I have a situation where I need to use select for all entries for a dynamic internal table.
select * from /BIC/AZHSD_O1500 into i_table for all entries in <b>Dynamic_table</b> where doc_number = <dynamic_table????????>
here iam not knowing how to match the <dynamic_table????????> doc_number ?
the dynamic_table contains the doc_number as one field.
here dynaimc_table is the internal table which is dynamic.
I have tried various options but couldnot find the solution.
Please resolve.
Sidhartha.data : i_dyn_where type char72 occurs 0.
field-symbols : <fs> type table.
assign itab[] to <fs>.
i_dyn_where = 'docno = <fs>-docno'.
append i_dyn_where.
select *
from vbak
into table t_vbak
for all entries in <fs>
where (I_dyn_where). "Populate this where condition dynamically too
Hope this will solve ur prob. -
Building Field-Catalog for dynamic internal tables
Hi All,
I created a dynamic internal table(<fs_final>,<fs_final_line>) and populated data into it.Now I want to provide field catalog to these dynamic internal table.
Can anyone suggest me the how to create a field catalog for existing dynamic internal table.Thanks in advance.
Regards,
Chakradhar.
Moderator message - Please use proper subject line in future.
Message was edited by: Suhas SahaUse this code to get all components of internal table.
Then build fieldcatlog.
DATA: tab_return type abap_compdescr_tab,
components like line of tab_return.
perform get_int_table_fields using <fs_it> changing tab_return.
loop at tab_return into components.
wa_fldcat-fieldname = components-name. "Field Name
wa_fldcat-scrtext_m = components-name. "Column Heading
wa_fldcat-inttype = components-type_kind. "Data Type
wa_fldcat-intlen = components-length. "Data Lenght
wa_fldcat-decimals = components-decimals. "Data Decimal Places
append wa_fldcat to it_fldcat.
endloop.
form get_int_table_fields using t_data type any table
changing t_return type abap_compdescr_tab.
data:
oref_table type ref to cl_abap_tabledescr,
oref_struc type ref to cl_abap_structdescr,
oref_error type ref to cx_root,
text type string.
*Get the description of data object type
try.
oref_table ?=
cl_abap_tabledescr=>describe_by_data( t_data ).
catch cx_root into oref_error.
text = oref_error->get_text( ).
write: / text.
exit.
endtry.
*Get the line type
try.
oref_struc ?= oref_table->get_table_line_type( ).
catch cx_root into oref_error.
text = oref_error->get_text( ).
write: / text.
exit.
endtry.
append lines of oref_struc->components to t_return.
endform.
Regards
Sreekanth -
Problem with format displayed in output while using Pivot table
Hi All,
I am using Pivot table in 10.1.3.4.1 version for displaying dynamic type data. Data is coming fine but it is coming in very strange format. I have following two tables in my RTF Template.
Table1 using Pivot table
!http://farm3.static.flickr.com/2570/4092137243_924cca92ca.jpg!
Table 2 - A normal table
!http://img5.imageshack.us/img5/6651/table3p.jpg!
In the output PDF, “Table 2” shows data fine but “Table 1” shows very strange kind of behaviour if the columns exceed more than 5 in “Table 1” . If columns in Pivot table output are more than 5[at present according to my Table1 size] then columns more than 5 are shown on next page after Table 2 instead of displaying inside outer table “Table1“. Anyone has any idea what is the reason behind this strange behavior and how can I avoid it ?
Thanks
-SookieHi All,
I tried including following piece of code in RTF as mentioned here: [http://winrichman.blogspot.com/2009/05/cross-tab-by-limiting-number-of-colums.html] but as a result it showed blank page in report. Nothing else.
<?variable:G11;count(xdoxslt:distinct_values(/CUST_SUMMARY/LIST_CLIENT/CLIENT/LIST_OVERALL_ASSET_ALLOC/OVERALL_ASSET_ALLOC/ASSET_LIAB_DESC))?> <?variable:numcol;5?>
<?template:table1?><?param:cellvalue;1?><?param:maxcolvalue;5?>
<?choose:?>
<?when:$cellvalue < $maxcolvalue?>
!http://farm3.static.flickr.com/2508/4104410643_f540c1d5a3_m.jpg!
<?call@inlines:table1?><?with-param:cellvalue;(number($cellvalue) + $numcol)?><?with-param:maxcolvalue;$maxcolvalue?><?end call?>
<?end when?>
<?end choose?>
<?end template?>
Also modified RTf as
C <?crosstab:c594;"//OVERALL_ASSET_ALLOC";"PORTFOLIO_NAME{,o=a,t=t}";"ASSET_LIAB_DESC{,o=a,t=t}";"PERCENT";"sum"?>
H
G <?for-each@column:$c594//C1?><?if@column:position() > $cellvalue and position() <= ($cellvalue + $numcol) ?>
ASSET_LIAB_DESC <?./H?>
E <?end if?><?end for-each?>
G <?for-each:$c594//R1?>
PORTFOLIO_NAME <?./H?>
G <?for-each@cell:.//R1C1?><?if@cell:position() > $cellvalue and position() <= ($cellvalue + $numcol) ?>
99.00% <?./M1?>
E <?end if?><?end for-each?>
E <?end for-each?>I have this as my xml
<?xml version="1.0" encoding="UTF-8"?>
<CUST_SUMMARY>
<CLIENTID>1034</CLIENTID>
<LIST_CLIENT>
<CLIENT>
<CLIENT_ID>1034</CLIENT_ID>
<LIST_OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID>1110</PORTFOLIO_ID>
<PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Alternatives</ASSET_LIAB_DESC>
<PERCENT>2.93117485730770817994482449012020516681E-03</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID>1110</PORTFOLIO_ID>
<PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Collectables</ASSET_LIAB_DESC>
<PERCENT>1.28354604277895431879689156620000563094E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID>1110</PORTFOLIO_ID>
<PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
<PERCENT>3.91466115811489974032104849667369505831E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID>1110</PORTFOLIO_ID>
<PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
<PERCENT>8.71946226825880885538778864840827563226E-01</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID>1110</PORTFOLIO_ID>
<PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Others</ASSET_LIAB_DESC>
<PERCENT>7.3140526307872865690096910040315224715E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Alternatives</ASSET_LIAB_DESC>
<PERCENT>2.93117485730770817994482449012020516681E-03</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Collectables</ASSET_LIAB_DESC>
<PERCENT>1.28354604277895431879689156620000563094E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
<PERCENT>3.91466115811489974032104849667369505831E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
<PERCENT>8.71946226825880885538778864840827563226E-01</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Others</ASSET_LIAB_DESC>
<PERCENT>7.3140526307872865690096910040315224715E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Alternatives</ASSET_LIAB_DESC>
<PERCENT>2.93117485730770817994482449012020516681E-03</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Collectables</ASSET_LIAB_DESC>
<PERCENT>1.28354604277895431879689156620000563094E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
<PERCENT>-3.6085338841885100259678951503326304942E-01</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
<PERCENT>2.71946226825880885538778864840827563226E-01</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Others</ASSET_LIAB_DESC>
<PERCENT>7.3140526307872865690096910040315224715E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Cash</ASSET_LIAB_DESC>
<PERCENT>.3</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Recommended Allocation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
<PERCENT>.4</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Recommended Allocation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
<PERCENT>.3</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Recommended Allocation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Cash</ASSET_LIAB_DESC>
<PERCENT>.3</PERCENT>
</OVERALL_ASSET_ALLOC>
</LIST_OVERALL_ASSET_ALLOC>
</CLIENT>
</LIST_CLIENT>
</CUST_SUMMARY>and Original RTF looks like !http://farm3.static.flickr.com/2508/4104410643_f540c1d5a3_m.jpg!
with code as
C <?crosstab:c594;"//OVERALL_ASSET_ALLOC";"PORTFOLIO_NAME{,o=a,t=t}";"ASSET_LIAB_DESC{,o=a,t=t}";"PERCENT";"sum"?>
H <?horizontal-break-table:1?>
G <?for-each@column:$c594//C1?>
ASSET_LIAB_DESC <?./H?>
E <?end for-each?>
G <?for-each:$c594//R1?>
PORTFOLIO_NAME <?./H?>
G <?for-each@cell:.//R1C1?>
99.00% <?./M1?>
E <?end for-each?>
E <?end for-each?>Anyone can now tell my mistake? What wrong I am doing? Why it is showing blank page in output? How to solve this page breaking problem?
Thanks
-Sookie -
Field Texts for Dynamic Internal Tables
Hi All,
I want to know whether there is any way to get the field Headings (Not the field names)
Below is my CODE
For ex :
CLASS lvl_met DEFINITION.
PUBLIC SECTION.
METHODS : l_met IMPORTING m_itab TYPE STANDARD TABLE.
ENDCLASS.
CLASS lvl_met IMPLEMENTATION.
METHOD l_met.
data : l_t_fields TYPE abap_compdescr_tab." WITH HEADER LINE.
field-symbols:
<p_data> type any,
<p_field> type any,
<p_component> type abap_compdescr.
CREATE DATA MY_WA LIKE LINE OF m_itab.
ASSIGN MY_WA->* TO <P_DATA>.
DESC_STRUC ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA( <P_DATA> ).
*I want the field Headings(Field Text) - In this case i want some thing like Material Number and Plant
I can read this texts if i know atleast the data element
At this point i see <p_data> in degbug mode under absolute type column i see \TYPE=WERKS_D aganst werks field
I don't know how to capture the \TYPE=WERKS_D this thing so atleast i can read field Text based on Data Element
Is there any other way to find out the field text
ENDCLASS.
TABLES : marc.
DATA : l_met TYPE REF TO lcl_met.
types : BEGIN OF t_itab,
matnr like marc-matnr,
werks like marc-werks,
end of t_itab.
data : itab type table of t_itab.
START-OF-SELECTION.
IF l_met IS INITIAL.
CREATE OBJECT l_met.
ENDIF.
select matnr werks from marc into TABLE itab up to 10 rows.
l_met->get_headertext( EXPORTING m_itab = itab ).
Thanks
DavidHi Naimesh,
I tried exactly what you said
lt_comp = desc_struc->get_components( ). "Get the fields of the structure
loop at lt_comp into ls_comp.
lo_elem_desc ?= cl_abap_elemdescr=>describe_by_name( ls_comp-name ).
lf_dfies = lo_elem_desc->get_ddic_field( ).
WRITE: / lf_dfies-scrtext_s,
/ lf_dfies-scrtext_m,
/ lf_dfies-scrtext_l.
WRITE:/ ls_comp-name. " Write the column names
endloop.
It Works fine for Matnr because field name and data element are same but when it comes to werks it gives me a dump because the date element is different werks_d
I just tried hard coding werks_d and it works fine
lo_elem_desc ?= cl_abap_elemdescr=>describe_by_name( 'WERKS_D' ).
lf_dfies = lo_elem_desc->get_ddic_field( ).
WRITE: / lf_dfies-scrtext_s,
/ lf_dfies-scrtext_m,
/ lf_dfies-scrtext_l.
Let me know how
Thanks
David
Edited by: DAVID KITSO on Nov 23, 2009 10:09 PM -
To populate data in a dynamic internal table
Hi,
I have an internal table <FS_1> which I have created dynamically. Now i need to populate the columns (7th column onwards) in the internal table with my data in GT_REQMT which is an internal table.
Data: L_IDX type I.
L_IDX = 6.
Loop at <FS_1> assigning <FS_2>.
If sy-tabix = 1.
Loop at GT_REQMT.
Add 1 to L_IDX.
*****I need to populate GT_REQMT-DATA to column 7 then 8 etc depending on the number of loops.
Modify <FS_1> from <FS_2>.
Endloop.
Else.
**do other things here**
Endif.
Endloop.
I have search through the forums and weblogs but the solutions are catered to populating the internal tables from SAP database using SQL statements.
I couldn't find anything on populating own data in dynamic table by looping it. Please help. THANKS!!
Cheers,
ChelseaHi!
I have used classes for dynamic internal table, SO i here give you my sample code for your help.
DATA : new_table TYPE REF TO data,
new_line TYPE REF TO data.
FIELD-SYMBOLS : <TAB1> type standard table,
<l_table> TYPE ANY TABLE,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
count = count + 1.
clear wa_fieldcat.
wa_fieldcat-col_pos = count.
wa_fieldcat-fieldname = 'CONDITION'.
wa_fieldcat-coltext = 'Condition Value'.
wa_fieldcat-ref_field = 'KWERT'.
wa_fieldcat-ref_table = 'KONV'.
wa_fieldcat-outputlen = 13.
append wa_fieldcat to it_fieldcat.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = new_table.
ASSIGN new_table->* TO <l_table>.
CREATE DATA new_line LIKE LINE OF <l_table>.
ASSIGN new_line->* TO <l_line>.
ASSIGN COMPONENT KWERT OF STRUCTURE <l_line> TO <l_field>.
<l_field> = t_kschlkonv-vtext.
NOw u append internal table
IF its helps you then dont forget to rewards points.
Regards From
Priyank -
Need ALV LIST for displaying Dynamic Internal Tables
Hi Guys,
I have some thing like 2 Dynamic internal tables.
Say 1st Internal table will be filled based on some condition.
say 2nd table will be filled based on some condition.
When appending the 1st Internal table, if that internal table is filled it creates another internal table of same kind and continues so on until some condition.
In the same way when appending the 2nd Internal table, if that internal table is filled it creates another internal table of same kind and continues so on until some condition.
My requirement is I need to display all these Internal tables in the output.
The output should look something like
1st Internal Table
some gap
2nd Internal Table
some gap
so on...................
Is there any standard ALV List, to display all these Internal Tables in such a way.
Thanks,
Prasad.Hi.
One thing more here is code which get 10 records from 2 tables and then show them in ALV.
first when u execute it will show data from ist table.
when u go back (F3) then it will sow data from 2nd table.
But if u want to show both ALV on the same screen then u will have to use screen programin and using class u will have to create container and then have to do it.
But as i above mentioned. that sample code is as below.
REPORT ztn_test LINE-COUNT 100.
data: itab_ref type ref to data.
data: hstr type lvc_title.
data: tabname like DD02T-TABNAME.
tabname = 'MARA'. " First Table
create data itab_ref type standard table of (tabname).
field-symbols: <itab> type standard table.
assign itab_ref->* to <itab>.
select * UP TO 10 ROWS from (tabname) into corresponding fields of table <itab>.
perform showalv.
tabname = 'KNA1'. " 2nd Table
create data itab_ref type standard table of (tabname).
"field-symbols: <itab> type standard table.
assign itab_ref->* to <itab>.
select * UP TO 10 ROWS from (tabname) into corresponding fields of table <itab>.
perform showalv.
form showalv.
" to show that data in alv
type-pools: slis.
data: myalv type ref to cl_gui_alv_grid, "ALV Grid
fieldcat type slis_t_fieldcat_alv, "Field Catalog Table
ls_fcat type slis_fieldcat_alv, "Line of Field catalog.
ls_heading type slis_listheader, "Line of Heading.
layout type slis_layout_alv, "layout of ALV for Heading and Logo.
event type slis_t_event, "Event Raising to Display Heading.
event_str type slis_alv_event. "Event String.
type-pools: slis.
data: heading type slis_t_listheader. "List Heading.
if heading[] is initial.
ls_heading-typ = 'H'.
ls_heading-info = 'HR: Master Data Change History'.
append ls_heading to heading.
endif.
* ls_heading-typ = 'A'.
* ls_heading-info = ''.
* APPEND ls_heading TO heading.
* ALV DISPLAY *
*******Making Layout of ALV
layout-zebra = 'X'.
layout-colwidth_optimize = 'X'.
*Calling function to raise event to display heading and icon above ALV
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = event[]
* EXCEPTIONS
* LIST_TYPE_WRONG = 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.
******calling TOP_OF_PAGE Event
read table event with key name = 'TOP_OF_PAGE' into event_str.
if sy-subrc = 0.
move: 'TOP_OF_PAGE' to event_str-form.
modify event from event_str index sy-tabix.
endif.
**** Now use this Fuction to display ALV without any Screen Programming.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = 'SAPLZFSL_HR_UTILS' "sy-cprog
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
i_structure_name = tabname
* I_BACKGROUND_ID = ' '
i_grid_title = hstr "Heading of ALV Grid.
* I_GRID_SETTINGS =
is_layout = layout
* it_fieldcat = fieldcat[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
i_default = 'X'
i_save = 'X'
* IS_VARIANT =
it_events = event[]
* 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 = <itab>
* 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.
Maybe you are looking for
-
Can I install Oracle 8.1.6 on RH LINUX 7.1
Can i Install Oracle 8.1.6 on Redhat Linux 7.1
-
Hi all, I need to create a custom table with the following fields: sold to, sold to description, EDI partner type, partner number, and partner description. My problem is where to retrieve the partner description if the partner type is equal to B (ban
-
Adding Itunes EQ to already converted MP3s, Is this possible?
I have a ton of MP3s I downloaded from the web. I want to add one of the preset EQ settings to them. Is there a way to do this even though they are already converted to MP3 format? If not, is there a way to convert them to wav again and then back to
-
How do I generate a simple calendar???
I regularly need to generate calendars to print schedules, tell people when they need to be at a meeting, etc. IS there a way I can generate calendars in pages/iWork? I am aware it may require I use numbers, but I have looked for a template an I can'
-
The speakers on my laptop are extremely low despite setting all of the volume to maximum volume. Looking at othe posts on this topic, there is a recommendation to go to the "Enhancements" tab within the sound settings but I do not have that tab avail