12-20-2012 7:08 PM
Hi,
I'm new in the ABAP world!
I'm trying to code a 5 Steps research into a 1 step research.
The problem i have is:
Instead of getting data for Multiple VKONT, i get data for only one VKONT.
Can someone help me!!!
My code is in the attached file.
Any advice are welcome!!
12-20-2012 11:01 PM
Few errors in code:
1. Some code practices are really obsolete. Please change it for performance issues since you are playing with table DFKKOP which normally is a large table.
2. Why to use Select... Endselect when you can directly use select for populating data in IT_DATA.
3. Instead of writing multiple queries for different HVORG and TVORG, why not write only one and then delete the extra line from internal table which would be faster.
4. Same applies for field AUGRD field as well. Writing 6 queries you are picking lots of redundant data.
5. INTO CORRESPONDING FIELDS is not required since structure is same.
6. CDEC is just a structure, i don't know how are you using it with IN statement.
You can try something like this:
SELECT * FROM DFKKOP INTO TABLE IT_DFKKOP
WHERE VKONT = CDEC and
HVORG IN (all your HVORGs) AND
AUGRD not in ('05','10','11').
Now use this internal table to remove entries not required like extra TVORGs and BLDATs.
Hope it helps.
Regards,
Ravi
12-20-2012 8:23 PM
In some SELECT statements you're using 'VKONT = CDEC' or 'VKONT IN CDEC' in place of 'VKONT IN IT_CDEC'.
Regards,
Edgar
12-20-2012 11:01 PM
Few errors in code:
1. Some code practices are really obsolete. Please change it for performance issues since you are playing with table DFKKOP which normally is a large table.
2. Why to use Select... Endselect when you can directly use select for populating data in IT_DATA.
3. Instead of writing multiple queries for different HVORG and TVORG, why not write only one and then delete the extra line from internal table which would be faster.
4. Same applies for field AUGRD field as well. Writing 6 queries you are picking lots of redundant data.
5. INTO CORRESPONDING FIELDS is not required since structure is same.
6. CDEC is just a structure, i don't know how are you using it with IN statement.
You can try something like this:
SELECT * FROM DFKKOP INTO TABLE IT_DFKKOP
WHERE VKONT = CDEC and
HVORG IN (all your HVORGs) AND
AUGRD not in ('05','10','11').
Now use this internal table to remove entries not required like extra TVORGs and BLDATs.
Hope it helps.
Regards,
Ravi
12-21-2012 8:11 PM
Thanx for the reply. You are right, the table DFKKOP is huge and any research without OPBEL as a key in the research is very long. However, i dont have other choice...
How would I remove entries in my internal table?
The IT here wont let me use the delete statement... or i will have to work hard to be able to use it!
12-21-2012 7:32 PM
It's problem with you collect statement.
You where using the collect statement inside the loop.
Please write the simple test program without collect and check what is happend !
Kind Rgds
Ravi
12-24-2012 10:18 AM
Hi Former Member ,
Greetings for new in the ABAP world,
U have tried that ur best fine, some of the codes you are used that is really obsolete,
Thanks & Regards