‎2011 Jul 28 12:56 PM
Hi,
I am using the function module posting_interface_clearing to post & clear the open items.
Here the requirement is we need to clear the open items from two different customer accounts against a single bank account.
For example the amount of 1000 EUR from the Bank A/C 41234 is cleared against two different customer accounts say 123 & 413. First of all how should we populate the ft_clear structure so that the clearing has to happen against two different customer accounts. The FB05 transaction is used. Can anyone help ?? I have searched the forum & tried a lot of combinations but its not working...Need some help
*The user will have a report from which the user can select any no. of open items and all those open items which can be from different or same customer accounts needs to cleared against an incoming amount of a single Bank Account *. I am sure posting_interface_clearing can do it but how. ?
‎2011 Aug 30 7:59 AM
...
FORM f_prepare_ftclear .
DATA: ls_ftclear TYPE ftclear.
CONSTANTS: lc_agkoa TYPE koart VALUE 'D', "Customers
lc_selfd TYPE fld30_f05a VALUE 'BELNR'.
LOOP AT gt_bsid_clearing INTO gs_bsid_clearing. "Clearing Table
ls_ftclear-agkoa = lc_agkoa.
ls_ftclear-agkon = gs_bsid_clearing-kunnr. "Customer
ls_ftclear-agbuk = gs_bsid_clearing-bukrs. "Company code
ls_ftclear-xnops = gc_x. "G/L Indicator
ls_ftclear-selfd = lc_selfd.
CONCATENATE gs_bsid_clearing-belnr
gs_bsid_clearing-gjahr
gs_bsid_clearing-buzei INTO ls_ftclear-selvon.
ls_ftclear-selbis = gs_bsid_clearing-belnr.
APPEND ls_ftclear TO gt_ftclear.
ENDLOOP.
ENDFORM." F_PREPARE_FTCLEAR
Continued
‎2011 Aug 27 12:09 PM
‎2011 Aug 29 4:59 PM
Hi Tanmoy
I meet the same problem you have solved. Would you mind sharing your solution?
My situation:
I have 2 documents.
1 document,1100000001
'Item' 'Posting Key' 'Sp GL Ind' 'Amount'
1 09 2 130
2 09 2 50
3 50 -180
Another document,,1100000002
'Item' 'Posting Key' 'Sp GL Ind' 'Amount'
1 09 2 180
2 19 2 -180
I want to use this interface FM to clear document 1100000001, items 1 and 2 with document 1100000002, item 2 and generate an empty clearing document.
I use Sp GL Ind. as selection criteria, so document 1100000002, item 1 come out also. However, I don't want it to appear.
Would you have any solution to solve this problem?
Thank you very much
Horse
‎2011 Aug 30 7:34 AM
Sure... I am posting the relevant part of my code extract here. If you have further questions please write back
IF gt_bsid_clearing IS NOT INITIAL.
PERFORM: f_posting_interface_start.
PERFORM: f_posting_interface_clearing.
PERFORM: f_posting_interface_end.
ENDIF.
FORM f_posting_interface_start .
CONSTANTS: lc_function LIKE rfipi-funct VALUE 'C',
" B= BDC, C= Call Trans
lc_mode LIKE rfpdo-allgazmd VALUE 'E', "ERRORS only
lc_update LIKE rfpdo-allgvbmd VALUE 'S' .
CALL FUNCTION 'POSTING_INTERFACE_START'
EXPORTING
i_function = lc_function
i_mode = lc_mode
i_update = lc_update
EXCEPTIONS
client_incorrect = 1
function_invalid = 2
group_name_missing = 3
mode_invalid = 4
update_invalid = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE e024(z_alv_efi013a_msg_cl).
ENDIF.
ENDFORM." F_POSTING_INTERFACE_START
Continued....
Edited by: Tanmoy Mondal on Aug 30, 2011 8:35 AM
Edited by: Tanmoy Mondal on Aug 30, 2011 8:36 AM
Edited by: Tanmoy Mondal on Aug 30, 2011 8:43 AM
Edited by: Tanmoy Mondal on Aug 30, 2011 8:44 AM
‎2011 Aug 30 7:47 AM
FORM f_posting_interface_clearing.
CONSTANTS: lc_auglv TYPE auglv VALUE 'EINGZAHL',
lc_tcode TYPE sytcode VALUE 'FB05',
lc_sgfunct TYPE sgfunct_pi VALUE 'C'.
PERFORM: f_prepare_ftpost.
PERFORM: f_prepare_ftclear.
CALL FUNCTION 'POSTING_INTERFACE_CLEARING'
EXPORTING
i_auglv = lc_auglv
i_tcode = lc_tcode
i_sgfunct = lc_sgfunct
TABLES
t_blntab = gt_blntab
t_ftclear = gt_ftclear
t_ftpost = gt_ftpost
t_fttax = gt_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.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN '1'.
MESSAGE e013(z_alv_efi013a_msg_cl).
WHEN '2'.
MESSAGE e014(z_alv_efi013a_msg_cl).
WHEN '3'.
MESSAGE e015(z_alv_efi013a_msg_cl).
WHEN '4'.
MESSAGE e016(z_alv_efi013a_msg_cl).
WHEN '5'.
MESSAGE e017(z_alv_efi013a_msg_cl).
WHEN '6'.
MESSAGE e018(z_alv_efi013a_msg_cl).
WHEN '7'.
MESSAGE e019(z_alv_efi013a_msg_cl).
WHEN '8'.
MESSAGE e020(z_alv_efi013a_msg_cl).
WHEN '9'.
MESSAGE e021(z_alv_efi013a_msg_cl).
ENDCASE.
ELSE.
COMMIT WORK.
SET SCREEN 0.
ENDIF.
ENDFORM." F_POSTING_INTERFACE_CLEARING
Continued....
Edited by: Tanmoy Mondal on Aug 30, 2011 8:47 AM
Edited by: Tanmoy Mondal on Aug 30, 2011 8:54 AM
‎2011 Aug 30 7:57 AM
FORM f_prepare_ftpost .
CONSTANTS: lc_header TYPE c VALUE 'K', "Header
lc_item TYPE c VALUE 'P', "Item
lc_count TYPE i VALUE '001'.
*fill_header(BKPF)
* Convert the date format from YYYYMMDD -> DD/MM/YYYY
PERFORM: f_convert_date USING pa_bldat
CHANGING pa_bldat.
gs_ftpost-stype = lc_header.
gs_ftpost-count = lc_count.
gs_ftpost-fnam = 'BKPF-BLDAT'.
gs_ftpost-fval = pa_bldat.
APPEND gs_ftpost TO gt_ftpost.
CLEAR gs_ftpost.
* Convert the date format from YYYYMMDD -> DD/MM/YYYY
PERFORM: f_convert_date USING pa_budat
CHANGING pa_budat.
gs_ftpost-stype = lc_header.
gs_ftpost-count = lc_count.
gs_ftpost-fnam = 'BKPF-BUDAT'.
gs_ftpost-fval = pa_budat.
APPEND gs_ftpost TO gt_ftpost.
CLEAR gs_ftpost.
gs_ftpost-stype = lc_header.
gs_ftpost-count = lc_count.
gs_ftpost-fnam = 'BKPF-BLART'.
gs_ftpost-fval = pa_blart.
APPEND gs_ftpost TO gt_ftpost.
CLEAR gs_ftpost.
gs_ftpost-stype = lc_header.
gs_ftpost-count = lc_count.
gs_ftpost-fnam = 'BKPF-BUKRS'.
gs_ftpost-fval = pa_bukrs.
APPEND gs_ftpost TO gt_ftpost.
CLEAR gs_ftpost.
gs_ftpost-stype = lc_header.
gs_ftpost-count = lc_count.
gs_ftpost-fnam = 'BKPF-WAERS'. "Currency
gs_ftpost-fval = pa_curr.
APPEND gs_ftpost TO gt_ftpost.
CLEAR gs_ftpost.
gs_ftpost-stype = lc_header.
gs_ftpost-count = lc_count.
gs_ftpost-fnam = 'BKPF-XBLNR'.
gs_ftpost-fval = pa_xblnr.
APPEND gs_ftpost TO gt_ftpost.
CLEAR gs_ftpost.
gs_ftpost-stype = lc_header.
gs_ftpost-count = lc_count.
gs_ftpost-fnam = 'BKPF-BKTXT'. "Doc. Header Text
gs_ftpost-fval = pa_text.
APPEND gs_ftpost TO gt_ftpost.
CLEAR gs_ftpost.
*Commented temporarily
* gs_ftpost-stype = lc_header.
* gs_ftpost-count = lc_count.
* gs_ftpost-fnam = 'BKPF-KURSF'. "Exchange Rate
* gs_ftpost-fval = pa_erate.
* SHIFT gs_ftpost-fval LEFT DELETING LEADING space.
* APPEND gs_ftpost TO gt_ftpost.
* CLEAR gs_ftpost.
*Item Data
gs_ftpost-stype = lc_item.
gs_ftpost-count = lc_count.
gs_ftpost-fnam = 'RF05A-NEWKO'.
gs_ftpost-fval = pa_newko.
APPEND gs_ftpost TO gt_ftpost.
CLEAR gs_ftpost.
gs_ftpost-stype = lc_item.
gs_ftpost-count = lc_count.
gs_ftpost-fnam = 'RF05A-NEWBS'.
gs_ftpost-fval = pa_newbs.
APPEND gs_ftpost TO gt_ftpost.
CLEAR gs_ftpost.
gs_ftpost-stype = lc_item.
gs_ftpost-count = lc_count.
gs_ftpost-fnam = 'BSEG-WRBTR'.
gs_ftpost-fval = pa_wrbtr.
SHIFT gs_ftpost-fval LEFT DELETING LEADING space.
APPEND gs_ftpost TO gt_ftpost.
CLEAR gs_ftpost.
* Convert the date format from YYYYMMDD -> DD/MM/YYYY
PERFORM: f_convert_date USING pa_valut
CHANGING pa_valut.
gs_ftpost-stype = lc_item.
gs_ftpost-count = lc_count.
gs_ftpost-fnam = 'BSEG-VALUT'.
gs_ftpost-fval = pa_valut.
APPEND gs_ftpost TO gt_ftpost.
CLEAR gs_ftpost.
* Convert the date format from YYYYMMDD -> DD/MM/YYYY
PERFORM: f_convert_date USING pa_zfbdt
CHANGING pa_zfbdt.
gs_ftpost-stype = lc_item.
gs_ftpost-count = lc_count.
gs_ftpost-fnam = 'BSEG-ZFBDT'.
gs_ftpost-fval = pa_zfbdt.
APPEND gs_ftpost TO gt_ftpost.
CLEAR gs_ftpost.
Continued
ENDFORM." F_PREPARE_FTPOST
‎2011 Aug 30 7:59 AM
...
FORM f_prepare_ftclear .
DATA: ls_ftclear TYPE ftclear.
CONSTANTS: lc_agkoa TYPE koart VALUE 'D', "Customers
lc_selfd TYPE fld30_f05a VALUE 'BELNR'.
LOOP AT gt_bsid_clearing INTO gs_bsid_clearing. "Clearing Table
ls_ftclear-agkoa = lc_agkoa.
ls_ftclear-agkon = gs_bsid_clearing-kunnr. "Customer
ls_ftclear-agbuk = gs_bsid_clearing-bukrs. "Company code
ls_ftclear-xnops = gc_x. "G/L Indicator
ls_ftclear-selfd = lc_selfd.
CONCATENATE gs_bsid_clearing-belnr
gs_bsid_clearing-gjahr
gs_bsid_clearing-buzei INTO ls_ftclear-selvon.
ls_ftclear-selbis = gs_bsid_clearing-belnr.
APPEND ls_ftclear TO gt_ftclear.
ENDLOOP.
ENDFORM." F_PREPARE_FTCLEAR
Continued
‎2011 Aug 30 8:01 AM
...
FORM f_posting_interface_end .
CALL FUNCTION 'POSTING_INTERFACE_END'
EXPORTING
i_bdcimmed = gc_x
EXCEPTIONS
session_not_processable = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e025(z_alv_efi013a_msg_cl).
ENDIF.
ENDFORM. " F_POSTING_INTERFACE_END
Thanks
Tanmoy
‎2011 Nov 15 7:27 PM
Hi Tanmoy,
I am facing some problem in populating the data for the Line Item level. In the foreground if I trigger it populates the values in the header correctly but in the line item level, if I pass in the code the posting key, the values are not populated in the respective field.
Stype used is "P". Could you please provide ur inputs.
Batch Input Values
LT_FTPOST-STYPE = 'K'."Header
LT_FTPOST-COUNT = 1. "number of Dynpro
LT_FTPOST-FNAM = 'BKPF-BLDAT'.
CONCATENATE SY-DATUM4(2) SY-DATUM6(2) SY-DATUM(4) INTO LT_FTPOST-FVAL SEPARATED BY '/'.
APPEND LT_FTPOST.
LT_FTPOST-FNAM = 'BKPF-BUDAT'.
CONCATENATE SY-DATUM4(2) SY-DATUM6(2) SY-DATUM(4) INTO LT_FTPOST-FVAL SEPARATED BY '/'.
APPEND LT_FTPOST.
LT_FTPOST-FNAM = 'BKPF-BLART'.
LT_FTPOST-FVAL = 'DZ'. "Same type as documents cleared via F-32
APPEND LT_FTPOST.
Documents to be cleared
LT_FTCLEAR-AGKOA = 'D'. "Account Type
LT_FTCLEAR-XNOPS = 'X'. "Indicator: Select only open items which are not special G/L?
LT_FTCLEAR-AGBUK = P_BUKRS. "Example company code
LT_FTCLEAR-AGKON = P_KUNNR. "Example Customer
LT_FTCLEAR-SELFD = 'BELNR'."Selection Field
LT_FTCLEAR-SELVON = P_DOC1.
LT_FTCLEAR-SELBIS = P_DOC1.
APPEND LT_FTCLEAR.
LT_FTCLEAR-SELVON = P_DOC2.
LT_FTCLEAR-SELBIS = P_DOC2.
APPEND LT_FTCLEAR.
**Item Level
Batch Input Values
LT_FTPOST-STYPE = 'P'."Header
LT_FTPOST-COUNT = '001'. "2. "number of Dynpro
LT_FTPOST-FNAM = 'RF05A-NEWKO'.
LT_FTPOST-FVAL = '40'. "
APPEND LT_FTPOST.
*
Batch Input Values
LT_FTPOST-STYPE = 'P'."Header
LT_FTPOST-COUNT = '001'. "2. "number of Dynpro
LT_FTPOST-FNAM = 'RF05A-NEWBS'.
LT_FTPOST-FVAL = '40'. "
APPEND LT_FTPOST.
Thanks.
Dinesh.
‎2011 Nov 29 6:42 AM
Hi Din_esh ,
Am not sure if your issue has been resolved but i had the same problem and this is how i solved it
in addition to BUDAT BLDAT that you have so far as your header also add
lt_ftpost-stype = 'K'."Header
lt_ftpost-count = 1. "number of Dynpro
lt_ftpost-fnam = 'BKPF-BUKRS'.
lt_ftpost-fval = p_bukrs.
APPEND lt_ftpost.
CLEAR lt_ftpost.
lt_ftpost-stype = 'K'."Header
lt_ftpost-count = 1. "number of Dynpro
lt_ftpost-fnam = 'BKPF-BKTXT'.
lt_ftpost-fval = 'Intercompany clearing'.
APPEND lt_ftpost.
lt_ftpost-stype = 'K'."Header
lt_ftpost-count = 1. "number of Dynpro
lt_ftpost-fnam = 'BKPF-WAERS'.
lt_ftpost-fval = 'USD'.
APPEND lt_ftpost.
once you add this you can add the line item details and it will work . These need to be given in order for the function module to work . also see link http://www.se80.co.uk/sapfms/p/post/posting_interface_document.htm for documentation. Hope this helps.
‎2014 Jan 13 4:40 PM
Hi,
Really good answer. I could finally fix my program with your help. I just concatenate the key field of BSID as you did.
‎2014 Jan 13 4:47 PM
Hi,
This was posted long back & good to see it is really helpful.....
‎2014 Aug 09 2:28 PM
Hi, this post really helps a lot! save lots of time to research again! Great job for sharing the information.
‎2015 Feb 02 12:19 PM
Hi All,
This post really helpful.
But how to do partial/residual payment using function module posting_interface_clearing .
Please help me with this.
Thanks & Regards,
Shakeel.