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: 

selecting data from MVKE

Former Member
0 Kudos

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!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try:

CALL FUNCTION 'MVKE_READ_WITH_MATNR'
EXPORTING
   matnr = w_ltap-matnr
   KZRFB = 'X'
  ...

Best regards,

Leandro Mengue

10 REPLIES 10

brad_bohn
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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.

brad_bohn
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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!

Former Member
0 Kudos

Hi,

Try:

CALL FUNCTION 'MVKE_READ_WITH_MATNR'
EXPORTING
   matnr = w_ltap-matnr
   KZRFB = 'X'
  ...

Best regards,

Leandro Mengue

0 Kudos

Leandro,

Tried passing the additional parameter as u suggested but still the sam eproblem.Please advise.

0 Kudos

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.

Former Member
0 Kudos

SOLVED

0 Kudos

Hi,

Please, post your solution (may be help another users).

Best regards,

Leandro Mengue

Former Member
0 Kudos

It's probably a conversion exit problem. You will likely have to pass your material number through the exit before doing the SELECT.

Rob