Application Development and Automation 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: 
Read only

Help with small code

Former Member
0 Likes
715

Hi,

The matnr exists in the table and it should pull something in, however, the following code is not pulling the matrn:

SELECT SINGLE MATNR FROM MARC

INTO LV_MATNR

WHERE MATNR = XVBAP-MATNR

AND WERKS = XVBAP-WERKS

AND ZZLIFNR = LV_ZZLIFNR.

LV_MATNR is type MARC-MATNR.

The other variables exist and i checked in the table for a record, but it does pull it up.

Thanks,

John

6 REPLIES 6
Read only

Former Member
0 Likes
692

Hi John,

Please check in debugging ,are you getting values from XVBAP-MATNR

XVBAP-WERKS ,LV_ZZLIFNR ?

if so use matnr value - 18 char in query and see the results.

I hope problem might be matnr -> it will have less than 18 char

Thanks

Seshu

Read only

0 Likes
692

Nope, doesn't work. I hardcoded the values in a test program:

data: lv_matnr like marc-matnr.

SELECT single MATNR FROM MARC

INTO LV_MATNR

WHERE MATNR = '000000000001275148'

AND WERKS = '1020'

AND ZZLIFNR = '300276'.

The record exits, but its not pulling a thing.

Read only

0 Likes
692

what is the length of ZZLIFNR -> give all zero's infront of 300276

and see the results

Thanks

Seshu

Read only

0 Likes
692

Hi,

Give the variable values/constant values with correct length so that it would fetch the data. Go to SE11 and check the length and display the data and give the same in condition if there are no conversion exits. Else use conversion exits.

Regards,

Srilatha.

Read only

0 Likes
692

Just looking at ZZLIFNR i assume that it must be a 10 chracter field, to which you should pass a 10 character value(Padded with enouh 0s).

on a side note, you do not need to restrict based on ZZLIFNR at all because, the key for mara is MATNR and WERKS only..

select * from marc into lv_matnr where

matnr = <material> and werks = <Plant>.

if marc-zzlifnr <> <Value you want to compare>.

do some thing.

else.

do something else.

endif.

Read only

0 Likes
692

Hi John,

You should change the values of LIFNR as 0000300276 and check the result.

Regards,

Atish