Dynamic Table - Deep Structure
Hi Gurus,
this is my first posting, so be patient!
I want to create a deep structure dynamic table via method
cl_alv_table_create=>create_dynamic_table, is this possible? Are there tricks to make it happen?
Background: i wanna create an alv with dynamic fieldcatalalog, in this case i want to colour special fields, which is done by lvc_s_layo-?csp_fieldname? in combination with a field in my internal table which is typed ?lvc_t_scol?. Is this possible under 6.2.43
thanxs for your replies
juergen
- ?i dont actually know by rote the correct fieldnames of lvc_xxxxx?
Hi Jurgen, I took on the challenge. This program provides a dynamic table with the ability to set the colors of the cells.
Create the structure ZCDF_CELL_COLOR in the dictionary as described in the program.
Create screen 100 as empty, with next screen set to 0, and the following flow logic:
PROCESS BEFORE OUTPUT.
MODULE initialization.
PROCESS AFTER INPUT.
REPORT zcdf_dynamic_table.
* Dynamic ALV Grid with Cell Coloring
DATA:
r_dyn_table TYPE REF TO data,
r_wa_dyn_table TYPE REF TO data,
r_dock_ctnr TYPE REF TO cl_gui_docking_container,
r_alv_grid TYPE REF TO cl_gui_alv_grid,
t_fieldcat1 TYPE lvc_t_fcat, "with cell color
t_fieldcat2 TYPE lvc_t_fcat, "without cell color
wa_fieldcat LIKE LINE OF t_fieldcat1,
wa_cellcolors TYPE LINE OF lvc_t_scol,
wa_is_layout TYPE lvc_s_layo.
FIELD-SYMBOLS:
<t_dyn_table> TYPE STANDARD TABLE,
<wa_dyn_table> TYPE ANY,
<t_cellcolors> TYPE lvc_t_scol,
<w_field> TYPE ANY.
START-OF-SELECTION.
* Build field catalog based on your criteria.
wa_fieldcat-fieldname = 'FIELD1'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-outputlen = '10'.
wa_fieldcat-coltext = 'My Field 1'.
wa_fieldcat-seltext = wa_fieldcat-coltext.
APPEND wa_fieldcat TO t_fieldcat1.
wa_fieldcat-fieldname = 'FIELD2'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-outputlen = '10'.
wa_fieldcat-coltext = 'My Field 2'.
wa_fieldcat-seltext = wa_fieldcat-coltext.
APPEND wa_fieldcat TO t_fieldcat1.
* Before adding cell color table,
* save fieldcatalog to pass
* to ALV call.
t_fieldcat2[] = t_fieldcat1[].
* Add cell color table.
* ZCDF_CELL_COLOR is a structure in the
* dictionary with one
* field called T_CELL_COLOR of type LVC_T_SCOL.
wa_fieldcat-fieldname = 'T_CELLCOLORS'.
wa_fieldcat-ref_field = 'T_CELL_COLOR'.
wa_fieldcat-ref_table = 'ZCDF_CELL_COLOR'.
APPEND wa_fieldcat TO t_fieldcat1.
* Create dynamic table.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fieldcat1
IMPORTING
ep_table = r_dyn_table
EXCEPTIONS
generate_subpool_dir_full = 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.
* Get access to new table using field symbol.
ASSIGN r_dyn_table->* TO <t_dyn_table>.
* Create work area for new table.
CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.
* Get access to new work area using field symbol.
ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.
* Get data into table from somewhere. Field names are
* known at this point because field catalog is already
* built. Read field names from the field catalog or use
* COMPONENT <number> in a DO loop to access the fields.
* A simpler hard coded approach is used here.
ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table>
TO <w_field>.
<w_field> = 'ABC'.
ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table>
TO <w_field>.
<w_field> = 'XYZ'.
APPEND <wa_dyn_table> TO <t_dyn_table>.
ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table>
TO <w_field>.
<w_field> = 'TUV'.
ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table>
TO <w_field>.
<w_field> = 'DEF'.
APPEND <wa_dyn_table> TO <t_dyn_table>.
* Color cells based on your criteria.
* In this example, a test on
* FIELD2 is used to decide on color.
LOOP AT <t_dyn_table> INTO <wa_dyn_table>.
ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table>
TO <w_field>.
ASSIGN COMPONENT 'T_CELLCOLORS'
OF STRUCTURE <wa_dyn_table> TO <t_cellcolors>.
CLEAR wa_cellcolors.
wa_cellcolors-fname = 'FIELD2'.
IF <w_field> = 'DEF'.
wa_cellcolors-color-col = '7'.
ELSE.
wa_cellcolors-color-col = '5'.
ENDIF.
APPEND wa_cellcolors TO <t_cellcolors>.
MODIFY <t_dyn_table> FROM <wa_dyn_table>.
ENDLOOP.
CALL SCREEN 100.
* MODULE initialization OUTPUT
MODULE initialization OUTPUT.
* Set up for ALV display.
IF r_dock_ctnr IS INITIAL.
CREATE OBJECT r_dock_ctnr
EXPORTING
side =
cl_gui_docking_container=>dock_at_left
ratio = '90'.
CREATE OBJECT r_alv_grid
EXPORTING i_parent = r_dock_ctnr.
* Set ALV controls.
wa_is_layout-ctab_fname = 'T_CELLCOLORS'.
* Display.
CALL METHOD r_alv_grid->set_table_for_first_display
EXPORTING
is_layout = wa_is_layout
CHANGING
it_outtab = <t_dyn_table>
it_fieldcatalog = t_fieldcat2.
ELSE. "grids already prepared
* Refresh display.
CALL METHOD r_alv_grid->refresh_table_display
EXPORTING
i_soft_refresh = ' '
EXCEPTIONS
finished = 1
OTHERS = 2.
ENDIF.
ENDMODULE. " initialization OUTPUT
Similar Messages
-
Retrieving data from Excel format to internal table(deep structure)
hi all,
can anybody help me how to Retrieving data from Excel format to internal table(deep structure)
and if u have any sample code for that please send it.
my internal table is like this
DATA: BEGIN OF ty_text,
vbeln TYPE vbeln,
posnr TYPE posnr,
seqno TYPE seqno,
textid TYPE tdid,
tdline TYPE tdline,
END OF ty_text.
DATA: BEGIN OF ty_item,
vbeln TYPE vbeln,
posnr TYPE posnr,
dispct1(16),
dispct2(16),
dispct3(16),
text LIKE table of ty_text,
END OF ty_item.hi,
check this code
TABLES:zmatnr.
TYPE-POOLS truxs.
DATA : itab LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
DATA row LIKE alsmex_tabline-row.
data : gi_final like zmatnr occurs 0 with header line.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETER : pfname LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pfname.
PERFORM search.
START-OF-SELECTION.
perform process.
form process.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = pfname
i_begin_col = 1
i_begin_row = 2
i_end_col = 12
i_end_row = 65000
TABLES
intern = itab
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
describe table itab lines itab_count.
row = 1.
loop at itab.
if itab-row <> row.
append gi_final.
clear gi_final.
endif.
case itab-col.
when '1'.
gi_final-MATNR = itab-value.
when '2'.
gi_final-Maktx = itab-value.
endcase.
row = itab-row.
endloop.
append gi_final.
clear gi_final.
endform.
FORM search .
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
static = 'X'
CHANGING
file_name = pfname.
ENDFORM.
regards
siva -
ALV dynamic with deep structure
Hi All,
I need to program an ALV Report with a deep structure based on a outbound proxy structure, so I should pass to ALV function or ALV Method a dynamic table and a dynamic structure.
I tried to do it but I got a dump using this function module REUSE_ALV_GRID_DISPLAY with these parameters: STRUCTURE_NAME and T_OUTTAB.
Please, some suggestions about this.
Thanks in advance.
Alexis.Hi Vasanth
this is my example:
DATA: tl_proxy TYPE TABLE OF zpidt_operacion.
DATA: sl_proxy TYPE zpidt_operacion.
sl_proxy-dt_operacion-dt_cab_operacion-vkorg = '0001'.
APPEND sl_proxy TO tl_proxy.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = 'ZPIDT_OPERACION'
TABLES
t_outtab = tl_proxy
EXCEPTIONS
program_error = 1
OTHERS = 2.
Please, could you tell me how I have to do it.
Thanks,
Alexis. -
[ECC6] Inserting data from internal table (deep structure) into db table
Hi experts,
I have a problem when inserting data from IT using deep structure into a database table. Please help:
I have one database table with 2 columns ZTest (col1, col2). Col1 is key.
In my program I have a deep structure t_screen using table type lvc_t_scol:
In 4.6c systems, the INSERT statement works well but it does not work in ECC6 systems.
DATA: BEGIN OF t_screen OCCURS 0,
rec_count(3) TYPE n,
col1 LIKE ZTest-col1,
col2 LIKE ZTest-col2.
DATA: ct TYPE lvc_t_scol.
DATA: END OF t_screen.
t_screen-col1 = 'test1'.
t_screen-col2 = 'test1'.
APPEND t_screen.
t_screen-col1 = 'test2'.
t_screen-col2 = 'test2'.
APPEND t_screen.
INSERT ZTest FROM TABLE t_screen ACCEPTING DUPLICATE KEYS.
Currently I have an idea using a temporary internal table with the same structure as ZTest. Use MOVE-CORRESPONDING statement to move data from t_screen table to temporary table before inserting --> It worked. But do you have any ideas without using temporary table?Hi
There are a large number of stataments couldn't be supported in unicode system and so it doesn't allow to do it in ECC 6.
U need to delete the deep structure from your defination:
DATA: BEGIN OF t_screen OCCURS 0,
rec_count(3) TYPE n,
col1 LIKE ZTest-col1,
col2 LIKE ZTest-col2.
DATA: ct TYPE lvc_t_scol. "<-------- Error is here
DATA: END OF t_screen.
So u need to use a structure like this to update your table:
DATA: BEGIN OF T_ZTEST OCCURS 0,
rec_count(3) TYPE n,
col1 LIKE ZTest-col1,
col2 LIKE ZTest-col2.
DATA: END OFT_ZTEST.
Max -
Hello everybody,
im tried to create a dynamic table with cl_alv_table_create=>create_dynamic_table, but that doesnt work for the table i need. I need a table with a changing number of columns of type "type ref to CL_DD_INPUT_ELEMENT", but the fieldcat only takes normal Data-Types.
So my question is, is there any way to create a dynamic table or structure with components of type ref to CL_DD_INPUT_ELEMENT?
Thank you very much for any help.
CheersI generally use Factory methods of RTTS classes to create dynamic tables. Check my reply (Step 1) in this thread getting column headers dynamically from input parameters in alv..
-
Dynamic ALV: but with globally available dynamic table type
Hello,
I would like to create a dynamic node for a ALV and dynamic table types to fill and the ALV.
The ALV data can be changed so I need to read it again.
I have read all the threads about dynamic node create and i have no problem with it. I can create a structure and a table dynamically. thats also no issue for me.
But. I fill the ALV data in a method and read it in another method to save the changes in a data base table.
Thats also no problem
So where i need your help? I currently create the dynamic table and structure in both methods. That works, but why do the same thing twice?
I cant figure out by myself how to create a dynamic table/structure in a global way, so the dynamic table/structure is created once and then available in the whole WD4A view.
I tried is with a class type in se24 with reference to CL_ABAP_STRUCTDESCR but I cant make that run, because to access the type I created an attribute in se24 with reference to the class type that I now try in instance and fill in the method. But ABAP thinks that my attribute is not compatible anymore.
Any idea how to make a dynamic table globally available? That must be an ABAP god who can answer this question, hehe. So imagin me falling on my knees for the one who has an answer that really works
Kind regards,
HendrikThis doesn't seem too difficult really. For a dynamic table you just need to declare the internal table as TYPE REF TO DATA.
Just more this declaration to the attributes of your Component Controller. So for instance in my component controller I have an attribute called i_data with the RefTo column checked and the associated type = DATA.
So now I could do the following:
create data wd_this->idata type table of (tablename).
Or however you are dynamically creating the table - maybe with TYPE HANDLE instead.
The point is that your dynamic table is now global to your entire component and you can read and write to it from different methods.
Is this what you were looking for? Without knowing more about your existing coding, it is difficult to say more. -
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 -
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 -
Creating dynamic internal table with deep structure
Hi all,
I need to create an internal table with deep structure dynamically. I've already created tables with method 'create_dynamic_table' but I'm struggling with the deep structure.
I would need an internal table with the following structure:
DATA: BEGIN OF lt_t1,
s1 TYPE REF TO data,
s2 TYPE REF TO data,
END OF lt_t1.
S1 and S2 have to be tables.
It might be possible with RTTS but all the examples in the forums (that I've found so far) are related to at least one DDIC-structure. And that's my problem because both tables are created during runtime.
Thank you in advance
NicolaHi Frédéric,
I hope my english is good enough to explain it correctly:
We use a function builder for SEM-BPS which copies data from one Cube to another. This Cube is transactional, so you can't easily read a structure out of DDIC.
The export parameter of this function builder is a table with type 'any table'.
Until today we used a fixed definition e.g.:
TYPES:
BEGIN OF xtyp_chas,
/sie/sr_ocomp TYPE /b52/oisr_ocomp,
/sie/ts_03psp TYPE /b52/oits_03psp,
0activity TYPE /bi0/oiactivity,
0acty_elemt TYPE /bi0/oiacty_elemt,
0costelmnt TYPE /bi0/oicostelmnt,
0co_area TYPE /bi0/oico_area,
0creditor TYPE /bi0/oicreditor,
0currency TYPE /bi0/oicurrency,
0curtype TYPE /bi0/oicurtype,
0db_cr_ind TYPE /bi0/oidb_cr_ind,
0fiscper TYPE /bi0/oifiscper,
0fiscper3 TYPE /bi0/oifiscper3,
0fiscyear TYPE /bi0/oifiscyear,
0metype TYPE /bi0/oimetype,
0network TYPE /bi0/oinetwork,
0part_actty TYPE /bi0/oipart_actty,
0part_cctr TYPE /bi0/oipart_cctr,
0piobjsv TYPE /bi0/oipiobjsv,
0project TYPE /bi0/oiproject,
0unit TYPE /bi0/oiunit,
0vtdetail TYPE /bi0/oivtdetail,
0vtstat TYPE /bi0/oivtstat,
0vtype TYPE /bi0/oivtype,
0bus_area TYPE /bi0/oibus_area,
0cashdetail TYPE /bi0/oicashdetail,
0cashtype TYPE /bi0/oicashtype,
0comp_code TYPE /bi0/oicomp_code,
0coorder TYPE /bi0/oicoorder,
0cs_dimen TYPE /bi0/oics_dimen,
0cs_unit TYPE /bi0/oics_unit,
0int_bus TYPE /bi0/oiint_bus,
0part_abcpr TYPE /bi0/oipart_abcpr,
0part_coord TYPE /bi0/oipart_coord,
0part_wbsel TYPE /bi0/oipart_wbsel,
0piovalue TYPE /bi0/oipiovalue,
0profit_ctr TYPE /bi0/oiprofit_ctr,
0ps_obj TYPE /bi0/oips_obj,
0statussys0 TYPE /bi0/oistatussys0,
zfbwheroj TYPE /bic/oizfbwheroj,
END OF xtyp_chas,
BEGIN OF xtyp_kyfs,
0amount TYPE /bi0/oiamount,
0quantity TYPE /bi0/oiquantity,
zf03oaws TYPE /bic/oizf03oaws,
zf03oqty TYPE /bic/oizf03oqty,
zf03ozsta TYPE /bic/oizf03ozsta,
END OF xtyp_kyfs,
BEGIN OF xtyp_zf03g003,
s_chas TYPE xtyp_chas,
s_kyfs TYPE xtyp_kyfs,
END OF xtyp_zf03g003,
xtyp_zf03g003_t TYPE HASHED TABLE OF xtyp_zf03g003
WITH UNIQUE KEY s_chas.
DATA: lt_ibm_data TYPE xtyp_zf03g003_t,
ls_ibm_data TYPE xtyp_zf03g003.
So one table (s_chas) contains the characteristics of the Cube and the other (s_kyfs) contains the keyfigures. That's exactly the format we need for the export parameter. At the end of the program, we use the following coding to fill the export table (eto_chas):
loop at lt_ibm_data into ls_ibm_data.
collect ls_ibm_data-s_chas into eto_chas.
endloop.
So in this moment I give this table the structure that is needed to move the data into the cube. I can't change the requirement because it is a standard interface.
I would like to change that coding to be dynamically. Because if somebody changes a charasteristic or a keyfigure in the cube, we would have to change the function builder too. I don't think that the SEM-BPS department will let us know every time they've changed something anyway.
So I hope that my explanation wasn't too confusing
Nicola -
How to add deep structure like LVC_T_SCOL in dynamic internal table
Hello,
can any one help me with adding a deep structure to a dynamically created internal table. the deep structure which needs to be added is for the color purpose for each record i.e. LVC_T_SCOL .
Dynamic table created with below method.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_struct
i_length_in_byte = 'X'
IMPORTING
ep_table = dy_table.
ASSIGN: dy_table->* TO <dyn_table>,
dy_table->* TO <dyn_line>.
gt_struct has the list of fields and their technical attributs.
Thanks In Advance.
BR,
Rajeshcan you add a column name and attribs in gt_struct? It needs to be declared like:
<colorcolumnname> type lvc_t_scol. -
Regarding creation of dynamic deep structure
Hi all,
I have to construct the dynamic deep structure.
for example,
With the help of information about address and t_table, i have to create the deep structure on runtime.
In one case i need to create the deep strcuture with address alone and in another case i need to create the deep structure with address and t_table.
DATA : begin of address ,
address type string ,
end of address.
data : begin of t_tab ,
name(10) type c,
age type i,
address like address,
end of t_tab,
t_table like Table of t_tab.
data: BEGIN OF wa_vig,
details1 like address,
details2 like t_table,
END OF wa_vig.
data: BEGIN OF wa_vig,
details1 like address,
END OF wa_vig.
Please guide me, how should i acheive this with the help of dynamic declarion .
regards
VigneshHi All,
I will be happy if i can acheive this using RTTS concept.
Regards
Vignesh -
Append a line to a dynamic table in a dynamic structure
Hello,
i've created a dynamic structure <ls_itab> TYPE ANY.
This structure contains a deep structure name 'CELLSTYLES' of type lvc_t_styl.
Now i want to add a line to the deep structure CELLSTYLES.
I'll tried something like this:
data: <ld_fld> TYPE ANY,
<ls_itab> TYPE ANY.
ASSIGN COMPONENT 'CELLSTYLES' OF STRUCTURE <ls_itab> TO <ld_fld>.
But i can't append line to <ld_fld> because it's no internaltable.
Please help.
Best regards,
TomSdHi Thomas,
Put this code at declaration.
FIELD-SYMBOLS: <L_TABLE> TYPE STANDARD TABLE.
Here Append will not work; after the code you have written use.
INSERT <ls_itab> INTO TABLE <L_TABLE>.
Hope it will solve ur problem.
Regards
Krishnendu -
Create Structure with dynamical Table-Type
Hi experts,
is there a possibility, to create a structure via SE11 and including there a field which referes to a dynamic table-type.
So that I can append to this structure-field all different table-types?
for example: ones I append MARA[] and ones AFKO[]
Thx for helpHi Christian,
There's not predefined generic type to do that, but you could create your own field type (deep structure) which would be able to keep table lines after transposition (90 degree flip) where in example it would have four columns: Table type, row id(index) field name, value. That way you could store ANY table row you need... This will not come cheap and will involve some work of course.
You may want have a look at standard ABAP services RRTS and RTTI (see classes and structures used in attributes an parameters) - these are two services for handling data types and metadata related operations during runtime. You may want to use them for flipping your table entries to the tabular form and so on. You may also find some ideas there on how to compose your own data type for your purposes.
Good luck!
Marcin -
How to pass values in dynamic structure and then dynamic table
Hi,
we have a Z structure in se11 holding 10 fields. But at run time i need to create a dynamic table with more than 10 records.
I am able to create the structure and corresponding internal table. Now the issue is i have to populate this dynamic structure with some values and then append it to dynamic internal table. Since the dynamic table type is any its not allowing an index operation like modify etc etc.
Could anyone help me in passing the values . I have searched in SDN . everyone created a dynamic table and then populated it values from some standard or custom tables.Then assigning the component of structure and displaying the output. but in my situation i have no such values stored in any tables. i populate values based on certain calculation.Hi Friends,
This is the piece of code.After creating dynamic work area and dynamic table what i should do?
TYPES: BEGIN OF STR,
ID TYPE I,
NAME(30) TYPE C,
END OF STR.
data: v_lines type i.
STR_TYPE ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( 'STR' ).
STR_COMP = STR_TYPE->GET_COMPONENTS( ).
APPEND LINES OF STR_COMP TO COMP_TAB.
COMP-NAME = 'NAME1'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'VALUE1'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'NAME2'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'VALUE2'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'NAME3'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'VALUE3'.
COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_STRING( ).
APPEND COMP TO COMP_TAB.
NEW_STR = CL_ABAP_STRUCTDESCR=>CREATE( COMP_TAB ).
NEW_TAB = CL_ABAP_TABLEDESCR=>CREATE(
P_LINE_TYPE = NEW_STR
P_TABLE_KIND = CL_ABAP_TABLEDESCR=>TABLEKIND_STD
P_UNIQUE = ABAP_FALSE ).
CREATE DATA DREF TYPE HANDLE NEW_TAB.
CREATE DATA DREF1 TYPE HANDLE NEW_str. -
Here's how to use DYNAMIC tables for almost any structure (4.6C onwards)
Hi guys
I'm describing a feature here that has been around since 4.6C that is not really well known but can really simplfy programming where you need to get data into some sort of internal table and then display it either as a classical list or as al ALV grid.
This feature is RTTI which allows you to retrieve your structure, build a dynamic FCAT (Field catalog) and a Dynamic table.
Here's a really quick little program which reads 200 entries from VAPMA into a dynamic table. Any structure will work if you use the code sample shown.
To pass it to an ALV GRID is then really simple as you've already got the Field Catalog, Table and Data.
The method I'm showing below will work for almost ANY structure you care to name whether or not the fields are in the data dictionary.
I create a dynamic FCAT and dynamic table based on the FCAT and then populate it.
You can create field catalogs dynamically quite simply by using the new RTTI facility available from 4.6C onwards.
(From here it's only a small step to dynamic tables and EASY ALV grid displays)
Example to create dynamic FCAT and table and populate it with 200 entries from VAPMA
PROGRAM ZZ_BUILD_FLDCATALOG.
tables: vapma.
Define any structure
types: begin of s_elements,
vbeln type vapma-vbeln,
posnr type vapma-posnr,
matnr type vapma-matnr,
kunnr type vapma-kunnr,
werks type vapma-werks,
vkorg type vapma-vkorg,
vkbur type vapma-vkbur,
status type c,
end of s_elements.
end of your structure
data lr_rtti_struc type ref to cl_abap_structdescr .
data:
zog like line of lr_rtti_struc->components .
data:
zogt like table of zog,
wa_it_fldcat type lvc_s_fcat,
it_fldcat type lvc_t_fcat ,
dy_line type ref to data,
dy_table type ref to data.
data: dref type ref to data.
field-symbols: <fs> type any,
<dyn_table> type standard table,
<dyn_wa>.
*now I want to build a field catalog
*First get your data structure into a field symbol
create data dref type s_elements.
assign dref->* to <fs>.
lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( <fs> ).
zogt[] = lr_rtti_struc->components.
Now build the field catalog. zogt has the structure in it from RTTI.
loop at zogt into zog.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = zog-name .
wa_it_fldcat-datatype = zog-type_kind.
wa_it_fldcat-inttype = zog-type_kind.
wa_it_fldcat-intlen = zog-length.
wa_it_fldcat-decimals = zog-decimals.
wa_it_fldcat-coltext = zog-name.
wa_it_fldcat-lowercase = 'X'.
append wa_it_fldcat to it_fldcat .
endloop.
Let's create a dynamic table and populate it
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = dy_table.
assign dy_table->* to <dyn_table>.
create data dy_line like line of <dyn_table>.
assign dy_line->* to <dyn_wa>.
select vbeln posnr matnr kunnr werks vkorg vkbur
up to 200 rows
from vapma
into corresponding fields of table <dyn_table>.
from here you can pass your table to a GRID for display etc etc.
Cheers
JimboThanks for the info.
I went to their web site and also Googled.
I found a great review on their photographer's books on nikonians.org
They use an HP/Indigo Ultrastream 3000 digital offset press for all hardcover books, which is GREAT!
I did sign up and requested the 45 day trial "photographer" account.
I am curious if Shared Ink offers a size that matches the ONLY current book size from Aperture, the odd 8.5x11.
In the above review, I saw that Shared Ink offers a 12x12 book.. very nice! Except you will need to design that one in CS2
So then, all that Apple really needs to do is simply add the ability to select/create custom book sizes. Then we don't need a printing service from Apple, as there are plenty of options out there, and more arriving on the market each month!
Maybe you are looking for
-
IPad apps won't even launch which tapped
Hi, On and iPad 2 - with the latest iOS, - I am unable to open any apps on my iPad. Short of completly wiping it and starting over - I'd really like to have some other options. I've done a hardware reset (power +home). I've deleted an i
-
HT201210 My camera pic & videos do not appear in photos
Just purchased iPhone 5s. Not all photos are DL yet. However, took a few pics & videos with the camera & they do not appear in photos/camera roll??? Help! Catwell
-
Unable to add ztables in table control
Dear experts, i have got ztables, using table controls in module pool. i need to display multiple tables in TC for accepting the values and also displaying the data from the database. I am also not getting the column headings for the fields from ztab
-
http://http://kb.adobe.com/selfservice/viewContent.do?externalId=kb407110&sliceId=2 Simply download the latest plug in under DOWNLOADS. Manually go into your program files are and pull out OLD Camera Raw Plug in bring to your desk top Place NEW Came
-
Mediasmart software problem loading onto computer with new hard drive and operating system
My computer recently crashed and I had to buy a new hard drive and operating system. None of the programs from the old hard drive were saved. The computer is an HP Pavilion dv7-3165dx Entertainment Notebook and I have Windows 7 Professional (64x)