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

faster processing for bkpf?

Former Member
0 Likes
637

Currently my code is as below:

SELECT * FROM bkpf INTO CORRESPONDING FIELDS OF TABLE zbkpf

WHERE bukrs = pbukrs

AND gjahr = pgjahr

AND belnr IN belnr

AND bstat = space

AND monat = period.

these paramaters are the indexs...

Still its taking a long time...

any idea to share?

5 REPLIES 5
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
589

Hi ,

Instead of using INTO CORRESPONDING FIELDS OF TABLE zbkpf

declare a type like types: begin of itab ,

field1

field2

end of itab.

this table should include all the required fields .

After that :

SELECT * FROM bkpf INTO table itab

WHERE bukrs = pbukrs

AND gjahr = pgjahr

AND belnr IN belnr

AND bstat = space

AND monat = period.

Hope this helps.

Read only

dani_mn
Active Contributor
0 Likes
589

HI,

don't use INTO CORRESPONDING FIELDS.

declare zbkpf with same structure as bkpf and then use.

SELECT * FROM bkpf <b>INTO TABLE zbkpf</b>

WHERE bukrs = pbukrs

AND gjahr = pgjahr

AND belnr IN belnr

AND bstat = space

AND monat = period.

Read only

Former Member
0 Likes
589

Hi,

Do you need all the fields of BKPF table in your internal table ZBKPF. You can just declare your internal table with only those fields which you require for your processing & then select them in the same order from BKPF.

In this manner you can remove the usage of INTO CORRESPONDING FIELDS OF TABLE construct as well as select *.

This would reduce the time drastically.

Regards,

Chetan.

PS:Reward points if this helps.

Read only

Former Member
0 Likes
589

instead declare an internal table itab with the fields required....

then as the table is BKPF...the best way is

select <fields> from bkpf

where <conditions>.

move data from bkpf to itab.

endselect.

This process is faster for FI related tables...

Read only

Former Member
0 Likes
589

Hi,

Can you swap the positions of GJAHR and BELNR positions in the statement. There are chances that it is not going thru the index rather going for a full table scan.

Use the fields which are required instead of * and use INTO TABLE rather than INTO CORRESPONDING FIELDS OF

Hope this helps.

Thanks

Naresh