2010 May 24 8:48 PM
Hi,
I need to fetch the value of field MVGR3 from table MVKE for some MATNR.
I am using the FM "MVKE_READ_WITH_MATNR" to fetch the value for the field MVGR3 .
I have written something like this :
LOOP AT t_ltap INTO w_ltap.
CALL FUNCTION 'MVKE_READ_WITH_MATNR'
EXPORTING
matnr = w_ltap-matnr
TABLES
mvke_tab = t_mvgr3
EXCEPTIONS
not_found = 1
lock_on_mvke = 2
lock_system_error = 3
enqueue_mode_changed = 4
OTHERS = 5.
endloop.
t_ltap table contains values for material no.So looping at that tableIm fetcing the MVGR3 field for each matnr.
However when i run this FM explicityly in SE37,I can get the values for each material.However When i call the FM through my program ,i get the exception 1 ie. SY-SUBRC = 1.
How is this?Please help.
Thanks!
2010 May 24 9:04 PM
Hi,
Try:
CALL FUNCTION 'MVKE_READ_WITH_MATNR'
EXPORTING
matnr = w_ltap-matnr
KZRFB = 'X'
...
Best regards,
Leandro Mengue
2010 May 24 9:02 PM
Hard to tell without the rest of your code, but most likely you aren't sending the internal value of the material number in the code-based function call if you are in fact using the same material number for both tests or you didn't refresh the buffer. The SE37 test workbench is dynpro-based and thus converts the values automatically. Did you select the values from LTAP directly? Debugging the function would answer your question.
You would be better off selecting the values with a FOR ALL ENTRIES process as well.
2010 May 24 10:36 PM
Hi Brad,
I tried using "FOR ALL ENTRIES " in LTAP and then selecting data from MVKE,but still im not getting the entries.
NOTE : Im usng only MATNR as the key for selection of data from MVKE.
2010 May 25 1:53 PM
So, you solved it. Was it the internal/external format issue I mentioned? If you solve an issue yourself, you need to post the resolution so that others will benefit from your mistakes/experience if they search and find your post.
2010 May 25 11:33 PM
Yes Brad.
It was the format issue for material no.I was removing the leading zroes and hence the issue.
Thanks for all the help.points rewarded!
2010 May 24 9:04 PM
Hi,
Try:
CALL FUNCTION 'MVKE_READ_WITH_MATNR'
EXPORTING
matnr = w_ltap-matnr
KZRFB = 'X'
...
Best regards,
Leandro Mengue
2010 May 24 10:37 PM
Leandro,
Tried passing the additional parameter as u suggested but still the sam eproblem.Please advise.
2010 May 24 10:52 PM
Hi - I have written below code and this is working fine for me try the same.
TYPES : BEGIN OF ty_mara,
matnr TYPE matnr,
END OF ty_mara.
DATA : i_mara TYPE STANDARD TABLE OF ty_mara,
i_mvke TYPE STANDARD TABLE OF MVKE,
w_mara TYPE ty_mara,
v_count TYPE c.
SELECT matnr
FROM mara
into w_mara.
CALL FUNCTION 'MVKE_READ_WITH_MATNR'
EXPORTING
matnr = w_mara-matnr
TABLES
mvke_tab = i_mvke
EXCEPTIONS
not_found = 1
lock_on_mvke = 2
lock_system_error = 3
enqueue_mode_changed = 4
OTHERS = 5.
v_count = v_count + 1.
if v_count eq 5.
exit.
endif.
ENDSELECT.
2010 May 24 10:56 PM
2010 May 24 11:42 PM
Hi,
Please, post your solution (may be help another users).
Best regards,
Leandro Mengue
2010 May 24 10:58 PM
It's probably a conversion exit problem. You will likely have to pass your material number through the exit before doing the SELECT.
Rob