Extracting Purchase order details

Hai All,
           I am workng on a report in which I have to display the purchase order and GRN details for a given Purchase Requisition number.
If the PR has 5 line items and PO is made only for 2 line items, then the purchase order details for only those 2 line items should be displayed, but I am getting default purch ord data for all those 5 line items even though PO is not made for 3 line items.
Can anyone pls help me on this....

Hi ,
    Here goes ur solution , Only u have to use EBAN and EKBE for the purpose.The report displays item no wise details of PR with PO and GR. selection options for PR REQ or REQ Date  is used .
types: begin of int_pr,
     banfn like eban-banfn,
     bnfpo like eban-bnfpo,
     badat like eban-badat,
     ebeln like eban-ebeln,
     bedat like eban-bedat,
     matnr like eban-matnr,
    end of int_pr.
declaring work area.
data: pr_wa type table of int_pr,
      pr_wa1 like line of pr_wa,
       prnum(10),prval(10),tot type n.
types: begin of type_ekbe,
       ebeln like ekbe-ebeln,       " PO NO
       ebelp like ekbe-ebelp,        " ITEM NO IN PO
       belnr like ekbe-belnr,         " GR NO
       end of type_ekbe.
data: itab_gr type table of type_ekbe,
      wa_gr like line of itab_gr.
giving selection crieteria
select-options pr_no for eban-banfn.         " for purchase requistion no.
select-options pr_dt for eban-badat.         " for pr date
start-of-selection.
if pr_no is not initial.
select banfn bnfpo badat ebeln bedat matnr into corresponding fields of table pr_wa from eban where
banfn in pr_no and loekz ne 'x'.
select ebeln ebelp belnr into table itab_gr from ekbe for all entries in pr_wa where ebeln = pr_wa-ebeln and ebelp = pr_wa-bnfpo.
elseif pr_dt is not initial.
select banfn bnfpo badat ebeln bedat matnr into corresponding fields of table pr_wa from eban where
badat in pr_dt and loekz ne 'x' order by badat.
select ebeln ebelp belnr into table itab_gr from ekbe for all entries in pr_wa where ebeln = pr_wa-ebeln and ebelp = pr_wa-bnfpo.
endif.
loop at pr_wa into pr_wa1.
read table itab_gr into wa_gr with key ebeln = pr_wa1-ebeln  ebelp = pr_wa1-bnfpo.
if pr_wa1-ebeln ne ' '.
write: / sy-vline,2(10) pr_wa1-banfn color 2, sy-vline,14(12) pr_wa1-badat color 2, sy-vline, 28(9) pr_wa1-bnfpo color 2, sy-vline, 40(13) pr_wa1-matnr color 2, sy-vline, 55(16) pr_wa1-ebeln color 2, sy-vline, 74(15) pr_wa1-bedat color 2, sy-vline,
wa_gr-belnr,sy-vline.
else.
write: / sy-vline,2(10) pr_wa1-banfn color 2, sy-vline,14(12) pr_wa1-badat color 2, sy-vline, 28(9) pr_wa1-bnfpo color 2, sy-vline, 40(13) pr_wa1-matnr color 2, sy-vline, 55(16) 'not processed' color 6, sy-vline, 74(15) pr_wa1-bedat color 2, sy-vline,
wa_gr-belnr,sy-vline.
endif.
endloop.
uline at /1(90).
                             thats all u have to do for getting the required output.

Similar Messages

  • Upload of purchase order details using LSMW

    Hi friends,
    I encountered a problem while uploading purchase order details using LSMW . in the field mapping I could not able to fine the field TCODE. as a result I could not assign the transaction code ME21. could you please suggest me a solution.
      thanks

    Hai
    Check with the following
    Select fifth Radio button then follow the bellow step
    <b>5) select radio-Button 5 and execute
       Maintain Field Mapping and Conversion Rules
       Select the Tcode and click on Rule button there you   will select constant
       and press continue button
       give Transaction Code : ME21 and press Enter</b>
    Thanks & regards
    Sreenivasulu P

  • Interactive ALV report for vendorwise purchase order details

    Hi Experts,
    I am trying to create vendor wise purchase order interactive report, if i click any of vendor detail it has to display vendor details in a popup window or if i click any of purchase details it has to display purchase order details ina popup..
    can any body explain by using function modules REUSE_ALV_POPUP_TO_SELECT and REUSE_ALV_FIELDCATALOG_MERGE...

    Check the link below will be of some use to you.
    http://www.geocities.com/mpioud/Z_REUSE_ALV_POPUP_TO_SELECT.html
    Regards,
    Murthy

  • Interactive report for vendorwise purchase order details

    Hi Experts,
      I am trying to create vendor wise purchase order interactive report, if  i click any of vendor detail it has to call display vendor screen for selected vendor or if i click any of purchase details it has to open purchase order details..
    can any body explain...

    hi arun,
    use at line-selection
    example,
    at line-selection.
    if sy-ucomm = 'PICK'.
      if wa_lifnr is not initial.
        set parameter id 'LIF' field wa_lifnr.
        set parameter id 'BUK' field wa_bukrs.
        set parameter id 'EKO' field wa_ekorg.
        call transaction 'XK03'.  endif.
      if wa_ebeln is not initial.
        set parameter id 'BES' field wa_ebeln.
        call transaction 'ME23N' and skip first screen.
      endif.
    endif.
    Regards,
    Logan

  • I Need interactive report to list the purchase orders details for a vendor

    I Need interactive report to list the purchase orders details for a vendor that has    interactive drill down options to give the detail of vendor from vendor master.

    Hi
    see this sample report
    this is Customer wise sales orders
    just make similar report just using LFA1, EKKO and EKPO tables instead of KNA1,VBAK,VBAP
    REPORT ZTEJ_INTAB1 LINE-SIZE 103 LINE-COUNT 35(5) NO STANDARD PAGE
    HEADING.
    *TABLES DECLARATION
    TABLES : KNA1, VBAK, VBAP.
    *SELECT OPTIONS
    SELECT-OPTIONS: CUST_NO FOR KNA1-KUNNR.
    *INITIALIZATION
    INITIALIZATION.
    CUST_NO-LOW = '01'.
    CUST_NO-HIGH = '5000'.
    CUST_NO-SIGN = 'I'.
    CUST_NO-OPTION = 'BT'.
    APPEND CUST_NO.
    *SELECTION SCREEN VALIDATION
    AT SELECTION-SCREEN ON CUST_NO.
    LOOP AT SCREEN.
    IF CUST_NO-LOW < 1 OR CUST_NO-HIGH > 5000.
    MESSAGE E001(ZTJ1).
    ENDIF.
    ENDLOOP.
    *BASIC LIST SELECTION
    START-OF-SELECTION.
    SELECT KUNNR NAME1 ORT01 LAND1 INTO
    (KNA1-KUNNR, KNA1-NAME1,KNA1-ORT01,KNA1-LAND1)
    FROM KNA1
    WHERE KUNNR IN CUST_NO.
    WRITE:/1 SY-VLINE,
    KNA1-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
    16 SY-VLINE,
    KNA1-NAME1 UNDER 'NAME',
    61 SY-VLINE,
    KNA1-ORT01 UNDER 'CITY',
    86 SY-VLINE,
    KNA1-LAND1 UNDER 'COUNTRY',
    103 SY-VLINE.
    HIDE: KNA1-KUNNR.
    ENDSELECT.
    ULINE.
    *SECONDARY LIST ACCESS
    AT user-command.
    IF SY-UCOMM = 'IONE'.
    PERFORM SALES_ORD.
    ENDIF.
    IF SY-UCOMM = 'ITWO'.
    PERFORM ITEM_DET.
    ENDIF.
    *TOP OF PAGE
    TOP-OF-PAGE.
    FORMAT COLOR 1.
    WRITE : 'CUSTOMER DETAILS'.
    FORMAT COLOR 1 OFF.
    ULINE.
    FORMAT COLOR 3.
    WRITE : 1 SY-VLINE,
    3 'CUSTOMER NO.',
    16 SY-VLINE,
    18 'NAME',
    61 SY-VLINE,
    63 'CITY',
    86 SY-VLINE,
    88 'COUNTRY',
    103 SY-VLINE.
    ULINE.
    FORMAT COLOR 3 OFF.
    *TOP OF PAGE FOR SECONDARY LISTS
    TOP-OF-PAGE DURING LINE-SELECTION.
    *TOP OF PAGE FOR 1ST SECONDARY LIST
    IF SY-UCOMM = 'IONE'.
    ULINE.
    FORMAT COLOR 1.
    WRITE : 'SALES ORDER DETAILS'.
    ULINE.
    FORMAT COLOR 1 OFF.
    FORMAT COLOR 3.
    WRITE : 1 SY-VLINE,
    3 'CUSTOMER NO.',
    16 SY-VLINE,
    18 'SALES ORDER NO.',
    40 SY-VLINE,
    42 'DATE',
    60 SY-VLINE,
    62 'CREATOR',
    85 SY-VLINE,
    87 'DOC DATE',
    103 SY-VLINE.
    ULINE.
    ENDIF.
    FORMAT COLOR 3 OFF.
    *TOP OF PAGE FOR 2ND SECONDARY LIST
    IF SY-UCOMM = 'ITWO'.
    ULINE.
    FORMAT COLOR 1.
    WRITE : 'ITEM DETAILS'.
    ULINE.
    FORMAT COLOR 1 OFF.
    FORMAT COLOR 3.
    WRITE : 1 SY-VLINE,
    3 'SALES ORDER NO.',
    40 SY-VLINE,
    42 'SALES ITEM NO.',
    60 SY-VLINE,
    62 'ORDER QUANTITY',
    103 SY-VLINE.
    ULINE.
    ENDIF.
    FORMAT COLOR 3 OFF.
    *END OF PAGE
    END-OF-PAGE.
    ULINE.
    WRITE :'USER :',SY-UNAME,/,'DATE :', SY-DATUM, 85 'END OF PAGE:',
    SY-PAGNO.
    SKIP.
    *& Form SALES_ORD
    *& FIRST SECONDARY LIST FORM
    FORM SALES_ORD .
    SELECT KUNNR VBELN ERDAT ERNAM AUDAT INTO
    (VBAK-KUNNR, VBAK-VBELN, VBAK-ERDAT, VBAK-ERNAM, VBAK-AUDAT)
    FROM VBAK
    WHERE KUNNR = KNA1-KUNNR.
    WRITE:/1 SY-VLINE,
    VBAK-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
    16 SY-VLINE,
    VBAK-VBELN UNDER 'SALES ORDER NO.' HOTSPOT ON,
    40 SY-VLINE,
    VBAK-ERDAT UNDER 'DATE',
    60 SY-VLINE,
    VBAK-ERNAM UNDER 'CREATOR',
    85 SY-VLINE,
    VBAK-AUDAT UNDER 'DOC DATE',
    103 SY-VLINE.
    HIDE : VBAK-VBELN.
    ENDSELECT.
    ULINE.
    ENDFORM. " SALES_ORD
    *& Form ITEM_DET
    *& SECOND SECONDARY LIST FORM
    FORM ITEM_DET .
    SELECT VBELN POSNR KWMENG INTO
    (VBAP-VBELN, VBAP-POSNR, VBAP-KWMENG)
    FROM VBAP
    WHERE VBELN = VBAK-VBELN.
    WRITE : /1 SY-VLINE,
    VBAP-VBELN UNDER 'SALES ORDER NO.',
    40 SY-VLINE,
    VBAP-POSNR UNDER 'SALES ITEM NO.',
    60 SY-VLINE,
    VBAP-KWMENG UNDER 'ORDER QUANTITY',
    103 SY-VLINE.
    ENDSELECT.
    ULINE.
    ENDFORM. " ITEM_DET
    REPORT demo_list_at_pf.
    START-OF-SELECTION.
    WRITE 'Basic List, Press PF5, PF6, PF7, or PF8'.
    AT pf5.
    PERFORM out.
    AT pf6.
    PERFORM out.
    AT pf7.
    PERFORM out.
    AT pf8.
    PERFORM out.
    FORM out.
    WRITE: 'Secondary List by PF-Key Selection',
    / 'SY-LSIND =', sy-lsind,
    / 'SY-UCOMM =', sy-ucomm.
    ENDFORM.
    After executing the program, the system displays the basic list. The user can press the function keys F5 , F6 , F7 , and F8 to create secondary lists. If, for example, the 14th key the user presses is F6 , the output on the displayed secondary list looks as follows:
    Secondary List by PF-Key Selection
    SY-LSIND = 14
    SY-UCOMM = PF06
    Example for AT USER-COMMAND.
    REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
    START-OF-SELECTION.
    WRITE: 'Basic List',
    / 'SY-LSIND:', sy-lsind.
    TOP-OF-PAGE.
    WRITE 'Top-of-Page'.
    ULINE.
    TOP-OF-PAGE DURING LINE-SELECTION.
    CASE sy-pfkey.
    WHEN 'TEST'.
    WRITE 'Self-defined GUI for Function Codes'.
    ULINE.
    ENDCASE.
    AT LINE-SELECTION.
    SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
    PERFORM out.
    sy-lsind = sy-lsind - 1.
    AT USER-COMMAND.
    CASE sy-ucomm.
    WHEN 'FC1'.
    PERFORM out.
    WRITE / 'Button FUN 1 was pressed'.
    WHEN 'FC2'.
    PERFORM out.
    WRITE / 'Button FUN 2 was pressed'.
    WHEN 'FC3'.
    PERFORM out.
    WRITE / 'Button FUN 3 was pressed'.
    WHEN 'FC4'.
    PERFORM out.
    WRITE / 'Button FUN 4 was pressed'.
    WHEN 'FC5'.
    PERFORM out.
    WRITE / 'Button FUN 5 was pressed'.
    ENDCASE.
    sy-lsind = sy-lsind - 1.
    FORM out.
    WRITE: 'Secondary List',
    / 'SY-LSIND:', sy-lsind,
    / 'SY-PFKEY:', sy-pfkey.
    ENDFORM.
    When you run the program, the system displays the following basic list with a the page header defined in the program:
    You can trigger the AT LINE-SELECTION event by double-clicking a line. The system sets the status TEST and deactivates the function code PICK. The status TEST contains function codes FC1 to FC5. These are assigned to pushbuttons in the application toolbar. The page header of the detail list depends on the status.
    Here, double-clicking a line no longer triggers an event. However, there is now an application toolbar containing five user-defined pushbuttons. You can use these to trigger the AT USER-COMMAND event. The CASE statement contains a different reaction for each pushbutton.
    For each interactive event, the system decreases the SY-LSIND system field by one, thus canceling out the automatic increase. All detail lists now have the same level as the basic list and thus overwrite it. While the detail list is being created, SY-LSIND still has the value 1.
    Regards
    Anji

  • For getting purchase order details what are the inputs and outputs

    I need to display purchase order details in EP portal by using integration EP, XI and R/3.
    I dont know what are the Inputs and what are the Outputs.
    Reward points for helpers.
    Cheers,
    Preethika

    Hi Preethika,
    for displaying PO use BAPI : BAPI_PO_GETDETAIL
    Its input is PO number
    Its output are tables PO_HEADER_TEXTS - for PO header data
    PO_ITEMS - for PO line items
    Thanks,
    Rajeev Gupta

  • How to report Invoice details and also the related Purchase order details

    Hello,
    Any suggestions on How to Report both Invoice details and the related Purchase Order details.
    Ex:
    INvoice Line items Amounts /Qty
    PO Line Items Amounts /Qty
    Thanks in advance
    Jagadish

    Hello,
    Any suggestions on How to Report both Invoice details and the related Purchase Order details.
    Ex:
    INvoice Line items Amounts /Qty
    PO Line Items Amounts /Qty
    Thanks in advance
    Jagadish

  • Help with purchase order detail

    Hello Experts,
    I am currently trying to get information on a purchase order, but not having any luck.  I need to find the PO Number, and PO Approval Date.  I cannot find either of these.  I have tried using BBP_PD_PO_GETDETAIL, but have no luck with this.  here is what I have:
    move w_result-sc_guid TO lv_guid.
            CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
             EXPORTING
               I_GUID                           = lv_guid
               I_OBJECT_ID                      = w_zwkflw_rep-object_id
               I_WITH_ITEMDATA                  = 'X'
               I_READ_FROM_ARCHIVE              = 'X'
             IMPORTING
               E_HEADER                         = ls_e_header
             TABLES
               E_ITEM                           = lt_e_item
    All I have available is shopping cart number.  Can anyone assist please?  Thank you.

    hi,
    try below steps to retrieve purchase order details from a shopping cart.
    get the purchase order GUID in ET_HEADER_REL parameter of BBP_PD_SC_GETDETAIL fm using the shopping cart number or GUID.
    then to get the purchase order details, use BBP_PD_PO_GETDETAIL importing I_GUID = purchase order GUID from ET_HEADER_REL.
    regards.

  • AP Invoices' Purchase Order Details

    Hi All,
    Are there any SAP standard reports that can show AP invoices' Purchase Order details such as whether there's a GR being done or not?
    Thanks,
    CW

    Hi,
    Try ME2L, ME2M, ME2N. Change the "scope of list" for different format.
    Cheers !

  • Creating confirmation using Purchase Order details

    Hi all,
    I am trying to create a confirmation for a Purchase Order in SRM Version 5,ECC 5.0(ECS Scenario).
    In my program, I first get all the Purchase Orders using the function module, BBP_PD_PO_GETDETAIL. Then I want to confirm this Purchase Order in the back end and front end using some funtion module.
    I have tried with the function module, BP_PD_CONF_CREATE, to create the confirmation.For this function module, I have passed the header details such as Object_id,process_type,log_system_FI ,be_log_system,
    be_object_type , be_refobj_type.
    I have also passed the Item,partner,account,org,longtext,pridoc and tax details of the PO as input to this function module.
    On execution of this function module, I get the Confirmation number, but the confirmation does not get created in the front end as well as backend. I also tried with the following function modules,
    BAPI_CONFEC_CREATE - For this function module I first tried passing the PO details as above as input but it didnt work. Then I tried passing the output of the Function module BP_PD_CONF_CREATE which had the Confirmation number, as input to BAPI_CONFEC_CREATE. It gives an error 'There has been a unexpected exception'.
    I also used the following function modules,
    BBP_PD_CONF_UPDATE
    BBP_GOODS_MVT_CREATE
    BBP_PROCDOC_CREATE
    But none of them works....
    Please help me if anyone has dealed with such a scenario.
    Thanks,
    Sowmiya M

    Hello,
    I am also new in SCM ICH, but may be there is no transportation line defined for this material.
    Call transaction /SAPAPO/SCC_TL1 in your ICH-System or select menu Inventory Collaboration Hub - Master Data - Transportation Lane.
    Create a product-specific transportation line.
    I am not sure, if it's neccessary to transfer the PO once more before confirming.

  • BAPI to get the Purchase Order Details

    Hi Folks,
    Which BAPI is used for retriving the details of a particulare Purchase Order? Please also mention how the same is used? Sample code will be helpful.
    Thanks
    Siddarth

    Hi Sid,
    Try this out...
    Report ZBapi .
    data: po_items type table of bapiekpo with header line.
    parameters: p_ebeln type ekko-ebeln.
    call function 'BAPI_PO_GETDETAIL'
      exporting
        purchaseorder                    = p_ebeln
      ITEMS                            = 'X'
      ACCOUNT_ASSIGNMENT               = ' '
      SCHEDULES                        = ' '
      HISTORY                          = ' '
      ITEM_TEXTS                       = ' '
      HEADER_TEXTS                     = ' '
      SERVICES                         = ' '
      CONFIRMATIONS                    = ' '
      SERVICE_TEXTS                    = ' '
      EXTENSIONS                       = ' '
    IMPORTING
      PO_HEADER                        =
      PO_ADDRESS                       =
    tables
      PO_HEADER_TEXTS                  =
       po_items                         = po_items
      PO_ITEM_ACCOUNT_ASSIGNMENT       =
      PO_ITEM_SCHEDULES                =
      PO_ITEM_CONFIRMATIONS            =
      PO_ITEM_TEXTS                    =
      PO_ITEM_HISTORY                  =
      PO_ITEM_HISTORY_TOTALS           =
      PO_ITEM_LIMITS                   =
      PO_ITEM_CONTRACT_LIMITS          =
      PO_ITEM_SERVICES                 =
      PO_ITEM_SRV_ACCASS_VALUES        =
      RETURN                           =
      PO_SERVICES_TEXTS                =
      EXTENSIONOUT                     =
    check sy-subrc  = 0.
    loop at po_items.
      write:/ po_items.
    endloop.
    <b>Reward Points if Useful</b>
    Regards
    Gokul

  • Where can I find out what the rules are for extracting Purchase Orders?

    Hi all,
    Relating to BI 7.0, ECC 4.6
    From a business perspective we are looking to be able to identify ALL the rules/criteria for Purchase Orders when they are extracted in ECC to BI.
    The datasource is 2LIS_02_ITM
    For example deleted PO items are not extracted to BI, nor where LOEKZ (Memory flag =X).
    In brief there is criteria that identifies which PO items are extracted.
    Where can I find out what ALL of these conditions for extraction are?
    I have looked in the extractor program MCEX_BW_LO_API and there is a class for filling the a table but I cant see any criteria here to how it decides WHAT to extract i.e where in the code the criteria is set.
    Also this of course could be set in customizing somewhere?
    Anybody know where?
    Thanks in advance.
    Steve Jones

    you can also check the start routines in BI for 2LIS ITM, there are a few exclusions and PO deletions there.
    you can find more information in SAP Notes.
    reagrds
    Ramesh

  • Extracting Purchase Order condition data

    Hi All,
    I have requirement where as i need to pull the purchase order condition data, but i haven't found any datasources regarding that, can somebody guide me how to pull that data to BW.
    thanks
    Neel

    Hi Neel,
    Create view of EKKO ( Purchasing header ) and KONV  (Conditions (Transaction Data)) and link it on EKKO-KNUMV to KONV-KNUMV.
    Create Generic Extractor based on the View.
    Hope that helps.
    Regards
    Mr Kapadia
    Assigning points is the way to say thanks in SDN.

  • EXIT_SAPLEBNF_005 (ZXM06U51) - getting the current purchase order details

    I have a requirement to determine release agent in part based on who owns the budget. That's easy. The hard part is getting the current data (at least so far)...
    I have tried using the MEPO_DOC_* function moduless. They didn't even give me the amount (at least not in all situations).
    I have now tried using the class based interface (IF_PURCHASE_ORDER_MM) - which seems OK at first but has an unwanted side effect: it interferes heavily with the purchase order transaction.
    Currently I am struggling to get rid of the side effects, but there must be an easier way than the path I have started on. I've been looking for some sort of manager class which could be used to retrieve the interface reference without having to initialize it myself via CL_PO_HEADER_HANDLE_MM but haven't found one yet.
    Part of my problem is that the user exit is called twice, so if I buffer the handle transaction ME22N doesn't initialize correctly (initially appears in display mode becuase the first call for some reason is stating that it's transaction ME23N in change mode). If I don't buffer the handle, the switch to change mode doesn't work properly in ME23N. Thank you SAP!
    I've been struggling with this for more than a day now, so it's time to ask the experts to see if anyone can help me get out of this [Catch 22|http://en.wikipedia.org/wiki/Catch-22_%28logic%29|Catch 22 explanation in Wikipedia]-like situation
    FORM po_get_interface_handle
         USING value(pe_purchase_order) TYPE ekko-ebeln
         CHANGING po_purchase_order TYPE REF TO if_purchase_order_mm.
    * 2011-04-19 EX_KKILHAVN (Kjetil Kilhavn, Blue Consulting)
    * Buffer handles to avoid problems with multiple initializations
      TYPES: BEGIN OF buffer_po_handle,
               ebeln     TYPE ekko-ebeln,
               po_handle TYPE REF TO cl_po_header_handle_mm,
             END OF buffer_po_handle.
      STATICS: lt_po_handles_buffer TYPE SORTED TABLE OF buffer_po_handle
                                      WITH UNIQUE KEY ebeln.
      DATA: ls_po_handle         LIKE LINE OF lt_po_handles_buffer[],
            le_transaction_type  TYPE t160-trtyp,
            le_activity_category TYPE char01,
            le_transaction_code  TYPE syst-tcode,
            ls_document          TYPE mepo_document,
            le_result            TYPE mmpur_bool.
      READ TABLE lt_po_handles_buffer[]
           WITH TABLE KEY ebeln = pe_purchase_order
           INTO ls_po_handle.
      IF sy-subrc <> 0.
        ls_po_handle-ebeln = pe_purchase_order.
        CREATE OBJECT ls_po_handle-po_handle
          EXPORTING
            im_po_number = pe_purchase_order
          EXCEPTIONS
            failure      = 1.
        IF sy-subrc               =  0           AND
           ls_po_handle-po_handle IS NOT INITIAL.
          "Check transaction type must handle code being invoked from change transactions
          "and from other transactions (e.g. Business Workflow agent determination)
          CALL METHOD ls_po_handle-po_handle->get_transaction_state
            IMPORTING
              ex_trtyp = le_transaction_type
              ex_aktyp = le_activity_category
              ex_tcode = le_transaction_code.
          IF le_transaction_type IS INITIAL.
            le_transaction_type = 'A'.
          ENDIF.
          IF le_transaction_code IS INITIAL.
            le_transaction_code = 'ME23N'.
          ENDIF.
          ls_po_handle-po_handle->set_state( im_state = cl_po_header_handle_mm=>c_available ).
          MOVE: mmpur_po_process    TO ls_document-process,
               le_transaction_type  TO ls_document-trtyp,
               pe_purchase_order    TO ls_document-doc_key(10),
               mmpur_initiator_call TO ls_document-initiator-initiator.
          ls_po_handle-po_handle->po_initialize( im_document = ls_document ).
          CALL METHOD ls_po_handle-po_handle->po_read
            EXPORTING
              im_tcode     = le_transaction_code
              im_trtyp     = ls_document-trtyp
              im_aktyp     = le_activity_category "ls_document-trtyp
              im_po_number = pe_purchase_order
              im_document  = ls_document
            IMPORTING
              ex_result    = le_result.
          IF le_result = mmpur_yes.
            READ TABLE lt_po_handles_buffer[]
                 WITH TABLE KEY ebeln = ls_po_handle-ebeln
                 TRANSPORTING NO FIELDS.
            INSERT ls_po_handle INTO lt_po_handles_buffer[] INDEX sy-tabix.
          ENDIF.
        ENDIF.
      ENDIF.
      TRY.
          po_purchase_order = ls_po_handle-po_handle.
        CATCH cx_sy_move_cast_error.
      ENDTRY.
    ENDFORM.                    "po_get_interface_handle

    Hi ravi,
    can you please tell me the Tcode  for creation of purchaze order in SRM.
    thank you
    sunny.

  • Purchase order details

    Hi All ,
    Is there any Function module that gives me all the details of the PO ? which is available in the transaction ??
    Thanks .

    Hi,
    Please try FM 'BAPI_PO_GETDETAIL'
    In this as per ur requirement u can give 'X'  in exporting and correspoding table.
    CALL FUNCTION 'BAPI_PO_GETDETAIL'
      EXPORTING
        PURCHASEORDER                    =
      ITEMS                            = 'X'
      ACCOUNT_ASSIGNMENT               = ' '
      SCHEDULES                        = ' '
      HISTORY                          = ' '
      ITEM_TEXTS                       = ' '
      HEADER_TEXTS                     = ' '
      SERVICES                         = ' '
      CONFIRMATIONS                    = ' '
      SERVICE_TEXTS                    = ' '
      EXTENSIONS                       = ' '
    IMPORTING
      PO_HEADER                        =
      PO_ADDRESS                       =
    TABLES
      PO_HEADER_TEXTS                  =
      PO_ITEMS                         =
      PO_ITEM_ACCOUNT_ASSIGNMENT       =
      PO_ITEM_SCHEDULES                =
      PO_ITEM_CONFIRMATIONS            =
      PO_ITEM_TEXTS                    =
      PO_ITEM_HISTORY                  =
      PO_ITEM_HISTORY_TOTALS           =
      PO_ITEM_LIMITS                   =
      PO_ITEM_CONTRACT_LIMITS          =
      PO_ITEM_SERVICES                 =
      PO_ITEM_SRV_ACCASS_VALUES        =
      RETURN                           =
      PO_SERVICES_TEXTS                =
      EXTENSIONOU

Maybe you are looking for