Application Development and Automation 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: 
Read only

2 SELECT statements or READ?

Former Member
0 Likes
767

Hi there

I posted a question yesterday with regards to a select join and have managed to get that working.

This builds an ALV with data relating to several matnrs. On this report I have a field called zsuper which is the supersession part number for each matnr.

Ideally I want to get further details about this zsuper and display this as well in my ALV.

I need to find maktx for the zsuper, mmsta, labst and ebeln if bsart = 'ZD11'

Could I do this in my original SELECT or would I need to create new variables for each of these fields and read the tables that they are in into these variables?

Never had to create a deep report before!

Hi there

I posted a question yesterday with regards to a select join and have managed to get that working.

This builds an ALV with data relating to several matnrs. On this report I have a field called zsuper which is the supersession part number for each matnr.

Ideally I want to get further details about this zsuper and display this as well in my ALV.

I need to find maktx for the zsuper, mmsta, labst and ebeln if bsart = 'ZD11'

Could I do this in my original SELECT or would I need to create new variables for each of these fields and read the tables that they are in into these variables?

Never had to create a deep report before!

5 REPLIES 5
Read only

andreas_mann3
Active Contributor
0 Likes
743

try sample-prg. BCALV_TEST_HIERSEQ_LIST

/ fm REUSE_ALV_HIERSEQ_LIST_DISPLAY

A.

Read only

Former Member
0 Likes
743

Managed to get the plants for each zsuper material but not sure how to move this data to a particular variable

SELECT werks

INTO CORRESPONDING FIELDS OF TABLE it_marc

from marc for all entries in part_data

where zsuper = part_data-zsuper.

if not sy-subrc is initial.

endif.

This gets all the plants for all the supersession parts, but needs to appear in a certain column called SUPER_WERKS which has been declared as plant in a structure.

Read only

0 Likes
743

Hi,

Since you are using "INTO CORRESPONDING FIELDS" clause of SELECT statement, I suggest you to use SELECT - ENDSELECT and

SELECT WERKS INTO <Workarea>-SUPER_WERKS......

Alternate Option, First read all the WERKS into an Internal table and use READ statement.

Regards,

Raj

Edited by: Rajasekhar Matukumalli on Apr 30, 2008 11:20 AM

Read only

Former Member
0 Likes
743

It is always important to keep in mind the less number of data base hits, the more is the performance of the code.

So use one selected followed by a read.

Thanks.

Read only

Former Member
0 Likes
743

select-endselect always lowers your performance as it hits database for every record. The best way is to get all the data in the internal table at one go and then manipulate the values on this internal table. This way your code performance will improve.

Thanks,

Sheel