Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI to update FB01

Former Member
0 Kudos
933

Hi,

Is there any BAPI to post documnets into FB01?Also plz let me know the mandatory fields to be given to the BAPI.

Thanks,

Rakesh.

3 REPLIES 3

Former Member
0 Kudos
136

Hi,

try these:

BAPI_ACC_GL_POSTING_POST

BAPI_ACC_BILLING_POST

BAPI_ACC_INVOICE_RECEIPT_POST

Regards

Former Member
0 Kudos
136

• BAPI_ACC_GL_POSTING_POST

Function modules involved in updating FI

FI_DOCUMENT_PROCESS

DOCUMENT_POST

Pattern in which function modules are called

The function module fi_document_process is called 4 times and finally document_post is called once which updates the tables.

Step 1. Call FI_DOCUMENT_PROCESS

Import Parameters

I_GJAHR LIKE TRWCA- YEAR

I_PROCESS LIKE TRWPR-PROCESS

I_EVENT LIKE TRWPR-EVENT

Tables

T_BKPF LIKE BKPF

T_BSEG LIKE BSEG

T_BSEGZ LIKE BSEGZ

T_ACCIT_EXT LIKE ACCIT_EXTENSION

Values to populate import parameters

i_gjahr = '2007' “Fiscal year from the screen

i_process = 'BELEG' “Constant, can be hard coded

i_event = 'CRBSEGZ' “Constant, can be hard coded

xbkpf-bukrs '1000'. “ Company code from the screen

xbkpf-belnr '$1'. “ constant , can be hard coded

xbkpf-gjahr '2007'. “ Fiscal Year , from the screen

xbkpf-blart 'DZ'. “ Can be obtained from the invoice document

xbkpf-bldat '20070116'. “ Document Date, from the screen

xbkpf-budat ’20070118'. “ Posting Date , from the screen

xbkpf-monat '01'. “ constant , can be hard coded

xbkpf-wwert '20070118'. “ posting Date

xbkpf-usnam 'SAPUSER'. “ user name

xbkpf-tcode 'FBZ1'. “ Constant, can be hard coded

xbkpf-waers 'EUR'. “ currency, from the screen

xbkpf-glvor 'RFBU'. “ constant can be hard coded

xbkpf-awtyp 'BKPF'. “ constant, can be hard coded

xbkpf-fikrs ’1000'. “ customer account number, from the screen

xbkpf-hwaer 'EUR'. “ Currency, from the screen

xbkpf-awsys 'ECCCLNT800'. „can be hard coded

xbseg Record 1

xbseg-bukrs '1000'. “ Company code from the screen

xbseg-belnr '$1' . “ constant , can be hard coded

xbseg-gjahr '2007'. „ Fiscal Year, from the screen

xbseg-buzei ’001'. “ constant , can be hard coded

xbseg-bschl '40'. “ constant , can be hard coded

xbseg-koart 'S'. “ constant , can be hard coded

xbseg-shkzg 'S' . “ constant , can be hard coded

xbseg-dmbtr '10'. „ Amount, from the screen

xbseg-wrbtr '10'. „ Amount, from the screen

xbseg-pswbt ’10'. „ Amount, from the screen

xbseg-pswsl 'EUR'. „ Currency, from the screen

xbseg-valut ’20070118'. “ Posting date, from the screen

xbseg-altkt '0000110100'.

xbseg-vorgn 'RFBU'. “ constant , can be hard coded

xbseg-fdlev 'B9'. “ constant , can be hard coded

xbseg-fdwbt '10'. „ Amount, from the screen

xbseg-fdtag '20070118'. “ Posting date, from the screen

xbseg-kokrs ’1000'. “ Customer account

xbseg-xkres 'X'. “ constant , can be hard coded

xbseg-xopvw 'X'. “ constant , can be hard coded

xbseg-hkont '0000110009'. “ Bank Account number

xbseg-xbilk 'X'. “ constant , can be hard coded

xbseg-fipos '9620'. “ constant , can be hard coded

xbseg-lokkt '0000110009'. “ Bank Account number

xbseg Record 2.

bseg-bukrs '1000'. “ Company code from the screen

bseg-belnr. '$1' “ constant , can be hard coded

bseg-gjahr. '2007' “ Fiscal year from the screen

bseg-augbl. '*' “ constant , can be hard coded

bseg-buzei'002'. “ constant , can be hard coded

bseg-bschl. '15' “ constant , can be hard coded

bseg-koart. 'D' “ constant , can be hard coded

bseg-shkzg. 'H' “ constant , can be hard coded

bseg-dmbtr. '10' “Amount, from the screen

bseg-wrbtr. '10' “Amount, from the screen

bseg-pswbt. '10' “Amount, from the screen

bseg-pswsl. 'EUR' “ currency, from the screen

bseg-altkt. '0000120100'

bseg-vorgn. 'RFBU' “ constant , can be hard coded

bseg-kokrs. '1000' “ Customer account number

bseg-xkres. 'X' “ constant , can be hard coded

bseg-xopvw. 'X' “ constant , can be hard coded

bseg-hkont. '0000140000'

bseg-xbilk. 'X' “ constant , can be hard coded

bseg-fipos. '9620' “ constant , can be hard coded

bseg-lokkt. '0000140000'

bseg-nebtr. '10' “ Amount, from the screen

bseg-xauto. 'X' “ constant , can be hard coded

bseg-xzahl. 'X' “ constant , can be hard coded

bseg-saknr. '0000140000'

bseg-zfbdt. '20070116'” Invoice document date

bseg-hwmet. 'A' “ constant , can be hard coded

bseg-kkber. '1000' “ Customer account number

bseg-agzei. '1' “ constant , can be hard coded

Step 2. Call FI_DOCUMENT_PROCESS

Import Parameters

I_GJAHR LIKE TRWCA- YEAR

I_PROCESS LIKE TRWPR-PROCESS

I_EVENT LIKE TRWPR-EVENT

Tables

T_BKPF LIKE BKPF

T_BSEG LIKE BSEG

T_BSEGZ LIKE BSEGZ

T_AUSZ3 LIKE AUSZ_CLR

T_AUSZ4 LIKE AUSZ_CLR_ASGMT

T_ACCIT_EXT LIKE ACCIT_EXTENSION

Values to populate import parameters

i_gjahr = '2007' “Fiscal year from the screen

i_process = 'BELEG' “Constant, can be hard coded

i_event = 'CLOSE' “Constant, can be hard coded

Table xausz3.

ausz3-agzei. '1' “Constant, can be hard coded

ausz3-waers. 'EUR' „ Currency from the screen

ausz3-bukrs. '1000' „ Company Code

ausz3-belnr. '1800000076' „ Document number from the screen

ausz3-gjahr. '2007' „ Fiscal Year

ausz3-buzei. '001'

ausz3-shkzg. 'S' “Constant, can be hard coded

ausz3-dmbtr. '10' “ Amount, from the screen

ausz3-wrbtr. '10' “ Amount, from the screen

ausz3-koart. 'D' “Constant, can be hard coded

Step 3. Call FI_DOCUMENT_PROCESS

Import Parameters

I_GJAHR LIKE TRWCA- YEAR

I_PROCESS LIKE TRWPR-PROCESS

I_EVENT LIKE TRWPR-EVENT

Tables

T_BKPF LIKE BKPF

T_BSEG LIKE BSEG

T_BSEGZ LIKE BSEGZ

T_AUSZ3 LIKE AUSZ_CLR

T_AUSZ4 LIKE AUSZ_CLR_ASGMT

T_ACCIT_EXT LIKE ACCIT_EXTENSION

Values to populate import parameters

i_gjahr = '2007' “Fiscal year from the screen

i_process = 'BELEG' “Constant, can be hard coded

i_event = 'PROJECT' “Constant, can be hard coded

I_AUGLV = 'EINGZAHL' “Constant, can be hard coded

Step 4. Call POST_DOCUMENT

Import Parameters

I_BKDF LIKE BKDF

I_UF05A LIKE UF05A

I_GENER LIKE T020-GENER

I_AUGLV LIKE T041A-AUGLV

Tables

T_AUSZ1 LIKE AUSZ1

T_AUSZ2 LIKE AUSZ2

T_AUSZ3 LIKE AUSZ_CLR

T_AUSZ4 LIKE AUSZ_CLR_ASGMT

T_BKP1 LIKE BKP1

T_BKPF LIKE BKPF

T_BSEC LIKE BSEC

T_BSED LIKE BSED

T_BSEG LIKE BSEG

T_BSET LIKE BSET

T_BSEU LIKE BSEU

Values to populate import parameters

Table xausz1

xausz1-belnr. '1800000076' „ Document number from the screen

xausz1-bukrs. '1000' „ Company code from the screen

xausz1-gjahr. '2007' „ Fiscal year from the screen

xausz1-buzei. '001' “ Constant , can be hard coded

Table xausz2

ausz2-bukrs. '1000' „ Company code from the screen

ausz2-aktio. 'A' “ Constant , can be hard coded

ausz2-augbl. '1400000054' „ Posted document number..from the function NUMBER_GET_NEXT(Dynamically generated unique number)

ausz2-augdt. '20070118' „ Posting Date from the screen

ausz2-auggj. '2007' „ Fiscal Year from the screen

Table xbkpf

First record of the internal table zbkpf has to be modified with the dynamically generated document number.

Xbkpf-belnr. ‘1400000054’

Table xbkp1

xbkp1-currj '2007' “ Fiscal year, from the screen

Table xbseg

Following fields in the table xbseg has to be modified before passing to this function module.

Record 1

TO wa_bseg1-belnr. '1400000054' “ Dynamically generated number

TO wa_bseg1-zuonr. '20070116' “ Document Date from the screen

Record 2

bseg1-belnr. '1400000054' „ Dynamically generated number

bseg1-augdt. '20070118' „ Posting date from the screen

bseg1-augcp. '20070118' „ Posting date from the screen

bseg1-augbl. '1400000054' „ Dynamically generated number

bseg1-zuonr. '14000000542007' „ Concatenating dynamically generated number and fiscal year

bseg1-kunnr. '1000' “ Customer number from the screen

Table Xbseu

Record 1

bseu-waers 'EUR' “ Currency from the screen

Record 2

bseu-waers. 'EUR' “ Currency from the screen

bseu-xzver. 'X' “ Constant Hard coded

Step 5. Call FI_DOCUMENT_PROCESS

Import parameters

I_GJAHR LIKE TRWCA-TOYEAR

I_PROCESS LIKE TRWPR-PROCESS

I_EVENT LIKE TRWPR-EVENT

I_AWTYP LIKE ACCHD-AWTYP

I_AWREF LIKE ACCHD-AWREF

I_AWORG LIKE ACCHD-AWORG

I_AWSYS LIKE ACCHD-AWSYS

Tables

T_BKPF LIKE BKPF

Values to populate import parameters

i_gjahr = '2007' “ Fiscal Year from the screen

i_process = 'BELEG' “ Constant

i_event = 'POST' “ Constant

i_awtyp = 'BKPF' “ Constant

i_awref = '1400000054'”Dynamically generated posting doc number

i_aworg = '10002007' “ Concatenate comp code and Fiscal Year

i_awsys = 'ECCCLNT800'” Constant.

Regards,

Rusidar S

former_member235056
Active Contributor
0 Kudos
136

Hi,

Pls refer lin for list of all bapis in sap:

<a href="http://www.planetsap.com/LIST_ALL_BAPIs.htm">http://www.planetsap.com/LIST_ALL_BAPIs.htm</a>

Pls reward helpful points.

Regards,

Ameet