Skip to Content

how to create and RFC

hi,

i am trying to create a purchase order and i need to create a custom made RFC, ZBAPI_PO_CREATE, so can some one help me out with the procedure and code to create the Z object.

kalyan.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Sep 25, 2007 at 03:59 AM

    Kalyan,

    I believe that you want to create the Z RFC function to include the BAPI_PO_CREATE & BAPI_TRANSACTION_COMMIT.

    1. Create the import export changing and tables incl exceptions definition as BAPI_PO_CREATE.

    2. Make this FM as RFC

    3. Call Function BAPI_PO_CREATE

    4. call function BAPI_TRANSACTION_COMMIT.

    Thanks.

    Srini

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 25, 2007 at 04:09 AM
    Add comment
    10|10000 characters needed characters exceeded

    • hey kumar,

      heres the code that i have used, but i am getting error messges when i execute, please let me know if u could help.

      FUNCTION ZBAPI_PO_CREATE.

      *"----


      ""Local interface:

      *"----


      DATA bapi_po_schedules LIKE bapieket OCCURS 0 WITH HEADER LINE.

      IF bypass_bapi NE ''.

      CALL FUNCTION 'RANDOM_I4'

      EXPORTING

      rnd_min = 0

      rnd_max = 1000000000

      IMPORTING

      rnd_value = purchaseorder.

      ELSE.

      LOOP AT po_items.

      MOVE-CORRESPONDING po_items TO bapi_po_schedules.

      ENDLOOP.

      CALL FUNCTION 'BAPI_PO_CREATE'

      EXPORTING

      po_header = po_header

      • PO_HEADER_ADD_DATA =

      • HEADER_ADD_DATA_RELEVANT =

      • PO_ADDRESS =

      • SKIP_ITEMS_WITH_ERROR = 'X'

      • ITEM_ADD_DATA_RELEVANT =

      • HEADER_TECH_FIELDS =

      IMPORTING

      purchaseorder = purchaseorder

      TABLES

      po_items = po_items

      • PO_ITEM_ADD_DATA =

      po_item_schedules = bapi_po_schedules.

      • PO_ITEM_ACCOUNT_ASSIGNMENT =

      • PO_ITEM_TEXT =

      • RETURN =

      • PO_LIMITS =

      • PO_CONTRACT_LIMITS =

      • PO_SERVICES =

      • PO_SRV_ACCASS_VALUES =

      • PO_SERVICES_TEXT =

      • PO_BUSINESS_PARTNER =

      • EXTENSIONIN =

      • POADDRDELIVERY =

      COMMIT WORK.

      ENDIF.

      ENDFUNCTION.