‎2008 Dec 05 2:29 PM
Hi Experts,
I have one query. I have unique sales order in my table ITAB. Now my requirement is to find out the partner function SP & SH for all sales order available in ITAB.
For partner function I have appended both partner function in one range table having 2 values as above mentioned.
I wrote the below logic
LOOP AT ITAB INTO WA.
SELECT * FROM VBPA INTO CORRESPONDING FIELDS OF TABLE JTAB WHERE VBELN = WA-VBELN AND PARVW IN R_PARVW.
ENDLOOP.
I have checked the database table VBPA having entries for both partner function. But still after the loop I am getting only one value in internal table JTAB.
Any suggestion pls?
‎2008 Dec 05 2:33 PM
Hii
Use this code:
Select * from VBPA into table JTAB for all entries in ITAB
where vbeln = it_vbeln and parvw in r_parvw.
This'll give you all the delivery num & partners
Cheers
RAvish
PS: Never use a select query inside a loop unless unavoidable.
‎2008 Dec 05 2:39 PM
When you do Select ... into table .. statement, your internal table is refreshed for every statement, so it will have the results from just the last execution. thats the reason you are getting one entry as you are in a loop here.
Look at the answer above, and fix it./
‎2008 Dec 05 2:45 PM
HI,
Instead of writing select in the loop try this way
SELECT * FROM VBPA INTO CORRESPONDING FIELDS OF TABLE JTAB
FOR ALL ENTRIES IN ITAB
WHERE VBELN = ITAB-VBELN AND PARVW IN R_PARVW
‎2008 Dec 05 2:50 PM
Hi Neha,
I think you need to consider POSNR while selecting from VBPA table, then you can see more than one entry in the internal table for partner functions.
LOOP AT ITAB INTO WA.
SELECT * FROM VBPA INTO CORRESPONDING FIELDS OF TABLE JTAB WHERE VBELN = WA-VBELN and posnr = wa-posnr AND PARVW IN R_PARVW.
ENDLOOP.
Hope this helps
-Sujatha