Skip to Content

posting_interface_document

can i get example of sample program with this fm.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Posted on Aug 21, 2007 at 08:46 PM

    can i also get a sample program of bapi_acc_document_post

    Add comment
    10|10000 characters needed characters exceeded

    • [code]DATA:

      WA_CURRENCY TYPE BAPIACCR09,

      WA_CUSTOMER TYPE bapiacar09,

      WA_RETURN2 TYPE BAPIRET2,

      WA_RETURN3 TYPE BAPIRET2,

      WA_ACCOUNTGL TYPE BAPIACGL09.

      START-OF-SELECTION.

      WA_DOCUMENTHEADER-OBJ_TYPE = 'IDOC'.

      CONCATENATE SY-SYSID 'CLNT' SY-MANDT INTO WA_DOCUMENTHEADER-OBJ_SYS.

      WA_DOCUMENTHEADER-OBJ_KEY = '$'.

      WA_DOCUMENTHEADER-USERNAME = SY-UNAME.

      WA_DOCUMENTHEADER-COMP_CODE = 'GOVP'.

      WA_DOCUMENTHEADER-BUS_ACT = 'RFBU'.

      WA_DOCUMENTHEADER-HEADER_TXT = 'BAPI TEST'.

      WA_DOCUMENTHEADER-FISC_YEAR = '2007'.

      WA_DOCUMENTHEADER-DOC_DATE = SY-DATUM.

      WA_DOCUMENTHEADER-PSTNG_DATE = SY-DATUM.

      WA_DOCUMENTHEADER-FIS_PERIOD = ' '.

      WA_DOCUMENTHEADER-DOC_TYPE = 'DR'.

      WA_DOCUMENTHEADER-ref_doc_no = '1234512345'.

      *--One time customer data

      Data : wa_onetimecust type BAPIACPA09.

      wa_onetimecust-NAME = 'Mr'.

      wa_onetimecust-NAME_2 = 'OneTimeCustomer'.

      wa_onetimecust-CITY = 'Bangalore'.

      wa_onetimecust-COUNTRY = 'India'.

      *---end:One time customer data

      WA_CUSTOMER-itemno_acc = '1'.

      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

      EXPORTING

      input = '100000'

      IMPORTING

      output = WA_CUSTOMER-CUSTOMER.

      WA_CUSTOMER-comp_code = 'GOVP'.

      APPEND WA_CUSTOMER TO it_bapiacar09.

      CLEAR: WA_ACCOUNTGL.

      WA_ACCOUNTGL-ITEMNO_ACC = 2.

      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

      EXPORTING

      input = '6100.2600'

      IMPORTING

      output = WA_ACCOUNTGL-gl_account.

      WA_ACCOUNTGL-COMP_CODE = 'GOVP'.

      WA_ACCOUNTGL-ITEM_TEXT = 'TO CUSTOMER' .

      WA_ACCOUNTGL-COSTCENTER = 'DUMMY'.

      APPEND WA_ACCOUNTGL TO IT_ACCOUNTGL.

      CLEAR: WA_ACCOUNTGL.

      CLEAR: WA_CURRENCY.

      CLEAR: WA_CURRENCY.

      WA_CURRENCY-ITEMNO_ACC = 1.

      WA_CURRENCY-CURR_TYPE = '00'.

      WA_CURRENCY-CURRENCY = 'USD'.

      WA_CURRENCY-AMT_DOCCUR = 10.

      APPEND WA_CURRENCY TO IT_CURRENCY.

      CLEAR: WA_CURRENCY.

      WA_CURRENCY-ITEMNO_ACC = 2.

      WA_CURRENCY-CURR_TYPE = '00'.

      WA_CURRENCY-CURRENCY = 'USD'.

      WA_CURRENCY-AMT_DOCCUR = -10.

      APPEND WA_CURRENCY TO IT_CURRENCY.

      • --------------------------------------------------------

      • Post

      • --------------------------------------------------------

      CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

      EXPORTING

      DOCUMENTHEADER = WA_DOCUMENTHEADER

      CUSTOMERCPD = wa_onetimecust

      IMPORTING

      OBJ_TYPE = OBJ_TYPE

      OBJ_KEY = OBJ_KEY

      OBJ_SYS = OBJ_SYS

      TABLES

      ACCOUNTGL = IT_ACCOUNTGL

      accountreceivable = it_bapiacar09

      CURRENCYAMOUNT = IT_CURRENCY

      RETURN = IT_RETURN.

      LOOP AT IT_RETURN INTO WA_RETURN.

      WRITE : /1 WA_RETURN-MESSAGE.

      ENDLOOP.

      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

      EXPORTING

      WAIT = 'X'

      IMPORTING

      RETURN = WA_RETURN3. [/code]