‎2007 Mar 21 5:52 AM
i want to post FI documents from old company code to new company code using these functions:POSTING_INTERFACE_START
POSTING_INTERFACE_DOCUMENT
POSTING_INTERFACE_END
Can somebody show me how i can implement it in abap code
‎2007 Mar 21 5:56 AM
Hi,
DATA: ftp east TYPE ftp east OCCURS 0 WITH HEADER LINE.
* Internal accounting cut place initialize
CALL FUNCTION POSTING_INTERFACE_START
EXPORTING
i_function = I
more i_user =
EXCEPTION
client_incorrect = 1
function_invalid = 2
group_name_missing = 3
mode_invalid = 4
update_invalid = 5
OTHERS = 6.
* Head
PERFORM fill_ftpost USING K 1 BKPF BUDAT 31102006.
PERFORM fill_ftpost USING K 1 BKPF BLDAT 31102006.
PERFORM fill_ftpost USING K 1 BKPF BLART MD.
PERFORM fill_ftpost USING K 1 BKPF BKTXT LALELU.
PERFORM fill_ftpost USING K 1 bkpf belnr 20808599.
PERFORM fill_ftpost USING K 1 BKPF XBLNR 123.
* IF EMERGENCY control identifier IS INITIAL.
PERFORM fill_ftpost USING K 1 BKPF XMWST X.
* ENDIF.
PERFORM fill_ftpost USING K 1 BKPF BUKRS 1000.
* PERFORM fill_ftpost USING K 1 BKPF MONTH wa_mhnk-ausdt+4 (2).
PERFORM fill_ftpost USING K 1 BKPF WAERS EUR.
* Pos1 (debtor)
PERFORM fill_ftpost USING P 1 BSEG BSCHL 01.
PERFORM fill_ftpost USING P 1 BSEG KUNNR 10926014.
PERFORM fill_ftpost USING P 1 BSEG WRBTR 116,00.
* IF EMERGENCY control identifier IS INITIAL.
PERFORM fill_ftpost USING P 1 BKPF XMWST X.
* PERFORM fill_ftpost USING P 1 BSEG MWSKZ control identifier.
* ENDIF.
PERFORM fill_ftpost USING P 1 BSEG ZTERM 1003.
PERFORM fill_ftpost USING P 1 BSEG ZFBDT 31102006.
PERFORM fill_ftpost USING P 1 BSEG SGTXT LALELU.
PERFORM fill_ftpost USING P 1 BSEG ZUONR LALELUKOPF.
* Pos2 (revenue account)
PERFORM fill_ftpost USING P 2 BSEG BSCHL 50.
PERFORM fill_ftpost USING P 2 BSEG HKONT 409600.
PERFORM fill_ftpost USING P 2 BSEG WRBTR 100,00.
* IF EMERGENCY control identifier IS INITIAL.
PERFORM fill_ftpost USING P 2 BSEG MWSKZ A1.
* ENDIF.
PERFORM fill_ftpost USING P 2 BSEG SGTXT LALELU.
PERFORM fill_ftpost USING P 2 COBL PRCTR NETPHONE.
PERFORM fill_ftpost USING P 2 BSEG ZUONR LALELU.
PERFORM book TABLES ftp east.
*************************************************
FORM fill_ftpost USING p_stype
p_count
p_fnam
p_fval.
ftp east type = p_stype.
ftp east COUNT = p_count.
ftpost fnam = p_fnam.
ftpost fval = p_fval.
CONDENSE ftpost fval.
APPEND ftp east.
END FORM. FTPOST_FIELD
*&--------------------------------------------------------------------*
*& form BEECHES
*&--------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> P1 text
* <- p2 text
*----------------------------------------------------------------------*
TABLES ftp east books FORM.
DATA: blntab TYPE blntab OCCURS 0 WITH HEADER LINE,
fttax TYPE fttax OCCURS 0 WITH HEADER LINE.
DATA: msgid LIKE system-msgid,
msgno LIKE system-msgno,
msgty LIKE system-msgty,
msgv1 LIKE sy-msgv1,
msgv2 LIKE sy-msgv2,
msgv3 LIKE sy-msgv3,
msgv4 LIKE sy-msgv4.
CALL FUNCTION POSTING_INTERFACE_DOCUMENT
EXPORTING
i_tcode = FB01
IMPORTING
e_subrc = system-subrc
e_msgid = msgid
e_msgty = msgty
e_msgno = msgno
e_msgv1 = msgv1
e_msgv2 = msgv2
e_msgv3 = msgv3
e_msgv4 = msgv4
TABLES
t_ftpost = ftp east
t_fttax = fttax
t_blntab = blntab
EXCEPTION
account_missing = 1
company_code_missing = 2
posting_key_invalid = 3
posting_key_missing = 4
record_type_invalid = 5
transaction_code_invalid = 6
amount_format_error = 7
too_many_line_items = 8
company_code_invalid = 9
screen_not_found = 10
no_authorization = 11
OTHERS = 12.
IF system-subrc <> 0.
MESSAGE ID SYSTEM-MSGID TYPE SYSTEM-MSGTY NUMBER SYSTEM-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH ftp east.
REFRESH fttax.
END FORM. BEECHES
Regards
Sudheer