Professional Documents
Culture Documents
Getting Started
Welcome, Guest
Login
Register
Pgina 1 de 5
Newsletters Store
Products
About SCN
Downloads
Industries
Partnership
Developer Center
Lines of Business
University Alliances
Innovation
We are improving! Due to further refinements, our original planned dates for no new content of September 4th through September 7th have been moved.
The SCN wiki will not be available for new content submission starting September 4th 6PM CET until September 7 6PM CET. Please plan your SCN wiki tasks accordingly.
Useful Information
Purchase Order Data Extraction using ABAP Classes
Applies to:
Sample Program Developed in ECC 5.0
Summary
This post narrates the use of ABAP Classes for Extracting Purchase Order Details.
Created on:
16.11.2010
Author(s) Bio
Vinod Kumar is an ABAP Consultant working with NIIT Technologies LImited
Table of Contents
Purchase Order Data Extraction using ABAP Classes
Link to Content's target Space :
Applies to:
Summary
Author(s): Vinod Kumar T
Class & Methods Used
Contents in Sample Code
Comments
Sample Code
Related Content
Interface / Method
Description
CL_PO_HEADER_HANDLE_MM
SET_STATE
CL_PO_HEADER_HANDLE_MM
PO_INITIALIZE
Initialize/Refresh PO
Environment
CL_PO_HEADER_HANDLE_MM
PO_READ
CL_PO_HEADER_HANDLE_MM
IF_PURCHASE_ORDER_MM~GET_DATA
CL_PO_HEADER_HANDLE_MM
IF_PURCAHSING_DOCUMENT~GET_PARTNERS
Get PO Header
Partners
CL_PO_HEADER_HANDLE_MM
IF_LONGTEXTS_MM~GET_TEXTOBJECT
CL_PO_HEADER_HANDLE_MM
IF_LONGTEXTS_MM~GET_TYPES
http://wiki.scn.sap.com/wiki/display/ABAP/Purchase+Order+Data+Extraction+using+A...
20/08/2015
Purchase Order Data Extraction using ABAP Classes - ABAP Development - SCN Wiki
Class
Interface / Method
Description
CL_PO_HEADER_HANDLE_MM
IF_LONGTEXTS_MM~GET_TEXT
Pgina 2 de 5
Text
CL_PO_HEADER_HANDLE_MM
IF_PURCHASE_ORDER_MM~GET_ITEMS
CL_PO_ITEM_HANDLE_MM
IF_PURCHASE_ORDER_ITEM_MM~GET_DATA
CL_PO_ITEM_HANDLE_MM
IF_PURCHASE_ORDER_ITEM_MM~GET_SCHEDULES
Get PO Item
Schedule instance
CL_PO_SCHEDULE_HANDLE_MM
IF_PURCAHSE_ORDER_SCHEDULE_MM~GET_DATA
Get PO Item
Schedule data
CL_PO_ITEM_HANDLE_MM
IF_PURCHASE_ORDER_ITEM_MM~GET_ACCOUNTINGS
Get PO Acct
Assignment Instance
CL_PO_ACCOUNTING_HANDLE_MM
IF_PURCHASE_ORDER_ACCOUNT_MM~GET_DATA
Get PO Acct
Assingment data
CL_PO_ITEM_HANDLE_MM
IF_PURCHASE_ORDER_ITEM_MM~GET_CONDITIONS
CL_PO_ITEM_HANDLE_MM
IF_LONGTEXTS_MM~GET_TYPES
CL_PO_ITEM_HANDLE_MM
IF_LONGTEXTS_MM~GET_TEXT
CL_PO_ITEM_HANDLE_MM
IF_PURCHASE_ORDER_ITEM_MM~GET_HISOTRY
Get PO History
(Document Flow)
Comments
The code written here stores the data in internal tables. Further processing of internal tables or Display of the contents are not
mentioned in the sample code.
Sample Code
&--------------------------------------------------------------------*& Report ZVK_CL_PO
&--------------------------------------------------------------------*& Report to Extract Purchase Order details
&--------------------------------------------------------------------REPORT zvk_cl_po.
TABLES : ekko.
TYPE-POOLS : mmpur, abap.
DATA : zcl_po TYPE REF TO cl_po_header_handle_mm.
* Definition for header *
DATA : ls_document TYPE mepo_document,
lv_result TYPE mmpur_bool,
ls_mepoheader TYPE mepoheader.
* Definition for Item *
DATA : lt_items
ls_items
TYPE purchase_order_items,
TYPE purchase_order_item,
http://wiki.scn.sap.com/wiki/display/ABAP/Purchase+Order+Data+Extraction+using+A...
20/08/2015
Purchase Order Data Extraction using ABAP Classes - ABAP Development - SCN Wiki
Pgina 3 de 5
TYPE me_ekbnk,
TYPE me_ekbe,
TYPE me_ekbz.
http://wiki.scn.sap.com/wiki/display/ABAP/Purchase+Order+Data+Extraction+using+A...
20/08/2015
Purchase Order Data Extraction using ABAP Classes - ABAP Development - SCN Wiki
Pgina 4 de 5
= 'ME23N'
= ls_document-trtyp
im_aktyp
= ls_document-trtyp
im_po_number = p_ebeln
im_document = ls_document
IMPORTING
ex_result
= lv_result ).
IF lv_result = abap_true.
* --------------------------------------------------*
* Extract PO Header Information *
* --------------------------------------------------*
CLEAR : ls_mepoheader.
ls_mepoheader = zcl_po->if_purchase_order_mm~get_data( ).
* --------------------------------------------------*
* Extract PO Header Partners *
* --------------------------------------------------*
REFRESH : lt_partners.
lt_partners = zcl_po->if_purchasing_document~get_partners( ).
* --------------------------------------------------*
* Extract Header Text Object Details *
* --------------------------------------------------*
CLEAR : lv_tdobject, lv_metafield.
zcl_po->if_longtexts_mm~get_textobject(
IMPORTING
ex_tdobject = lv_tdobject
ex_metafield = lv_metafield ).
* --------------------------------------------------*
* Extract Header Text ID information *
* --------------------------------------------------*
REFRESH : lt_h_txttypes.
zcl_po->if_longtexts_mm~get_types(
IMPORTING
ex_texttypes = lt_h_txttypes ).
* --------------------------------------------------*
* Extract Header Text Informaton *
* --------------------------------------------------*
REFRESH : lt_h_textdata.
LOOP AT lt_h_txttypes INTO ls_h_txttypes.
zcl_po->if_longtexts_mm~get_text(
EXPORTING
im_tdid
= ls_h_txttypes-tdid
IMPORTING
ex_textlines
= lt_h_txtlines
ex_text_formatted = lv_h_format ).
APPEND LINES OF lt_h_txtlines TO lt_h_textdata.
ENDLOOP.
* --------------------------------------------------*
* Extract PO Item Information *
* --------------------------------------------------*
REFRESH : lt_items.
lt_items = zcl_po->if_purchase_order_mm~get_items( ).
LOOP AT lt_items INTO ls_items.
** ls_items-item returns the type Interface : IF_PURCHASE_ORDER_ITEM_MM
** which is part of the class : CL_PO_ITEM_HANDLE_MM
** Call the Interface method GET_DATA to get the Item details related to
** the Purchase Order. Item details data are passed to the structure
** ls_mepoitem and appended to the internal table lt_mepoitem.
ls_mepoitem = ls_items-item->get_data( ).
APPEND ls_mepoitem TO lt_mepoitem.
* --------------------------------------------------*
* Extract PO delivery schedule *
* --------------------------------------------------*
REFRESH : lt_schedules.
lt_schedules = ls_items-item->get_schedules( ).
LOOP AT lt_schedules INTO ls_schedules.
http://wiki.scn.sap.com/wiki/display/ABAP/Purchase+Order+Data+Extraction+using+A...
20/08/2015
Purchase Order Data Extraction using ABAP Classes - ABAP Development - SCN Wiki
Pgina 5 de 5
= ls_i_txttypes-tdid
IMPORTING
ex_textlines
= lt_i_txtlines ).
= ls_indicator
ex_item_totals
= lt_item_total
ex_item_totals_delivery = lt_item_del
ex_grir_assignment
ex_history
= lt_grir_det
= lt_history
ex_history_delivery
= lt_del_hist ).
Related Content
cl_po
Contact Us
Privacy
Legal Disclosure
cl_po_header_handle_mm
cl_po_item_handle_mm
Copyright
http://wiki.scn.sap.com/wiki/display/ABAP/Purchase+Order+Data+Extraction+using+A...
Follow SCN
20/08/2015