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..... Statement not working after SP11 upgrade

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

former_member221770
Contributor
0 Kudos

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

18 REPLIES 18

former_member221770
Contributor
0 Kudos

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

0 Kudos

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

0 Kudos

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

0 Kudos

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

0 Kudos

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

0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

Hi Nandkishor,

Can you send me SQL trace for this query?

What DB r u using??

Reg,

Arpit

0 Kudos

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

0 Kudos

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.

0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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?

0 Kudos

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

Lakshmant1
Active Contributor
0 Kudos

Hi Nandkishor,

Try this one,

after each select, do the commit work.

EXEC SQL.

COMMIT WORK

ENDEXEC.

Thanks

Lakshman

Former Member
0 Kudos

Please provide the data declaration of lw_matnr

and it's value from debug when the SELECT executes.