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

Creating FI documents in a program

Former Member
0 Likes
3,052

Hello everyone,

I have a requirement to implement a SAP project for interest calculation, that instead of customer-based it is accounts receivable-based, which pretty much means that all records overdue in table bseg (in this case i use bsad and bsid) have to be included. I have already modified a lot of SAP standards to get the interest indicator to the places customer wants them (va41/42/fb02/fb03 etc.) and while creating the document, the info is written in a special z* table that i've created. So that works mostly, now... I have created a raport that has a selection screen at first and then displays all the data in a ALV grid. I have all the information in that raport that I need to create an invoice.. How do I do that? The invoice should not have a SD document number, but it should have XBLNR - document reference number. I probably have to use a function module, but I can't find the right one, spent the whole yesterday reading forums.... 'rv_invoice_create' I did try to use.. but not really what I'm looking for. Does anyone have any ideas what so ever?

Thanks!

15 REPLIES 15
Read only

Former Member
0 Likes
2,642

This message was moderated.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,642

Hello Marten,

Did you try a std. SAP trxn FINT? It calculates the int. on the overdue items & posts a FI doc.

May be you can search SDN for further details.

@ Amit: It's against forum rules to ask for award points.

BR,

Suhas

Edited by: Suhas Saha on Mar 20, 2009 9:14 AM

Read only

Former Member
0 Likes
2,642

Hi,

Thanks for the answers.

I managed to create an interest invoice with fint, but can't find the invoice anywhere??

Plus FINT creates the interest calculation based on customer information, not as I need it.

Thanks

Read only

mvoros
Active Contributor
0 Likes
2,642

Hi,

have you tried to use standard BAPI for FI posting BAPI_ACC_DOCUMENT_POST or more specific BAPIs like BAPI_ACC_GL_POSTING_POST or BAPI_ACC_BILLING_POST. Check documentation for these BAPI and there are plenty of posts related to these BAPIs on this forum as well.

Cheers

Read only

Former Member
0 Likes
2,642

I keep getting an error while using BAPI_ACC_DOCUMENT_POST

Incorrect entry in field OBJ_TYPE: BKPF <


doc_header-obj_type   = 'BKPF'.
doc_header-obj_key    = 'test1'.
doc_header-bus_act    = 'RFBU'.
doc_header-username   = sy-uname.
doc_header-doc_date   = ztodat.
doc_header-header_txt = 'test'.
doc_header-comp_code  = '0060'.
doc_header-doc_type   = 'DV'.
doc_header-ref_doc_no = '999999999999'.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
  EXPORTING
    DOCUMENTHEADER = doc_header
  IMPORTING
     OBJ_TYPE  = obj_type
     OBJ_KEY   = obj_key
     OBJ_SYS   = obj_sys
  TABLES
      CURRENCYAMOUNT = it_ca
      RETURN         = return.

Read only

ThomasZloch
Active Contributor
0 Likes
2,642

Try leaving obj_type and obj_key blank, and likely you will have to pass table "accountgl" and/or "accountreceivable" as well to the BAPI.

Thomas

Read only

Former Member
0 Likes
2,642

Can't make it work.

Is there a demo program for posting DV type documents or has anyone ever done it?

Thanks!

Read only

Former Member
0 Likes
2,642

Ok, so..

I think I got the point of this now.

document header is for BKPF table 1 row

accountgl is for BSEG table 2 rows

accountreceivable is for BSID table 1 row

if I get them filled up properly, it should work?

thanks

Read only

0 Likes
2,642

Hi Märten,

You should also fill up the CurrencyAmount parameter with an internal table that would have all the amounts you want to assign to both GL accounts and to the A/R line (customer).

Hope it helps you.

Regards,

Daniel.

Read only

ThomasZloch
Active Contributor
0 Likes
2,642

> Ok, so..

> I think I got the point of this now.

> document header is for BKPF table 1 row

> accountgl is for BSEG table 2 rows

> accountreceivable is for BSID table 1 row

>

> if I get them filled up properly, it should work?

>

>

> thanks

Yes, one "accountgl" per G/L account item, one "accountreceivable" per customer item. It depends how the posted document should look like, from a functional point of view.

This BAPI has an online documentation, with references to yet more documentation, did you check that? Also check the where-used list of that function module in your system for samples of the correct usage.

Thomas

Read only

Former Member
0 Likes
2,642

Hey Thomas,

where can I get the online documentation?

I did fill up the currency table, so that should be ok.

Thanks!

Read only

ThomasZloch
Active Contributor
0 Likes
2,642

When you display the source code in SE37, there is a button "function module documentation".

Thomas

Read only

Former Member
0 Likes
2,642

Hello,

Thanks for all the answers.

I used trans. SHDB to generate my own function module, which simulates transaction FB70. It was faster.

Thank you, I will now close this thread.

Read only

ThomasZloch
Active Contributor
0 Likes
2,642

Well, using the BAPI would be much more future (i.e. upgrade) proof than creating fragile recordings, but there you go.

Thomas

Read only

Former Member
0 Likes
2,642

true,

but as I'm little bit in a hurry, I first need to get this worked for testing and then later I will have more time to use the BAPI.

Thanks