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: 

How to use the FM AC_DOCUMENT_CREATE

0 Kudos
6,560

Dear all,

Does anyone know how to use the FM AC_DOCUMENT_CREATE?

Thank you

Best regards

Eric

12 REPLIES 12

Former Member
0 Kudos
2,644

hi,

the fm AC_DOCUMENT_CREATE-

Responsible for data derivation and validation, substitution and user-exits.

CALL FUNCTION 'AC_DOCUMENT_CREATE'

* EXPORTING

*   i_comp = SPACE                     " trwpr-component  Limited to one component

*   i_comp_check = SPACE          " trwpr-component  Limited to one component for checks

  TABLES

    t_acchd =                  " acchd         FI/CO document header information

    t_accit =                    " accit              FI/CO document item information

    t_acccr =                   " acccr           FI/CO document currency information

*   t_accda =                  " accda         FI/CO document assets additional information

*   t_accfi =                    " accfi              FI/CO document financial accounting additional information

*   t_acctx =                   " accbset       Tax statement

*   t_acctax =                  " acctax        Tax information

    .  "  AC_DOCUMENT_CREATE"

check this link

http://wiki.sdn.sap.com/wiki/display/ERPFI/Accounting+Interface+Architecture

0 Kudos
2,644

Hi,

This is very helpful.

Thank you very much.

Best regards.

shaik_sajid
Active Contributor
0 Kudos
2,644

0 Kudos
2,644

Hi, Shaik

It is very helpful.

Thank you very much.

But I still don't know how to set the parameter(T_ACCHD,T_ACCIT,T_ACCCR).

Best Regards.

Former Member
0 Kudos
2,644

Hi Qiang,

Hope the following link helps:

http://www.se80.co.uk/sapfms/a/ac_d/ac_document_create.htm

Regards

Purnand

0 Kudos
2,644

Hi, Purnand

Thank you very much.

But how to set the parameter(T_ACCHD,T_ACCIT,T_ACCCR)?

Best regards.

Former Member
0 Kudos
2,644

Better use BAPI....

report z_test_bapi_gl_ac_doc .

data:

obj_type like bapiache02-obj_type,

obj_key like bapiache02-obj_key,

obj_sys like bapiache02-obj_sys,

documentheader like bapiache08,


accountgl like bapiacgl08

occurs 0 with header line,

currencyamount like bapiaccr08

occurs 0 with header line,

return like bapiret2

occurs 0 with header line,

extension1 like bapiextc

occurs 0 with header line,


t_edidd like edidd occurs 0 with header line,

bapi_retn_info like bapiret2 occurs 0 with header line.

data: error_flag.


documentheader-username = sy-uname.

documentheader-header_txt = 'Test using BAPI'.

documentheader-comp_code = '1000'.

documentheader-doc_date = sy-datum.

documentheader-pstng_date = sy-datum.

documentheader-doc_type = 'SA'.



accountgl-itemno_acc = '1'.

accountgl-gl_account = '0000160100'.

accountgl-comp_code = '1000'.

accountgl-pstng_date = sy-datum.

accountgl-doc_type = 'SA'.

accountgl-profit_ctr = '0000010000'.

append accountgl.


accountgl-itemno_acc = '2'.

accountgl-gl_account = '0000160100'.

accountgl-comp_code = '1000'.

accountgl-pstng_date = sy-datum.

accountgl-doc_type = 'SA'.

accountgl-profit_ctr = '0000010000'.

append accountgl.


currencyamount-itemno_acc = '1'.

currencyamount-currency = 'GBP'.

currencyamount-amt_doccur = '100.00'.

append currencyamount.


currencyamount-itemno_acc = '2'.

currencyamount-currency = 'GBP'.

currencyamount-amt_doccur = '-100.00'.

append currencyamount.



* call BAPI-function in this system *

call function 'BAPI_ACC_GL_POSTING_POST'

exporting

documentheader = documentheader

* importing

* obj_type = obj_type

* obj_key = obj_key

* obj_sys = obj_sys

tables

accountgl = accountgl

currencyamount = currencyamount

return = return

extension1 = extension1

exceptions

others = 1.

if sy-subrc <> 0.

message e999(re) with 'Problem occured'.

else.

loop at return.

if not return is initial.

clear bapi_retn_info.

move-corresponding return to bapi_retn_info.

if return-type = 'A' or return-type = 'E'.

error_flag = 'X'.

endif.

append bapi_retn_info.

endif.

endloop.

if error_flag = 'X'.

message e999(re) with 'Problem occured'.

rollback work.

else.

commit work.

endif.

endif.

0 Kudos
2,644

Hi,

I have to use AC_DOCUMENT_CREATE to simulate FI accounting document before save,not post.

Thank you.

Best Regards

RaymondGiuseppi
Active Contributor
0 Kudos
2,644

Better use released FM/BAPI like BAPI_ACC_DOCUMENT_POST (already many threads on this subject) - the BAPI will use the AC_DOCUMENT FM during execution.

Regards,

Raymond

0 Kudos
2,644

Hi,Raymond

I have a requirement to simulate FI accounting document before post.

Thank you.

Best regards.

0 Kudos
2,644

Two solutions

  • You will find (most) conversions between documented BAPI parameters and not released not documented FM parameters in forms like check_and_fill_acc_document of function group ACC9 (include LACC9F20) and following forms in the BAPI source. Those FM will help you to fill ACC_DOCUMENT* FM parameters
  • Or you could "play" with a BTE like RWBAPI01 or BAdI like ACC_DOCUMENT during a call of BAPI_ACC_DOCUMENT_CHECK, those exits receive most of the ACC table (ACCHD, ACCIT, ACCCR, ACCWT, ACCTX) and an extension parameter, so you could pass a value in the extension to trigger export of those internal table in BAdI/BTE during BAPI call and read those back in your driver program to be displayed.

Regards,

Raymond

0 Kudos
2,644

Hi,Raymond,

Thank you for your solutions.

I will try to use the solutions.

Best regards.