Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with multiple selection

Former Member
0 Kudos

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!!

1 ACCEPTED SOLUTION

raviahuja
Contributor
0 Kudos

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

5 REPLIES 5

edgar_nagasaki
Contributor
0 Kudos

In some SELECT statements you're using 'VKONT = CDEC' or 'VKONT IN CDEC' in place of 'VKONT IN IT_CDEC'.

Regards,

Edgar

raviahuja
Contributor
0 Kudos

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

Former Member
0 Kudos

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!

ravi_lanjewar
Contributor
0 Kudos

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

Former Member
0 Kudos

Hi

  • Using select../ with endselect, why cant u try with select single.., or UPTO 1 rows based on ur requirement for fetching particular datas.
  • Instead of using multiple select statements, select all the values from DBtable into ITAB and based on ur requirements u can read the table or loop that table with where condition to get your data,