Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Reg : Internal Table.

Former Member
0 Likes
737

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

7 REPLIES 7
Read only

Former Member
0 Likes
707

You have two options.

Select INTO TABLE

or

SELECT

posnr

FROM vbap

INTO l_vposnr

WHERE vbeln = com_kbv1-vbeln.

........

ENDSELECT.

Read only

Former Member
0 Likes
707

Hi

after that select query put loop at that internal table and put count

field so you will know how many fields are there

Read only

former_member188827
Active Contributor
0 Likes
707

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

Read only

Former Member
0 Likes
707

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.

Read only

Former Member
0 Likes
707

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.

Read only

Former Member
0 Likes
707

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.

Read only

Former Member
0 Likes
707

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.