Skip to Content
avatar image
Former Member

selecting data from MVKE

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!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    May 24, 2010 at 08:04 PM

    Hi,

    Try:

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

    Best regards,

    Leandro Mengue

    Add comment
    10|10000 characters needed characters exceeded

    • 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.
      

  • May 24, 2010 at 08: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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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!

  • avatar image
    Former Member
    May 24, 2010 at 09:56 PM

    SOLVED

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 24, 2010 at 09: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

    Add comment
    10|10000 characters needed characters exceeded