Welcome To My BLOG

This site is to give a brief idea for the abap learners who are looking for some real time programs .It consists of collection of programs from my side . I hope these programs are very much used for all of the learners. Please check the links for any information in ABAP.
Please vote for my Blog. And please input me on this mail addrssess.Email me

Share this link with your friends

http://www.rebtel.com/u/15163104576

For every friend who signs up using this link and makes a payment, we'll give you 8 €!


Monday, December 13, 2010

OOPS:Method using Internal Table as one of the parameters

REPORT YSUBOOPS5 .

types : begin of typ_tab ,
matnr like mara-matnr ,
meins like mara-meins ,
end of typ_tab .

data : itab type standard table of typ_tab ,
x_tab LIKE LINE OF ITAB.

CLASS get_materials DEFINITION.
PUBLIC SECTION.
METHODS : getmara IMPORTING matgr TYPE C
EXPORTING l_tab TYPE ANY TABLE.
endclass.

CLASS get_materials IMPLEMENTATION.
METHOD : getmara .
SELECT matnr meins INTO TABLE l_tab
FROM MARA
WHERE MATKL = matgr.
ENDMETHOD.
ENDCLASS.

PARAMETERS : p_matkl like mara-matkl .

START-OF-SELECTION.
DATA : w_mat TYPE REF TO get_materials.
CREATE OBJECT : w_mat.
CALL METHOD w_mat->getmara EXPORTING matgr = p_matkl
IMPORTING l_tab = itab .
LOOP AT ITAB INTO X_TAB.
WRITE:/5 X_TAB-MATNR , X_TAB-MEINS.
ENDLOOP.

No comments: