Defining table from DDIC-structure dynamically
Hi folks!
Does anybody know whether it is possible to build an internal table from DDIC-structures dynamically?
I have a deep structured itab_upload(whose structure is defined in the DDIC), which contains 2 fields(Number Name) and a third field which contains itab_desc.
This itab_desc can contain either 2 fields(Number Name) and a third field which contains another itab_desc <b>or</b> 3 fields for numbers(without any other itab).If itab_desc contains another itab_desc, the second itab_desc contains only 3 fields for numbers and names...
help will be very appreciated and points will be rewarded!
Felix
Hi Felix,
Please find below the material which will help you to solve your problem :-
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae
Please reward points if helpful.
Regards.
Srikanta Gope.
[email protected]
Similar Messages
-
EA3, Unhooking a table from a structured type
When I reset the drop down 'Based on Structured Type:' on the 'Table Properties' window for a relational model, the attributes that were inherited from the underlying structure which are displayed as columns in the table are not removed. I'm not sure if that is by design or by accident. I would prefer that if the table is unhooked from the object type that the object attributes would be removed from the table.
This is in Data Modeler EA3 3.1.0.691
Thanks,
ScottK
Edited by: ScottK on Jan 17, 2012 1:10 PMIn SDDM 3.3 EA2 if I unhook an object table from the structured type the columns remain. I can then replace one of those columns as the primary column, replacing the object table generated column value Oid. If I rehook (based on structured type) that table back to an object type, I am not able to use any of those inherited attributes as a column value within the primary key structure.
In a normal object table definition or an object relation table the structured type's attributes can be used as a primary key column. The problem only surfaces if I accidentally un-define the setting on (based on structured type) and then try to reset it. -
Dynamic table from an structure
Hi,
I want to create one alv grid using function REUSE_ALV_GRID_DISPLAY,for this i have passing the fieldcatalog to slis_t_fieldcat_alv.i have been passing my fieldnames ,and col,sel_text_m to fieldcatalog.instead of passing the fields can we assign fields catalog dynamically from the structure.....i have all the fieldnames in one structure for to be displayed in alv list.
pls read the below for reference....
DATA : BEGIN OF wa_inv,
lifnr LIKE rbkp-lifnr,
belnr LIKE rbkp-belnr,
bldat LIKE rbkp-bldat,
END OF wa_inv.
fieldcatalog-fieldname = 'LIFNR'.
fieldcatalog-seltext_m = 'Vendor'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-sp_group = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
*.....this following part will be avaid ..and it should *..be assigned to dynamically
fieldcatalog-fieldname = 'BELNR'.
fieldcatalog-col_pos = 1.
fieldcatalog-seltext_m = 'Invoice No'.
fieldcatalog-key = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BLDAT'.
fieldcatalog-seltext_m = 'Invoice Date'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = gd_repid
IS_LAYOUT = gd_layout
IT_FIELDCAT = fieldcatalog[]
PrakashHi ,
here's an example for fm REUSE_ALV_FIELDCATALOG_MERGE
-> fields of itab must be defined with like not with type!
DATA : BEGIN OF itab1,
f1 LIKE vbak-vbeln,
f2 LIKE vbap-posnr,
f3 LIKE vbak-netwr,
END OF itab1.
rep = sy-repid.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = rep
i_internal_tabname = 'ITAB1'
i_client_never_display = 'X'
i_inclname = rep
CHANGING
ct_fieldcat = fcat.
regards Andreas -
How to find out the tables from extract structures
Hi All,
As I know my data sources are 2lis_04_p_matnr,2lis_04_p_comp,2lis_04_p_arbpl.
How to find out the tables concerned with the fields in the extract structure.
ThanksPl check this link:
http://help.sap.com/saphelp_nw2004s/helpdata/en/29/79eb3cad744026e10000000a11405a/frameset.htm
OR navigate to: help.sap.com - netweaver - bi content - supply chain - look for your application area and the extractor and you will see the source tables and fields.
Ravi Thothadri -
How to create an dynamic internal table with the structure of a ddic table
Hi all,
I want to fill ddic-tables (which I already created) in my abap dictionary with data out of CSV-files (which are located on the CRM-Server). The ddic tables have different amount of fields.
I started with creating a table which contains the name of the tables and the path to the matching CSV-file.
At the beginning I'm filling an internal table with part of this data (the name of the ddic-tables) - after that I am looping at this internal table.
LOOP AT lt_struc ASSIGNING <lfs_struc>.
LOOP AT lv_itab1 INTO lv_wa1 WHERE ztab_name = <lfs_struc>.
lv_feld = lv_wa1-zdat_name.
ENDLOOP.
CONCATENATE 'C:\-tmp\Exportierte Tabellen\' lv_feld INTO lv_pfad.
Do.
OPEN DATASET lv_pfad FOR INPUT IN TEXT MODE ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
READ DATASET lv_pfad INTO lv_rec.
IF sy-subrc NE 0.
EXIT.
ENDIF.
enddo.
REPLACE ALL OCCURRENCES OF '"' IN lv_rec WITH ''.
SPLIT lv_rec AT ';' INTO TABLE lt_str_values.
INSERT into (<lfs_struc>) values lr_str_value.
CLOSE DATASET lv_pfad.
endloop.
This is not the whole code, but it's working until
SPLIT lv_rec AT ';' INTO TABLE lt_str_values.
I want to split all the data of lv_rec into an internal table which has the structure of the current ddic-table, but I didn't find out how to do give the internal table the structure of the ddic-table. In the code I used an internal tyble type string but I should be the structure of the matching tabel.
If I try to create an internal table by using a fiel symbol, I am told, that the data types are not matching.
Has anyone an idea?Hi Mayari,
though you were successfull with
METHOD cl_alv_table_create=>create_dynamic_table
I must warn you not to use it. The reason is that the number of tables created is limited, the method uses GENERATE SUBROUTINE statement and this triggers an unwanted database commit.
If you know the DDIC structure, it is (starting with ECC6.0) much easier:
field-symbols:
<table> type standard table.
data:
lr_data type ref to data.
Create data lr_data type table of (<DDIC structure>).
assign lr_data->* to <table>.
The split code can be simplified gaining speed loosing complexity not loosing functionality.
field-symbols:<fs_s> type any.
field-symbols:<fs_t> type any.
SPLIT lv_rec AT ';' INTO table it_string.
loop at it_string assigning <fs_s>.
assign component sy-tabix of wa_string to <fs_t>.
if sy-subrc = 0.
<fs_t> = <fs_s>.
endif.
at last.
append <fs_itwa3> to <ft_itab3>.
endat.
endloop.
Though it may work as Keshav.T suggested, there is no need to do that way.
Regards,
Clemens -
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 -
Hi experts,
how can I handle it to exporting a table from a structure from a methode?
At the moment I export the structure in the methode but I need to export a table.
At the moment:
Parameter Type Typing Methode Associated Type
param_1 Exporting Type structure
I need something like that:
Parameter Type Typing Methode Associated Type
param_1 Exporting Type Table of structure
... but that is not possibleI think he meant something like this
CLASS lcl_test DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: get_tab EXPORTING gen_table TYPE table.
ENDCLASS.
CLASS lcl_test IMPLEMENTATION.
METHOD get_tab.
SELECT * FROM sflight INTO TABLE gen_table UP TO 10 ROWS.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA: it_sflight TYPE TABLE OF sflight.
lcl_test=>get_tab( IMPORTING gen_table = it_sflight ).
"here IT_SFLIGHT holds what you want
Of course you could make it more generic, meaning query dynamic DB table inside get_tab and create dynamic table outside the method call to get returned data to that table. But basically it shows the idea.
Regards
Marcin -
How to read tables and fields transaction,how to find table from a strucre
hi all,
i am having problem in reading tables and fields for developing a customised report. can anybady help me how to extract tabele and fields from a transaction code and how to map table from a structure.
It will me much help full, if u had any documentation. u should be appreciated.
Thanking u
kiran
Message was edited by:
kiranHi Kiran,
You can make use of the tables or Views available.
Reward If Useful.
Regards,
Chitra -
HR Logical database PNP. OO to fill table dynamic table from PNP ?
Hi all
I want to get some stuff from the HR logical database into a dynamic table
Here's a real simple example that writes info out to a normal list.
(report is based on using Logical DB PNP)
tables: pernr.
INFOTYPES: 0001, "Organizational Assignment
0002. "Personal Data
SELECT-OPTIONS: language FOR p0002-sprsl.
INITIALIZATION.
pnptimed = 'D'.
GET pernr.
PROVIDE * FROM p0002 BETWEEN pn-begda AND pn-endda.
CHECK language.
WRITE: / p0002-pernr,
sy-vline,
p0001-ename,
sy-vline,
p0002-sprsl,
sy-vline,
p0002-gbdat.
ENDPROVIDE.
endform.
Now what I want to do is replace the write stuff by appending the entries into a dynamic table which I will display as an ALV Grid.
so I add my structure in the data declarations
types: begin of s_elements,
pernr type p0002-pernr,
ename type p0001-ename,
sprsl type p0002-sprsl,
gbdat type p0002-gbdat.
drop_down_handle type int4.
types: end of s_elements.
include zz_jimbo_incl.
build the dynamic table
create data dref type s_elements.
assign dref->* to <fs>.
i_routine = 'POPULATE_DYNAMIC_ITAB'.*
i_names = 'NAME_COLUMNS'.
i_gridtitle = 'HR TEST'.
invoker = sy-repid.
i_zebra = 'X '.
i_edit = ' '.
call function 'ZZ_CALL_SCREEN'
exporting
invoker = invoker
my_line = <fs>
i_gridtitle = i_gridtitle
i_edit = i_edit
i_zebra = i_zebra
i_names = i_names
i_routine = i_routine
importing
z_object = z_object
dy_table = dy_table.
Now to populate the dynamic Itab the routine below is entered.
form populate_dynamic_itab changing dy_table.
assign dy_table->* to <dyn_table>.
create data dy_line like line of <dyn_table>.
assign dy_line->* to <dyn_wa>.
However I can't use GET / PROVIDE / ENDPROVIDE in a Form.
Anyway round this ---seems HR has an aversion to OO.
Cheers
jimboHi,
well, GET_PERNR is a so called event_statement. It has nothing to do with ABAP 00.
Normally it will be like this:
START-OF-SELECTION.
GET_PERNR.
PROVIDE ....
END-OF-SELECTION.
-> and here the CALL SCREEN NNNN for ALV-Display.
Provide-statements you can use in forms of course, and as many times you want during GET and END-OF-SELECTION.
But as I understood : you just want to save the write-statements?
I always develop a DDIC-Structure, declarate the data objects in the programm, read the data via Provide into the infotypes, and then make a move-corresponding to my structure. and display it.
Normally no problem.
kind regards
maik -
Get the data from a structure not a transparent table
Hello masters, does anyone knows how to retrieve data from a structure?
Structures do not contain data, they are mearly a way to describe it and are usually used in screen programming to collect data into which come from transparent tables. For example, lets say you have data from two tables that need to be displayed on a screen, the data is related, so a good programming practice is to use a structure either described internally in the program, or in the ABAP dictionary. Then in the program, you retrieve the data from the transpart tables and move the data to the structure fields, these structure fields are then defined within the screen.
Anyway, when you do F1 help on a field in a screen, and it is says that it is part of a structure, then this is becasue the structure is being used to group these fields into a common container when doing the screen programming, so it is a little trickier to find where the data is coming from, but not impossible. One way is to use the ST05 to do a SQL trace on the program, this will tell you the tables being hit, and you can find the data that way. Another way, is to debug the program, and see where the data is coming from.
Regards,
Rich Heilman -
Pass structure, internal table from workitem to BSP
Hi All,
I have a requirement where a BSP application is to be called from the workitem.
How can i pass a structure or an internal table from the workitem to the BSP application?In the BSP application mark the check box AUTO on the PAGE ATTRIBUTES tab and this makes the value available in the displayed URL of the BSP application.
the documention mentation provided by SAP regarding this option is
A page attribute marked as automatic is automatically supplied with a value from the calling URL or the navigation from another page. However there must exist a parameter of the same name with value in the URL or navigation interface.
here your navigation interface is WF_EXTSRV that you have already defined make the parameter as Exporting and when you get the URL read the URL and by using the OFFSET concept you can read the value of the element that you want in the BSP application -
How to define an itab based from a structure inside a class
Hello Experts,
How can I define an internal table based from a structure that
is declared inside a class?I want to define it in the START-OF-SELECTION event.
I'll create a scenario below:
* CLASS lcl_main DEFINITION
CLASS lcl_main DEFINITION ABSTRACT.
PUBLIC SECTION.
TYPES: BEGIN OF t_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
ernam TYPE vbak-ernam,
auart TYPE vbak-auart,
kunnr TYPE vbak-kunnr,
vkgrp TYPE vbak-vkgrp,
END OF t_vbak.
ENDCLASS. "lcl_main DEFINITION
START-OF-SELECTION.
*Here i want to define an internal table based from the structure T_VBAK.
Hope you could help me out here guys. Thank you and take care!.
-
Determining internal table structure dynamically
Hi,
I have a number of internal tables in my program which I declare using types. As an example:
TYPES: begin of ty_hierarchy,
control_id(6) type c,
node_id(10) type c,
node_name type bezei40,
material type matnr,
node_level type prodh_stuf,
node_parent(10) type c,
end of ty_hierarchy.
DATA: it_hierarchy type ty_hierarchy occurs 0.
Further down my program I need to determine the structure of internal table IT_HIERARCHY dynamically. Because I have a number of internal tables, I need to determine which internal table is being processed. Therefore it's important that I know the structure of the table that I'm currently processing.
I am aware of CL_ABAP* classes and functions like GET_COMPONENT_LIST. However because I have declared my tables using the TYPE statement the method/function cannot read my table structure correctly. If I changed my declaration to be as below, the method/function work! However I don't want to do this as I use field symbols to reference my internal tables and need to use the TYPE statement.
DATA: begin of ty_hierarchy,
control_id(6) type c,
node_id(10) type c,
node_name type bezei40,
material type matnr,
node_level type prodh_stuf,
node_parent(10) type c,
end of ty_hierarchy.
DATA: begin of it_hierarchy occurs 0.
include structure ty_hierarchy
DATA: end of it_hierarchy.
Does anyone know on how I can determine my internal table structure dynamically but still keeping my internal table declarations using TYPE statement?
Any help would be greatly appreciated with reward points .....
Thanks
LiamHello Liam
Both the ABAP-OO as well as the FM-based approach described by Eswar work well with your way of defining the itabs. I described three different ways how to get the structure of your itab dynamically:
- directly using the itab
- using a field symbol
- using a data reference
REPORT zus_sdn_dynamic_itabs.
TYPE-POOLS: abap.
TYPES: BEGIN OF ty_hierarchy,
control_id(6) TYPE c,
node_id(10) TYPE c,
node_name TYPE bezei40,
material TYPE matnr,
node_level TYPE prodh_stuf,
node_parent(10) TYPE c,
END OF ty_hierarchy.
DATA:
gs_hierarchy TYPE ty_hierarchy,
it_hierarchy TYPE ty_hierarchy OCCURS 0.
DATA:
gt_comp TYPE abap_compdescr_tab,
gs_comp_a LIKE LINE OF gt_comp,
gd_type TYPE abap_typekind,
gs_comp TYPE rstrucinfo,
it_comp TYPE TABLE OF rstrucinfo.
DATA:
go_struct TYPE REF TO cl_abap_structdescr,
go_table TYPE REF TO cl_abap_tabledescr,
gdo_data TYPE REF TO data.
FIELD-SYMBOLS:
<gt_itab> TYPE table.
START-OF-SELECTION.
GET REFERENCE OF it_hierarchy INTO gdo_data.
ASSIGN gdo_data->* TO <gt_itab>.
* (1) Describe directly by using the itab
* go_table ?= cl_abap_structdescr=>describe_by_data( it_hierarchy ).
* (2) Describe indirectly by using field symbol
* go_table ?= cl_abap_structdescr=>describe_by_data( <gt_itab> ).
* (3) Describe by data reference to itab
go_table ?= cl_abap_structdescr=>describe_by_data_ref( gdo_data ).
go_struct ?= go_table->get_table_line_type( ).
WRITE: / 'ABAP-OO Version:'.
gt_comp = go_struct->components.
LOOP AT gt_comp INTO gs_comp_a.
WRITE: / gs_comp_a-name,
gs_comp_a-length,
gs_comp_a-type_kind,
gs_comp_a-decimals.
ENDLOOP.
SKIP 2.
CALL FUNCTION 'GET_COMPONENT_LIST'
EXPORTING
program = sy-repid
fieldname = 'GS_HIERARCHY'
TABLES
components = it_comp.
WRITE: / 'Function Module Version:'.
LOOP AT it_comp INTO gs_comp.
WRITE: / gs_comp-compname,
gs_comp-level,
gs_comp-leng,
gs_comp-type,
gs_comp-olen,
gs_comp-decs.
ENDLOOP.
END-OF-SELECTION.
Regards
Uwe -
Should I define tables in the CSS file or from the Table option on the menu bar?
I am having trouble understanding which table definitions are the ascendant ones: the CSSfile table definitions or the definitions from the Table option on the menu bar. Is there a conflict if I am applying the CSS style to every topic? Who wins...CSS or Table?
Hi there
Sorry, but I think you are a bit confused. I'm assuming here that you are referring to defining tables via the toolbar? Where you use this button?
That simply inserts the table structure which is later styled using CSS.
Then there is the other option where you click Table > Insert > Table and you do two things. You insert the table structure as well as some special CSS codes that are added to your CSS file.
Cheers... Rick -
Dynamic DDIC structure - work at runtime with changes
Hi Experts,
I have a problem in a method of Web Dynpro Abap. Ich have a database structure /SME/DED_DYN and change its fields at runtime. I do that with the function DDIF_TABL_PUT and the activation with DDIF_TABL_ACTIVATE.
I have:
COMMIT WORK and wait.
CALL FUNCTION 'DDIF_TABL_PUT'
EXPORTING
NAME = '/SME/DED_DYN'
TABLES
DD03P_TAB = DD03P_TAB
DD05M_TAB = DD05M_TAB
DD08V_TAB = DD08V_TAB
DD35V_TAB = DD35V_TAB
DD36M_TAB = DD36M_TAB
EXCEPTIONS
tabl_not_found = 1
name_inconsistent = 2
tabl_inconsistent = 3
put_failure = 4
put_refused = 5
others = 6.
COMMIT WORK and wait.
if sy-subrc = 0.
call function 'DDIF_TABL_ACTIVATE'
exporting
name = '/SME/DED_DYN'
IMPORTING
rc = rc
exceptions
not_found = 1
put_failure = 2
others = 3.
endif.
The fields of the DDIC structure /SME/DED_DYN are changed at runtime dynamicly. Not their value, the fields themselves with fieldname and datatype. I need to work with these NEW fields of the DDIC structure at the same runtime. But somewhere the OLD /SME/DED_DYN is buffered I think, because the method only reads this old structure although in Transaction SE11 it changes to the NEW one at runtime correctly. I have to refresh my whole Web Dynpro Application in the browser and then it works with the new structure.What buffer could this be and how can I clear it, so that my method in WebDynpro can proceed with the new DDIC structure?
I hope you understand my problem.
Thanks for your help!!
Best regards,
IngmarHi,
I create a database table which name is ZTABL1 .
The fields of this table are MANDT and FIELDS1 .
Then i write the code below .
It changes the dbtable dynamically and the values of the fields.
I hope this help you.
DATA : DD03P_TAB LIKE DD03P OCCURS 0 WITH HEADER LINE .
DATA : DD05M_TAB LIKE DD05M OCCURS 0 WITH HEADER LINE .
DATA : DD08V_TAB LIKE DD08V OCCURS 0 WITH HEADER LINE .
DATA : DD12V_TAB LIKE DD12V OCCURS 0 WITH HEADER LINE .
DATA : DD17V_TAB LIKE DD17V OCCURS 0 WITH HEADER LINE .
DATA : DD35V_TAB LIKE DD35V OCCURS 0 WITH HEADER LINE .
DATA : DD36M_TAB LIKE DD36M OCCURS 0 WITH HEADER LINE .
DATA : lt_fcat TYPE lvc_t_fcat ,
ls_fcat TYPE lvc_s_fcat .
DATA : lt_table TYPE REF TO data.
DATA : ZTABL1 .
CALL FUNCTION 'DDIF_TABL_GET'
EXPORTING
NAME = 'ZTABL1'
TABLES
DD03P_TAB = DD03P_TAB
DD05M_TAB = DD05M_TAB
DD08V_TAB = DD08V_TAB
DD12V_TAB = DD12V_TAB
DD17V_TAB = DD17V_TAB
DD35V_TAB = DD35V_TAB
DD36M_TAB = DD36M_TAB
EXCEPTIONS
ILLEGAL_INPUT = 1
OTHERS = 2
LOOP AT DD05M_TAB WHERE FIELDNAME NE 'MANDT' .
DD05M_TAB-FIELDNAME = 'FIELD2' .
MODIFY DD05M_TAB .
ENDLOOP.
LOOP AT DD03P_TAB WHERE FIELDNAME NE 'MANDT'
DD03P_TAB-FIELDNAME = 'FIELD2' .
MODIFY DD03P_TAB .
ENDLOOP.
LOOP AT DD08V_TAB WHERE FIELDNAME NE 'MANDT' .
DD08V_TAB-FIELDNAME = 'FIELD2' .
APPEND DD08V_TAB .
ENDLOOP.
LOOP AT DD35V_TAB WHERE FIELDNAME NE 'MANDT' .
DD35V_TAB-FIELDNAME = 'FIELD2' .
MODIFY DD35V_TAB .
ENDLOOP.
LOOP AT DD36M_TAB WHERE FIELDNAME NE 'MANDT' .
DD36M_TAB-FIELDNAME = 'FIELD2' .
MODIFY DD36M_TAB .
ENDLOOP.
CALL FUNCTION 'DDIF_TABL_PUT'
EXPORTING
NAME = 'ZTABL1'
TABLES
DD03P_TAB = DD03P_TAB
DD05M_TAB = DD05M_TAB
DD08V_TAB = DD08V_TAB
DD35V_TAB = DD35V_TAB
DD36M_TAB = DD36M_TAB
EXCEPTIONS
TABL_NOT_FOUND = 1
NAME_INCONSISTENT = 2
TABL_INCONSISTENT = 3
PUT_FAILURE = 4
PUT_REFUSED = 5
OTHERS = 6
COMMIT WORK AND WAIT .
DATA : lv_subrc like sy-subrc .
CALL FUNCTION 'DDIF_TABL_ACTIVATE'
EXPORTING
NAME = 'ZTABL1'
AUTH_CHK = ' '
IMPORTING
RC = lv_subrc
EXCEPTIONS
NOT_FOUND = 1
PUT_FAILURE = 2
OTHERS = 3
COMMIT WORK AND WAIT .
clear : lt_fcat , lt_fcat[] .
LOOP AT DD03P_TAB .
MOVE-CORRESPONDING DD03P_TAB TO ls_fcat .
APPEND ls_fcat TO lt_fcat .
ENDLOOP.
PERFORM process.
*& Form process
form process.
FIELD-SYMBOLS : <table> TYPE table .
FIELD-SYMBOLS : <s_table> TYPE ANY .
FIELD-SYMBOLS : <f_1> TYPE ANY .
DATA : ls_ZTABL1 type ZTABL1 .
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING it_fieldcatalog = lt_fcat
IMPORTING ep_table = lt_table.
ASSIGN lt_table->* TO <table>.
ASSIGN LOCAL COPY OF INITIAL LINE OF <table> TO <s_table>.
LOOP AT lt_fcat INTO ls_fcat.
IF ls_fcat-fieldname = 'FIELD2' .
ASSIGN COMPONENT ls_fcat-fieldname OF STRUCTURE <s_table> TO <f_1> .
<f_1> = 'A' .
ENDIF.
ENDLOOP.
MOVE-CORRESPONDING <s_table> TO ls_ZTABL1 .
INSERT INTO ZTABL1 values ls_ZTABL1.
endform. " process
Maybe you are looking for
-
VZW palm centro w/ out data plan and want to get data
hey all. i have a palm centro wich i love, but i want to know if i can connect to evdo rev a for free at all, i know its wierd that i got it without a data plan, but i want to get data Post relates to: Centro (Verizon)
-
Door Video App video direct to a 9900 phone
Has anyone setup a live video feed direct to an IP phone from a door intercom. I was thinking if there was a way to have a live video feed from a video encoder to direcly disply on the phone like VTA. Has anyone done somthing like this.
-
How to hide DecisionUserNote text edit box?
Hi everybody, Could you tell me the way to HIDE the text edit box which appears in the UWL preview of some tasks used to include a note? It is supposed that filling NOTES in the Sections to exclude iView property would do it but I'm not getting the e
-
Planning Dependent Demand with Phantom Strategy (59)
Hi We would like to maintain forecasts at a Phantom material level and consume this forecast based on dependent demand (Planning Strategy 59 in ECC and an equivalent custom strategy in APO). This works in ECC MRP, but does not appear to work in APO C
-
I am attempting to download and install Adobe Reader on an employees laptop, running Windows Vista Business. When the download and installation both reach 100%, the dialog box showing the progress disappears, and Adobe Reader is nowhere to be found.