Skip to Content
author's profile photo Former Member
Former Member

How to get Quotation Details on IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM

Hi Gurus,

I am new to SAP. I am implementing changes on ME21N.

I need to copy price(Conditions Sub Page) from Quotation(VA22) to ME21N and using Interface IF_EX_ME_PROCESS_PO_CUST to implement changes.

I have created ZCL_IM_ME_PROCESS_PO_CUST class interface and added following Code and hardcoded NETPR = 180. With above change i could successfully override PO Price value.

Now the requirment is need to copy price from Quotation instead of Hardcoding. In the below method I could get any Quotation details attached to PO( We are creating PO from Purchase requisition and its tied to Quotation). How can I access quotation attached to PO iteam?

METHOD IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM .

DATA: LS_MEPOITEM TYPE MEPOITEM.

  • Call Method to get the Item Data

LS_MEPOITEM = IM_ITEM->GET_DATA( ).

  • Now manipulate the structure LS_MEPOITEM to populate the field NETPR

LS_MEPOITEM-NETPR = 180.

  • Call the below method to Set latest Values.

IM_ITEM->SET_DATA( LS_MEPOITEM ).

ENDMETHOD.

Thanks in advance.

Shreeshail

Edited by: ssganiger on Sep 7, 2009 12:22 PM

Edited by: ssganiger on Sep 7, 2009 12:34 PM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 07, 2009 at 10:41 AM

    Hi

    U need to know the quatation number, so u can get the header data from VBAK table in particular the field VBAK-KNUMV and use it to read the conditions of quatation from KONV table: KONV-KNUMV = VBAK-KNUMV.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Max,

      Thanks for input. I could resolve the issue.

      Here goes sample code for reference.

      METHOD IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM .

      DATA: LS_MEPOITEM TYPE MEPOITEM,

      LS_NETPR TYPE NETPR,

      LS_MEPOHEADER TYPE MEPOHEADER,

      LS_MEPOACCOUNTING TYPE MEPOACCOUNTING,

      HEADER_OBJ TYPE REF TO IF_PURCHASE_ORDER_MM,

      IT_ACCOUNTINGS TYPE PURCHASE_ORDER_ACCOUNTINGS,

      ACCOUNTING_OBJ TYPE PURCHASE_ORDER_ACCOUNTING,

      LS_KNUMV TYPE KNUMV,

      LS_KONV TYPE KONV.

      • GET THE HEADER

      HEADER_OBJ = IM_ITEM->GET_HEADER( ).

      • GET THE HEADER DATA

      LS_MEPOHEADER = HEADER_OBJ->GET_DATA( ).

      • GET THE ITEM DATA

      LS_MEPOITEM = IM_ITEM->GET_DATA( ).

      • GET THE ACCOUNTING DATA

      IT_ACCOUNTINGS = IM_ITEM->GET_ACCOUNTINGS( ).

      LOOP AT IT_ACCOUNTINGS INTO ACCOUNTING_OBJ.

      LS_MEPOACCOUNTING = ACCOUNTING_OBJ-ACCOUNTING->GET_DATA( ).

      ENDLOOP.

      • FIRST GET DOCUMENT CONDITION NUMBER FROM VBAK

      SELECT SINGLE KNUMV INTO LS_KNUMV FROM VBAK WHERE VBELN = LS_MEPOACCOUNTING-VBELN.

      • SELECT ZK01, EK01 OR ZPES DOCUMENT CONDITION TYPES FOR SELECTED VBELN AND POSNR AND SUM THE TOTAL.

      SELECT * FROM KONV INTO LS_KONV WHERE KNUMV = LS_KNUMV AND KPOSN = LS_MEPOACCOUNTING-VBELP AND KSCHL IN ('ZK01', 'EK01' ,'ZPES').

      LS_NETPR = LS_NETPR + LS_KONV-KBETR.

      ENDSELECT.

      • ASSIGN THE TOTAL AMOUNT TO MEPOIEM-NETPR.

      LS_MEPOITEM-NETPR = LS_NETPR.

      • SET LATEST VALUES.

      IM_ITEM->SET_DATA( LS_MEPOITEM ).

      ENDMETHOD.

      Thanks

      Shreeshail

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.