‎2007 Aug 17 11:52 AM
Hi Experts ,
Logic :
data: l_vposnr TYPE vbap-posnr.
SELECT SINGLE
posnr
FROM vbap
INTO l_vposnr
WHERE vbeln = com_kbv1-vbeln.
Here the items Value ( posnr ) wil be stored in varibale l_vposnr.
My Questions is ??
How can i know how many items are der in this Particular Variable (l_posnr)
Based on this Line Items , i can go futher processing ??
Plz Provide Me some Logic ??
Regards,
Murthy
‎2007 Aug 17 11:54 AM
You have two options.
Select INTO TABLE
or
SELECT
posnr
FROM vbap
INTO l_vposnr
WHERE vbeln = com_kbv1-vbeln.
........
ENDSELECT.
‎2007 Aug 17 11:54 AM
Hi
after that select query put loop at that internal table and put count
field so you will know how many fields are there
‎2007 Aug 17 11:55 AM
since u r using single addtion with select statement , there will be only one value...
also since it is a variable it can hold only one value at a time..nyways
‎2007 Aug 17 11:56 AM
Hi,
Try this,
DATA: L_VOSPNR TYPE VBAP-POSNR,
COUNT(10).
SELECT SINGLE POSNR FROM VBAP INTO I_VPOSNR WHERE
VBELN = COM_KBV1-VBELN.
DESCRIBE TABLE I_VPOSNR LINES COUNT.
WRITE: COUNT. " this gives the no. of lines in int. tab.
Regards,
Padmam.
‎2007 Aug 17 11:56 AM
Hi Narayana,
As per my understanding on your question - you want to know, how many values this variable wil have??
As you see in the declaration, it is just a variable which means that will hold ONE valule at any given point of time.
Also as you have Select SINGLE - it will also return only one value.
So what ever may be the case, it will hold ONLY ONE value.
<i>Reward if helpful</i>
Best Regards,
Ram.
‎2007 Aug 17 12:05 PM
hi
there exists single value only beacuse it is variable (not internal table to store more than one record) and using select single statements, it selects single record only
declare internal table and select data
types : begin of t_vbap,
vbeln like vbak-vbeln,
posnr like vbap-posnr,
end of t_vbap.
data : it_vbap type table of t_vbap.
select vbeln posnr from vbap into table it_vbap where vbeln = com_kbv1-vbeln.
‎2007 Aug 17 12:25 PM
data: l_vposnr TYPE vbap-posnr.
SELECT SINGLE
posnr
FROM vbap
INTO l_vposnr
WHERE vbeln = com_kbv1-vbeln.
above statement gets only one POSNR
for all POSNR consider the code below
data:
begin of itab occurs 0,
l_vposnr TYPE vbap-posnr,
end of itab.
SELECT
posnr
FROM vbap
INTO table itab
WHERE vbeln = com_kbv1-vbeln.
loop at itab.
write:/ itab-l_vposnr.
endloop.