View previous topic :: View next topic
Author
Message
admin Администратор Joined: 01 Sep 2007 Posts: 1640
Posted: Sat Apr 12, 2008 1:06 am Post subject: BAPI_ACC_GL_ POSTING_REV_ POST
BAPI_ACC_GL_ POSTING_REV_POST - Учет и отчетность: проводка сторно общей проводки по основному счету
Code: 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'.
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.