FB05 or F-30 using a standard SAP FM
FB05 or F-30 using a standard SAP FM: To be able to clear documents, we use the SAP t-codes : FB05 or F-30. Both these transactions are practically the same.
There are three function modules that are required to be able to clear documents through a program . There were plenty of posts but they are all very confusing in terms of flow of information. I thought that this might be a good start.
Step 1. POSTING_INTERFACE_START
Step 2. POSTING_INTERFACE_CLEARING
Step 3. POSTING_INTERFACE_END
Step 1.
I used the following parameters to call the first FM.
CALL FUNCTION ‘POSTING_INTERFACE_START’
EXPORTING
i_function = “C” “Call transaction method => C
i_keep = “X”
i_user = sy–uname
i_update = ‘S”
EXCEPTIONS
client_incorrect = 1
function_invalid = 2
group_name_missing = 3
mode_invalid = 4
update_invalid = 5
OTHERS = 6.
Step 2.
In the tables list, the ones which we are going to be concerned are lt_ftpost and lt_ftclear.
I will let you figure out the datatypes for other tables because they do not have significance in this doc (They are not even used).
lt_ftclear : This table will have the list of the documents which you want to clear
lt_ftpost : This table will have the list/details of clearing documents which you want to post against the cleared items.
CALL FUNCTION ‘POSTING_INTERFACE_CLEARING’
EXPORTING
i_auglv = ‘UMBUCHNG’
i_tcode = ‘FB05’
i_sgfunct = ‘C’
IMPORTING
e_msgid = sy-msgid
e_msgty = sy-msgty
e_msgno = sy-msgno
e_msgv1 = sy-msgv1
e_msgv2 = sy-msgv2
e_msgv3 = sy-msgv3
e_msgv4 = sy-msgv4
TABLES
t_blntab = lt_blntab
t_ftclear = lt_ftclear
t_ftpost = lt_ftpost
t_fttax = lt_fttax
EXCEPTIONS
clearing_procedure_invalid = 1
clearing_procedure_missing = 2
table_t041a_empty = 3
transaction_code_invalid = 4
amount_format_error = 5
too_many_line_items = 6
company_code_invalid = 7
screen_not_found = 8
no_authorization = 9
OTHERS = 10.
Step 3.
CALL FUNCTION ‘POSTING_INTERFACE_END’
EXPORTING
I_BDCIMMED = ‘X’
EXCEPTIONS
SESSION_NOT_PROCESSABLE = 1
OTHERS = 2.
These three steps should do the trick for clearing out the documents and posting documents against the cleared ones.
Make sure that the date passed in the function modules is the same as the user who is using it. You could use the FM ” /SAPDII/SPP05_CONVERT_DATE”. It returns the date in the format of the user running the code.
Feel free to comment if you want me to add something.
New NetWeaver Information at SAP.com
Very Helpfull