‎2011 Feb 25 1:18 PM
Hi,
I was unable to fetch contract's header partner function where as my select query returning all partner function of that contract.
for example if 100 CSEs are there in contract I have to fetch CSE for that entire contract where POSNR is '000000'.
pl see my code .
SELECT vbeln
parvw
pernr
FROM vbpa
INTO TABLE it_vbpa
FOR ALL ENTRIES IN it_vbak
WHERE vbeln EQ it_vbak-vbeln
AND posnr EQ '000000'
AND parvw IN r_parvw.
Thanks,
Nag
‎2011 Feb 25 1:27 PM
Hi,
try to write the code as below..
SELECT vbeln
parvw
pernr
FROM vbpa
INTO TABLE it_vbpa
FOR ALL ENTRIES IN it_vbak
WHERE vbeln EQ it_vbak-vbeln
AND posnr EQ space
AND parvw IN r_parvw.
Thanks
Arbind
‎2011 Feb 25 1:29 PM
‎2011 Feb 25 1:29 PM
‎2011 Feb 25 1:33 PM
PARVW condition is perfect..it is failing just becuase of the POSNR..
Thanks,
Nag
‎2011 Feb 25 1:37 PM
Hi,
Please check what values you are passing to Partner Function Range.
I thnik r_parvw may be the problem, since posnr you already passed as space.
So code is ok,check the ranges value in debug mode and pass it to VBPA table to see whether you are
getting the correct data.
Thanks
Arbind
‎2011 Feb 25 1:40 PM
Hi,
I have checked PARVW ranges in debug ..the table is populating fine....something we have to do with this POSNR.
Thanks,
Nag
‎2011 Feb 25 1:55 PM
Hi Nagajuna,
See since Posnr data type is Numc so you can pass '000000' or space.
as you found ranges is also ok.
Check that internal table for VBAK is populating correct data because sometimes it happens that if internal table in For entries is empty than no filter may work.
This may be the reason.
Check it once in debug.
Thanks
Arbind
‎2011 Feb 25 2:11 PM
Hi,
I agree with the previous post, i tried your code and getting data.
I think you should check that really for the given condn data exist in both VBAK and VBPA tables.
POSNR and PARVW already have conversion exit and i think you are using range/ select-options, so conversion part is being taken care by these statements.
Thanks,
Anmol.
‎2011 Feb 25 2:21 PM
Just for testing purpose comment the line and see if data is coming?
*AND parvw IN r_parvw.
If data is coming then loop at r_parvw and use conversion exit for each line.
Similarly comment the posnr line in where condition and then check the data
‎2011 Feb 27 2:36 PM
Hi All,
Thanks for ur suggestions, I need only header data but my internal table is populating with all header plus Item data....Ranges are perfect ..Have checked in debug mode It contains 4 records which I want...
But the problem is with posnr ...even if i give SPACE or '000000' then all the records of VBPA are getting fetched...hope u understand it clearly
Thanks
Nag
‎2011 Feb 27 4:55 PM
Hi Nagarjuna,
Actually your code is perfect I tried in my system its fetching data.
Do one thing directly goto se11--> Vbpa table ---> in Selection Screen Pass the the vales you are getting from it_vbak-vbeln
( you can take it in debug mode in excel from your program) and the Posnr field as '000000' and also the ranges for parvw as it contains only 4 records so no problem you can pass it in the table.
Check it once whther the output you are getting from your program and the output you are getting from Se11 are same or not.
You can judge it there.
I would also request you to find that it_vbak[] consist some data.
Thanks
Arbind
‎2011 Feb 28 3:02 PM
Hi Nagarjuna,
Try doing this :
Get all the data without mentioning the POSNR field in the select statement. Once you get the data into your internal table, loop the internal table something like below
Loop at itab into workarea where Posnr ne '000000'
append workarea to itab1.
clear workarea.
endloop.
(OR)
Loop at itab into workarea.
if workarea-Posnr eq '000000'
append workarea to itab1.
clear workarea.
endif.
endloop.
** You can delete the entries inside the loop based on the condition but it tries to regenerate an index everytime u delete an entry.
So, to increase the performance, it is better to append the entries to another internal table which is faster.
Let me know if this is working.
Thanks,
Guru
‎2011 Feb 25 1:43 PM
Yes just check the ranges, as this might be only problem. Rest everything is looking good.
Partner functions are not same as you see in VBPA.
For example if you pass AG in the partner you get SP.
So what ever you are getting in the ranges take same and go to table VBPA and try to fetch with them.
Hope this helps
‎2011 Feb 28 11:59 AM
Hi Nagarjuna,
I had tried with the below code. It worked.
TYPES: begin of ty_vbak,
vbeln type vbak-vbeln,
end of ty_vbak.
data: it_vbpa type standard table of vbpa,
it_vbak type standard table of ty_vbak.
data: ls_vbak type ty_vbak,
ls_vbpa type vbpa.
Ranges: r_parvw FOR knvp-parvw.
Constants:c_inclusive(1) TYPE c VALUE 'I',
c_equal(2) TYPE c VALUE 'EQ'.
CLEAR r_parvw.
r_parvw-low = 'AG'.
r_parvw-option = c_equal.
r_parvw-sign = c_inclusive.
APPEND r_parvw.
CLEAR ls_vbak.
ls_vbak-vbeln = '0000000013'.
APPEND ls_vbak to it_vbak.
SELECT *
FROM vbpa
INTO TABLE it_vbpa
FOR ALL ENTRIES IN it_vbak
WHERE vbeln EQ it_vbak-vbeln
AND posnr EQ '000000'
AND parvw IN r_parvw.
Please cross check the it_vbak & r_parvw entries at the SELECT quey in debugging. Hope it should work.
Regards,
Satish Kanteti
‎2011 Feb 28 12:23 PM
As POSNR is of type NUMC so in where condition put POSNR EQ 0. it works for me so i am sure will work for you as well.