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

Regarding Select stmt.

shadow
Participant
0 Likes
926

Hi All,

I have Small issue , am extracting the data from BSIK ,using this select stmt

REFRESH it_bsik.

  • SELECT lifnr umskz blart dmbtr FROM bsik INTO TABLE it_bsik

  • FOR ALL ENTRIES IN it_emp

  • WHERE lifnr = it_emp-lifnr

  • AND bukrs = 'FUND'

  • AND gjahr = p_gjahr

  • AND blart IN ('ZA','ZN','ZL','ZK','ZG','ZM'). am using this select Query .

I have 14 records in my table but while extracting only am getting 11 in internal table it_bsik.

i need to get total records and base on umskz ,blart amount has to be sum.

I want to display ZN data with Spl GL 9, k and ZA data with 2 ,5 ,8 indivisually.

Data which i have .

kN01079 9 ZN 14.75

KN01079 9 ZN 618.35

KN01079 K ZN 10.92

KN01079 K ZN 143.47

KN01079 2 ZA 1,755.00

KN01079 2 ZA 1,755.00

KN01079 2 ZA 10.92

KN01079 5 ZA 2,296.00

KN01079 5 ZA 2,296.00

KN01079 5 ZA 248.51

KN01079 8 ZA 6,097.00

KN01079 8 ZA 6,097.00

KN01079 9 ZA 248.51

KN01079 K ZA 10.92

Thanks & Regard's,

shaik.

6 REPLIES 6
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
896

Because FOR ALL ENTRIES does a delete adjacent duplicates on the resultant set before populating the target internal table.

Please select all the key fields of the table to ensure that the duplicate records are not deleted when using FAE.

BR,

Suhas

Read only

Former Member
0 Likes
896

Try this code:

data : temp_itbsik type standard table of it_bsik.

loop at it_bsik into wa_bsik.

at end of blart.

sum.

apppend wa_bsik to temp_itbsik.

endat.

endloop.

Read only

Clemenss
Active Contributor
0 Likes
896

Hi Shaik,

Suhas is right. You do not need the key fields in the target structure, just use

SELECT 
* key fields
BUKRS
LIFNR
UMSKS
UMSKZ
AUGDT
AUGBL
ZUONR
GJAHR
BELNR
BUZEI
* required data fields
lifnr umskz blart dmbtr INTO CORRESPONDING FIELDS OF TABLE it_bsik
 FROM bsik 
...

The INTO CORRESPONDING FIELDS clause is always the best option. It will not reduce performance because it is evaluated once at compile time.

Then you will get all records.

Regards,

Clemens

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
896

Hey Clemens,

And also i have checked INTO CORRESPONDING FIELDS v/s INTO TABLE in SE30 many a times. But the former is always an expensive statement. Can you please explain why you say "INTO CORRESPONDING FIELDS is always the best option"?

Cheers,

Suhas

Read only

Clemenss
Active Contributor
0 Likes
896

If, for what ever reason the table structure changes, selecting some fields into an unchanged target structure (or vice versa) you risk a dump in the best case, wrong data in the worst case. INTO CORRESPONDING FIELD always works correct.

If you feel it is not good for performance, the please deliver a proof in ECC600 or later. I really appreciate so see a significant difference.

Regards,

Clemens

Read only

shadow
Participant
0 Likes
896

Answered.