on 01-24-2008 3:01 PM
Hi,
I have written a select statement like this
SELECT SINGLE vgbel vgpos INTO (l_vgbel,l_vgpos) FROM lips
WHERE vbeln = l_vbeln.
IF SY-SUBRC = 0.
SELECT SINGLE bstkd FROM vbkd INTO l_bstkd
WHERE vbeln = l_vgbel AND
posnr = l_vgpos.
ENDIF.
The first select statement is getting executed.But the second one is showing sy-subrc value 4.What would be the reason?
Hi...
It all depends on the declaration of the variables..
Declare the variables as
data l_vgbel type lips-vgbel.
data l_vgpos type lips-vgpos.
SELECT SINGLE vgbel vgpos INTO (l_vgbel,l_vgpos) FROM lips
WHERE vbeln = l_vbeln.
IF SY-SUBRC = 0.
SELECT SINGLE bstkd FROM vbkd INTO l_bstkd
WHERE vbeln = l_vgbel AND
posnr = l_vgpos.
ENDIF.
Regards,
Sai Ramesh
If it is not working then add the below code just before the second select query.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_vgbel
IMPORTING
output = l_vgbel.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_vgpos
IMPORTING
output = l_vgpos.
What is ur requirement actually ? In general VGBEL in lips contains Purchase order number. VBKD contains only the Sales documents... so it will never give you sy-subrc 0.
Edited by: Sai ramesh on Jan 25, 2008 10:04 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The requirement is given like this.
For all delivery items on this BOL pick up from LIKP the delivery number and read LIPS for all delivery items shipping on this shipment. Use LIPS-VGBEL and LIPS-VGPOS to access the sales order number and line item and then read VBKD to find the Customer PO numbers BSTKD on this shipment. List all unique customer PO numbers, Do Not repeat them.
Then check this code,,
data l_vbelv type vbfa-vbelv.
data l_posnv type vbfa-posnv.
select single vbelv posnv
from vbfa
into (l_vbelv,l_posnv)
where vbeln = i_vbeln
and posnn = i_posnr
and vbtyp_n = 'J'
and vbtyp_v = 'C'.
From the above query u will get the sales order number and item number for a particular deliver item (i_vbeln,i_posnr).
SELECT SINGLE bstkd FROM vbkd INTO l_bstkd
WHERE vbeln = l_vbelv AND
posnr = l_posnv.
Pass these values to VBKD table .. u will get the PO number from BSTKD field.
So for one item in delivery you will get the sales order number and purchase order number.
Repeat the same for all the items... or use ( select ... for all entries ) query to get all the items details at a time.
Regards,
Sai Ramesh
use converion routiens if any exists..else data problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If I remember correctly...
if the data in VBKD concerns the entire sales order (header level), then VBKD-POSNR will be '000000'.
You should adjust your select to account for this possibility.
Cheers
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Might me that you dont have values in the table
Or do the conversion exit for l _vgbel
You have conversion exit for vgbel.
Regards,
Nageswar
Edited by: nageswar vattikuti on Jan 24, 2008 8:39 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here l_vgbel,l_vgpos,l_vbeln,l_bstkd are variables
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.