Application Development and Automation 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: 
Read only

BAPI for FB50

Former Member
0 Likes
4,865

Hi Experts,

Is there any BAPI for FB50. BDC is giving me error. When i enter more than 7 items through SHDB recording any i click on insert button, enter the record and then save, it gives me error Specify account number because when i click on insert button, the business area gets applied to all line items, then i have to manually clear the business area. Then only it gets saved. Please suggect me if there is any BAPI for FB50.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,894

Hi

try this BAPI :BAPI_ACC_GL_POSTING_POST

Regards

Shiva

27 REPLIES 27
Read only

Former Member
0 Likes
3,895

Hi

try this BAPI :BAPI_ACC_GL_POSTING_POST

Regards

Shiva

Read only

0 Likes
3,894

I had previously referred to this BAPI but was not able to pass the parameters. Can you tell me how do i pass the parameters.

At header level i need to pass Doc. Date, Reference, Doc. Header text, Document Type

At item level i need to pass G/L Account, D/C, Amount in Doc. curr, Tax code, Company code and WBS element.

Thanks in advance.

Read only

0 Likes
3,894

Hi Priti,

Go through the Documentation of the BAPI you will get the clear Idea How to proceed.

If that is not understood, please feel free to reply.

Regards

Read only

0 Likes
3,894

Hi Vikas,

As i have already mentioned the fields which i want to upload, can u tell me which BAPI to use

BAPI_ACC_GL_POSTING_POST or BAPI_ACC_DOCUMENT_POST and can u tell me the parameters i need to pass especially at the item level.

Read only

0 Likes
3,894

Hi Priti,

USE BAPI_ACC_DOCUMENT_POST

"At header level i need to pass Doc. Date, Reference, Doc. Header text, Document Type"

ALL These Fields are available in Structure DOCUMENTHEADER Import Parameter.

"At item level i need to pass G/L Account, D/C, Amount in Doc. curr, Tax code, Company code and WBS element."

To populate items fields you have to use Structure ACCOUNTGL and CURRENCYAMOUNT in Tables tab.

Please do remember to populate some mandatory fields like BUS_AREA etc. You will come to know about the mandatory fields by clicking on the structures in BAPI Documentation.

Regards.

Read only

0 Likes
3,894

But on execution it is giving me the following errors.

Num Message

609 Error in document: BKPFF $ DEVCLNT300

014 FI/CO interface: Line item entered several times

What values do i have to give in OBJ_TYPE and OBJ_KEY.

If i give value in OBJ_TYPE as 'BKPF' then it is giving me 5 errors which includes

609 Error in document: BKPF

Read only

0 Likes
3,894

Hi Priti,

Try This.

OBJ_TYP = BEBD.

OBJ_KEY = "Object Key should be any 10 digits".

In case the problem is not solved. Please revert with your code and flat file structure of one record.

Regards,

Vikas

Read only

0 Likes
3,894

Hi Vikas,

I am executing the FM directly through SE37 for test purpose. Now while checking, I have given OBJ_TYP = BEBD and OBJ_KEY = 1400000010. Now its giving me the following error.

609 Error in document: BEBD 1400000010

602 Required field OBJ_SYS was not transferred in parameter DOCUMENTHEADER

602 Required field BUS_ACT was not transferred in parameter DOCUMENTHEADER

Read only

0 Likes
3,894

Hi Priti,

Are you passing

OBJ_SYS

BUS_ACT to DOCUMENTHEADER properly. Hope you are not using inverted commas with these values.

If you miss a single parameter you will get Error609. Please check and as i said send the code and flat file to me.

Regards,

Vikas

Read only

0 Likes
3,894

See this Sample Code..


*&---------------------------------------------------------------------*
*& Report  ZBAPIACCDOCUMENTPOST1                                       *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  ZBAPIACCDOCUMENTPOST1                   .

*&---HEADER DECLARATION
DATA: HEADER TYPE BAPIACHE09. " HEADER DATA


*&----G/L ACCOUNT ITEM
DATA: ACCOUNTGL TYPE STANDARD TABLE OF BAPIACGL09.


*&----ACCOUNTS PAYABLE ITEMS

DATA: ACCOUNTPAYABLE TYPE STANDARD TABLE OF BAPIACAP09.
DATA: WA_ACCOUNTPAYABLE TYPE BAPIACAP09.

*&---CURRENCY ITEMS
DATA: CURRENCY_AMOUNT TYPE STANDARD TABLE OF BAPIACCR09.

*&----RETURN PARAMETER
DATA: RETURN TYPE STANDARD TABLE OF BAPIRET2 with header line.
**********************************************************************
*	WORK-AREA DECLARATION
**********************************************************************
*&----WORKAREA FOR G/L ACCOUNT ITEM
DATA: WA_ACCOUNTGL TYPE BAPIACGL09.

*&---WORKAREA FOR CURRENCY ITEMS
DATA: WA_CURRENCY_AMOUNT TYPE BAPIACCR09.
**********************************************************************
	INITIALIZATION.
**********************************************************************
HEADER-OBJ_TYPE = 'BEBD'.
HEADER-OBJ_KEY = '1000000050'.
HEADER-OBJ_SYS = 'B3TCLNT800'.
HEADER-HEADER_TXT = 'TEST HEADER'.
HEADER-USERNAME = 'DEVELOPER'.
HEADER-COMP_CODE = 'JKT1'.
HEADER-FISC_YEAR = '2008'.
HEADER-DOC_DATE = SY-DATUM.
HEADER-PSTNG_DATE = SY-DATUM.
HEADER-TRANS_DATE = SY-DATUM.
HEADER-DOC_TYPE = 'KR'.
HEADER-BUS_ACT = 'RMRP'.


*WA_ACCOUNTGL-ITEMNO_ACC = '0000000010'.
*WA_ACCOUNTGL-GL_ACCOUNT = '0000400200'.
*WA_ACCOUNTGL-ITEM_TEXT = 'SO_DOC'.
*WA_ACCOUNTGL-DE_CRE_IND = 'S'.
*wa_accountgl-costcenter = 'JK000'.
*WA_ACCOUNTGL-VENDOR_NO = 'A125'.
*WA_ACCOUNTGL-REF_KEY_3 = '31'.
*
*APPEND WA_ACCOUNTGL TO ACCOUNTGL.
*CLEAR WA_ACCOUNTGL.
*
*WA_ACCOUNTGL-ITEMNO_ACC = '0000000020'.
*WA_ACCOUNTGL-GL_ACCOUNT = '0000400200'.
*WA_ACCOUNTGL-ITEM_TEXT = 'SO_DOC'.
*WA_ACCOUNTGL-DE_CRE_IND = 'H'.
*wa_accountgl-costcenter = 'JK000'.
*WA_ACCOUNTGL-REF_KEY_3 = '40'.
*
*APPEND WA_ACCOUNTGL TO ACCOUNTGL.
*CLEAR WA_ACCOUNTGL.


WA_ACCOUNTPAYABLE-ITEMNO_ACC = '10'.
WA_ACCOUNTPAYABLE-VENDOR_NO = 'A125'.
WA_ACCOUNTPAYABLE-REF_KEY_3 = '31'.
WA_ACCOUNTPAYABLE-BUS_AREA = 'JKTD'.

APPEND WA_ACCOUNTPAYABLE TO ACCOUNTPAYABLE.
CLEAR WA_ACCOUNTPAYABLE.


WA_ACCOUNTPAYABLE-ITEMNO_ACC = '20'.
WA_ACCOUNTPAYABLE-GL_ACCOUNT = '400200'.
WA_ACCOUNTPAYABLE-REF_KEY_3 = '40'.
WA_ACCOUNTPAYABLE-BUS_AREA = 'JKTD'.

APPEND WA_ACCOUNTPAYABLE TO ACCOUNTPAYABLE.
CLEAR WA_ACCOUNTPAYABLE.



WA_CURRENCY_AMOUNT-ITEMNO_ACC = '0000000010'.
WA_CURRENCY_AMOUNT-AMT_DOCCUR = '500'.
WA_CURRENCY_AMOUNT-CURRENCY = 'INR'.
APPEND WA_CURRENCY_AMOUNT TO CURRENCY_AMOUNT.
CLEAR WA_CURRENCY_AMOUNT.

WA_CURRENCY_AMOUNT-ITEMNO_ACC = '0000000020'.
WA_CURRENCY_AMOUNT-AMT_DOCCUR = '-500'.
WA_CURRENCY_AMOUNT-CURRENCY = 'INR'.
APPEND WA_CURRENCY_AMOUNT TO CURRENCY_AMOUNT.
CLEAR WA_CURRENCY_AMOUNT.

**************************************************************
*	START-OF-SELECTION
**************************************************************

START-OF-SELECTION.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
  EXPORTING
    DOCUMENTHEADER          = HEADER
*   CUSTOMERCPD             =
*   CONTRACTHEADER          =
* IMPORTING
*   OBJ_TYPE                =
*   OBJ_KEY                 =
*   OBJ_SYS                 =
  TABLES
*   ACCOUNTGL               = ACCOUNTGL
*   ACCOUNTRECEIVABLE       =
   ACCOUNTPAYABLE          = ACCOUNTPAYABLE
*   ACCOUNTTAX              =
    CURRENCYAMOUNT          = CURRENCY_AMOUNT
*   CRITERIA                =
*   VALUEFIELD              =
*   EXTENSION1              =
    RETURN                  = RETURN
*   PAYMENTCARD             =
*   CONTRACTITEM            =
*   EXTENSION2              =
*   REALESTATE              =
          .


IF return-type EQ 'S'.

COMMIT WORK.
*CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
** EXPORTING
**   WAIT          =
* IMPORTING
*   RETURN        = RETURN
*          .
WRITE:/ RETURN-TYPE.
write:/ return-message.

ELSE.
WRITE:/ RETURN-TYPE.
write:/ return-message.

ENDIF.

Code Formatted by: Alvaro Tejada Galindo on Dec 26, 2008 11:09 AM

Read only

0 Likes
3,894

Thanks a lot Vikes. Its working

Read only

0 Likes
3,894

Great.

ALL THE BEST.

Vikas.

Read only

0 Likes
3,894

Hi,

how do i get the document no. generated by this BAPI??

Read only

0 Likes
3,894

Hi Priti,

This BAPI is used for posting FI Documents for Certain Transaction's like FB50, F-02 etc..

The Document No. gets generated internally, to see that you have to refer the DBTAB which is getting updated by this BAPI...

Vikas

Read only

0 Likes
3,894

Hi Vikas,

I know that i will need to refer the dbtab. but is there any other way out. Or if i need to refer the dbtab i.e. BKPF or BSEG, then what are the parameters i will need to pass for the same

Read only

0 Likes
3,894

Hi

The return_tab ( there is table in the bapi called return_tab) will contain the value of the document that has been created once the BAPI is executed.

reg

Ramya

Read only

0 Likes
3,894

As Ramaya Said, You must have passed RETURN table.

Either PUT a break point on RETURN table and debug or Simply put a loop and write down the return table. You will get the desired result.

Vikas

Read only

0 Likes
3,894

I am not getting it in return tab also.

This is the run time data i get in return table.

TYPE S

ID RW

NUMBER 605

MESSAGE Document posted successfully: BEBD 1000000050 DEVCLNT300

LOG_NO

LOG_MSG_NO 000000

MESSAGE_V1 BEBD

MESSAGE_V2 1000000050

MESSAGE_V3 DEVCLNT300

MESSAGE_V4

PARAMETER

ROW 0

FIELD

SYSTEM DEVCLNT300

Read only

0 Likes
3,894

Hi

MESSAGE_V2 = 1000000050

the above is the document . please check it.

hope ur problem is resolved.

reg

Ramya

Read only

0 Likes
3,894

Hi Priti,

HEADER-OBJ_KEY = '1000000050' is the 10 digit Docu Number you are looking for.

Message_V2 = 1000000050.

Regards

Vikas

Read only

0 Likes
3,894

'1000000050' is the value which i am passing in HEADER-OBJ_KEY . The document no. generated goes in BKPF & BSEG. and it is in the field BELNR, its value is 1000000207. Now this no. does not come in return tab.

Read only

0 Likes
3,894

I am using the same BAPI with tax amount also. The document gets posted but when i goto FB03 to display the document and click on tax button, it shows me tax amount as 0 instead of the tax amount. In the internal table CURRENCY_AMOUNT passed to the BAPI, i am passing the values in the fields : AMT_DOCCUR, TAX_AMT, AMT_BASE. Yet it does not show the value during the display. Do i need to pass any other parameters ?

Any soln.

Read only

Former Member
0 Likes
3,894

hi,

plz use : BAPI_ACC_DOCUMENT_POST

BAPI_ACC_GL_POSTING_POST

also refer:

regards

rahul

Read only

Former Member
0 Likes
3,894

Hi,

Goto Se37 and Type BAPI_ACC* then press f4 Key you will get list of BAPI's for GL Posting choose as per your requirement.

Vikas

Read only

Former Member
0 Likes
3,894

HI

check

BAPI_ACC_DOCUMENT_CHECK

regards,

Ramya

Read only

Former Member
0 Likes
3,894

Hi,

Is it possible to get the document no. generated by this BAPI???

Read only

Former Member
0 Likes
3,894

We are posting vendor invoice with tax. System will calculate the tax automatically when we will give the tick on the field "calculate tax" on the t. code FB60 OR F-43. we have used the BAPI BAPI_ACC_DOCUMENT_POST. In that BAPI we have used AccountGL, CurrencyAmount, Acccount Payable. In that bapi we are not getting field calculate tax.

Secondly we have tried to fill internal table "Account Tax" for posting the tax amount but it gives error - Line item entered Several Times. So we have removed the Internal table and we tried to post the document with tax code field in AccountGL and AccountPayable. Document gets posted by the system but wiithout calculating tax line item.

Please suggest for a solution.

Edited by: priti suryawanshi on Aug 28, 2009 7:05 AM