Modify the structure of internal table which created dynamically!!!
HI All,
I am creating internal table dynamically using the below syntax. Now I need to remove few of the fields from the internal table structure. Could you please help me how to go ahead in these cases?
* Create table dynamically for local data
CREATE DATA gv_table_l TYPE TABLE OF (<fs_tabname>).
CREATE DATA gv_wa_l TYPE (<fs_tabname>).
ASSIGN gv_table_l->* TO <fs_local_tab>.
ASSIGN gv_wa_l->* TO <fs_local_wa
>.
Please let me know if you have any thoughts.
Thanks,
Raghu.
Hi ,
check this wiki
[Internal Table|http://wiki.sdn.sap.com/wiki/display/Snippets/Howtocreateinternaltable+dynamically]
in your case ...
1.Get filed list based on the type ...make use of "cl_abap_datadescr=>describe_by_type('MARA'), check for syntax or sample programs...
2.Delete fields which you dont want to be in your internal table....
3.Create internal table using method " CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE" ref attached link for sample code by Pinaki...
regards
Prabhu
Similar Messages
-
How to find out structure of internal table?
Hi
is there any way how to find out name of structure upon which internal
table was created?
i got internal table passed to function module by any table
type. There can be different types of table passed in. Inside of
module a need to find out the structure of table.
I've found a tricky way how to find this information using following
command 'DESCRIBE FIELD dobj INTO td.', but its probably not a correct
way because using this command is not recommended in application
programs.
Is there any function module, or something i can use for getting this information?
ThanksThanks very much
This has solved my problem:
DATA descr_ref TYPE ref to cl_abap_typedescr.
DATA tabname TYPE string.
descr_ref = cl_abap_typedescr=>describe_by_data( itab ).
tabname = descr_ref->absolute_name. -
How to prevent developers from modifying the structure of DB
We are developing an application and using Oracle 8i as DB server. I don't want the developers to modify the structure of tables. They should only be able to insert/update/delete rows of the tables.
How can I make it?
Any suggestions will be appreciated.A good rule is that no one logs in as the schema owner. You could give the schema owner a strong password, and not share it with the developers. Then create a role. Every time you make a table in this schema, be sure you're logged in as the schema owner, then grant select,insert,update,delete on the table to the role. Better yet, make two roles. Grant select on all tables to one role, which will be a readonly role. Grant select,insert,update,delete to the other role.
Then, you can grant one of the roles to your developers -- the readonly role or the read/write role, as you choose. As you add tables, grant access to them to the roles and the users with the role automatically get DML access -- but not DDL access.
Be sure to check which system privileges and roles your users already have. If you've made them all DBAs, all bets are off! 8) -
Question reg. modifying latest record in internal table
Can you tell me if it is possible to modify the last appended record to the internal table?
I just want to modify the record in the internal table which is appended at the latest. Please tell me the logic for this.
Thanks a lot,
KrishenHi try with this:
DATA line TYPE I.
DATA wa_itab TYPE LINE OF it_itab.
DESCRIBE TABLE IT_TABLE LINE line.
READ TABLE IT_TABLE INTO wa_itab INDEX line.
WA_TABLE-FIELD = 'new value'.
MODIFY TABLE IT_TABLE FROM wa_itab
TRANSPORTING field.
Best regards. -
Problem in uploading the file of internal table into appliaction server
i want to send the data of internal table to application server through selection screen and in selection screen and in selection screen parameter it should show the path of application server and through that path internal table data should go to application server , if possible give the code
Hi,
form download_file_appl_server.
open dataset p_dlf2 for output
in text mode encoding default .
if sy-subrc ne 0.
message:i005 with text-415 text-407.
endif.
loop at i_final into wa_final.
transfer wa_final to p_dlf2.
endloop.
close dataset p_dlf2.
endform. " OPENDATA_CLOSE
where p_dlf2 is the seelction screen parameter which give the application server file path
You can use this code for ur purpose.
Reward if useful.
Regards
Shibin -
How to rearrange the structure of a table by using a view?
At wits end: I need to reorganize the structure of a table into a new structure - either as a view or actually moving the data from the old structure to the new structure (using a view).
The old structure is:
TESTNAME, SCHOOL_ID, PTILE1, PTILE2, PTILE3 ... PTILE99
Test1,0001,18,19,20...
Test1,0002,23,24,28...
Test1,0003,20,21,26...
Test2,0001,48,52,55...
Test2,0002,50,54,54...
Test2,0003,60,62,64
The new structure is:
SCHOOL_ID,PTILE,TESTNAME1,TESTNAME2...
1,0001,Score1,Score2...
1,0002,Score1,Score2...
1,0003,Score1,Score2...
2,0001,Score1,Score2...
2,0002,Score1,Score2...
2,0003,Score1,Score2...
99,0001,Score1,Score2...
99,0002,Score1,Score2...
99,0003,Score1,Score2...
What this data shows are the percentiles for test scores for different tests for each school who took the tests.
It seems like creating a view to arrange the data through a bunch of selects and unions would work, but I can't figure out how.Tricky.
When confronted with a problem like this I try to write out an algorthm in pseudocode to work out what I want to do. If you have more than 2 or 3 tables to merge I'd consider going with a new structure; otherwise the view approach might be a good idea. Remember that if you go with a new structure you can insert once and update the other values later, something like
foreach school insert row
update testname1
update testname2
Good luck. -
Hi I want to know the difference between the type of internal tables.
I know the types of internal table but i dont know the difference between them can any one explain me in simple sentence.
Hi,
<b>Standard Internal Tables</b>
Standard tables have a linear index. You can access them using either the index or the key. If you use the key, the response time is in linear relationship to the number of table entries. The key of a standard table is always non-unique, and you may not include any specification for the uniqueness in the table definition.
This table type is particularly appropriate if you want to address individual table entries using the index. This is the quickest way to access table entries. To fill a standard table, append lines using the (APPEND) statement. You should read, modify and delete lines by referring to the index (INDEX option with the relevant ABAP command). The response time for accessing a standard table is in linear relation to the number of table entries. If you need to use key access, standard tables are appropriate if you can fill and process the table in separate steps. For example, you can fill a standard table by appending records and then sort it. If you then use key access with the binary search option (BINARY), the response time is in logarithmic relation to
the number of table entries.
<b>Sorted Internal Tables</b>
Sorted tables are always saved correctly sorted by key. They also have a linear key, and, like standard tables, you can access them using either the table index or the key. When you use the key, the response time is in logarithmic relationship to the number of table entries, since the system uses a binary search. The key of a sorted table can be either unique, or non-unique, and you must specify either UNIQUE or NON-UNIQUE in the table definition. Standard tables and sorted tables both belong to the generic group index tables.
This table type is particularly suitable if you want the table to be sorted while you are still adding entries to it. You fill the table using the (INSERT) statement, according to the sort sequence defined in the table key. Table entries that do not fit are recognised before they are inserted. The response time for access using the key is in logarithmic relation to the number of
table entries, since the system automatically uses a binary search. Sorted tables are appropriate for partially sequential processing in a LOOP, as long as the WHERE condition contains the beginning of the table key.
<b>Hashed Internal Tables</b>
Hashes tables have no internal linear index. You can only access hashed tables by specifying the key. The response time is constant, regardless of the number of table entries, since the search uses a hash algorithm. The key of a hashed table must be unique, and you must specify UNIQUE in the table definition.
This table type is particularly suitable if you want mainly to use key access for table entries. You cannot access hashed tables using the index. When you use key access, the response time remains constant, regardless of the number of table entries. As with database tables, the key of a hashed table is always unique. Hashed tables are therefore a useful way of constructing and
using internal tables that are similar to database tables. -
How to locate the user id of user which created a Business Partner Master Data set
Hi everyone,
First post on here, on a number of occasions I have found either the answer to or a steer towards when facing a issue, hopefully someone can help with this question.
I'm working with SAP B1, v9 PL11 on SQL 2008R2.
I have to create a query which displays; cardcode, cardname, createdate, cardtype, username of creating user, on or after a date variable.
Having looked over the OCRD table I can't see a specific field containing data that would correspond to a user code.
OUSR looks like a good candidate with the user details but I don't think I can see any data types which are directly comparable so not able to make a workable join.. I've tried a number of combinations, such as ocrd.usersign = ousr.usersign and while it returned data it was not correct.
Please can someone help me find the name of the relevant field, or table which would contain this value so I can then complete my query.
Many thanks in advance!Hi,
Welcome to SAP B1 forum.
Try this query:
SELECT T0.[CardCode], T0.[CardName],T0.usersign, T1.[U_NAME] FROM OCRD T0 left join OUSR T1 on t1.userid = t0.usersign WHERE T0.[CardType] = 'c'
Thanks & Regards,
Nagarajan -
Copy the structure of a table to another with another table name.
how to copy the structure of a table to another with another table name.
ie. i want a emp table with same values/structure to be copied to another table called my_employee.
how can this be done?create table my_emp as select * from emp;
If you do not want the data to be copied then do the following:
create table my_emp as select * from emp
where 1=2;
Avanti. -
How to Read records from structure to internal table
HI,
Can any body know how to read the records from structure to internal table at runtime.
please give me sample program if possible.
thanks in advance
KPif your internal table is having the same structure as the structure you are reading the values from then you can directly assign like..
internatable table work area or header line = structure.
or else if they are different assign field by field like
internal table-field1 = structure-field1.
internal table-field2 = structure-field2.
award points if it helps. -
Fetch the values from internal table inside an internal table (urgent!!)
data : BEGIN OF PITB2_ZLINFO occurs 0,
BEGDA LIKE SY-DATUM,
ENDDA LIKE SY-DATUM,
PABRJ(4) TYPE N, "Payroll Year
PABRP(2) TYPE N, "Pay. Period
ZL LIKE PC2BF OCCURS 0,
END OF PITB2_ZLINFO.
I have a internal table like this,
How to Fetch the values from internal table inside an internal table.
Kindly Help me on this..
Regards,
Ram.Hi,
Try this....
Loop at PITB2_ZLINF0.
Loop at PITB2_ZLINF0-ZL.
endloop.
Endloop.
Thanks...
Preetham S -
Gui_download for transferring the data from internal table to excel sheet.
hi all,
i am using gui_download for transferring the data from internal table to excel sheet.
I have a internal table with 3 columns col1,col2,col3 and I am getting the file at the specified path,but my problem is that,in the excel sheet(path specified) all the 3 columns values are printed in one column.Please help me.
Thanks in advance.Hi Venkata,
plz use FM 'SAP_CONVERT_TO_XLS_FORMAT' :
call function 'SAP_CONVERT_TO_XLS_FORMAT'
exporting
* I_FIELD_SEPERATOR =
* I_LINE_HEADER =
i_filename = p_file
* I_APPL_KEEP = ' '
tables
i_tab_sap_data = t_mbew
* CHANGING
* I_TAB_CONVERTED_DATA =
* EXCEPTIONS
* CONVERSION_FAILED = 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.
Hope this helps,
Erwan -
How to get the list of database Views modifying the DB tools list tables.vi
Hi,
I have a problem, I just started using LabVIEW and in particular the LabVIEW connectivity toolkit and I am lookig fgor suggestion regarding how to get the list of database Views modifying the DB tools list tables.vi...
Thanks in advance,
MichelaHi Michela,
since the VI you want to modify is part of a Toolkit, I suggest you to copy the whole block diagram in a new VI and then save it in a new location.
Place the DB List Tables.vi on a block diagram, double click on it and go to the tab "Window -> Show Block Diagram "
Select "Edit -> Select All" to select the whole block diagram and select "Edit -> Copy"
Open a new VI and select "Edit -> Paste"
Save the new VI
In this way you can modify everything you want without overwriting the Toolkits VIs.
Hope this can help.
Regards,
Andrea N.
Systems Engineer ATE & RF - Mediterranean Region
National Instruments Italy -
How to increase the length of internal table dynamically
How to increase the length of internal table dynamically depending on the number of fields fetched into the internal table ?
The requirement code :
types: begin of t_data,
form like zscr_data_hdr-form,
werks like zscr_data_hdr-werks,
matnr like zscr_data_hdr-matnr,
verid like zscr_data_hdr-verid,
lot like zscr_data_hdr-lot,
lot_qty like zscr_data_hdr-lot_qty,
udate like zscr_data_hdr-udate,
utime like zscr_data_hdr-utime,
zuser like zscr_data_hdr-zuser,
processed like zscr_data_hdr-processed,
defect like zscr_defect_data-defect,
vornr like zscr_route_data-vornr,
fld1 like zscr_defect_data-defect_val,
fld2 like zscr_defect_data-defect_val,
fld3 like zscr_defect_data-defect_val,
fld4 like zscr_defect_data-defect_val,
fld5 like zscr_defect_data-defect_val,
fld6 like zscr_defect_data-defect_val,
fld7 like zscr_defect_data-defect_val,
fld8 like zscr_defect_data-defect_val,
fld9 like zscr_defect_data-defect_val,
fld10 like zscr_defect_data-defect_val,
fld11 like zscr_defect_data-defect_val,
fld12 like zscr_defect_data-defect_val,
fld13 like zscr_defect_data-defect_val,
fld14 like zscr_defect_data-defect_val,
fld15 like zscr_defect_data-defect_val,
fld16 like zscr_defect_data-defect_val,
fld17 like zscr_defect_data-defect_val,
fld18 like zscr_defect_data-defect_val,
fld19 like zscr_defect_data-defect_val,
fld20 like zscr_defect_data-defect_val,
fld21 like zscr_defect_data-defect_val,
fld22 like zscr_defect_data-defect_val,
fld23 like zscr_defect_data-defect_val,
fld24 like zscr_defect_data-defect_val,
fld25 like zscr_defect_data-defect_val,
fld26 like zscr_defect_data-defect_val,
fld27 like zscr_defect_data-defect_val,
fld28 like zscr_defect_data-defect_val,
fld29 like zscr_defect_data-defect_val,
fld30 like zscr_defect_data-defect_val,
fld31 like zscr_defect_data-defect_val,
fld32 like zscr_defect_data-defect_val,
fld33 like zscr_defect_data-defect_val,
fld34 like zscr_defect_data-defect_val,
fld35 like zscr_defect_data-defect_val,
fld36 like zscr_defect_data-defect_val,
fld37 like zscr_defect_data-defect_val,
fld38 like zscr_defect_data-defect_val,
fld39 like zscr_defect_data-defect_val,
fld40 like zscr_defect_data-defect_val,
fld41 like zscr_defect_data-defect_val,
fld42 like zscr_defect_data-defect_val,
fld43 like zscr_defect_data-defect_val,
fld44 like zscr_defect_data-defect_val,
fld45 like zscr_defect_data-defect_val,
fld46 like zscr_defect_data-defect_val,
fld47 like zscr_defect_data-defect_val,
fld48 like zscr_defect_data-defect_val,
fld49 like zscr_defect_data-defect_val,
fld50 like zscr_defect_data-defect_val,
fld51 like zscr_defect_data-defect_val,
fld52 like zscr_defect_data-defect_val,
fld53 like zscr_defect_data-defect_val,
fld54 like zscr_defect_data-defect_val,
fld55 like zscr_defect_data-defect_val,
fld56 like zscr_defect_data-defect_val,
fld57 like zscr_defect_data-defect_val,
fld58 like zscr_defect_data-defect_val,
fld59 like zscr_defect_data-defect_val,
fld60 like zscr_defect_data-defect_val,
fld61 like zscr_defect_data-defect_val,
fld62 like zscr_defect_data-defect_val,
fld63 like zscr_defect_data-defect_val,
fld64 like zscr_defect_data-defect_val,
fld65 like zscr_defect_data-defect_val,
fld66 like zscr_defect_data-defect_val,
fld67 like zscr_defect_data-defect_val,
fld68 like zscr_defect_data-defect_val,
fld69 like zscr_defect_data-defect_val,
fld70 like zscr_defect_data-defect_val,
fld71 like zscr_defect_data-defect_val,
fld72 like zscr_defect_data-defect_val,
fld73 like zscr_defect_data-defect_val,
fld74 like zscr_defect_data-defect_val,
fld75 like zscr_defect_data-defect_val,
fld76 like zscr_defect_data-defect_val,
fld77 like zscr_defect_data-defect_val,
fld78 like zscr_defect_data-defect_val,
fld79 like zscr_defect_data-defect_val,
fld80 like zscr_defect_data-defect_val,
fld81 like zscr_defect_data-defect_val,
fld82 like zscr_defect_data-defect_val,
fld83 like zscr_defect_data-defect_val,
fld84 like zscr_defect_data-defect_val,
fld85 like zscr_defect_data-defect_val,
fld86 like zscr_defect_data-defect_val,
fld87 like zscr_defect_data-defect_val,
fld88 like zscr_defect_data-defect_val,
fld89 like zscr_defect_data-defect_val,
fld90 like zscr_defect_data-defect_val,
fld91 like zscr_defect_data-defect_val,
fld92 like zscr_defect_data-defect_val,
fld93 like zscr_defect_data-defect_val,
fld94 like zscr_defect_data-defect_val,
fld95 like zscr_defect_data-defect_val,
fld96 like zscr_defect_data-defect_val,
fld97 like zscr_defect_data-defect_val,
fld98 like zscr_defect_data-defect_val,
fld99 like zscr_defect_data-defect_val,
fld100 like zscr_defect_data-defect_val,
fld101 like zscr_defect_data-defect_val,
fld102 like zscr_defect_data-defect_val,
fld103 like zscr_defect_data-defect_val,
fld104 like zscr_defect_data-defect_val,
fld105 like zscr_defect_data-defect_val,
fld106 like zscr_defect_data-defect_val,
fld107 like zscr_defect_data-defect_val,
fld108 like zscr_defect_data-defect_val,
fld109 like zscr_defect_data-defect_val,
fld110 like zscr_defect_data-defect_val,
fld111 like zscr_defect_data-defect_val,
fld112 like zscr_defect_data-defect_val,
fld113 like zscr_defect_data-defect_val,
fld114 like zscr_defect_data-defect_val,
fld115 like zscr_defect_data-defect_val,
fld116 like zscr_defect_data-defect_val,
fld117 like zscr_defect_data-defect_val,
fld118 like zscr_defect_data-defect_val,
fld119 like zscr_defect_data-defect_val,
fld120 like zscr_defect_data-defect_val,
fld121 like zscr_defect_data-defect_val,
fld122 like zscr_defect_data-defect_val,
fld123 like zscr_defect_data-defect_val,
fld124 like zscr_defect_data-defect_val,
fld125 like zscr_defect_data-defect_val,
fld126 like zscr_defect_data-defect_val,
fld127 like zscr_defect_data-defect_val,
fld128 like zscr_defect_data-defect_val,
fld129 like zscr_defect_data-defect_val,
fld130 like zscr_defect_data-defect_val,
fld131 like zscr_defect_data-defect_val,
fld132 like zscr_defect_data-defect_val,
fld133 like zscr_defect_data-defect_val,
fld134 like zscr_defect_data-defect_val,
fld135 like zscr_defect_data-defect_val,
dayst like zscr_data_hdr-dayst,
end of t_data.
In this fld1 to fld135 are defined in internal table.
But if the number of fields are more than 135 then the program is going to short dump.
Some times fld1 to fid170 or more fields will be there in my internal table.
Please suggest me how to make my requirement dynamic and display this data fetched into this internal table onto a .XLS file in the presentation server ?Hi
You can try to use the type string:
form like zscr_data_hdr-form,
werks like zscr_data_hdr-werks,
matnr like zscr_data_hdr-matnr,
verid like zscr_data_hdr-verid,
lot like zscr_data_hdr-lot,
lot_qty like zscr_data_hdr-lot_qty,
udate like zscr_data_hdr-udate,
utime like zscr_data_hdr-utime,
zuser like zscr_data_hdr-zuser,
processed like zscr_data_hdr-processed,
defect like zscr_defect_data-defect,
vornr like zscr_route_data-vornr,
fieldxx type string,
dayst like zscr_data_hdr-dayst,
end of t_data.
So you can save you informations of every fld<n> concatenating their values into fieldxx.
Max -
How enter the values in to table when create entries option is not working
hi everyone,
can u please tell me How enter the values in to table when create entries option is not working.
it's urgent.
thanking u allHi Shree,
how many entries u want to insert ,,
is it a ztable or custom table ..
just tell me ur clear requirement ..
clarify the same ..
if no options avaliable then if its less entries or some value u can do it through debugging ..
if its bulk entries then u can write a program ..
just let me know ..
regards,
VIjay
Maybe you are looking for
-
How to Export data from a Table to Excel using PL/SQL Code
Hi, I need to export data from a table to the excel sheet using PL/SQL script. could you pls provide with custom codes or sample procedures. Bobby
-
RH9, oracle 9.2.0.2, ORA-00604 error
Hi, I got a del 400 sc pc, with 512 Mb Ram and 1024 MB swap. I have installed rh9 and oracle 9.2.0.2, following Yours RH9 and 9i howto, and all goes well. I linked dbca with my jdk 1.4 (following instructions) But I got an ORA-00604 error connecting
-
Creating user exits for Formula Routine in Tcode O5F5
Hi All, I have to create a new rounding routine for my projet in transaction O5F5. The path which i have taken is. In transaction O5F5. Maintain Formula & Average Pricing Exit -> Formula Evaluation -> Formula rounding. Now after creation a new formul
-
I have the following code: Import-Module "sqlps" -DisableNameChecking #####http://www.travisgan.com/2013/03/powershell-and-performance-monitor.html function ExtractPerfmonData param( [string]$server, [string]$instance [Micros
-
One song not authroized; all otheras are. Help?
So, last week I d/l'd the complation of Glee's music from Sectionals. All songs came through fine, but for some reason, "Control" is saying it is not authorized on my computer. It won't accept my username/pw to authorize it for the comptuer. All o