2015 Apr 16 6:31 AM
Dear Frds,
I have a scenerio , I made a invoice to customer Rs 1000/- . But my customer is paying only Rs 500/- only .. so i am going to F-28 and doing partial payment......
In invoice i will get the accounting entry .... I will make partial payment entry Rs 500 /- after a month generate accounting entry ... Here I need to update baseline date to be orginal invoiced accounting entry posting date .. how to achieve these ........help me out.
Kabil....
2015 Apr 16 7:22 AM
Hi Kabil,
Here we are posting the document without referring the invoice number.
We can do the same using BAPI BAPI_ACC_DOC_POST, kindly check the below code.
*"----------------------------------------------------------------------
*"*" Data Declaration
*"----------------------------------------------------------------------
DATA: l_dochead LIKE bapiache09,
t_accpay LIKE TABLE OF bapiacap09,
t_accrec LIKE TABLE OF bapiacar09,
t_curramt LIKE TABLE OF bapiaccr09,
wa_curramt TYPE bapiaccr09,
t_accgl LIKE TABLE OF bapiacgl09,
wa_accgl TYPE bapiacgl09,
t_extension1 LIKE TABLE OF bapiacextc,
l_ret LIKE bapiret2,
t_ret LIKE TABLE OF bapiret2,
wa_ret TYPE bapiret2,
wa_accrec TYPE bapiacar09,
it_ac_det TYPE TABLE OF zsmp_cash_ac_det,
wa_ac_det TYPE zsmp_cash_ac_det,
l_sd_casr_ps TYPE zfi_casr_ps,
l_item1 TYPE int2,
l_datum TYPE datum,
lv_bukrs TYPE bukrs,
lv_seq_no TYPE posnr_acc.
*"----------------------------------------------------------------------
*"*" Refresh Internal Table & Work Area
*"----------------------------------------------------------------------
CLEAR:l_dochead,wa_curramt,l_ret,lv_bukrs,wa_accgl,wa_ac_det,lv_seq_no.
REFRESH:t_accpay,t_accrec,t_curramt,t_accgl,t_ret,it_ac_det.
l_datum = sy-datum.
*"----------------------------------------------------------------------
*"*" Get the Company code of the Customer Number
*"----------------------------------------------------------------------
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = i_cash_input-cust_no
IMPORTING
output = i_cash_input-cust_no.
SELECT SINGLE bukrs FROM knb1 INTO lv_bukrs WHERE kunnr = i_cash_input-cust_no.
*"----------------------------------------------------------------------
*"*" Get the Account no deatils of the customer number
*"----------------------------------------------------------------------
IF t_cash_itm_det[] IS NOT INITIAL.
SELECT * FROM zsmp_cash_ac_det INTO TABLE it_ac_det FOR ALL ENTRIES IN t_cash_itm_det
WHERE cust_no = t_cash_itm_det-cust_no.
ENDIF.
*"----------------------------------------------------------------------
*"*" Building the BAPI Document Header Details
*"----------------------------------------------------------------------
l_dochead-obj_type = space.
l_dochead-obj_key = space.
l_dochead-obj_sys = space.
l_dochead-bus_act = 'RFBU'.
l_dochead-comp_code = lv_bukrs.
l_dochead-doc_date = l_datum.
l_dochead-pstng_date = l_datum.
l_dochead-doc_type = 'DZ'.
l_dochead-username = i_cash_input-username.
l_dochead-fisc_year = sy-datum+0(4). "Fiscal Year
CONCATENATE text-001 i_cash_input-cust_no 'on'
l_datum INTO l_dochead-header_txt SEPARATED BY space.
CLEAR:lv_seq_no.
*"----------------------------------------------------------------------
*"*" Building the Account GL Table Details
*"----------------------------------------------------------------------
LOOP AT t_cash_itm_det.
lv_seq_no = lv_seq_no + 1.
wa_accgl-itemno_acc = lv_seq_no. ""t_cash_itm_det-invoice_no.
* wa_accgl-comp_code = lv_bukrs.
READ TABLE it_ac_det INTO wa_ac_det WITH KEY cust_no = i_cash_input-cust_no.
IF sy-subrc = 0.
wa_accgl-gl_account = wa_ac_det-ac_no. "'105200'. ""t_cash_itm_det-invoice_no.
ELSE.
wa_accgl-gl_account = '130002'.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_accgl-gl_account
IMPORTING
output = wa_accgl-gl_account.
wa_accgl-profit_ctr = '5031'. ""w_postings-prcent.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_accgl-profit_ctr
IMPORTING
output = wa_accgl-profit_ctr.
APPEND wa_accgl TO t_accgl.
CLEAR: wa_accgl.
wa_curramt-itemno_acc = lv_seq_no. ""t_cash_itm_det-invoice_no.
*** wa_curramt-curr_type = c_doc_curr. "Document Currency
wa_curramt-currency = 'KWD'. ""i_cash_input-currency.
wa_curramt-amt_doccur = t_cash_itm_det-amt_received * ( 1 ).
APPEND wa_curramt TO t_curramt.
CLEAR wa_curramt.
lv_seq_no = lv_seq_no + 1.
wa_accrec-itemno_acc = lv_seq_no.
wa_accrec-customer = i_cash_input-cust_no.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_accrec-customer
IMPORTING
output = wa_accrec-customer.
APPEND wa_accrec TO t_accrec.
CLEAR: wa_accrec.
wa_curramt-itemno_acc = lv_seq_no.
wa_curramt-currency = 'KWD'. "" i_cash_input-currency.
wa_curramt-amt_doccur = t_cash_itm_det-amt_received * ( -1 ).
APPEND wa_curramt TO t_curramt.
CLEAR wa_curramt.
ENDLOOP.
SORT t_curramt BY itemno_acc DESCENDING.
*"----------------------------------------------------------------------
*"*" Call the BAPI to Post the Document Deatils
*"----------------------------------------------------------------------
DATA: l_obj_type TYPE BAPIACHE09-OBJ_TYPE,
l_obj_key TYPE BAPIACHE09-OBJ_KEY,
l_obj_sys TYPE BAPIACHE09-OBJ_SYS.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = l_dochead
IMPORTING
OBJ_TYPE = l_obj_type
OBJ_KEY = l_obj_key
OBJ_SYS = l_obj_sys
TABLES
accountgl = t_accgl
accountreceivable = t_accrec
currencyamount = t_curramt
return = t_ret.
READ TABLE t_ret INTO wa_ret WITH KEY type = 'E'.
**** In case of any error rollback all the details *******
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
e_return_type = 'E'.
e_return_text = text-004. " Error While creating the document details
**** In case of success commit all the details *******
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
e_return_type = 'S'.
READ TABLE t_ret INTO wa_ret WITH KEY type = 'S'.
IF sy-subrc = 0.
e_return_text = l_obj_key+0(10).
ENDIF.
ENDIF.
Also find the below document For base line date and Payment terms
Regards
Rajkumar Narasimman
Dear Frds,
I have a scenerio , I made a invoice to customer Rs 1000/- . But my customer is paying only Rs 500/- only .. so i am going to F-28 and doing partial payment......
In invoice i will get the accounting entry .... I will make partial payment entry Rs 500 /- after a month generate accounting entry ... Here I need to update baseline date to be orginal invoiced accounting entry posting date .. how to achieve these ........help me out.
Kabil....
2015 Apr 16 7:22 AM
Hi Kabil,
Here we are posting the document without referring the invoice number.
We can do the same using BAPI BAPI_ACC_DOC_POST, kindly check the below code.
*"----------------------------------------------------------------------
*"*" Data Declaration
*"----------------------------------------------------------------------
DATA: l_dochead LIKE bapiache09,
t_accpay LIKE TABLE OF bapiacap09,
t_accrec LIKE TABLE OF bapiacar09,
t_curramt LIKE TABLE OF bapiaccr09,
wa_curramt TYPE bapiaccr09,
t_accgl LIKE TABLE OF bapiacgl09,
wa_accgl TYPE bapiacgl09,
t_extension1 LIKE TABLE OF bapiacextc,
l_ret LIKE bapiret2,
t_ret LIKE TABLE OF bapiret2,
wa_ret TYPE bapiret2,
wa_accrec TYPE bapiacar09,
it_ac_det TYPE TABLE OF zsmp_cash_ac_det,
wa_ac_det TYPE zsmp_cash_ac_det,
l_sd_casr_ps TYPE zfi_casr_ps,
l_item1 TYPE int2,
l_datum TYPE datum,
lv_bukrs TYPE bukrs,
lv_seq_no TYPE posnr_acc.
*"----------------------------------------------------------------------
*"*" Refresh Internal Table & Work Area
*"----------------------------------------------------------------------
CLEAR:l_dochead,wa_curramt,l_ret,lv_bukrs,wa_accgl,wa_ac_det,lv_seq_no.
REFRESH:t_accpay,t_accrec,t_curramt,t_accgl,t_ret,it_ac_det.
l_datum = sy-datum.
*"----------------------------------------------------------------------
*"*" Get the Company code of the Customer Number
*"----------------------------------------------------------------------
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = i_cash_input-cust_no
IMPORTING
output = i_cash_input-cust_no.
SELECT SINGLE bukrs FROM knb1 INTO lv_bukrs WHERE kunnr = i_cash_input-cust_no.
*"----------------------------------------------------------------------
*"*" Get the Account no deatils of the customer number
*"----------------------------------------------------------------------
IF t_cash_itm_det[] IS NOT INITIAL.
SELECT * FROM zsmp_cash_ac_det INTO TABLE it_ac_det FOR ALL ENTRIES IN t_cash_itm_det
WHERE cust_no = t_cash_itm_det-cust_no.
ENDIF.
*"----------------------------------------------------------------------
*"*" Building the BAPI Document Header Details
*"----------------------------------------------------------------------
l_dochead-obj_type = space.
l_dochead-obj_key = space.
l_dochead-obj_sys = space.
l_dochead-bus_act = 'RFBU'.
l_dochead-comp_code = lv_bukrs.
l_dochead-doc_date = l_datum.
l_dochead-pstng_date = l_datum.
l_dochead-doc_type = 'DZ'.
l_dochead-username = i_cash_input-username.
l_dochead-fisc_year = sy-datum+0(4). "Fiscal Year
CONCATENATE text-001 i_cash_input-cust_no 'on'
l_datum INTO l_dochead-header_txt SEPARATED BY space.
CLEAR:lv_seq_no.
*"----------------------------------------------------------------------
*"*" Building the Account GL Table Details
*"----------------------------------------------------------------------
LOOP AT t_cash_itm_det.
lv_seq_no = lv_seq_no + 1.
wa_accgl-itemno_acc = lv_seq_no. ""t_cash_itm_det-invoice_no.
* wa_accgl-comp_code = lv_bukrs.
READ TABLE it_ac_det INTO wa_ac_det WITH KEY cust_no = i_cash_input-cust_no.
IF sy-subrc = 0.
wa_accgl-gl_account = wa_ac_det-ac_no. "'105200'. ""t_cash_itm_det-invoice_no.
ELSE.
wa_accgl-gl_account = '130002'.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_accgl-gl_account
IMPORTING
output = wa_accgl-gl_account.
wa_accgl-profit_ctr = '5031'. ""w_postings-prcent.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_accgl-profit_ctr
IMPORTING
output = wa_accgl-profit_ctr.
APPEND wa_accgl TO t_accgl.
CLEAR: wa_accgl.
wa_curramt-itemno_acc = lv_seq_no. ""t_cash_itm_det-invoice_no.
*** wa_curramt-curr_type = c_doc_curr. "Document Currency
wa_curramt-currency = 'KWD'. ""i_cash_input-currency.
wa_curramt-amt_doccur = t_cash_itm_det-amt_received * ( 1 ).
APPEND wa_curramt TO t_curramt.
CLEAR wa_curramt.
lv_seq_no = lv_seq_no + 1.
wa_accrec-itemno_acc = lv_seq_no.
wa_accrec-customer = i_cash_input-cust_no.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_accrec-customer
IMPORTING
output = wa_accrec-customer.
APPEND wa_accrec TO t_accrec.
CLEAR: wa_accrec.
wa_curramt-itemno_acc = lv_seq_no.
wa_curramt-currency = 'KWD'. "" i_cash_input-currency.
wa_curramt-amt_doccur = t_cash_itm_det-amt_received * ( -1 ).
APPEND wa_curramt TO t_curramt.
CLEAR wa_curramt.
ENDLOOP.
SORT t_curramt BY itemno_acc DESCENDING.
*"----------------------------------------------------------------------
*"*" Call the BAPI to Post the Document Deatils
*"----------------------------------------------------------------------
DATA: l_obj_type TYPE BAPIACHE09-OBJ_TYPE,
l_obj_key TYPE BAPIACHE09-OBJ_KEY,
l_obj_sys TYPE BAPIACHE09-OBJ_SYS.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = l_dochead
IMPORTING
OBJ_TYPE = l_obj_type
OBJ_KEY = l_obj_key
OBJ_SYS = l_obj_sys
TABLES
accountgl = t_accgl
accountreceivable = t_accrec
currencyamount = t_curramt
return = t_ret.
READ TABLE t_ret INTO wa_ret WITH KEY type = 'E'.
**** In case of any error rollback all the details *******
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
e_return_type = 'E'.
e_return_text = text-004. " Error While creating the document details
**** In case of success commit all the details *******
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
e_return_type = 'S'.
READ TABLE t_ret INTO wa_ret WITH KEY type = 'S'.
IF sy-subrc = 0.
e_return_text = l_obj_key+0(10).
ENDIF.
ENDIF.
Also find the below document For base line date and Payment terms
Regards
Rajkumar Narasimman
2015 Apr 16 8:01 AM
Hi Rajkumar,
I m going to refer based on invoice number . My concern is in the based on the partial payment i am going to calculate customer age in ztransaction report
2015 Apr 16 10:37 AM
Hi Kabil,
Can you please pass the Invoice number in DOCUMENTHEADER-REF_DOC_NO.
Regards
Rajkumar Narasimman
2015 Apr 16 2:01 PM
Hi rajkumar,
My scenerio is
| Document Number | Year | Posting date | Amount | Invoice Reference number | Assignment field |
| 30000625 | 2009 | 20091028 | 12500 | 911000629 | 211000652 |
| 1400001259 | 2015 | 20150413 | 500 | 911000629 | 211000652 |
Ist line has original invoice document & 2nd line is partially paid amount.
i want to calculate customer age based on original 1st line 28.10.2009 . not using partial payment date.
13.04.2015
2015 Apr 18 5:52 AM
Dear Rajkumar,
I have completed the issue by referring original document to calculate the customer age. I am closing the thread....................
Kabil
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |