‎2008 Jun 06 8:18 AM
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??
‎2008 Jun 06 8:22 AM
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.
‎2008 Jun 06 8:29 AM
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.
‎2008 Jun 06 8:33 AM
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
‎2008 Jun 06 8:36 AM
Hi Neha,
Use Function module CONVERSION_EXIT_AUART_INPUT.
This is the conversion exit for AUART.
Rewards....if useful.
Regards
Mohit Bansal
‎2008 Jun 06 8:41 AM
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'.
‎2008 Jun 06 10:11 AM
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....
‎2008 Jun 06 10:45 AM
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
‎2008 Jun 06 10:51 AM
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.
‎2008 Jun 06 10:38 AM
Try with ' OR' (2 spaces and then 2 chars), it should work.
Regards, Tapas
‎2008 Jun 06 10:41 AM
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
‎2008 Jun 06 10:53 AM
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