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

optimizing the select query

Former Member
0 Likes
473

Hi All,

I would like to know what would be alternate table or optimal way to make the following queries work in a more efficient manner.

1) select sfakn from vbrk into table tl_sfakn for all entries in tl_vbrp WHERE sfakn = tl_vbrp-vbeln.

2) SELECT vbeln FROM vbrp INTO TABLE tl_vbrp FOR ALL ENTRIES IN tl_vbap[] WHERE vgbel = tl_vbap-vbeln.

any help would be appreciated.

thanks

vijay

2 REPLIES 2
Read only

Former Member
0 Likes
383

Dear Friend i could see that you are working on mainly on VBRP and VBRK.

Please try with the following Views for a better results.

WB2_V_VBRK_VBRP

Data Selection from Customer Billing Document

WB2_V_VBRK_VBRP2

Data Selection from Customer Billing Documents (w/o WBGT

Regards,

Lijo Joseph

Read only

Former Member
0 Likes
383

Hello Vijay,

How doing?. plz find my suggestions

1. fetch vgbel ( sales document) also into tl_vbrp in previous select. Now make use of document flow as shown

select vbeln from vbfa

into table tl_vbfa for all entries in tl_vbrp

where vbelv EQ t_vbrp-vgbel and

VBTYP_N IN ('M','N','O','P'). "billing docs

if tl_vbfa[] is not inital.

select vbeln sfakn

into table tl_sfakn

from vbrk for all entries in tl_vbfa

where vbeln EQ tl_vbfa-vbeln.

if sy-subrc EQ 0.

delete tl_sfakn where sfakn is initial.

endif.

endif.

2. u can use VBFA as shown above , use preceding and subsequent document category appropriately

thanks

sreejith