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: 

How to fetch Billing Document Number

Former Member
0 Kudos

Hi All,

i have Sold to party (kunnr), from this i need to find Billing document number and the corresponding Ship to party.

i have used

SELECT vbeln FROM vbpa INTO TABLE gt_vbeln

WHERE PARVW = 'WE' AND

kunnr = p_kunnr.

if gt_vbeln is NOT INITIAL.

SELECT KUNNR FROM vbpa

INTO TABLE gt_kunnr

FOR ALL ENTRIES IN gt_vbeln

WHERE vbeln = gt_vbeln-vbeln AND

PARVW = 'AG'.

DELETE ADJACENT DUPLICATES FROM gt_kunnr COMPARING ALL FIELDS.

ENDIF.

the first select query is taking long time n it is going for dump, please suggest me the solution.

Regards,

Kumar

7 REPLIES 7

marcela_martinez
Participant
0 Kudos

Hi Kumar,

Notice that PARVW domain has a Conversion Routine. May be yo need to "pass" WE value though it before executing the SELECT clause.

Also you may develop an index with the requiered fields. For me it's not the best option, I'm not "good friend" of developing lots of indexes, but may be in your case it helps.

I hope it helps.

Kind regards,

Marcela.

Former Member
0 Kudos

This should not be a problem.

Unless you are calling this in some sort of LOOP??

Rob

0 Kudos

Hi,

No I am not calling inside the loop.

Regards,

Kumar

Former Member
0 Kudos

Table VBPA has an index on PARVW and KUNNR, so it shouldn't cause a problem if you are doing a single SELECT.

Are you sure this isn't in a routine that is called inside a LOOP?

How many records should be returned?

Have you run ST05 against this?

Rob

Former Member
0 Kudos

Hi Kumar,

I will recommend with the below solution:

1. Select vbeln from vbrk...gt_vbeln

where kunag = sold-to-party.

2. if gt_vbeln[] is not initial.

Select from vbpa...

for all entries in gt_vbeln

where vbeln = gt_vbeln-vbeln

and parvw = 'WE'. "Ship to party

endif.

If you have any qn / concern on the above soln, please let me know.

Regards,

Selva K.

Edited by: Selvakumar Krishnan on Jul 20, 2010 9:21 PM

Former Member
0 Kudos

Answered

0 Kudos

Moderator message - When closing old threads, there is no need to add a comment. Adding a pasted answer like "Answered" only brings old threads to the top of the forum list and pushes current ones down. If you do add a comment, please indicate just how the problem was resolved. Additionally, if you assign po1nts to helpful answers, that will encourage people to help with your next problem. Rob