Dynamically get the structure of an itab
Hi all,
How to get the structure of an Itab dynamically.
Regards,
bala
u mean to say that the itab table structure has to be dynamic. ???
u can refer the followig code.
REPORT ZDINUCOPY_DATA_FROM_CLIENTS .
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
PARAMETERS : P_CLIENT LIKE T000-MANDT OBLIGATORY,
P_TABLE(10) OBLIGATORY,
P_TARGET(10).
SELECTION-SCREEN COMMENT 45(65) TEXT-001 FOR FIELD P_TARGET.
SELECTION-SCREEN SKIP 1 .
PARAMETERS : P_DEL AS CHECKBOX.
PARAMETERS : P_INS AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK B1.
DATA: GP_TABLE TYPE REF TO DATA .
FIELD-SYMBOLS: <GT_TABLE> TYPE TABLE .
FIELD-SYMBOLS: <GS_TABLE> .
DATA : I_STRUCTURE_NAME LIKE DD02L-TABNAME,
CT_FIELDCAT TYPE LVC_T_FCAT.
AT SELECTION-SCREEN.
IF P_TABLE(1) NE 'Z' AND
P_TABLE(1) NE 'Y'.
MESSAGE E000(00) WITH 'Enter a customer table'.
ENDIF.
IF P_TARGET IS INITIAL.
P_TARGET = P_TABLE.
ENDIF.
START-OF-SELECTION.
I_STRUCTURE_NAME = P_TABLE.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = I_STRUCTURE_NAME
I_CLIENT_NEVER_DISPLAY = 'X'
CHANGING
CT_FIELDCAT = CT_FIELDCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3 .
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = CT_FIELDCAT
IMPORTING
EP_TABLE = GP_TABLE
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2.
ASSIGN GP_TABLE->* TO <GT_TABLE>.
BREAK-POINT.
Similar Messages
-
Ho to get the structure for a subnode
Hi Experts,
I am an beginner in webdynpro abap - sorry for this simple question, but I have not found an answer.
I have a context node generated from a interactive form. Let's call this node 'node1'.
Within this node I have a subnode 'subnode1' containing the elements for an internal table.
My simple question is: Ho can I get the structure of the subnote element?
I mean, this is clear for me:
DATA:
ls_node1 TYPE wd_this->element_node1.
But how about:
ls_subnode1 type ?????????????????
I guess the answer is quite simple... Thanks for your help.
AndreasHi,
This will be of the same type that you declared while creating the context node element node1. You may go to the context node tab to see the dictionary structure. Alternatively you double click on wd_this which would display the inferface for wd_this and search for element_node1 there.
Let me know if this helps.
Regards
Prasenjit -
Dynamically get the Max value from table and insert max value + 1 in Target
Hi All, I have a requirement given below, need help in building a solution for this: A mapping that will get the dynamically get the max value(Basically a number) from table , this target table is used by many other concurrent jobs and updated very frequently. My requirement is to get max value from this target table dynamically (Using dynamic look up) and then have an expression to increment by 1 and then load it to Target.I tried using SELCT max(col1) from target in dynamic look up override but this does not seem to work.Any work around here? I dont insist on using a SQL transformation here as Production DB could have 3 Million + records! Thanks in advance, -KRB
Q/微信859034112办理科廷/ECU/MU/西澳大学毕业证成绩单及真实使馆教育部认证/永久可查Q/微信859034112办理USYD/UNSW/MQ/UTS/Monash/悉尼大学毕业证成绩单及真实教育部认证专业面向澳洲留学生提供以下服务: 一:毕业证、成绩单等全套材料,从防伪到印刷,从水印到钢印烫金,水印底纹。二:真实使馆认证(留学人员回国证明),使馆存档可通过当地使馆查询三:真实教育部认证,教育部永久存档,教育部留服网站永久可查 四:真实留信认证,留信网入库存档,永久可查 现在教育部认证办理已经不需要提供回国证明(使馆认证),如无需要,请注意办理流程!联系人:kevin QQ: 859034112 微信:859034112如果您是以下情况,我们都能竭诚为您解决实际问题:1、在校期间,因各种原因未能顺利毕业,拿不到官方毕业证; 2、面对父母的压力,希望尽快拿到; 3、不清楚流程以及材料该如何准备; 4、回国时间很长,忘记办理; 5、回国马上就要找工作,办给用人单位看; 6、企事业单位必须要求办理的; 请联系英华教育客服kevin,专业负责为您排忧解难!资深业务!联系人:kevin QQ: 859034112 微信:859034112 澳洲各大高校均可办理,样板齐全。 悉尼大学 TheUniversity of Sydney 新南威尔士大学TheUniversity of New South Wales 墨尔本大学 The University ofMelbourne 阿德莱德大学 Adelaide University 莫纳什大学 Monash University 昆士兰大学The University of Queensland 西澳大学 The University of WesternAustralia 澳大利亚国立大学 The Australian National University 麦考瑞大学 Macquarie University 纽卡斯尔大学 TheUniversity of Newcastle 卧龙岗大学 University of Wollongong 格里菲斯大学 Griffith University 佛林德斯大学 Flinders University 塔斯马尼亚大学 University of Tasmania 西悉尼大学Universityof Western Sydney 邦德大学Bond University 迪肯大学 Deakin University 悉尼科技大学 University of Technology ,Sydney 科汀科技大学 Curtin University of Technology 墨尔本皇家理工学院 RMIT University 昆士兰科技大学QueenslandUniversity of Technology 拉筹伯大学 La Trobe University 莫道克大学 Murdoch University 堪培拉大学 University of Canberra 旋宾科技大学 Swinburne University of Technology南澳大学Universityof South Australia 中央昆士兰大学 University of Southern Queensland 查尔斯特大学 Charles SturtUniversity 詹姆斯库克大学 James Cook University 圣母大学 Notre Dame 新英格兰大学 The University of NewEngland 南昆士兰大学 Universityof Southern Queensland 澳洲天主教大学 Australia CatholicUniversity巴里迪大学Universityof Ballarat 埃迪斯科文大学 Edith Cowan University 南十字星大学 Southern Cross University 阳光海岸大学 University of Sunshine Coast 维多利亚大学VictoriaUniversity 北领地大学 NorthernTerritory University诚招代理:本公司诚聘当地代理人员,如果你有业余时间,有兴趣就请联系我们。敬告:面对网上有些不良个人中介,真实教育部认证故意虚假报价,毕业证、成绩单却报价很高,挖坑骗留学学生做和原版差异很大的毕业证和成绩单,却不做认证,欺骗广大留学生,请多留心!办理时请电话联系,或者视频看下对方的办公环境,办理实力,选择实体公司,以防被骗! 办理悉尼大学USYD毕业证Q/微信859034112成绩单学历认证 University of Sydney 办理新南威尔士大学UNSW毕业证Q/微信859034112成绩单学历认证 University of New South Wales 办理墨尔本大学Melbourne毕业证Q/微信859034112成绩单学历认证 University of Melbourne 办理昆士兰大学Queensland毕业证Q/微信859034112成绩单学历认证 University of Queensland 办理麦考瑞大学MQU毕业证Q/微信859034112成绩单学历认证 Macquarie University 办理莫纳什大学Monash毕业证Q/微信859034112成绩单学历认证 Monash University 办理澳洲国立大学ANU毕业证Q/微信859034112成绩单学历认证 Australian National University 办理澳洲天主教大学ACU毕业证Q/微信859034112成绩单学历认证 Australian Catholic University 办理悉尼科技大学UTS毕业证Q/微信859034112成绩单学历认证 University of Technology Sydney 办理查尔斯特大学CSU毕业证Q/微信859034112成绩单学历认证 Charles Sturt University 办理格里菲斯大学Griffith毕业证Q/微信859034112成绩单学历认证 Griffith University 办理科廷大学Curtin毕业证Q/微信859034112成绩单学历认证 Curtin University 办理西悉尼大学UWS毕业证Q/微信859034112成绩单学历认证University of Western Sydney 办理澳洲纽卡斯尔大学Newcastle毕业证Q/微信859034112成绩单学历认证 University of Newcastle 办理昆士兰科技大学QUT毕业证Q/微信859034112成绩单学历认证 Queensland University of Technology 办理皇家墨尔本理工学院RMIT毕业证Q/微信859034112成绩单学历认证 RMIT University 办理卧龙岗大学Wollongong毕业证Q/微信859034112成绩单学历认证 University of Wollongong 办理迪肯大学Deakin毕业证Q/微信859034112成绩单学历认证 Deakin University 办理拉筹伯大学毕业证Q/微信859034112成绩单学历认证 La Trobe University 办理新英格兰大学UNE毕业证Q/微信859034112成绩单学历认证 University of New England办理阿德莱德大学Adelaide毕业证Q/微信859034112成绩单学历认证 University of Adelaide办理西澳大学毕业证Q/微信859034112成绩单学历认证 University of Western Australia办理堪培拉大学Canberra毕业证Q/微信859034112成绩单学历认证 University of Canberra办理塔斯马尼亚大学Tasmania毕业证Q/微信859034112成绩单学历认证 University of Tasmania办理澳洲维多利亚大学Victoria毕业证Q/微信859034112成绩单学历认证Victoria University办理中央昆士兰大学CQU毕业证Q/微信859034112成绩单学历认证 Central Queensland University办理邦德大学Bond毕业证Q/微信859034112成绩单学历认证 Bond University办理南昆士兰大学USQ毕业证Q/微信859034112成绩单学历认证 University of Southern Queensland办理南澳大学USA毕业证Q/微信859034112成绩单学历认证 University of South Australia办理斯威本科技大学SUT毕业证Q/微信859034112成绩单学历认证 Swinburne University of Technology办理詹姆斯.库克大学JCU毕业证Q/微信859034112成绩单学历认证 James Cook University办理澳洲圣母大学UND毕业证Q/微信859034112成绩单学历认证 University of Notre Dame办理南十字星大学SCU毕业证Q/微信859034112成绩单学历认证 Southern Cross University办理弗林德斯大学Flinders毕业证Q/微信859034112成绩单学历认证 Flinders University办理莫道克大学Murdoch毕业证Q/微信859034112成绩单学历认证 Murdoch University办理埃迪斯科文ECU大学毕业证Q/微信859034112成绩单学历认证 Edith Cowan University 办理查尔斯达尔文大学CDU毕业证Q/微信859034112成绩单学历认证 Charles Darwin University办理巴拉瑞特大学Ballarat毕业证Q/微信859034112成绩单学历认证 University of Ballarat办理阳光海岸大学USC毕业证Q/微信859034112成绩单学历认证University of Sunshine Coast
-
How to dynamically get the SOM expression of a field?
As a follow up to the note below, I would really appreciate any help as of how to get the SOM expression of a field dynamically, by this, I mean how to get the SOM expression of a field at running time using JavaScript.
Thanks,
Isis
That does make things clearer. You will have to save the change information in the XML. I realize that you don't want to save an xml node for every field, but there is a better way. You can use scripting to add data nodes to the XML data in the form. I'm thinking of the following:
Include an empty container node in your XML schema: <HighlightedFields></HighlightedFields>
When a field is changed, in the field's change event call a common script: HighlightChangedField, passing in the object. The script will highlight the field (set the border a certain color or whatever). It will also add node underneath the HighlightedFields data node with the SOM expression of the field. The SOM expression is the "path" of the object in the form heirarchy, sort of like an xpath. So if you have a subform named Subform1 and you change the Name and Address textfields, you might end up with something like:
<HighlightedFields>
<HighlightedField>
<SOMExpression>xfa[0].form[0].myform[0].Subform1[0].Name[0]</SOMExpre ssion>
</HighlightedField>
<HighlightedField>
<SOMExpression>xfa[0].form[0].myform[0].Subform1[0].Address[0]</SOMEx pression>
</HighlightedField>
</HighlighedFields>
The upside of this is that you only store XML nodes for what is changed instead of needing a specific XML node for each field. The downside is that you will need a call to the common script in every field's change event: HighlightChangedField(this);
Now, to make this work when a form is loaded the next time, in the initialize event at the topmost subform in the hierarchy you add a script that walks the HighlightedFields data node, and for each HighlighedField entry you highlight the contained object. You can get a reference to an object using its SOM expression, so just take the SOM expression from each entry and do an xfa.resolveNode(SOMExpression) to get the object, then set whatever attributes you want to highlight the field.
The big issue I see with this would be if you have dynamically added objects on your form. In that case you would probably need to store the instance index along with the SOM expression for each changed object, then use that instance number when highlighting on form load.As a follow-up, I had said I would try to put together an example for you. The setting of the change indications and the highlighting of the fields is not a problem, but I did have an issue that perhaps one of the experts on the forum can help with:
The problem is how to detect a change in a text field without a lot of overhead. You can't just place a call to the highlight method in the Exit event without checking for a change, since the user can just tab from field to field without changing anything. Unfortunately the properties that show the old text and new text of a field are not valid on the Exit event. An alternative is to use the Change event, but with a text field the event fires for every character typed. This seems like a lot of extra processing..
Anyone know a better way? I went as far as using the extras collection on fields to hold the last value, but that adds a lot of complexity since it needs to be set to the initial raw value when the form is first loaded. I'd like to find a solution that doesn't require a lot of code to be added to every field on the form. -
Dynamic passing of the structure in LVC_FIELDCATALOG_MERGE
Hi ABAP Gurus,
I'am doing report to read cluster results
My requirement is :
The report uses LDB -PNP in the selection screen in addition to that Clusterid is passed and what ever cluster id we select for the pernr that cluSter id results has to show in the report output
The report has to dynamically change in the output (whole structure of the cluster id) how to pass in selected cluster id (what we selected in the selection screen) in the function module
LVC_FIELDCATALOG_MERGE
Importing
I_STRUCTURE_NAME - (HERE I WANT TO GET THE STRUCTURE OF THE SELECTED CLUSTER ID IN THE SELECTION SCREEN)
Thanks and Regards,
Deepthi.Recently I have been working on generic cluster access and I must say the task was challenging. What I've discovered is:
- generic access as per cluster ID is impossible via [IMPORT ... FROM DATABASE...|http://help.sap.com/abapdocu_70/en/ABAPIMPORT_SHORTREF.htm] -> in order to create a fully flexible access you would have to go for pure dynamic program generation by means of [GENERATE SUBROUTINE POOL|http://help.sap.com/abapdocu_70/en/ABAPGENERATE_SHORTREF.htm]
- as there are houndreds of available cluster IDs it is very difficult to determine those relevant to particular employee. For just one table PCL2 there are multiple of unknown to me areas which are hard to distinguish from those (un)relevant to employee. First look at fixed values from domain RELID_PCL2 gives the feeling what we are struggling with.
- focusing on all common clusters (only from PCL2) like CU, RX, ZL, B2, PS, PT can narrow the search result but still is a lot to be handled by one program
- eventually looking deeper only on RX and possibly B2 areas seemed to be the best choice (as mostly we use only those - at least I do). So I focused on this area as generic payroll result can be easily extracted. What I needed was extracting relid for given EE molga, then py result type for this relid, the simply using FM PYXX_READ_PAYROLL_RESULT to access py results itself for given cluster directory entry (table hrpy_rgdir )
- the final challenge was how to show the results in user friendly form. As the result table I had was not only nested but deep too it wasn't so obvious. Luckily to me I was using Web Dynpro which allows to create table popins (showing the table within the table) but I don't think there is corresponding GUI control in SAP GUI. So considering how you want to show this data is really not an easy thing to do.
- As for the structure of payroll result itself (or rather structure of each of its components) can be delivered using RTTI but you will also sweat a bit before getting that done.
To conclude. There is no easy way of accessing clusters by just giving its RELID Even though you would focus on some specific part, it will take you more time then you expect at the beggining. So I would try to suppress the tempation for a moment and consider all these discussed (and those which I didn't think of) aspects.
Regards
Marcin -
Little tip to get the nr of elements in a local structure using RTTI
sometimes you need to know the number of elements in a structure for manpulating data
for example you might need to convert the elements in an internal table to a special file format such as "field","field",......"field".
instead of something like this where you have counted the number of elements in your structure
you can obtain the number of elements dynamically. This saves changing the code each time you change the structure and can avoid errors.
data: zstring type string
data: zstring1 type string.
lv_index = 1.
WHILE lv_index LE 47.
.CLEAR zstring.
ASSIGN COMPONENT lv_index OF STRUCTURE your_ structure TO <fsa>.
CONCATENATE '"' <fsa> '"' INTO zstring.
CONCATENATE zstring1 zstring INTO zstring1.
CONCATENATE zstring1 ',' INTO zstring1.
lv_index = lv_index + 1.
CLEAR zstring.
endwhile
lv_index = 48.
ASSIGN COMPONENT lv_index OF STRUCTURE wa_interface_contracts TO <fsa>.
CONCATENATE '"' <fsa> '"' INTO zstring.
CONCATENATE zstring1 zstring INTO zstring1.
CONDENSE zstring1. "Left align all data fields within the string
APPEND zstring1 TO ta_string1.
CLEAR zstring.
CLEAR zstring1.
lv_index = 1.
Using the RTTI
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,
CREATE DATA dref TYPE your_structure
ASSIGN dref->* TO <fs>.
lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( <fs> ).
* get the structure details into a table.
* table zogt[] contains the structure details
zogt[] = lr_rtti_struc->components.
now the nr of rows in this table contains the number of elements in your structure.
cheers
jimbohi Jimbo,
why don't you start blogging?
ec -
FM to get the date specific structural help
I am working on structural help for Org id for a selection screen parameter.
I am using FM RH_OBJID_REQUEST. It is giving the structure valid ion today. My requirement is to get the structure valid on given period in the above selection field.
Please let me know is there any other way(other FM) to get the date specific structural help.Pass your dates to ORGBEG & ORGEND
Description
This parameter only applies to the search function.
The parameters ORGEND and ORGBEG together determine the period in which
the organizational assignment data for positions is read. The entry in
ORGBEG specifies the start of the search period.
Value range
Allowed values are all dates smaller than the date in ORGEND.
Default
The default value is the smallest system date.
Function Module
^Saquib -
Get the type of collecion elements
Hi,
I would like to get the type of the elements of a collection when I give the name the collection. Does anybody suggest anything about the SQL code?
For example
CREATE OR REPLACE TYPE CourseList AS TABLE OF VARCHAR2(64);
CREATE TABLE department (
name VARCHAR2(20),
director VARCHAR2(20),
office VARCHAR2(20),
courses CourseList)
NESTED TABLE courses STORE AS courses_tab;
How it is possible to get the type of elements of CourseList (in the example it is VARCHAR2(64)) if I give the name of the nested table courses?
Thank you> I would like to get the type of the elements of a collection when I give the name the collection.
sniff sniff
Smells like some kind of dynamic SQL or dynamic PL/SQL thing. It usually stinks.
If the dynamic part comes into play at rendering time (like in APEX for example that executes a SQL and then needs to dynamically render the projection) - use DBMS_SQL cursors (or ref cursors when rendering in an external client). Use the describe interface to dynamically determine the structure of the SQL projection.
Anything more than that - think carefully. Especially at it seems you want to deal with actual relational data structure dynamically. 99% of the time it is flawed and the remaining 1% of the time the person usually have no idea what he (or she) is really doing... ;-) -
To get the invoice number of amount applied in view prepayment applications
hi all
In AP abc Manager-Invoices--when we give invoice number in the invoice number field we get to see supplier name etc in the same Invoices Form there is a
tab called General from which we can get Amount Paid ,
Similarly there is a tab called View Prepayment Applications ,when clicked on this tab we can see Amount Applied and invoice number corresponding to that amount applied
KIndly help me from which table or view this invoice number can be obtained
i got amount applied from the view AP_UNAPPLY_PREPAYS_V,but i cant find the invoice number.
kindly guide
thanking in advance
Edited by: makdutakdu on Dec 19, 2011 11:29 AMThanks Robin,
i was able to get a work around for this. For the time being i am using the following code snippet, i will try using the one u sent an will see if this works too.
// create nodeinfo object for the node that table will bind to
final IWDNodeInfo nodeinfo = wdThis.wdGetContext().node<NODENAME>().getNodeInfo() ;
//get the structure of the node
final IStructure struct = nodeinfo.getStructureType() ;
Iterator iter = nodeinfo.iterateAttributes() ;
if (null != struct)
totalFields = struct.getNumberOfFields();
else
for ( Iterator i = nodeinfo.iterateAttributes(); i.hasNext(); i.next() )
totalFields++;
for(count = 1; count <= totalFields; count++)
fieldName = nodeinfo.getStructureType().getField(count).getName(); -
Check box als column in a standard table, how to get the selected row
Dear experts,
I habe standard tablt with check box as column. Now I want to get the current selected row structure and do some changes. How could I solve this problem? till now I just know to get the structure via lead selection.
lo_node->get_element().
lo_element = lo_node->get_static_attributes ( static_attributes = ls_row).
How could I get the element through check-box in stead of lead selection. Many thanks!check this code
To get the selected row number
data: lr_element type ref to if_wd_context_element,
lv_index type i.
lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
lv_index = lr_element->get_index( ).
Thanks
Bala Duvvuri -
Portal Development: How to get the attribute names of a node in view/page?
I am not able to find any standard method or a way to find the number of attributes and names of those attributes of a node at runtime.
is there any other way of doing it?
if i am misssing something(quite possible as i am just 2 weeks old in ES) please let me know.
regards
NitinThanks Robin,
i was able to get a work around for this. For the time being i am using the following code snippet, i will try using the one u sent an will see if this works too.
// create nodeinfo object for the node that table will bind to
final IWDNodeInfo nodeinfo = wdThis.wdGetContext().node<NODENAME>().getNodeInfo() ;
//get the structure of the node
final IStructure struct = nodeinfo.getStructureType() ;
Iterator iter = nodeinfo.iterateAttributes() ;
if (null != struct)
totalFields = struct.getNumberOfFields();
else
for ( Iterator i = nodeinfo.iterateAttributes(); i.hasNext(); i.next() )
totalFields++;
for(count = 1; count <= totalFields; count++)
fieldName = nodeinfo.getStructureType().getField(count).getName(); -
How to get the sheet name in a cell?
I need to dynamically get the sheet name into a series of cells, how do I do this?
Thank you.I don't see a function that does this and the formula based solution I started working on became so convoluted that it was easier to type the name of the sheet into the cell.
Sorry,
Terry -
What is the code to get the Label of radio button item at runtime?
Hi All
I am working on forms 10g(version 10.1.2.0.2 ) with Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 on windows 2000 platform.
My requirement is to dynamically get the label of the radio button item in a radio group.I am able to get the label of the radio group as shown below
Item :Radio group
Label : Gender
IF m_type = 'RADIO GROUP' THEN
m_label:=Get_Item_Property(m_Item ,label);
END IF;
There two Radio buttons inside this radio group which are
item : Radio button
Label : Male
item :Radio button
Label :female
What is the code to get the label of radio button(i.e) male and female ?
How will I get the count of radio buttons in a radio group at runtime?
Regards
MohanBut you have to provide the button name which cannot be get at runtime.
This is a lack of information that the Dev team would correct !
Francois -
EXEC SQL - GET DATABASE STRUCTURE - RECREATE IN SAP
Our system is connected to PS.
II'd like to write a program that does the following
get the structure of the database
create the structure in SAP
SELECT THE DATA OF THE TABLE
This would be done in order to maintain the structure manually
The problem is to get the structure from external database (exec sql)
Thanks for your help!
Regards,Hi stephan,
1. In oracle , there is one standard view
eg. V_ALL_TAB_FIELDS
in which we pass the table name,
and it returns, the records,
for the fieldnames, field type, its length, its sequence number etc.
2. Similarly u may discover for PS also.
regards,
amit m. -
How to get the NameTab Structure(X031L) for Dynamic internal table?
when we pass standard table to the FM 'DD_GET_NAMETAB' we will get the
nametab structure(x031l), like this i want to get the same structure for
dynamic internal table . how can I achieve this
please help me...Hi,
try this method
REPORT zmaschl_create_data_dynamic .
TYPE-POOLS: slis.
DATA: it_fcat TYPE slis_t_fieldcat_alv,
is_fcat LIKE LINE OF it_fcat.
DATA: it_fieldcat TYPE lvc_t_fcat,
is_fieldcat LIKE LINE OF it_fieldcat.
DATA: new_table TYPE REF TO data.
DATA: new_line TYPE REF TO data.
FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
Build fieldcat
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' EXPORTING i_structure_name = 'SYST' CHANGING ct_fieldcat = it_fcat[]. LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial. MOVE-CORRESPONDING is_fcat TO is_fieldcat. is_fieldcat-fieldname = is_fcat-fieldname. is_fieldcat-ref_field = is_fcat-fieldname. is_fieldcat-ref_table = is_fcat-ref_tabname. APPEND is_fieldcat TO it_fieldcat. ENDLOOP.
Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table EXPORTING it_fieldcatalog = it_fieldcat IMPORTING ep_table = new_table.
Create a new Line with the same structure of the table.
ASSIGN new_table->* TO <l_table>.CREATE DATA new_line LIKE LINE OF <l_table>.ASSIGN new_line->* TO <l_line>.
Test it...
DO 30 TIMES.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
<l_field> = sy-index.
INSERT <l_line> INTO TABLE <l_table>.
ENDDO.
LOOP AT <l_table> ASSIGNING <l_line>.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
WRITE <l_field>.
ENDLOOP.
Maybe you are looking for
-
I want to rip a cd on to my computer but it's not being detected as an audio cd. I think it's because it has some extra features on it (video stuff). Can anyone help me? How can I get this bugger to rip if it won't detect it's The cd is Radiohead's '
-
I am helping a client publish a book through Createspace. We are both using Windows 8 OS. She created her document in MS Publisher 2010. I made the necessary edits to her book, (111 pages) and saved it as a pdf for commercial printing. The resulting
-
Is there a way to find out how to get the index of a column?
Hello, I want to know the index of a column for example the column at the first position in a jtable is 0 so how can i get this index? for example: the column called "surname" is index 0 but the user can move the column. So the name stays the same bu
-
Authorization in solution Manager
Hi all, I want to give authorization for central system administation in solution manager I want the users to prevent deleting task log history which keeps tracks of monitoring for a whole month. I tried in giving the role sap_sv_solution_manager_dis
-
For some reason everytime I add things to my phone this "other" section grows just a little more. I am not sure entirely what I might be able to do to delete this and if I may be able to keeo it away in the future. I thought restoring my phone would