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: 

How Do I Retrieve Data from Structure SMEINH?

Former Member
0 Kudos

Hi,

I need to retrieve the value pointed to in the image below from MM03.  It's seems to be stored in Structure SMEINH, but I can't seem to find how to read that structure.

Can anyone help?

Thanks very much!

Andy

1 ACCEPTED SOLUTION

VenkatRamesh_V
Active Contributor

Hi,

Try,

  

Table MARM.

  

Hope it helpful,

Regards,

Venkat.

7 REPLIES 7

VenkatRamesh_V
Active Contributor

Hi,

Try,

  

Table MARM.

  

Hope it helpful,

Regards,

Venkat.

0 Kudos

Thanks Venkat.

I am aware of MARM, but I think this requirement is for me to get at the SMEINH structure.  That's the one I'm having trouble retrieving from.

Thx,

Andy

0 Kudos

The data is not actually "stored" in the structure, structure values are volatile, only living during program execution.

So are you working in an exit or BAdI of the transaction, else forget or reformulate your requirement.

(Or reverse engineering on FM MATERIAL_READ_ALL?)

Regards,

Raymond

0 Kudos

Hi,

Check the table MARM entries by giving the MM03  input.

Hope it helpful,

Regards,

Venkat.

0 Kudos

Hello Andrew!

Raymond is right, this data only exists during program execution. To retreive this data you should implement the following steps:

1. Run the functional module MATERIAL_READ_ALL and get content of MEINH table from it.

2. MEINH-AZSUB field calculates in include LMGD1O1H in module ME_ANZAHL_SUB_BERECHNEN (see picture).

So, you can use this algorithm to retreive the value of MEINH-AZSUB field.


MODULE ME_ANZAHL_SUB_BERECHNEN OUTPUT.

DATA: WA_MEINH LIKE SMEINH,

SUB_MEINH LIKE SMEINH.

check not mara-meins is initial.

if not ME_FEHLERFLG IS INITIAL.

   loop at meinh into wa_meinh where mesub is initial.

     wa_meinh-mesub = mara-meins.

     modify meinh from wa_meinh.

   endloop.

else.

  LOOP AT MEINH INTO WA_MEINH.

    IF WA_MEINH-MESUB IS INITIAL.

       WA_MEINH-MESUB = mara-meins.

       MODIFY MEINH FROM WA_MEINH.

    ENDIF.

    CHECK WA_MEINH-UMREN NE 0.

    IF WA_MEINH-MESUB = mara-meins.

      WA_MEINH-AZSUB = WA_MEINH-UMREZ / WA_MEINH-UMREN.

    ELSE.

      READ TABLE MEINH WITH KEY meinh = WA_MEINH-MESUB

               INTO SUB_MEINH.

       IF SY-SUBRC = 0.

         CHECK SUB_MEINH-UMREZ <> 0.

         WA_MEINH-AZSUB = ( WA_MEINH-UMREZ * SUB_MEINH-UMREN ) /

                         ( WA_MEINH-UMREN * SUB_MEINH-UMREZ ).

       ELSE.

*        error Subeinheit ex. nicht.

       ENDIF.

    ENDIF.

    MODIFY MEINH FROM WA_MEINH.

  ENDLOOP.

endif.

ENDMODULE.

ABAP source code in this document was coloured using the ABAP code lighter for SCN.

Best regards,

George Shlyahov

0 Kudos


Excellent information.  Thank you guys very much!

Andy

0 Kudos

Thank you for the question and answer - it sure helped me too.