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
Vignesh
Hi All,
I will be happy if i can acheive this using RTTS concept.
Regards
Vignesh
Similar Messages
-
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 -
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 -
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 -
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. -
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. -
How can i point to a specific field in DEEP structure and populate it?
Hello,
I have declared a internal table as below,
DATA: BEGIN OF wa_data,
vkorg TYPE vkorg
vtweg TYPE vtweg
spartTYPE spart
field_name TYPE CHAR30
value TYPE CHAR50
END OF wa_data
DATA: ls_data TYPE wa_data,
lt_data TYPE STANDARD TABLE OF wa_data.
The lt_data is populated as below,
VKORG-------VTWEG-------SPART-------FIELD_NAME-------VALUE
1000-----------10-------------01------------KALKS---------------ZP00 "Pricing procedure
1000-----------10-------------01------------ZTERM---------------15 days "Payment terms
1000-----------10-------------01------------MAHNA---------------09 "Dunning
Fine.
Now, i have a DEEP DEEP DEEP structure as belowm
DATA: ls_deep TYPE cmds_ei_extern. "Pls. see this deep structure 'cmds_ei_extern' in SAP DDIC / SE11
This deep structure is part of Customer master creation. Now, i would like to POPULATE this deep structure from my lt_data itab DYNAMICALLy, i mean, with out mentioning the field names (like, ZTERM, KALKS, MAHNA etc etc), bcz its these i am pulling this lt_data from a custom table, so going further business may also ADD a new record / field like BUSAB (Accouting clerk) with a value of AL (Allen Christi), hence i want to hv dynamic and its less tediuos also bcz,
We can LOOP lt_data INTO ls_data (for example, the ls_data-field_name = KALKS)
Now, point the KALKS in the deep deep deep structure and populate it with a value of ls_data-value (= 15 days)
ENDLLOOP.
Pls. let me know How can i do this, i guess, we need to use field symbols, pls. let me know the code to achieve my requirement
Thank youHi,
Please refer below code.This will populate field kunnr of the deep structure. Once you select the data as per your requirement,you can write similar code to populate rest of the fields in the deep strucure.
TYPES : BEGIN OF ty_data,
kunnr TYPE kunnr,
END OF ty_data.
FIELD-SYMBOLS : <lfs_cmds_ei_header> TYPE cmds_ei_header,
<lfs_cmds_ei_instance> TYPE cmds_ei_instance,
<lfs_kunnr> TYPE kunnr.
DATA: lfs_cmds_ei_extern TYPE cmds_ei_extern,
lr_dytable TYPE REF TO data,
lr_dytable_wa TYPE REF TO data,
lt_data TYPE STANDARD TABLE of ty_data ,
wa_data TYPE ty_data.
SELECT kunnr
FROM yalb_kunde
UP TO 1 ROWS
INTO TABLE lt_data.
IF sy-subrc = 0.
LOOP AT lt_data INTO lwa_data.
ASSIGN COMPONENT 'HEADER' OF STRUCTURE lfs_cmds_ei_extern TO <lfs_cmds_ei_header>.
IF sy-subrc = 0.
ASSIGN COMPONENT 'OBJECT_INSTANCE' OF STRUCTURE <lfs_cmds_ei_header> TO <lfs_cmds_ei_instance>.
IF sy-subrc = 0.
ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <lfs_cmds_ei_instance> TO <lfs_kunnr>.
IF sy-subrc = 0.
<lfs_kunnr> = lwa_data-kunnr.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
Thanks,
Priya -
Reciever file adapter configuration for Deep structure
Hi Experts,
I have a idoc to file scenario in which i used a data type for file in below format:
DT_Test
-->Recordset(0.unbounded)
>E21DPU1(0.unbounded)
>field1
>field2
>E21DPU5(0.unbounded)
>filed 3
>filed 4
>E21DP03(0.unbounded)
>filed 5
>filed 6
Here DT_test is datatype name,Recordset is a structure name which contain E21DPU1, E21DPU5,E21DPO3 stucture inside it.Now,E21DPU5 and E21DPO3 structures are under E21DPU1.
I am confused in creating content conversion parameters i.e what we have to mention in Recordset Stucture .
I used E21DPU1,,E21DPU5,,E21DP03,* .should it work for deep structure.
Thanks
DeepakHi,
file adapter does not handle 2 level deep structures
the easiest way to do it now is to go for abap or java mapping
and create a line for each of the output lines and handle this in the file adapter
so like <line> </line>
<line>E21DPU1(0.unbounded) with fields </line>
<line>E21DPU5(0.unbounded) with fields </line>
<line> etc. </line>
Regards,
Michal Krawczyk -
Problem with deep structure in Adobe Forms
Hi ,
I am converting smartform into adobe forms. While converting the program code in the code initialization of the smart forms also get transformed to adobe forms the problem is my internal table is of type deep structure while passing it through the tables parameter i am getting error in adobe forms .But while passing the internal table through import parameter its not giving error.The same code works fine with smartforms. I dont know why its not taking the structure of internal table in adobe forms properly .It happens only for deep strucure formal normal tables it works fine in table parameters .If any one has come across this scenario please share your ideas.
Best Regards,
SreeramIf I were you, I would never do this through any program. The only secure, reliable way is to rewrite everything by your own hands. Even if we could argue, your way works as well (and could be faster at the beginning), at the firt moment you will be asked to perform any tiny change in this "imported" thing, you will cry your eyes out (and understand why it is the only useful way to rewrite everything manually).
regards Otto -
XSLT transformation for deep structure .....
Hello,
I am trying to do an XSLT transformation for a deep structure HAP_S_PDF_DOCUMENT (see it in SE11), I have managed to achieve this. but not with perfection. i still get some redundant data and data have been experiencing Data duplication. I was hoping if you people point out the what is wrong in the transfromation. The data repeats for every once under node DATA and then under node of the refered structure name. Besides it also create a blank row even if the record is 0. I am mostly facing problem with nodes T_ELEMENTS. T_COL_CELL and T_FIELD. These are the nested structures, Can anybody help / guide me to achieve these transforamtion?
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="HAP_DOCUMENT">
<xsl:element name="HAP_DOCUMENT" namespace="">
<xsl:apply-templates select="MAIN_HEADER"/>
<xsl:apply-templates select="T_ELEMENTS"/>
<xsl:apply-templates select="T_STAT_CHG_BUTTONS"/>
<xsl:apply-templates select="S_APPRAISAL_ID"/>
<xsl:apply-templates select="S_HEADER"/>
<xsl:apply-templates select="POSITIONS"/>
<xsl:element name="STAT_CHG_BUTTON">
<xsl:value-of select="../STAT_CHG_BUTTON"/>
</xsl:element>
<xsl:element name="OFFLINE_ID">
<xsl:value-of select="OFFLINE_ID"/>
</xsl:element>
<xsl:element name="BSP_FLAG">
<xsl:value-of select="BSP_FLAG"/>
</xsl:element>
<xsl:element name="ROLE">
<xsl:value-of select="ROLE"/>
</xsl:element>
<xsl:element name="APPRAISAL_YEAR">
<xsl:value-of select="APPRAISAL_YEAR"/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="MAIN_HEADER">
<xsl:element name="MAIN_HEADER">
<xsl:for-each select="ZBGAPR_FORM_HEADER">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_ELEMENTS">
<xsl:element name="T_ELEMENTS">
<xsl:for-each select="ZHAP_S_PDF_ELEMENTS">
<xsl:element name="DATA">
<xsl:apply-templates select="T_COL_CELL"/>
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_COL_CELL">
<xsl:element name="T_COL_CELL">
<xsl:for-each select="ZHAP_S_PDF_COL_CELL">
<xsl:element name="DATA">
<xsl:apply-templates select="T_FIELD"/>
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_FIELD">
<xsl:element name="T_FIELD">
<xsl:for-each select="ZHAP_S_PDF_FIELD">
<xsl:element name="DATA">
<xsl:apply-templates select="T_VAL_VALUES"/>
<xsl:apply-templates select="T_VAL_RANGES"/>
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_VAL_VALUES">
<xsl:element name="T_VAL_VALUES">
<xsl:for-each select="HAP_S_BODY_CELL_VAL_VALUES">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_VAL_RANGES">
<xsl:element name="T_VAL_RANGES">
<xsl:for-each select="HAP_S_BODY_CELL_VAL_RANGES">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_STAT_CHG_BUTTONS">
<xsl:element name="T_STAT_CHG_BUTTONS">
<xsl:for-each select="HAP_S_BODY_CELL_VAL_RANGES">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="S_APPRAISAL_ID">
<xsl:element name="S_APPRAISAL_ID">
<xsl:copy-of select="node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="S_HEADER">
<xsl:element name="S_HEADER">
<xsl:apply-templates select="S_TEXTS"/>
<xsl:apply-templates select="T_APPRAISER"/>
<xsl:apply-templates select="T_APPRAISEE"/>
<xsl:apply-templates select="T_PART_APPRAISER"/>
<xsl:apply-templates select="T_OTHERS"/>
<xsl:apply-templates select="S_STATUS"/>
<xsl:apply-templates select="S_DATES"/>
<xsl:apply-templates select="S_DISPLAY"/>
</xsl:element>
</xsl:template>
<xsl:template match="POSITIONS">
<xsl:element name="POSITION">
<xsl:for-each select="ZBGHR_APR_POSITION_DET">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="S_TEXTS">
<xsl:element name="S_TEXTS">
<xsl:copy-of select="node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="T_APPRAISER">
<xsl:element name="T_APPRAISER">
<xsl:for-each select="HAP_S_PDF_APPRAISER">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_APPRAISEE">
<xsl:element name="T_APPRAISEE">
<xsl:for-each select="HAP_S_PDF_APPRAISEE">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_OTHERS">
<xsl:element name="T_OTHERS">
<xsl:for-each select="HAP_S_PDF_OTHERS">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_PART_APPRAISER">
<xsl:element name="T_PART_APPRAISER">
<xsl:for-each select="HAP_S_PDF_PART_APPRAISERS">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_PART_APPRAISER">
<xsl:element name="T_PART_APPRAISER">
<xsl:for-each select="HAP_S_PDF_PART_APPRAISERS">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="S_STATUS">
<xsl:element name="S_STATUS">
<xsl:copy-of select="node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="S_DATES">
<xsl:element name="S_DATES">
<xsl:copy-of select="node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="S_DISPLAY">
<xsl:element name="S_DISPLAY">
<xsl:copy-of select="node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="STAT_CHG_BUTTON">
</xsl:template>
<xsl:template match="OFFLINE_ID">
</xsl:template>
<xsl:template match="BSP_FLAG">
</xsl:template>
<xsl:template match="ROLE">
</xsl:template>
<xsl:template match="APPRAISAL_YEAR">
</xsl:template>
</xsl:transform>
Regards,
Shishir.P"XSLT transformation for a deep structure"
which way abap to xml or xml to abap?
you may want to check this thread
Re: Problem converting XML back to structure using XSLT -
How to read xml with deep structure into intarnal table.
Hi,
Could you pls any body provide xslt code for deep structure convert into internal table.
sample xml file:
- <ns0:CREATIONOFCONTRACT xmlns:ns0="http://BPCreationXSD.CreationOfContract">
- <CREATIONOFCONTRACTDATA>
<RequestType>L0011</RequestType>
<ApplicationId>AN-12</ApplicationId>
<LoanId>QO-22</LoanId>
- <Borrowerguarantorinfo>
<Borrowerbpno>101020</Borrowerbpno>
<Co-borrower1BPNo>101021</Co-borrower1BPNo>
<Co-borrower2BPNo>101022</Co-borrower2BPNo>
<Guarantor1BPNo>101023</Guarantor1BPNo>
<Guarantor2BPNo>101024</Guarantor2BPNo>
<Branch>New Delhi</Branch>
</Borrowerguarantorinfo>
- <Loaninfo>
<Applicationtype>Fresh</Applicationtype>
<Purposeofloan>Home Purchase</Purposeofloan>
<Securedunsecuredflag>Secured</Securedunsecuredflag>
<Loantype>HL with MRTA</Loantype>
<Loancurrency>INR</Loancurrency>
<Loanproduct>MaxiHome Loan Package</Loanproduct>
<Loanscheme>MaxiHome ZEC</Loanscheme>
<Loanamount>1500000.00</Loanamount>
<Loantenure>60</Loantenure>
<Tiered>No</Tiered>
</Loaninfo>
<Periodfrom>01/07/2009</Periodfrom>
<Periodto>16/09/2019</Periodto>
<RateType>Fixed</RateType>
<Ratecode>10.25</Ratecode>
</CREATIONOFCONTRACTDATA>
</ns0:CREATIONOFCONTRACT>Hi Ramesh,
Thanks for the info,but I found lot of tables unfortunately I am not getting the value for radio buttons. Also I found a FM FIELD_SELECTION_CUSTOMIZE , IMPORT_DYNPRO etc which will call that screen based on profile but it will not store data any where. I found several tables like TCATS, TFAWC, TFAWF, TFAWT etc.But I am not getting the value for raduio buttons.
Thanks & Regards,
Nagaraj Kalbavi -
Move deep structure do regular structure
HI All ,
I need to move a proxy structure (deep ) to abap regular structure (not deep)
there is general method or program which i can use ?
if not any example will help .
Thanks
James
Edited by: James Herb on Feb 4, 2010 9:52 AM
Edited by: James Herb on Feb 4, 2010 10:56 AMHi James,
Iam not completely clear with the question, but are you asking how to access values from a deep structure?
If so, check if this link helps you:
BADI_SCD_SAVE how to code IF_EX_BADI_SCD_SAVE~CHECK_COMPLETE
In this link, NETWR is being accessed from the deep structure I_SCD-X-ITEM[1]-VFKP-NETWR
Regards,
Swarna Munukoti -
Creating an XML From a Deep Structure using XSL Transformation
Hi ABAPers,
I have a requirement to use XSL Transformations on an ABAP deep type structure.
Currently i have an API that fills in this deep structure and by using CALL TRANSFORMATION ID.... i will get the BIG XML having having 100s of nodes . But actualy form the deep structure i need only some NODES (say 50)... So i tried writing an XSLT
in the transaction STRANS.. but on using this TRANSFORMATION which i wrote i am getting an error messgae like INVALID XML...
Am i going in right track or is there a good solution...
My sample transformation is as below...
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:value-of select="DATA/NODE_ELEMENTS/UUID_KEY/UUID"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/SEMANTICAL_NAME"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/STRUCT_CAT"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/USAGE_CAT"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/RESTRICTED_IND"/>
<xsl:value-of select="VALUES/DATA/NODE_ID"/>.
</xsl:template>
</xsl:transform>
Please help me in solving this issue....
Thanks,
Linda.Hi Linda,
I am replying based on your sample code.
Try the below following suggestions.
here 'GRPHDR' is the node where I am selecting the data.
IGRPHDR is the name of the reference.
First calling the transformation in you program.
TYPES: BEGIN OF tl_hdr,
msgid(20) TYPE c,
END OF tl_hdr.
DATA : t_hdr TYPE STANDARD TABLE OF tl_hdr.
GET REFERENCE OF t_hdr INTO l_result_xml-value.
l_result_xml-name = 'IGRPHDR'.
APPEND l_result_xml TO t_result_xml.
TRY.
CALL TRANSFORMATION yfi_xml_read
SOURCE XML it_xml_data
RESULT (t_result_xml).
CATCH cx_root INTO l_rif_ex.
l_var_text = l_rif_ex->get_text( ).
l_bapiret-type = 'E'.
l_bapiret-message = l_var_text.
APPEND l_bapiret TO errormsgs.
EXIT.
ENDTRY.
in XSL transformation
First write a block of statement to specify from which node you are taking the data.
No matter it is a node or sub-node.
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<IGRPHDR> " reference name of internal table
<xsl:apply-templates select="//GrpHdr"/>
</IGRPHDR>
</asx:values>
</asx:abap>
</xsl:template>
Next select the data from the nodes under the nodes specified in the transformation.
here msgid is the field i am selecting for value.
<xsl:template match="GrpHdr">
<item>
<MSGID> " field in the internal table t_hdr where data has to go
<xsl:value-of select="MsgId"/>
</MSGID>
</item>
</xsl:template>
reply back if further clarification is needed.
Thanks and regards,
Kannan N -
Can we create a deep structure in RFC?
Hi,
My requirement is to create an RFC which has 3 output tables. out of which 1 table contains deep structure, but SAP is not allowing me to create an RFC with deep structure. Message shows only flat structures support in RFC. can any one tell is there any limitation of creating a deep structure in RFC?
Thanks,
Kumar.Instead of a deep structure, you can define another internal table in your signature which will hold all of the data for all of th records of the other internal table, you just need a key value from the other internal table to be able to map which records go with what record in the original internal table. Does this make sense?
Regards,
Rich Heilman
Maybe you are looking for
-
Where are my pictures after editing in LR?
I just downloaded the free trial this morning and plan on buying right away...I love Lightroom! I edited some pics then saved them as Jpeg 2000 files. When I'm trying to upload onto Facebook the pictures are no where to be found w/in My Pictures. Sho
-
Content canvas to stacked canvas for scroll bars
I have a form which has more items. Initially I developed the form with content canvas(this has vertical scroll bar). now I changed this canvas to stacked canvas to get horizontal + vertical scroll bar. But I am not able to do it. Can any one please
-
Installing Adobe Reader XI from Adobe Reader X
For some reason, I cannot install Adobe Reader XI from X. I have downloaded it, both using the installer and direct. When I run the package, it says that it is successful, but when I check, I find that I am still running Adobe X (10.6.1). I am runnin
-
After a virus attack ... and recovery (I'm clean now) I removed (shouldn't have) these files from: bookmarks.bak and files from the .../Application Data\Mozilla\Firefox\Profiles\ca1ytozj.default\bookmarkbackups folder. I then reinstalled 3.6 and impo
-
How to read I/O card details using prtdiag ?
Hi, Can somebody explain the I/O Card details displayed after running prtdiag. ========================= IO Cards ========================= Bus Freq Brd Type MHz Slot Name Model 0 PCI 33 On-Board n