Skip to Content
author's profile photo Former Member
Former Member

BAPI_ACC_GL_POSTING_REV_POST - reverse document number

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' ?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 24, 2007 at 05:31 AM

    come on guys its urgent

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 24, 2007 at 05:32 AM

    yeah , u have to pass there parameters .

    Regards

    Prabhu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 24, 2007 at 05:59 AM

    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^

      Add a comment
      10|10000 characters needed characters exceeded

    • author's profile photo Former Member
      Former Member
      Posted on Apr 24, 2007 at 07:03 AM

      thanks

      Add a comment
      10|10000 characters needed characters exceeded

    Before answering

    You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
    You must be Logged in to submit an answer.

    Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.