G-YWWN0NYSS1 Handle the Handle Classes correctly - TECHNICAL GYAN GURU Handle the Handle Classes correctly - TECHNICAL GYAN GURU

Handle the Handle Classes correctly

Let’s delve into the Handle the Handle Classes correctly. Gone are the days where we had the freedom to have import boundaries as tables, designs or single fields. SAP has been pushing hard for over 10 years for Oh no. BADI ME_PROCESS_PO_CUST is one of the usually utilized upgrade object in Material Administration module, where many engineers find this BADI challenging to carry out.

What is the difficulty? Handle the Handle Classes correctly
Every one of the strategies in this BADI interface has TYPE REF TO bringing in boundaries.. Oh no!! it is an aggravation..

Kindly track down a functioning code scrap to peruse PO Header, PO Thing and PO Thing Administration information. If it’s not too much trouble, note lt_poitem, ls_items and lr_item are TYPE REF information types.

Strategy if_ex_me_process_po_cust~process_header.



DATA: ls_poheader TYPE mepoheader,
* Table Interface with PO Item External View
lt_poitem TYPE purchase_order_items, " Table IF_PURCHASE_ORDER_ITEM_MM
* Line Interface PO Item External View
ls_items TYPE purchase_order_item, " Line IF_PURCHASE_ORDER_ITEM_MM
lt_esll TYPE mmsrv_esll,
ls_item_data TYPE mepoitem,
* Handle for Item of a Purchasing Document
lr_item TYPE REF TO cl_po_item_handle_mm.

* Get PO Header data in structure
ls_poheader = im_header->get_data( ).

* Ref Table with PO Items
lt_poitem = im_header->get_items( ).

* Loop through interface
LOOP AT lt_poitem INTO ls_items.

* PO Item data in strucrue
ls_item_data = ls_items-item->get_data( ).

* Macro to get item
mmpur_dynamic_cast lr_item ls_items-item. " cl_po_item_handle_mm

* Use method of IF_SERVICES_MM interface to fetch Service data
CALL METHOD lr_item->if_services_mm~get_srv_data
EXPORTING
im_packno = ls_item_data-packno
IMPORTING
ex_esll = lt_esll.

ENDLOOP.

ENDMETHOD.

Allow me to show you how the designs, tables and reference objects see run time.

2
3
4

CL_PO_ITEM_HANDLE_MM is a vital class to deal with MM thing information. Look carefully the way that we have utilized the CL_PO_ITEM_HANDLE_MM class above.
Check the connection points withing the class. We really want to involve them to get more data as and when required.

1

Also you could have to look the beneath handle classes for PO for various situations.

a) CL_PO_HEADER_HANDLE_MM : Handle of a Purchasing Document
b) CL_PO_PARTNER_HANDLE_MM : Purchasing Document Partner
c) CL_PO_SCHEDULE_HANDLE_MM : Schedule Line of a Purchasing Document
d) CL_PO_ACCOUNTING_HANDLE_MM : Purchasing Document Account Assignment
e) CL_PO_ACCOUNTING_HANDLE_FM_MM : Purchasing Document Account Assignment

On the off chance that you thought about the thing mmpur_dynamic_cast is doing in the code bit previously? Really look at the full scale definition underneath. It is casiting &2 information to &1, for example lr_item ?= ls_items-thing.

*---------------------------------------------------------------------*
* MACROS for Dynamic Cast
*---------------------------------------------------------------------*
* use: dynamic_cast reference_target_type reference_source_type
* result: a) cast works (reference_target_type assigned)
* b) cast doesn't work (reference_target_type cleared)
* sy-subrc = 1

DEFINE mmpur_dynamic_cast.
catch system-exceptions move_cast_error = 1.
&1 ?= &2.
endcatch.
if sy-subrc = 1.
clear: &1.
endif.
END-OF-DEFINITION.

Trust with the above hint, you would have the option to bring and save information in this BADI or comparative BADIs where you need to deal with the handle class connection points and techniques. If it’s not too much trouble, drop a note on the off chance that you have any issue or disarray.

YOU MAY LIKE THIS

How to find badi in sap abap ?
Program Exits in Work Item for Workflow
Create and Consume Business Add-in(BAdI) in ABAP

SAP Managed Services

  • Related Posts

    Sending Inbound IDocs from SAP Program

    Before go into the depth of Sending Inbound IDocs from SAP Program. As a rule, the inbound IDoc to Drain is created by an outer framework (say XI) and gave…

    You’hv got an IDoc !!

    Assuming you google IDoc, you would be overwhelmed with large number of pages. Here, I have attempted to gather just those part which are essentially utilized continuously projects. You’hv got…

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You Missed

    Sending Inbound IDocs from SAP Program

    • By Varad
    • June 3, 2025
    • 18 views
    Sending Inbound IDocs from SAP Program

    You’hv got an IDoc !!

    • By Varad
    • June 2, 2025
    • 17 views
    You’hv got an IDoc !!

    *.IDO file for IDocs

    • By Varad
    • June 1, 2025
    • 41 views
    *.IDO file for IDocs

    A to Z of Custom Change Pointer

    • By Varad
    • May 31, 2025
    • 36 views
    A to Z of Custom Change Pointer

    IDoc Tips – Change Pointers and Reprocessing IDocs

    • By Varad
    • May 30, 2025
    • 39 views
    IDoc Tips – Change Pointers and Reprocessing IDocs

    Tool for GOS attachment from one SAP system to another SAP system

    • By Varad
    • May 29, 2025
    • 42 views
    Tool for GOS attachment from one SAP system to another SAP system