I have read many question from peoples about how to create many profitability Analysis Document which is reference to one G/L Account under one accounting document, as we know we can't create PA ( Profitability Analysis ) document on one G/L Account more than one PA Document using SAP Standard Transaction.
Solution for this problem can be solved using POSTING_INTERFACE_DOCUMENT and BAPI_COPAACTUALS_POSTCOSTDATA ( this moment i'm only discuss using this function and bapi ) the reason using POSTING_INTERFACE_DOCUMENT is about Tax Calculation and easy to use - SAP will calculate tax automatically. Let's started how to entry one COPA Data first.
1. Create One PA Document using POSTING_INTERFACE_DOCUMENT
Using FB01 , COPA entry is required to entry if G/L Account has been assignment to COPA Object .
Now the question is how to create program using POSTING_INTERFACE_DOCUMENT to posting PA Document ?? ( i suppose you know to use POSTING_INTERFACE_DOCUMENT.
CALL FUNCTION 'POSTING_INTERFACE_START'
EXPORTING
i_function = 'C'.
-----------------------------------------------------
CALL FUNCTION 'POSTING_INTERFACE_DOCUMENT'
EXPORTING
i_tcode = 'FB01'
IMPORTING
e_subrc = 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 = gi_ftpost
t_fttax = gi_fttax
t_blntab = gi_xblntab.
-------------------------------------
CALL FUNCTION 'POSTING_INTERFACE_END'.
1. Populating gi_ftpost with header data
Ex :
gi_ftpost-count = lv_line.
gi_ftpost-stype = 'K'.
gi_ftpost-fnam = 'BKPF-BUKRS'.
gi_ftpost-fval = gi_header-bldat.
APPEND gi_ftpost. < ...... >>
2. Populating gi_ftpost with item data.
*POSTING KEY
gi_ftpost-stype = 'P'.
gi_ftpost-fnam = 'RF05A-NEWBS'.
gi_ftpost-fval = gi_input_summ-newbs.
APPEND gi_ftpost. < ........ >>
3. Populating gi_ftpost with COPA Data.
gi_ftpost-fnam = 'BSEG-RKE_BUKRS'.
gi_ftpost-fval = gi_input-bukrs.
APPEND gi_ftpost. < ..... >>>
gi_ftpost-fnam = 'BSEG-RKE_ERLOS'.
gi_ftpost-fval = gi_input-erlos.
APPEND gi_ftpost. < ..... >>>
Note : Company Code is mandatory entry in COPA,
Now take a look difference between BUKRS on item data and BUKRS on COPA Data, yes the answer is we must populate itab with pattern BSEG-RKE_<field ..> why ? the answer is located inside POSTING_INTERFACE_CODE in LFIPIF00 Include.
Ok discussing about create one COPA is finished, let's continue discussing about how to create many COPA Document reference to one G/L Account on accounting document.
1. After Accounting Document has been created using POSTING_INTERFACE_DOCUMENT. ( Read t_blntab = gi_xblntab to get generated accounting document ). then use BAPI_COPAACTUALS_POSTCOSTDATA our next step.
2. Suppose you know how to use this BAPI .
The most important step is you must fill these field ( note : you can entry other field as needed ) :
<.... >>
gi_bapi_copa_data-record_id = lv_recordidc.
gi_bapi_copa_data-fieldname = 'BUKRS'.
gi_bapi_copa_data-value = gi_input-bukrs. "'5010'.
APPEND gi_bapi_copa_data.
gi_bapi_copa_data-record_id = lv_recordidc.
gi_bapi_copa_data-fieldname = 'KSTAR'.
gi_bapi_copa_data-value = gi_input-newko.
APPEND gi_bapi_copa_data. <......>>>
Now this is the result. :
Result : 1 GL Account 3100101001 have 4 COPA Data ( Profitability Analysis Document ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
5 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 |