Application Development 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: 

Function Module query

Former Member
0 Kudos

hi all ,

In my FM , i have a importing parameter kna1-kunnr

i want to select a field from table knvp

based on my importing parameter

how do i use it??

select field from knvp where ""

can anybody help me with this

thnkx

bhanu

8 REPLIES 8

former_member182190
Active Participant
0 Kudos

Hi,

If the name of ur Importing parameter is kna1-kunnr then

select fields

from knvp

where kunnr = kna1-kunnr.

if the name of ur importing parameter is i_kna1-kunnr then

select fields

from knvp

where kunnr = i_kna1-kunnr.

Hope this helps.

Regards,

Ismail.

0 Kudos

ITS GIVING ME ERROR MESSAGE

"KUNNR" IS UNKNOWN

Former Member
0 Kudos

hi,

select field from knvp where kunnr = kna1-kunnr.

try this

tables:kna1,knvp.

data itab like knvp occurs 0 with header line.

select kunnr from knvp into itab where kunnr = kna1-kunnr.

endselect.

reward if its helpful

Edited by: Rajasekhar Reddy on Jan 22, 2008 2:02 PM

Edited by: Rajasekhar Reddy on Jan 22, 2008 2:07 PM

0 Kudos

import parameter name may be gv_kunnr.

then ur select statment should be

select kunnr from knvp into table itab where kunnr = gv_kunnr.

Madhavi

Former Member
0 Kudos

Hello Bhanu,

Just create a data object like kna1-kunnr.

ex: kunnr1 like kna1-kunnr.

assign the value from importing parameter of function module to kunnr1.

then write query like:

select <field> from knvp where kunnr eq kunnr1.

hope it works.

Reward If Helpful.

Regards

--

Sasidhar Reddy Matli.

Former Member
0 Kudos

Bhanu,

Decalre the internal table with fields which you require from KNVP table.

FOR ex: In FM if you gave v_kunnr

select required fields into table

i_knvp from knvp

where kunnr EQ v_kunnr.

Don't forget to reward if useful...

Former Member
0 Kudos

Hi Dear,

You have 2 use the inner join Bcaz ur using

two tables.

1.First u create the structure for the fields which

u r gng to select from the KNVP table.

In this structure mention u r import parameter

field also.

Eg: Begin of x_KNVP,

Kunnr type Kunnr,

field2 type dataelement,

field3.....

End of x_KNVP.

2.Now write the select query like this

Select Field1

Field2

.

Fieldn

into corresponding fields of table it_KNVP

from KNVP as C

inner join KNA1 as D

on CKUNNR = DKUNNR.

I hope it will help you.If it helps reward me points.

Regards

AshokChowdhary.M

0 Kudos

thnkx

now i got it

thkx