on 2014 May 05 3:44 PM
Hello, I have built an internal table in my start routine and now i want to use it in my end routine so i can pick up the values and assign them to my fields in transformation. can someone tell me if this is possible?
thanks.
Request clarification before answering.
You can declare the Internal table globally in start routine as stated by vinod and then you can read the same table in end routine.
Suppose the internal table declared is ITAB.
In end routine the syntax would be:
loop at RESULT_PACKAGE assigning <result_fields>.
Read table itab into wa with key
Hope this gives an idea.
Regards,
AL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
if you use the one LOOP it will improve the performance if you write the end routine.
loop at RESULT_PACKAGE ASSIGNING <RESULT_FIELDS> .
READ TABLE IT_XXXX into LS_XXXX WITH KEY XXXXX =
<RESULT_FIELDS>-XXXXX. and DATE TO = 31.12.9999.
if you write the start routine it will read the record by record and end routine read packet by packet.
Thanks,
Phani.
Reading inside loop is the best option as far as performance is concern.
Add : once internal table filled with data, sort it with the key which you are going to use in read and then use binary search.
This will further improve the performance.
So if your read statement is
Read table ITAB with Key Field1 = 'xyz'.
Sort the ITAB after select statement in global declaration as
Sort table ITAB ascending field1.
and replace the read statement as :
Read table ITAB with Key Field1 = 'xyz' BINARY SEARCH.
Thank-You.
Regards,
VB
Hello, I decided to go for start routine, i want to use hash tables as they are good with performance. but i dont know how to do the loop on hash tables. i want to have 2 internal tables ok so the first one will have the source package data then i want to use my logic and send it to second internal table, once i get the data in second internal table then i want to read from it at the field level but my question is how to do the loop from one internal table to another. can you help me with that?
This is what I have written so far in my start routine:
SELECT
CUSTOMER
/BIC/ZADDR1
/BIC/ZADDR2
/BIC/ZADDR3
INTO TABLE ITAB1 FROM
/BIC/AZMAN_CUS
FOR ALL ENTRIES IN SOURCE_PACKAGE
WHERE MATERIAL = SOURCE_PACKAGE-CUSTOMER.
SORT ITAB1 BY MATERIAL /BIC/ZCLSCHAR.
now i want to do a loop and put this data in to itab2 which has a different structure, so how do i do that?
thanks.
Agreed with Vinod.
When you will go to start routine -> scroll up and you will find the global data declaration. This is common for all the routines (start, field, end). So ideally you will have to declare your table in this section and it will be accessible in all the routines.
Thanks
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Go on the top section of start routine, you will find the global decleration part.
like :
*$*$ begin of global - insert your declaration only below this line *-*
... "insert your code here
< Inser your table declaration and even select statement.
Same will be avaialble in end routine.
>
*$*$ end of global - insert your declaration only before this line *-*
Thank-You.
Regards,
VB
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
30 | |
10 | |
8 | |
7 | |
7 | |
6 | |
6 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.