08-03-2005 7:58 AM
Hi ,
In a program 2 SELECT statements are written , one is working and other is not after SP11 upgrade...
Following statement is working ( Returns a record ) ....
select single *
into ls_mara
from mara
where matnr = <b>gs_mm_rec-material</b>.
And following statment is not working ....
select *
from mara
appending table itab_mara
where matnr = <b>lw_matnr</b>
and lvorm <> 'X'.
<b>Note : Material is with lvorm <> 'X' in MARA , means it is satisfying the condition and material is same in both where condition</b> .
The exact scenario is ... A program is written which take the material from flat file and creates the material and then creates BOM using that material ( which is created in the same program just now ) as component.While debugging we can see that material is present in table MARA( through SE16 )but the second select statement doesn't return any record. Please help. Thanks in advance .
Regards
Nand Kishor
08-03-2005 8:02 AM
Nandkishor,
Try passing LW_MATNR through it's conversion routine to add in the leading zeros. This could be the cause of your problems.
ie.
call function 'CONVERSION_EXIT_MATN1_INPUT'
importing
input = lw_matnr
exporting
output = lw_matnr.
select *
from mara
appending table itab_mara
where matnr = lw_matnr
and lvorm <> 'X'.
Let me know how that goes.
Cheers,
Pat
08-03-2005 8:02 AM
Nandkishor,
Try passing LW_MATNR through it's conversion routine to add in the leading zeros. This could be the cause of your problems.
ie.
call function 'CONVERSION_EXIT_MATN1_INPUT'
importing
input = lw_matnr
exporting
output = lw_matnr.
select *
from mara
appending table itab_mara
where matnr = lw_matnr
and lvorm <> 'X'.
Let me know how that goes.
Cheers,
Pat
08-03-2005 8:10 AM
when a certain thing dosent work, as a ABAPER first thing which you should do is , do a little bit of debuggin.
This way apart from finding the cause of the problem, you would also learn something new.
Regards
Raja
08-03-2005 9:11 AM
Hi Pat ,
In both the cases no leading zeros are present but one is working and other is not.
Let me try your what you proposed.
Thanks for your help
Regards
NK
08-03-2005 9:21 AM
Hi Raja ,
I already debugged the prg no. of time and at last i posted this to forum . I'm new to this field. Thanks for your suggetion .
Regards
NK
08-03-2005 10:15 AM
Hi Pat ,
This ( 'CONVERSION_EXIT_MATN1_INPUT' ) is not solving our purpose.plz help .
We are using DB2 database .
SQL Trace is -
uration Obj. name Op. Recs. RC Statement
30 MARA REOPEN 0 SELECT WHERE "MANDT" = '810' AND "MATNR" = 'DWMaria9' AND "LVORM" <> 'X' FOR FETCH ONLY WITH UR
1,380 MARA FETCH 0 100
19 MARA CLOSE 0 0
08-03-2005 11:21 AM
Hi NK,
I hope you understand that my comment was on good intention. since you said you are new to ABAP, i suggest you to spend a good amount of time in debugging, you will learn a lot.
Sorry, if had hurt you with my comments.
Regards
Raja
08-03-2005 12:42 PM
Hi raja ,
Nothing like that....you have given good suggetion to me , i accept that.The only problem is DEAD LINE ....i have finish it till tomm.
Thanks & Regards
NK
08-03-2005 9:43 AM
Hi Nandkishor,
Can you send me SQL trace for this query?
What DB r u using??
Reg,
Arpit
08-03-2005 10:16 AM
Re: SELECT..... Statement not working after SP11 upgrade
Posted: Aug 3, 2005 5:15 AM Reply E-mail this post
HI Arpit
We are using DB2 database .
SQL Trace is -
uration Obj. name Op. Recs. RC Statement
30 MARA REOPEN 0 SELECT WHERE "MANDT" = '810' AND "MATNR" = 'DWMaria9' AND "LVORM" <> 'X' FOR FETCH ONLY WITH UR
1,380 MARA FETCH 0 100
19 MARA CLOSE 0 0
08-03-2005 10:20 AM
Nandkishor,
Can you tell us how are you populating LW_MATNR? If you cout cut and paste on the forum the necessary bits of code it would be great.
Cheers,
Pat.
08-03-2005 12:33 PM
Hi Pat,
I'm taking value in LW_MATNR from an internal table and in this internal table i'm taking values from a flat file .
Regards
Nand Kishor
08-03-2005 11:40 AM
Hi Kishor,
Can you please tell how are you passing value to 'lw_matnr' and at the time of SELECT what exactly is the value in this variable.
/Manik
08-03-2005 12:35 PM
Hi manik,
I'm taking value in LW_MATNR from an internal table and in this internal table i'm taking values from a flat file .
Regards
Nand Kishor
08-03-2005 12:46 PM
Hi Kishor,
can you paste the exact code and also the value which is there in the variable (example '00000015668789'). what the length of material you are passing to this variable. Are there leading zeros or tralling zeros in case the lenght is less then 18 characters. ?
Is it a loop pass where you are passing the value to this variable and populating it.
Please supply with the copy of the full code (perform),
/Manik
08-03-2005 2:30 PM
Hi Manik,
See SQL trace
30 MARA REOPEN 0 SELECT WHERE "MANDT" = '810' AND "MATNR" = 'DWMaria9' AND "LVORM" <> 'X' FOR FETCH ONLY WITH UR
1,380 MARA FETCH 0 100
19 MARA CLOSE 0 0
Material is 'DWMaria9' which is not a number so i feel meaning of zeros will not come.
i suppose this code should work.
Kishor-- Can you check weather your code works with out LVORM field in your system?
08-03-2005 5:33 PM
Hi All ,
Problem is solved ....it was the matter of CASE .
Material which i have used in flat file was in lowercase and program was trying fetch the record on the basis of flat file .
Regards
NK
08-03-2005 1:29 PM
Hi Nandkishor,
Try this one,
after each select, do the commit work.
EXEC SQL.
COMMIT WORK
ENDEXEC.
Thanks
Lakshman
08-03-2005 1:58 PM
Please provide the data declaration of lw_matnr
and it's value from debug when the SELECT executes.