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

function module

Former Member
0 Likes
480

Hi All,

pls can you help me

i have writen one fuction module

the import parameters are

p_stdate

p_eddate

p_vbeln

all are optionals

the select query is

select a~vbeln

a~erdat

a~auart

a~vkorg

a~vtweg

a~spart

a~kunnr

b~posnr

b~matnr

b~werks

b~lgort

b~kwmeng

INTO CORRESPONDING FIELDS OF TABLE it_inquiry

FROM vbak AS a inner join vbap as b on b~vbeln = vbeln

where aerdat BETWEEN p_stdate AND p_eddate and AAUART = 'AF' OR a~vbeln = P_vbeln .

1. in output i have given start date and enddate

it is working fine , it geting all the salesorder numbers.

2.when i have given only salesorder number

it is working fine, its geting all the details.

3.but when i was entering like startdate,enddate and salesorder

number ,it should display the salesorder which i have given , but iam geting all the sales orders which was created on dates.

can you help me

thanks

mars

5 REPLIES 5
Read only

Former Member
0 Likes
453

for that you hav to repalce the OR statement from where condition to AND

Read only

ak_upadhyay
Contributor
0 Likes
453

Hi,

Change ur query....

select a~vbeln

a~erdat

a~auart

a~vkorg

a~vtweg

a~spart

a~kunnr

b~posnr

b~matnr

b~werks

b~lgort

b~kwmeng

INTO CORRESPONDING FIELDS OF TABLE it_inquiry

FROM vbak AS a inner join vbap as b on avbeln = bvbeln

where aerdat BETWEEN p_stdate AND p_eddate and AAUART = 'AF' OR a~vbeln = P_vbeln .

Cheers

Reward points if useful.

Regards

AK

Read only

Former Member
0 Likes
453

Put AND and IN in where condition

select a~vbeln

a~erdat

a~auart

a~vkorg

a~vtweg

a~spart

a~kunnr

b~posnr

b~matnr

b~werks

b~lgort

b~kwmeng

INTO CORRESPONDING FIELDS OF TABLE it_inquiry

FROM vbak AS a inner join vbap as b on b~vbeln = vbeln

where aerdat BETWEEN p_stdate AND p_eddate and AAUART = 'AF'

AND a~vbeln IN P_vbeln .

Read only

Former Member
0 Likes
453

Hello.

This error appear because you use "OR a~vbeln = P_vbeln". Instead of using OR, you can use IN.

-


DATA lr_vbeln TYPE RANGE OF vbak-vbeln.

DATA l_rvbeln LIKE LINE OF lr_vbeln.

IF P_vbeln IS NOT INITIAL.

l_rvbeln-sign = 'I'.

l_rvbeln-option = 'EQ'.

l_rvbeln-low = p_vbeln.

APPEND l_rvbeln TO lr_vbeln.

ENDIF.

elect a~vbeln

a~erdat

a~auart

a~vkorg

a~vtweg

a~spart

a~kunnr

b~posnr

b~matnr

b~werks

b~lgort

b~kwmeng

INTO CORRESPONDING FIELDS OF TABLE it_inquiry

FROM vbak AS a inner join vbap as b on b~vbeln = vbeln

where aerdat BETWEEN p_stdate AND p_eddate and AAUART = 'AF' AND a~vbeln IN lr_vbeln .

Edited by: Pavel Martinov on Mar 13, 2008 10:26 AM

Read only

0 Likes
453

Hi

in that query

1.based on start date , end date and sales order, it is working fine,

2.when i given start date and enddate , its working fine,

3. but when i given only sales order number with out giving start date and end date, its not working

pls can you help

thanks

mars