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

Using BAPI_ACC_DOCUMENT_POST

Former Member
0 Likes
3,019

Hi,

I am using this BAPI to post FI documents using business transaction RFBU, RMRP and SD00.

I am not passing anything in OBJ_TYPE , OBJ_KEY , OBJ_SYS in Document header of this BAPI. So system is using BKPFF as Reference transaction and posting the document.

Now here the system uses combination of docno., companycode, fiscal year to build reference key.

I want to give my value in reference key.

Please suggest how can I do that ?

Thanks and Regards

Gurpreet Singh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,676

Hi,

See the Header reocrd filling...

* OBJ_TYPE has to be replaced by customers object key (Y* or Z*)
*  gd_documentheader-obj_type   = 'IDOC'.
*  gd_documentheader-obj_key    = ref_key.
  gd_documentheader-username   = sy-uname.
  gd_documentheader-header_txt = 'BAPI Test'.               "#EC NOTEXT
* gd_documentheader-obj_key_r  =
* GD_DOCUMENTHEADER-reason_rev =
 gd_documentheader-comp_code  = 'SLOC'.
* GD_DOCUMENTHEADER-AC_DOC_NO  =
  gd_documentheader-fisc_year  = sy-datum(4).
  gd_documentheader-doc_date   = sy-datum.
  gd_documentheader-pstng_date = sy-datum.
* GD_DOCUMENTHEADER-TRANS_DATE =
* GD_DOCUMENTHEADER-VALUE_DATE =
* GD_DOCUMENTHEADER-FIS_PERIOD =
 gd_documentheader-doc_type   = 'KR'.
 gd_documentheader-ref_doc_no = 'xxxx'.
* GD_DOCUMENTHEADER-COMPO_ACC  =
  gd_documentheader-bus_act    = 'RFBU'.

See the example Program, you wil find where to pass the Reference key

http://sap4.com/wiki/index.php?title=BAPI_ACC_DOCUMENT_POST

Regards

Sudheer

Message was edited by:

Sudheer Junnuthula

9 REPLIES 9
Read only

Former Member
0 Likes
1,676

pass the reference key thru BAPI

Read only

0 Likes
1,676

If I pass the reference key in document header to BAPI , system gives error that OBJ_TYPE and OBJ_SYS are empty and If I pass all these values , document is not posted. I am in ECC 6.0

Thanks and Regards

Gurpreet Singh

Read only

Former Member
0 Likes
1,677

Hi,

See the Header reocrd filling...

* OBJ_TYPE has to be replaced by customers object key (Y* or Z*)
*  gd_documentheader-obj_type   = 'IDOC'.
*  gd_documentheader-obj_key    = ref_key.
  gd_documentheader-username   = sy-uname.
  gd_documentheader-header_txt = 'BAPI Test'.               "#EC NOTEXT
* gd_documentheader-obj_key_r  =
* GD_DOCUMENTHEADER-reason_rev =
 gd_documentheader-comp_code  = 'SLOC'.
* GD_DOCUMENTHEADER-AC_DOC_NO  =
  gd_documentheader-fisc_year  = sy-datum(4).
  gd_documentheader-doc_date   = sy-datum.
  gd_documentheader-pstng_date = sy-datum.
* GD_DOCUMENTHEADER-TRANS_DATE =
* GD_DOCUMENTHEADER-VALUE_DATE =
* GD_DOCUMENTHEADER-FIS_PERIOD =
 gd_documentheader-doc_type   = 'KR'.
 gd_documentheader-ref_doc_no = 'xxxx'.
* GD_DOCUMENTHEADER-COMPO_ACC  =
  gd_documentheader-bus_act    = 'RFBU'.

See the example Program, you wil find where to pass the Reference key

http://sap4.com/wiki/index.php?title=BAPI_ACC_DOCUMENT_POST

Regards

Sudheer

Message was edited by:

Sudheer Junnuthula

Read only

Former Member
0 Likes
1,676

Hi Sudheer ,

Thanks a lot for the reply.

I have made a Z* type in TTYP with Function as FI_DOCUMENT_SENDER and STRUC as blank and I am passing object key in document header.

Now the problem is I am not able to get the docuemnt no. which is created . However the document is successfully created.

Please reply....

Thanks and Regards

Gurpreet Singh

Read only

0 Likes
1,676

Hi

Use this after the BAPI Call:


DATA : BEGIN OF t_belnr OCCURS 0.
        INCLUDE STRUCTURE rf048_d.
DATA : END OF t_belnr.

*         move the object key to the fi doc parameter
          CALL FUNCTION 'FI_ACCBELNR_GET'
            TABLES
              t_belnr = t_belnr.

          CLEAR t_belnr.
          READ TABLE t_belnr INDEX 1.
          write : / t_belnr-belnr_e. 

Hope this helps,

Erwan

Read only

Former Member
0 Likes
1,676

Hi Erwan,

Thanks for the reply..

But please tell whether it will be giving me the latest FI document or the FI document created by me .

This call to this FM is different from BAPI call. Is there any possibility of getting a different number in case one or two people are running the same program simultaneously and the FI document numbers get interchanged.

Please explain me this.

Thanks and Regards

Gurpreet Singh

Read only

0 Likes
1,676

Hi

I think the problem is to understand why you need to fill the reference key, because if you transfer something there the BAPI wants to know the operation (OBJ_TYPE) has generated that document.

Why don't use the field BAPIACHE09-REF_DOC_NO?

Max

Read only

Former Member
0 Likes
1,676

Hi Max,

Thanks for the reply..

This is the requirement that I have got. I laso suggested the same thing that reference document number can be used but they are using that number for a different purpose.

So is there any way where I an give my refernence key and get the FI doc. no. from BAPI itself rather than calling any other FM as it may cause some inconsistencies.

Please help.

Thnaks and Regards

Gurpreet Singh

Read only

0 Likes
1,676

Hi

U can try to append a new field in BKPF table where you'll store your reference and than use the extension of BAPI to transfer the data.

I wouldn't use the reference key because it can have inconcistance.

Max