Posting Interface document sample code

form buchen_beleg.

data: help_counter_before type i, help_counter_after type i.
data: help_subrc like sy-subrc.
describe table blntab lines help_counter_before.
help_subrc = 1.
clear belegnummer.

sort ftpost by stype count.
clear blntab. "note174346
call function 'POSTING_INTERFACE_DOCUMENT'
exporting
i_tcode = 'FBB1'
* i_tcode = 'FB01'
i_sgfunct = 'C'
importing
e_msgid = i_msgid
e_msgno = i_msgno
e_msgty = i_msgty
e_msgv1 = i_msgv1
e_msgv2 = i_msgv2
e_msgv3 = i_msgv3
e_msgv4 = i_msgv4
e_subrc = i_subrc
tables
t_blntab = blntab
t_ftpost = ftpost
t_fttax = fttax
exceptions
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
others = 9.

if sy-subrc eq 0.
perform append_msg using '1' '' sy-msgty sy-msgid sy-msgno
i_msgv1 i_msgv2 i_msgv3 i_msgv4.
describe table blntab lines help_counter_after.
if help_counter_after > help_counter_before.
read table blntab index help_counter_after.
if sy-subrc = 0. help_subrc = 0. endif.
endif.
if help_subrc = 0 and blntab-belnr ne space.
belegnummer = blntab-belnr.
bukrs = blntab-bukrs.
gjahr = blntab-gjahr.
perform update_belnr.
perform update_ewummfi.
else.
help_subrc = 1.
endif.
else.
help_subrc = 1.
case sy-subrc.
when 1.
perform append_msg using '2' '' 'A' 'FR' '451'
'ACCOUNT_MISSING' '' '' ''.
when 2.
perform append_msg using '2' '' 'A' 'FR' '451'
'COMPANY_CODE_MISSING' '' '' ' '.
when 3.
perform append_msg using '2' '' 'A' 'FR' '451'
'POSTING_KEY_INVALID' '' '' ''.
when 4.
perform append_msg using '2' '' 'A' 'FR' '451'
'POSTING_KEY_MISSING' '' '' ''.
when 5.
perform append_msg using '2' '' 'A' 'FR' '451'
'RECORD_TYPE_INVALID' '' '' ''.
when 6.
perform append_msg using '2' '' 'A' 'FR' '451'
'TRANSACTION_CODE_INVALID' '' '' ''.
endcase.
endif.

if help_subrc = 1.
perform skb1_xintb_setzen. "reset the changed account datas
result = 'E'.
perform finish_program using result upda.
perform write_prot_and_exit.
endif.
endform. "BUCHEN_BELEG

RELATED POST

MODULE POOL PROGRAMMING WITH GUI STATUS SAMPLE CODE
series.
SAP SCRIPT CONTROLS PART 1
SAP SCRIPT CONTROLS PART 2
SAP SCRIPT CONTROLS PART 3
SAP SCRIPT CONTROLS PART 4
SAP SCRIPT CONTROLS PART 5
SAP SCRIPT CONTROLS PART 6

No comments:

Post a Comment