‎2009 Apr 24 12:04 PM
Hi all,
Iam using a select query to check whether that material code exist or not.But even though material is created SY-SUBRC is coming 4.Iam doing this in one of my module pool program and this is working perfectly from more than a month in Production.This problem is coming for only few materials only not for all materials.The following is my select query :
SELECT COUNT( * ) FROM MARA WHERE MATNR = WA_BOQP-ZMATNR.4 days back I had a report in that I was selecting Sales orders based on the given selection screen data.The select query should have selected 12 SO but it was giving only 8 SO.The same report when run after 7-8 hours(after transport),started giving 12 SO.I was Amazed,same thing happend in one more program also.
What might be the problem? is it a BASIS guy problem or what?
Hope my query is clear.
Thanks & Reagrds
Rock.
‎2009 Apr 24 12:12 PM
It might be case of Conversion issue.
YOu have to use the fm CONVERSION_EXIT_MATNR_INPUT before the select query.
call function 'CONVERSION_EXIT_MATNR_INPUT'
exporting
INPUT = WA_BOQP-ZMATNR
Importing
OUTPUT = WA_BOQP-ZMATNR.
SELECT COUNT( * ) FROM MARA WHERE MATNR = WA_BOQP-ZMATNR.Regards,
Ravi
‎2009 Apr 24 12:10 PM
Hi
Please use a Conversion Exit before passing the material number to the "where" clause.
Cheers
Ravish
‎2009 Apr 24 12:10 PM
Hi,
Ensure you that field WA_BOQP-ZMATNR is in internal format. (and in DB too).
‎2009 Apr 24 12:11 PM
Hi...
i think No problem at all because you said its working perfactly after transport.
and if no records come from ur query then it will give subrc eq 4. and if material is available in table then first check no space is there in your workarea field ( WA_BOQP-ZMATNR ) value with the help of debugging and it must be of same type on which you are puting where condition.
may this helpful to you..
Regards,
Chintan
Edited by: Chintan_SAP on Apr 24, 2009 4:42 PM
‎2009 Apr 24 12:12 PM
It might be case of Conversion issue.
YOu have to use the fm CONVERSION_EXIT_MATNR_INPUT before the select query.
call function 'CONVERSION_EXIT_MATNR_INPUT'
exporting
INPUT = WA_BOQP-ZMATNR
Importing
OUTPUT = WA_BOQP-ZMATNR.
SELECT COUNT( * ) FROM MARA WHERE MATNR = WA_BOQP-ZMATNR.Regards,
Ravi
‎2009 Apr 24 12:19 PM
Thanks all,but I think all of u took me wrogly.
1)Iam using conversion exit b4 select query.
2)Ususally this problem is happening immediately after transport of program or immediately after creation of the material.
That SO numbers problem came immediately after transport and material problem is coming immediately after creation of the material.
Hope am clear in my question.
Thanks & regards,
Rock.
‎2009 Apr 24 12:57 PM
Hello Rock,
Ususally this problem is happening immediately after transport of program or immediately after creation of the material
Can you please explain what this statement means ?
BR,
Suhas
‎2009 Apr 24 1:01 PM
Hi,
I clubbed 2 different things there,half of my statement is referring to one problem of any report when transported to Production,some select statements giving wrong results.
The second case is happening with material numbers,when u create material and immediately run any report system is unable to select that material.
Hop am clear in my questia.
Thanks & Regards,
Rock.
‎2009 Apr 24 1:07 PM
Hi Rock,
perhaps anybody implement any FM "in update task" and is not working fine.
When you create a material (or any other object) you receive the message that "Material saved succesfully" but if there are update process, custom or standard, the database is not updated instead all of this process finish.
If the problem is just after save the material, i think that this is the problem. A Z process that are not working fine in update mode, or that all update process in the system are full and the BD actualization have to wait.
regards,
Pepe
‎2009 Apr 24 12:52 PM
Hi Rock...
Instead of SELECT COUNT.. better go for SELECT UP TO 1 ROWS......
The reason is that... certain database systems do not manage the number of lines in a table in their catalog and therefore must retrieve this number, the function COUNT( * ) is not suited to check whether a table contains lines at all. You should better use SELECT f ... FROM tab UP TO 1 ROWS for any table field f.
Cheers.....!!
‎2009 Apr 24 1:27 PM
Hi,
Try this
data l_count type i.
SELECT COUNT( * ) into l_count FROM MARA group by MATNR
having MATNR = '000000000000000001'.
write l_count.
endselect.
if sy-subrc eq 0.
write 'Entry exists'.
endif.
‎2009 May 11 7:10 AM