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: 

Select Query Problem

Former Member
0 Kudos

Hi Experts,

I have one query. I am trying to fetch the records from VBAK & VBAP table based on some condition as below

SELECT AVBELN AKUNNR B~POSNR

BMATNR BWERKS B~LGORT INTO TABLE ITAB FROM VBAP AS A

INNER JOIN VBAP AS B ON AVBELN = BVBELN

WHERE A~VKORG IN S_VKORG

AND A~AUART = 'OR'.

But here I am not getting any value in my internal table ITAB.

This is due to reason that order type AUART having 4 length & I am passing in my select query as 'OR'.

Even I tried to pass as '00OR' but still I am not getting value in ITAB.

The database table having records for this selection.

Any suggestion to resolve this issue i.e. What I need to do for order type in where clause??

11 REPLIES 11

Former Member
0 Kudos

Hello!

Try this:

DATA: i_field LIKE VBAP-AUART.

UNPACK 'OR' TO i_field.

And use i_field as a param in the where condition.

former_member181995
Active Contributor
0 Kudos

Neha,

you mention in your select query as AND A~AUART = 'OR'.

and A is denote to VBAP am afraid to say in VBAP doesnt have AUART.

so you need to write like as AND B~AUART = 'OR'.

please mark if solved.

Amit.

Former Member
0 Kudos

Hi

there is an internal conversion routine for the data element AUART,

pass value "TA" instead of "OR" as it is internally converted.

check the database table you will get ti easily

check the FM

CONVERSION_EXIT_AUART_INPUT

CONVERSION_EXIT_AUART_OUTPUT

reward if usefull,

Taher

Former Member
0 Kudos

Hi Neha,

Use Function module CONVERSION_EXIT_AUART_INPUT.

This is the conversion exit for AUART.

Rewards....if useful.

Regards

Mohit Bansal

Former Member
0 Kudos

CHANGE THE CODE IN THIS WAY U WILL GET IT

SELECT A~VBELN A~KUNNR B~POSNR
B~MATNR B~WERKS B~LGORT INTO TABLE ITAB FROM VBAK AS A
INNER JOIN VBAP AS B ON A~VBELN = B~VBELN
WHERE A~VKORG IN S_VKORG
AND A~AUART = 'OR'.

Former Member
0 Kudos

Hi All,

Sorry for typo error.

The field AUART is in VBAK table.

But still I did not get my answer. I think UNPACK command is generally used for Numeric type value. The field AUART is having type CHAR(4).

So, UNPACK command will not work.

Also I tried using conversion exit. But it is also not helpful.

Any other suggestion pls....

0 Kudos

just test other parts of your query by selecting all records (remove the condition for AUART)....then you can delete the records where AUART NE 'OR'

if rest is ok...we can go further in finding out...

Edited by: Priyank Jain on Jun 6, 2008 5:45 AM

0 Kudos

Neha,

please close this thread i think you got sufficient ans regarding same.

i think might be in your system this query doesn't fetch any data

because may be no DATA is there in particulates field.

we cant check this to our system because data is useless to you.

but your query looks fine to us.

just now try to find whether data exist or not.

Amit.

Former Member
0 Kudos

Try with ' OR' (2 spaces and then 2 chars), it should work.

Regards, Tapas

Former Member
0 Kudos

Hi Neha,

Just transfer the values into corresponding fields of table itab and you will get values depending on the condition which matches both VKORG and the hard coded AUART value which is gvien in select query.

just try this and u will get the answer.

if not, reply me i will try to help u out.

Regards

prashanth

Former Member
0 Kudos

1)FIRST CHECK TABLE FIRST WHETHER THEY HAVE DATA OR NOT.

2) YOU GIVEN VBAP TWICE(CORRECT IT)

GIVE VBAP AND VBAK

3)CHECK WITH THERE IS ANY RECORD MATCHING THESE CONDITION.

THANKS