F-02 Create a financial voucher BAPI

Source: Internet
Author: User

**1. Get header parameters, Documentheader**2. Project parameters ACCOUNTGL= LT_ACGL"g/L Account ItemAccountreceivable = Lt_acar"Customer ItemAccountpayable = Lt_acap"Vendor ItemCurrencyamount = Lt_aamt"Currency Amount*return Parametersreturn=Lt_retn.**3. BAPI Voucher posting,* * Credential data Check-prevent jumping clear:ls_retn,lt_retn[]. Call FUNCTION'Bapi_acc_document_check'Exporting Documentheader=Ls_ache TABLES ACCOUNTGL=LT_ACGL accountreceivable=Lt_acar accountpayable=Lt_acapreturn=Lt_retn. READ TABLE lt_retn into ls_retn with KEY type='E'. IF SY-SUBRC =0. LOOP at Lt_retn to ls_retn WHERE type= gc_e OR type =gc_a. CHECK LS_RETN-id <>'RW'. MESSAGE ID Ls_retn-ID TYPE ls_retn-Type number LS_RETN-Number with Ls_retn-MESSAGE_V1 Ls_retn-MESSAGE_V2 Ls_retn-Message_v3 Ls_retn-message_v4 into Gs_out-message.      EXIT. Endloop.      ELSE.      Clear:ls_retn,lt_retn[]. Call FUNCTION'Bapi_acc_document_post'Exporting Documentheader=Ls_ache Importing Obj_key=Lv_key TABLES ACCOUNTGL= LT_ACGL"g/L Account ItemAccountreceivable = Lt_acar"Customer ItemAccountpayable = Lt_acap"Vendor ItemCurrencyamount = Lt_aamt"Currency Amount          return=Lt_retn. READ TABLE lt_retn into ls_retn with KEY type=E. IF SY-SUBRC EQ0. Call FUNCTION'Bapi_transaction_commit'. MESSAGE=Processing Success BELNR= lv_key+0(Ten). Fetch the return field.    ELSE. Call FUNCTION'Bapi_transaction_rollback'. MESSAGE=Handling Error BELNR=Crawl error messages. ENDIF. ENDIF. BAPI_ACC_DOCUMENT_POSTFG:ACC9 Accounting:bapis Shorttext Accounting postingimport-input Parameters Short text documentheader like BAPIACHE09 headercustomercpd like BAPIACPA09 one-Time customercontractheader like Bapiaccahd 、、、 tables:accountgl like BAPIACGL09 G/L account itemaccountreceivable like BAPIACAR09 Customer itemaccountpayable like BAPIACAP09 Vendor I Temaccounttax like BAPIACTX09, itemcurrencyamount like BAPIACCR09 Currency itemscriteria like B APIACKEC9 CO-PA account Assignment Characteristicsvaluefield like BAPIACKEV9 CO-PA Account Assignment Value FieldsEXTENSION1 like BAPIACEXTC Container for 'Customer Exit'parameterreturn like BAPIRET2 Return parameterpaymentcard like BAPIACPC09 Payment Card Informationc    Ontractitem like bapiaccait Additional contract Accounts recieviable and payable Document line ItemEXTENSION2 Like Bapiparex Reference Structure forBAPI Parameters extensionin/extensionoutrealestate like BAPIACRE09 Real Estate account assignment DATAACCOUNTWT like BAPIACWT09 Withholding tax Information forFI interfacegs_out-Sqdno E_awtyp='Bkpff'. E_awkey='$'. Call FUNCTION'Own_logical_system_get'Importing Own_logical_system=Log_sys EXCEPTIONS own_logical_system_not_defined=1OTHERS=2. IF Sy-SUBRC is INITIAL. E_awsys=Log_sys. ENDIF. Logical_system_get. Log_sys Cdrclnt710document_header-bus_act Rfbu*Obj_type, Obj_key und Usernamegs_aw-Awtyp Bkpffgs_aw-awref $GS _bapi_acchd-username C_XIANGC

Voucher reversal:

bapi_acc_document_rev_checkfunction Module      BAPI_ACC_DOCUMENT_REV_POSTFG:ACC9      accounting:bapisshort text   accounting:post reversal5001- 5004 yj50lcv5000000yj51 5101 5102 lcv5100000

F-02 Create a financial voucher BAPI

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.