cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP SELECT-statement does not work properly with WHERE-clause in eCATT

vadimklimov
Active Contributor
0 Kudos

Dear all,

I am inserting inline ABAP code in eCATT script and need to retrieve some data from database table MARA. So I have the material number (MARA-MATNR) as selection criterion and need to get base unit of measure (MARA-MEINS) and move its value into variable LV_UM. I am sure that table has the record for this criterion (checked in TCode SE16).

The ABAP-code I wrote is as below:

ABAP.

TABLES MARA.

DATA wa_mara TYPE mara.

SELECT SINGLE * FROM mara INTO wa_mara WHERE matnr = '1234567890'.

ENDABAP.

Unfortunately, the work area WA_MARA is not filled after execution of the select-statement. I re-wrote the provided code doing SELECT without WHERE-clause and filling locally declared internal table and it worked fine, but when I add the selection criterion for the select-statement above, it breaks.

Could you please advise what can be the reason of such problem and how can i overcome it?

My regards,

Vadim

Accepted Solutions (1)

Accepted Solutions (1)

Vny12
Employee
Employee
0 Kudos

Hi vadim,

i see that ur ABAP-statement is perfectly fine,

but problem is 1234567890 is lenght of 18,

Matnr is char 18 length.

So please use '0000000000xxxxxx'.

Append zeros until you have length of 18 .

best regards

vinay

vadimklimov
Active Contributor
0 Kudos

Hi Vinay!

Thank you so much for your advice! You are correct - when writing WHERE-clause, I missed leading zeros in condition's value and this is why the SELECT-statement failed.

My kind regards to you and best wishes!

Vadim

Answers (0)