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_ACC_GL_POSTING_REV_POST - reverse document number

Former Member
0 Kudos

hi guys,

in my program i have used two bapi

BAPI_ACC_GL_POSTING_POST

BAPI_ACC_GL_POSTING_REV_POST

the problem is that the first bapi gives me the new document number created by it when i dont supply the parameters obj_key, type and sys.

but the bapi BAPI_ACC_GL_POSTING_REV_POST does not give the reverse doc number if i dont supply these three parametrs to it

IS IT THAT THESE THREE PARAMETERS ARE MANDATORY FOR BAPI

'BAPI_ACC_GL_POSTING_REV_POST' ?

4 REPLIES 4

Former Member
0 Kudos

come on guys its urgent

Former Member
0 Kudos

yeah , u have to pass there parameters .

Regards

Prabhu

Former Member
0 Kudos

hi

good

go through this code and try accordingly.

Parameters p_belnr like bkpf-belnr default '0100000236'.

*Get last SA type document posted to build document key

CALL FUNCTION 'NUMBER_GET_NEXT'

EXPORTING

NR_RANGE_NR = '01'

OBJECT = 'RF_BELEG'

  • QUANTITY = '1'

SUBOBJECT = '4000' "company code

TOYEAR = '2005'

  • IGNORE_BUFFER = '2005'

IMPORTING

NUMBER = docnum

  • QUANTITY =

  • RETURNCODE =

  • EXCEPTIONS

  • INTERVAL_NOT_FOUND = 1

  • NUMBER_RANGE_NOT_INTERN = 2

  • OBJECT_NOT_FOUND = 3

  • QUANTITY_IS_0 = 4

  • QUANTITY_IS_NOT_1 = 5

  • INTERVAL_OVERFLOW = 6

  • BUFFER_OVERFLOW = 7

  • OTHERS = 8

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

    • Begin to populate docnument header.

*obj_key contains new document no.

CONCATENATE docnum '4000' sy-datlo(4) INTO doc_header-obj_key.

doc_header-obj_type = 'BKPFF'.

*obj_key_r contains document no. needed to reverse

CONCATENATE p_belnr '4000' sy-datlo(4) INTO doc_header-obj_key_r.

doc_header-obj_sys = 'A1DMD011'.

*doc_header-OBJ_KEY_R = 'AWREF_REV'.

*doc_header-AC_DOC_NO = '8'.

*doc_header-header_txt = 'TEST BOC BAPI POSTING'.

doc_header-comp_code = '4000'.

doc_header-REASON_REV = '02'.

doc_header-pstng_date = '20050517'.

doc_header-FIS_PERIOD = '05'.

  • All tables filled - now call BAPI.

CALL FUNCTION 'BAPI_ACC_GL_POSTING_REV_POST'

EXPORTING

REVERSAL = doc_header

IMPORTING

OBJ_TYPE = doc_header-obj_type

OBJ_KEY = doc_header-obj_key

OBJ_SYS = doc_header-obj_sys

TABLES

RETURN = return

.

LOOP AT return WHERE type = 'E'.

EXIT.

ENDLOOP.

IF sy-subrc EQ 0.

WRITE: / 'BAPI call failed - debug and fix!'.

LOOP AT return.

WRITE: / .

WRITE:

return-TYPE,

'|',

return-ID,

'|',

return-NUMBER,

'|',

return-MESSAGE.

ENDLOOP.

ELSE.

LOOP AT return.

WRITE: / .

WRITE:

return-TYPE,

'|',

return-ID,

'|',

return-NUMBER,

'|',

return-MESSAGE.

ENDLOOP.

CLEAR return.

REFRESH return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT = 'X'

IMPORTING

return = return.

WRITE: / 'BAPI call worked!!'.

WRITE: / doc_header-obj_key, ' posted'.

thanks

mrutyun^

Former Member
0 Kudos

thanks