How to declare a internal table in start routine i.e. transformations
Hi Gurus,
How to define an internal table in a start rotuine?
any help greatly appreciated.
Best Regards,
Reddy.
Hi,
types: begin of str,
field1 type c,
field2 type c,
end of str.
data : itab type table of str with header line.
the above code should be inserted where it says insert code below this. this will be like a global decleration. this table will be available for all the routines that you write in the transformation.
All the best !!
Regards
Aparna
Similar Messages
-
Internal table on Start Routine
Hello
I have 5 key figures. They have an standard routine with a select statement. Basically they have to read an external DSO and get some fields values.
As all of them have the same SELECT statement I think it would be better to replace this with a select in the Start Routine, in order to improve performance. But unfortunatelly I'm not an abap programmer.
How could this be replaced in the Start routine ?
select single EXRATEXACC DOC_CURRCY NETVAL_INV
into (h_rate, h_dcurr, h_inv)
from /bic/azsdbiio100
where BILL_NUM eq SOURCE_FIELDS-/BIC/ZREFDOC
and BILL_ITEM eq SOURCE_FIELDS-/BIC/ZREFDOCLN
and COMP_CODE eq SOURCE_FIELDS-COMP_CODE.
if sy-subrc ne 0. " Not found
select single EXRATEXACC DOC_CURRCY NETVAL_INV
into (h_rate, h_dcurr, h_inv)
from /bic/azsdbiio100
where DOC_NUMBER eq SOURCE_FIELDS-DOC_NUMBER
and S_ORD_ITEM eq SOURCE_FIELDS-S_ORD_ITEM
and COMP_CODE eq SOURCE_FIELDS-COMP_CODE.
if sy-subrc eq 0.
h_flag = 'X'. " Document found
endif.
else.
h_flag = 'X'. "Document found.
endif.
if h_flag = 'X'.
if h_dcurr ne SOURCE_FIELDS-CURRENCY.
if h_rate lt 0.
h_rate = h_rate * ( -1 ).
clear h_amount.
if h_inv ne 0.
h_amount = h_inv.
else.
h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104 * h_rate.
endif.
elseif h_rate gt 0.
if h_inv ne 0.
h_amount = h_inv.
else.
h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104 / h_rate.
endif.
else.
h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104.
endif.
else.
h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104.
endif.
RESULT = h_amount.
CURRENCY = h_dcurr.
endif.
endif.Hi,
what you need to do first is to define internal tables in the start routine for each individual routine with the key fields. So look at the different SELECT SINGLE statements and build up the internal table(s). So for the first one you need to define an internal table with fields BILL_NUM, BILL_ITEM, COMP_CODE (your key) and EXRATEXACC, DOC_CURRCY and NETVAL_INV. I don't know if you can combine the two select single statements, that will depend on if BILL_NUM is the same type of field as DOC_NUMBER.
After declaration of the internal tables you can fill the bales by doing a SELECT instead of select single INTO the internal table.
In the individual update rules you can do a READ TABLE (internal table) WITH KEY yyyyyy
In this way you only have to access the DB once per data package and read from the internal memory for each record, which will definitely improve performance.
Hope this helps! -
How to declare global internal table in smartform
Hi
i need internal table in smart form with type of tline .. tline is structure and when i declare it in global definition as lines like tline it creates a structre ... kindly help me out
Regards
AmmadThis error is coming becasue u have not created an work area which is of same type as tdline.
Just double click on the error and copy paste the code here.Error now is nin ur code.
Secondly lets my internal table is GT_TLINE.
I will declare a work are GWA_TLINE type TLINE.
then i can have
loop at gt_line into gwa_tline or
read table gt_tline into gwa_tline with key etc.
Regards,
Nabheet Madan -
Need Clarification On Internal tables in Start Routine
Hi,
I have intenal table some IT_A which deletes the requests which are populated in to it.
Now I need to populate requests into IT_A from another internal table like IT_B which are of different structure.
I have three fields in common in both internal tables like RNR,Timestamp n SID with different field names
I Need Clarification that if i move the contents of the three fields to IT_A from IT_B by spcifying these three fields.Will the internal table IT_A deletes the Requests?
Thanks,
Sriram.Hi Sriram,
As mentioned IT_A deleted the request loaded into it.
if you move the contents of the three fields to IT_A from IT_B by spcifying the three fields after the deletion step for internal table IT_A takes place then it wont get deleted.
But it would be deleted if the the contents are moved before the deletion step takes place
regards,
mahesh -
Declaring the internal table in ABAP objects
Hi every1,
Please any one let me know how to declare an internal table in class (ABAP objects). Bcos i am new to this classes.
help me out.
Regards,
MadhaviHi,
Check this example..
TYPES: BEGIN OF TYPE_DATA,
MATNR TYPE MATNR,
WERKS TYPE WERKS_D,
END OF TYPE_DATA.
DATA: T_DATA TYPE STANDARD TABLE OF TYPE_DATA.
DATA: WA_DATA TYPE TYPE_DATA.
Adding rows to the internal table.
WA_DATA-MATNR = 'AA'.
APPEND WA_DATA TO T_DATA.
Processing the interna table
LOOP AT T_DATA INTO WA_DATA.
ENDLOOP.
Thanks,
Naren -
How to pass an internal table to a SmartForm?
Hi there!
I have a program that calls a SmartForm.
I have a internal table wich I want to print.
This internal table is based on a custom structure with NO standard includes (e.g., with custom fields).
How do I declare this internal table in the transaction SMARTFORMS?
Best Regards,
Luís.Refer below thread..
How to pass an internal table to smartform.
hope it will solve ur problem
Thanks & Regards
ilesh 24x7 -
How to join two internal table rows in alternative manner into one internal table?
How to join two internal table rows in alternative manner into one internal table?
two internal tables are suppose itab1 & itab2 & its data
Header 1
Header 2
Header 3
a
b
c
d
e
f
g
h
i
Header 1
Header 2
Header 3
1
2
3
4
5
6
7
8
9
INTO itab3 data
Header 1
Header 2
Header 3
a
b
c
1
2
3
d
e
f
4
5
6
g
h
i
7
8
9Hi Soubhik,
I have added two additional columns for each internal table.
Table_Count - It represents the Internal Table Number(ITAB1 -> 1, ITAB2 -> 2)
Row_Count - It represents the Row Count Number, increase the row count value 1 by one..
ITAB1:
Header 1
Header 2
Header 3
Table_Count
Row_Count
a
b
c
1
1
d
e
f
1
2
g
h
i
1
3
ITAB2:
Header 1
Header 2
Header 3
Table_Count
Row_Count
1
2
3
2
1
4
5
6
2
2
7
8
9
2
3
Create the Final Internal table as same as the ITAB1/ITAB2 structure.
"Data Declarations
DATA: IT_FINAL LIKE TABLE OF ITAB1. "Final Internal Table
FIELD-SYMBOLS: <FS_TAB1> TYPE TY_TAB1, "TAB1
<FS_TAB2> TYPE TY_TAB2. "TAB2
"Assign the values for the additional two column for ITAB1
LOOP AT ITAB1 ASSIGNING <FS_TAB1>.
<FS_TAB1>-TABLE_COUNT = 1. "Table value same for all row
<FS_TAB1>-ROW_COUNT = SY-TABIX. "Index value
ENDLOOP.
"Assign the values for the additional two column for ITAB2
LOOP AT ITAB2 ASSIGNING <FS_TAB2>.
<FS_TAB2>-TABLE_COUNT = 2. "Table value same for all row
<FS_TAB2>-ROW_COUNT = SY-TABIX. "Index value
ENDLOOP.
"Copy the First Internal Table 'ITAB1' to Final Table
IT_FINAL[] = ITAB1[].
"Copy the Second Internal Table 'ITAB2' to Final Table
APPEND IT
LOOP AT ITAB2 INTO WA_TAB2.
APPEND WA_TAB2 TO IT_FINAL.
ENDLOOP.
"Sort the Internal Table based on TABLE_COUNT & ROW_COUNT
SORT IT_FINAL BY ROW_COUNT TABLE_COUNT.
After sorting, check the output for IT_FINAL Table, you can find the required output as shown above.
Regards
Rajkumar Narasimman -
Declare dynamic internal table during runtime error
Hi Gurus,
I have encounter a problem here. I would like to have several block of alv list output; for each customer open items details. Thus, i need to create dynamic internal table duirng runtime as i do not know how many customers that should be output before user enter from the selection screen field for customer code.
I tried to search in the forums and found this website [Runtime Declaration of Internal Table;.
But when i tried to execute it, i have an error. The field symbols that i passed into the call function REUSE_ALV_BLOCK_LIST_APPEND for parameter t_outtab does not match. May i know how do i go about it?
Or are there any other solutions to display this kind of reports? I ever think of using hierarchy list alv. But it does not match the requirement. I would like to display the total amount for each customer. Can hierarchy list able to do so? Or it can only display as the grand total at the end of the report? I think it would be best to display as alv block output.
Your help will be much appreciated. <offer removed by moderator>
Thanks
Edited by: Thomas Zloch on Oct 22, 2010 11:23 AMthe problem comes up, when there are fields in the table which represent numbers with decimals (type p). Best is to reference the field directly what comes from SAP. Replace the LOOP At idetails ... ENDLOOP with:
LOOP AT idetails INTO xdetails.
CLEAR xfc.
xfc-fieldname = xfc-ref_field = xdetails-name .
xfc-ref_table = p_table.
* xfc-datatype = xdetails-type_kind.
* xfc-inttype = xdetails-type_kind.
* xfc-intlen = xdetails-length.
* xfc-decimals = xdetails-decimals.
APPEND xfc TO ifc.
ENDLOOP. -
How many times will internal table get filled?
Dear BW / ABAP gurus:
I am observing a routine in a transformation in 7.0 data flow.
The internal table is created as follows in the global declaration in the Start Routine:
TYPES: BEGIN OF ST_PROD,
/BIC/AZPROD TYPE /BIC/OIAZPROD,
/BIC/AZCOST TYPE /BIC/OIAZCOST,
END OF ST_PROD.
DATA: IT_PROD TYPE TABLE OF ST_PROD,
WA_PROD TYPE ST_PROD.
The programmer is fetching data for product cost which is not available in the source. This code is written in the Start Routine:
SELECT /BIC/AZPROD /BIC/AZCOST
FROM /BIC/PAZPROD
INTO CORRESPONDING FIELDS OF TABLE IT_PROD
WHERE OBJVERS = 'A'.
My questions:
(1) Is it a standard practice to create the internal table in the global declaration?
(2) Is it a standard practice to fill the internal table with data in the Start Routine? Is it possible to fill the internal table with data in the global declaration? Or is the global declaration only reserved for declaring variables and creating internal tables?
(3) What is the use of 2nd part global?
(4) Let's say there are 100, 000 records at the source and the DTP package size is 50,000. Then the Start Routine will get executed 2 times. So the code in the Start Routine will hit the database 2 times to fill the internal table. Is this correct?
Note to mods: Please do not delete the thread. Move to the beginner section if you think this is basic. But please do not delete. It take a long time to type out the questions.hi Saurav,
(1) Is it a standard practice to create the internal table in the global declaration?
1. No ,internal table should be created in global part only if they are getting used in field level or end routine .Else they must be in local part and should get refreshed at the end so that performance not get affected.
(2) Is it a standard practice to fill the internal table with data in the Start Routine? Is it possible to fill the internal table with data in the global declaration? Or is the global declaration only reserved for declaring variables and creating internal tables?
1.No if only you want to use the data in field level routine and start routine ,you will fill table in start routine otherwise no .
2.first global part is for data declaration so no in first global part select cannot come .
3.Second global part can have select but you cannot write any statement using source package or result package here as they are private object of transformation class and not recognized at this area.However simple select on any table other than these will be fine .
(3) What is the use of 2nd part global?
1.In second global part you can declare internal table ,structures that are not of type source package or result package but independent and can use them .
2.If you will declare these table in first global part they will be private object and you cannot write select using them in second global part .
3.Second global part is also declaration but outside the class so these objects are global across transformation with more flexibility .
4.If you will declare any data here using the structure of source /result package you will get error .This is a data declaration part comes between transformation definition and implementation part .
(4) Let's say there are 100, 000 records at the source and the DTP package size is 50,000. Then the Start Routine will get executed 2 times. So the code in the Start Routine will hit the database 2 times to fill the internal table. Is this correct?
yes the source and result package are actually the DTP packages only so code will get executed same no of time as you have number of packages in DTP extraction .
Hope this will be helpful .
Regards,
Jaya Tiwari -
How to declare variable for Table type in the ABAP Editor
Hi!
I have Table Type 'FIELDNAME_TAB' (Table of fieldnames). I want to pass the list of fieldnames to this Table Type in the ABAP Editor.
Can anyone help me in this?You would declare the internal table like so.
data: itab type FIELDNAME_TAB.
data: wa like line of itab.
wa = 'This_value'.
append wa to itab.
Regards.
Rich Heilman
Message was edited by:
Rich Heilman -
How to import the internal table into subroutine as parameter
how to import the internal table into subroutine as parameter, and its structure can be recognized inside the subroutine
Hi Yong,
try this:
parameters: p_tabnm like dd03l-tabname.
field-symbols: <fs_tabname> type standard table.
data: itab_ref type ref to data.
create data itab_ref type standard table of (p_tabnm)
with default key.
assign itab_ref->* to <fs_tabname>.
select * from (p_tabnm) into table <fs_tabname>.
perform subroutine tables <fs_tabname>
using p_tabnm.
*& Form subroutine
text
-->P_<FS_TABNAME> text
-->P_P_TABNM text
form subroutine tables p_tabname type standard table
using p_tabnm.
Here p_tabname already has the structure of the table you gave as input
parameter
endform. " subroutine -
How to read an internal table with more than one (2 or 3) key field(s).
how to read an internal table with more than one (2 or 3) key field(s). in ecc 6.0 version
hi ,
check this..
report.
tables: marc,mard.
data: begin of itab occurs 0,
matnr like marc-matnr,
werks like marc-werks,
pstat like marc-pstat,
end of itab.
data: begin of itab1 occurs 0,
matnr like mard-matnr,
werks like mard-werks,
lgort like mard-lgort,
end of itab1.
parameters:p_matnr like marc-matnr.
select matnr
werks
pstat
from marc
into table itab
where matnr = p_matnr.
sort itab by matnr werks.
select matnr
werks
lgort
from mard
into table itab1
for all entries in itab
where matnr = itab-matnr
and werks = itab-werks.
sort itab1 by matnr werks.
loop at itab.
read table itab1 with key matnr = itab-matnr
werks = itab-werks.
endloop.
regards,
venkat. -
How to define an internal table which have to be dynamic
Hallo,
here's a problem that i have to solve (but how ?).
I defined an internal Table with 2 columns:
col1: tablename
col2: fieldname
This table is filled with an unknown number of datasets like this:
dataset1: A001 KAPPL
dataset2: A001 KNUMH
dataset3: A903 KUNNR and so on.
I don't know which tablenames and fieldnames are contained.
Now i have to read those fields (e.g. KAPPL) from those tables (e.g. A001) into an internal table.
But i don't know how to define this internal table.
Could anyone help me please ?
Thanks a lot.
SilvioHi Wirth
DATA:
w_tabname TYPE w_tabname,
w_dref TYPE REF TO data,
table_name TYPE tadir-obj_name.
FIELD-SYMBOLS: <t_itab> TYPE ANY TABLE.
READ YOUR INTERNAL TABLE (DATA SET) AND GET THE TABLE NAME,
AND PASS IT TO W_TABNAME.
w_tabname = A001.
CREATE DATA w_dref TYPE TABLE OF (w_tabname).
ASSIGN w_dref->* TO <t_itab>.
Now use <t_itab> as your internal table to fetch data .
<t_itab> will have the structure of A001.
SELECT *
FROM (w_tabname) UP TO 10 ROWS
INTO TABLE <t_itab>.
Regards
Hareesh Menon -
How to copy complete internal table into main dababase table
please tell me how to copy complete internal table into main dababase table by overwriting all the entries of the main DBtable.
HI,
you can use<b> Insert Or Modify statement ..</b>
<b>Modify updates the existing record, insert creates a new one. ...</b>
insert ZDBTAB from table itab.
Modify ZDBTAB from table Itab.
The structure of itab should be exactly the same as the z table.
You should not update standard tables directly though.
rewards if usefuyl
regards,
nazeer -
Hot to declare 1 internal table with 2 structure
hiii
please advise how to build 1 internal table by including 2 structure .
example i tried to do like below it doesn't work
TYPES:
BEGIN OF gxs_prices_post.
TYPES p_dat type ckmlpr-zprsdat
INCLUDE STRUCTURE cki_ckmprp_single.
include structure ckmv0_matobj_tbl.
end of gxs_prices_post.Hi,
Test the Sample Code Bellow too,
TYPES: BEGIN OF ty1_test,
name(10),
END OF ty1_test.
DATA: BEGIN OF it OCCURS 100.
INCLUDE TYPE ty1_test.
INCLUDE STRUCTURE pa0001.
DATA END OF it.
Following too.
TYPES: BEGIN OF ty1_test,
name(10),
END OF ty1_test.
TYPES: BEGIN OF ty2_test.
INCLUDE TYPE ty1_test.
INCLUDE STRUCTURE pa0001.
TYPES END OF ty2_test.
data: it TYPE STANDARD TABLE OF ty2_test WITH HEADER LINE.
Best Regards,
Faisal
Maybe you are looking for
-
Hi everyone ! I've got a big problem using my MacMini with TV. I bought the Apple DVI to Video converter, and connected my Philips cathodic TV to the Mac. But the TV only displays gray and deformed pictures. I tried all resolutions available, but not
-
How can I add music to an Apple-formatted iPod from a Windows-PC?
without losing the music that I already downloaded from an iMac? When I try connecting the iPod to my Windows PC, it prompts me to restore, which would eliminate all the music that's already on the iPod. Any way around that?
-
HT1349 After installing windows 8, I have no sound on my mac desktop. Need help?
Hi, I recently installed Windows 8 and after the installation there is no audio (sound) in my iMac. I can't hear youtube videos, mp3 files, no nothing. Suggestions to solves this problem?
-
how to retrieve all datas that lost when i update my iphone4 to that 6.10 ios. i tried to look at may i tunes in my computer but it seems that i forgot to perform back ups since i purchased this phone 2yirs ago.. pls send me an advice..thank u.
-
JLabel click event to change picture
Hi All, I am new to GUI programming and need some help. I am trying to get a picture of a match to change to a different picture of a match when i click on it. Below is how I'm currently trying to do it. import javax.swing.UIManager; import java.awt.