2007 Jan 19 4:27 PM
Hi all,
This is the piece of code I have developed .
date1 = sy-datum - 89 .
date2 = sy-datum .
SELECT vbeln FROM vbak INTO CORRESPONDING FIELDS OF TABLE i_vbak
WHERE erdat >= date1 AND
erdat <= sy-datum AND
vkorg IN s_vkorg .
CHECK sy-subrc EQ 0 .
SELECT kunnr FROM vbpa INTO CORRESPONDING FIELDS OF TABLE i_vbpa
FOR ALL ENTRIES IN i_vbak
WHERE vbeln = i_vbak-vbeln AND
parvw = 'SH' .Given the criteria , the first select gets 439 records from the table VBAK which matches with the count from the table VBAK . The second select for all entries retuns sy-subrc as 4 where as I expect it should return 438 records from vbpa as per the given criteria . Can anyone please explaoi me where I am going wrong on the select statement .
Thanks ,
Daniel .
2007 Jan 19 4:30 PM
Hi,
Instead of SH give WE for the ship to party..
SELECT kunnr FROM vbpa INTO CORRESPONDING FIELDS OF TABLE i_vbpa
FOR ALL ENTRIES IN i_vbak
WHERE vbeln = i_vbak-vbeln AND
parvw = '<b>WE</b>'
Thanks,
Naren
Hi all,
This is the piece of code I have developed .
date1 = sy-datum - 89 .
date2 = sy-datum .
SELECT vbeln FROM vbak INTO CORRESPONDING FIELDS OF TABLE i_vbak
WHERE erdat >= date1 AND
erdat <= sy-datum AND
vkorg IN s_vkorg .
CHECK sy-subrc EQ 0 .
SELECT kunnr FROM vbpa INTO CORRESPONDING FIELDS OF TABLE i_vbpa
FOR ALL ENTRIES IN i_vbak
WHERE vbeln = i_vbak-vbeln AND
parvw = 'SH' .Given the criteria , the first select gets 439 records from the table VBAK which matches with the count from the table VBAK . The second select for all entries retuns sy-subrc as 4 where as I expect it should return 438 records from vbpa as per the given criteria . Can anyone please explaoi me where I am going wrong on the select statement .
Thanks ,
Daniel .
2007 Jan 19 4:30 PM
Hi,
Instead of SH give WE for the ship to party..
SELECT kunnr FROM vbpa INTO CORRESPONDING FIELDS OF TABLE i_vbpa
FOR ALL ENTRIES IN i_vbak
WHERE vbeln = i_vbak-vbeln AND
parvw = '<b>WE</b>'
Thanks,
Naren
2007 Jan 19 4:35 PM
Hi Narendra ,
It is returning some values , after giving "WE" instead of "SH" . But it is not matching with the record count form VBPA . I made a select on VBPA and I expect to get 438 records but it is giving only 123 entries . One thing I can observe is duplicates are not there in internal table . Can you please let me know what the issue could be .
Thanks ,
Daniel .
2007 Jan 19 4:34 PM
FOR ALL ENTRIES gets rid of duplicate entries.
So modify i_vbpa and:
SELECT vbeln posnr parvw kunnr
FROM vbpa
INTO CORRESPONDING FIELDS OF TABLE i_vbpa
FOR ALL ENTRIES IN i_vbak
WHERE vbeln = i_vbak-vbeln
AND parvw = 'SH' .
Rob
Message was edited by:
Rob Burbank
2007 Jan 19 4:44 PM
Hi,
As mentioned by Rob..WHen you are using FOR ALL ENTRIES..You have to give the key fields of the table VBPA..
SELECT <b>VBELN
POSNR
PARVW
kunnr</b>
FROM vbpa INTO CORRESPONDING FIELDS OF TABLE i_vbpa
FOR ALL ENTRIES IN i_vbak
WHERE vbeln = i_vbak-vbeln AND
parvw = <b>'WE'</b>
Thanks,
Naren
2007 Jan 19 4:51 PM
Hello Daniel,
Whenever u r using for all entries always u should select all the<b> key</b> of the table.
So select all the key fields of vbpa.
If useful reward.
Vasanth
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |