‎2012 Apr 03 10:11 AM
Hi
I use program RFBIBL00 to accounting but when I enter some value on field which doesn't exists on the screen (for example COBL t. OXK1)
then I got error in SM35. How to check before posting which field for account is visible on screen or not?
‎2012 Apr 03 3:26 PM
If you cannot obtain clear rules from functional (and have some time to develop)
- First call FI_GET_FIELD_SELECTION_STRING or FI_FIELD_SELECTION_DETERMINE to get the FAUS1/FAUS2 string for field selections
- Then build a dummy BSEG-like record and use FI_CHECK_ACCOUNT_ASSIGNMENT in a LOOP to determine missing or not allowed fields.
Personally I do not use RFBIBL00 long time, but either I call a BAPI like BAPI_ACC_DOCUMENT_POST or sometimes FM POSTING_INTERFACE_START, POSTING_INTERFACE_DOCUMENT and POSTING_INTERFACE_END.
Regards,
Raymond
‎2012 Apr 03 2:19 PM
You (or your functional analyst) have to work through the different situations individually and only include those fields that are needed.
Rob
‎2012 Apr 03 3:26 PM
If you cannot obtain clear rules from functional (and have some time to develop)
- First call FI_GET_FIELD_SELECTION_STRING or FI_FIELD_SELECTION_DETERMINE to get the FAUS1/FAUS2 string for field selections
- Then build a dummy BSEG-like record and use FI_CHECK_ACCOUNT_ASSIGNMENT in a LOOP to determine missing or not allowed fields.
Personally I do not use RFBIBL00 long time, but either I call a BAPI like BAPI_ACC_DOCUMENT_POST or sometimes FM POSTING_INTERFACE_START, POSTING_INTERFACE_DOCUMENT and POSTING_INTERFACE_END.
Regards,
Raymond
‎2012 Apr 04 9:19 AM
Thanx for advices but how to use FI_CHECK_ACCOUNT_ASSIGNMENT.
I don't know what to do with parameters:
I_KON_GROUP
I_SCREEN_NAME
?
‎2012 Apr 04 9:50 AM
Remember I wrote :
If you cannot obtain clear rules from functional (and have some time to develop)
Those are SCREEN-GROUP1 and SCREEN-NAME of the fields you want to check in the current dynpro in the FI posting transaction. Look at the batch-input in error in SM35 and navigate to the dynpro definitions for the fields in error, you can also identify the group reading the source code of FI_CHECK_ACCOUNT_ASSIGNMENT.
Example : Order on dynpro SAPLKACB/1015 is name = 'COBL-AUFNR' and group = '011'
Regards,
Raymond
‎2012 Apr 03 3:28 PM
I can put some fields for you here that might help you. But I also agree with Rob
it will always vary from case to case, you should consult with FD-er. Instead of using the RFIFBL00, here I am using three function modules that are used by the RFBIBL00 program for posting.
*----------------------------------------------------------------------*
* DATA/VARIABLE DECLARATION *
*----------------------------------------------------------------------*
DATA:
lwa_ftpost TYPE ftpost,
li_ftpost TYPE STANDARD TABLE OF ftpost,
li_blntab TYPE STANDARD TABLE OF blntab,
li_fttax TYPE STANDARD TABLE OF fttax,
lwa_account_gl TYPE bapiacgl09,
lwa_curr_amount TYPE bapiaccr09,
lwa_acr_rec TYPE bapiacar09,
l_count1(3) TYPE c VALUE '001',
lv_userid TYPE apq_mapn,
lo_ref TYPE REF TO z0fin4895cl_methods,
lv_date TYPE datum.
*----------------------------------------------------------------------*
* CONSTANTS DECLARATION *
*----------------------------------------------------------------------*
CONSTANTS:
c_function TYPE funct_pi VALUE 'B',
" B= BDC, C= Call Trans
c_tcode TYPE sytcode VALUE 'FB01',
c_function1 TYPE sgfunct_pi VALUE 'B', "B= BDC session
c_header TYPE c VALUE 'K', "Header
c_item TYPE c VALUE 'P', "Item
c_one(3) TYPE c VALUE '001',
c_credit(2) TYPE c VALUE '50',
c_debit(2) TYPE c VALUE '40',
c_session TYPE apq_grpn VALUE '4895', "Session name
c_flag TYPE apq_qdel VALUE 'X'.
*Prepare the Header for Posting
* Document date
CREATE OBJECT lo_ref.
CALL METHOD lo_ref->convert_date
EXPORTING
input_date = documentheader-doc_date
IMPORTING
output_date = lv_date.
lwa_ftpost-stype = c_header.
lwa_ftpost-count = c_one.
lwa_ftpost-fnam = text-001.
lwa_ftpost-fval = lv_date.
APPEND lwa_ftpost TO li_ftpost.
CLEAR: lwa_ftpost,
lv_date.
* Document Type
lwa_ftpost-stype = c_header.
lwa_ftpost-count = c_one.
lwa_ftpost-fnam = text-002.
lwa_ftpost-fval = documentheader-doc_type.
APPEND lwa_ftpost TO li_ftpost.
CLEAR lwa_ftpost.
* Company Code
lwa_ftpost-stype = c_header.
lwa_ftpost-count = c_one.
lwa_ftpost-fnam = text-003.
lwa_ftpost-fval = documentheader-comp_code.
APPEND lwa_ftpost TO li_ftpost.
CLEAR lwa_ftpost.
* Posting date
CALL METHOD lo_ref->convert_date
EXPORTING
input_date = documentheader-pstng_date
IMPORTING
output_date = lv_date.
lwa_ftpost-stype = c_header.
lwa_ftpost-count = c_one.
lwa_ftpost-fnam = text-004.
lwa_ftpost-fval = lv_date.
APPEND lwa_ftpost TO li_ftpost.
CLEAR: lwa_ftpost,
lv_date.
* Fiscal period
lwa_ftpost-stype = c_header.
lwa_ftpost-count = c_one.
lwa_ftpost-fnam = text-005.
lwa_ftpost-fval = documentheader-fis_period.
APPEND lwa_ftpost TO li_ftpost.
CLEAR lwa_ftpost.
READ TABLE curr_amount INTO lwa_curr_amount INDEX 1.
IF sy-subrc EQ c_zero.
lwa_ftpost-stype = c_header.
lwa_ftpost-count = c_one.
lwa_ftpost-fnam = text-006.
lwa_ftpost-fval = lwa_curr_amount-currency.
APPEND lwa_ftpost TO li_ftpost.
CLEAR:
lwa_ftpost,
lwa_curr_amount.
ENDIF.
*Reference Document Number
lwa_ftpost-stype = c_header.
lwa_ftpost-count = c_one.
lwa_ftpost-fnam = text-007.
lwa_ftpost-fval = documentheader-ref_doc_no.
APPEND lwa_ftpost TO li_ftpost.
CLEAR lwa_ftpost.
* Prepare the line-item for Posting.
LOOP AT account_gl INTO lwa_account_gl.
READ TABLE curr_amount INTO lwa_curr_amount
WITH KEY itemno_acc = lwa_account_gl-itemno_acc BINARY SEARCH.
IF sy-subrc EQ 0.
* G/L Account
lwa_ftpost-stype = c_item.
lwa_ftpost-count = l_count1.
lwa_ftpost-fnam = text-008.
lwa_ftpost-fval = lwa_account_gl-gl_account.
APPEND lwa_ftpost TO li_ftpost.
CLEAR lwa_ftpost.
* Posting key
IF lwa_curr_amount-amt_doccur LT c_zero.
"-ve signal, posting key = 50,Credit
lwa_ftpost-stype = c_item.
lwa_ftpost-count = l_count1.
lwa_ftpost-fnam = text-009.
lwa_ftpost-fval = c_credit.
APPEND lwa_ftpost TO li_ftpost.
CLEAR lwa_ftpost.
ELSE. "+ve signal, posting key = 40, Debit
lwa_ftpost-stype = c_item.
lwa_ftpost-count = l_count1.
lwa_ftpost-fnam = text-009.
lwa_ftpost-fval = c_debit.
APPEND lwa_ftpost TO li_ftpost.
CLEAR lwa_ftpost.
ENDIF.
* Amount in document currency
lwa_ftpost-stype = c_item.
lwa_ftpost-count = l_count1.
lwa_ftpost-fnam = text-010.
lwa_ftpost-fval = abs( lwa_curr_amount-amt_doccur ).
SHIFT lwa_ftpost-fval LEFT DELETING LEADING space.
APPEND lwa_ftpost TO li_ftpost.
CLEAR lwa_ftpost.
READ TABLE acr_recv INTO lwa_acr_rec
WITH KEY itemno_acc = lwa_account_gl-itemno_acc BINARY SEARCH.
* Allocation number/Assignment Number
lwa_ftpost-stype = c_item.
lwa_ftpost-count = l_count1.
lwa_ftpost-fnam = text-012.
lwa_ftpost-fval = lwa_account_gl-alloc_nmbr.
APPEND lwa_ftpost TO li_ftpost.
CLEAR lwa_ftpost.
* Item Text
lwa_ftpost-stype = c_item.
lwa_ftpost-count = l_count1.
lwa_ftpost-fnam = text-013.
lwa_ftpost-fval = lwa_account_gl-item_text.
APPEND lwa_ftpost TO li_ftpost.
CLEAR lwa_ftpost.
* Cost Center
lwa_ftpost-stype = c_item.
lwa_ftpost-count = l_count1.
lwa_ftpost-fnam = text-014.
lwa_ftpost-fval = lwa_account_gl-costcenter.
APPEND lwa_ftpost TO li_ftpost.
CLEAR lwa_ftpost.
* Profit Center
lwa_ftpost-stype = c_item.
lwa_ftpost-count = l_count1.
lwa_ftpost-fnam = text-015.
lwa_ftpost-fval = lwa_account_gl-profit_ctr.
APPEND lwa_ftpost TO li_ftpost.
CLEAR lwa_ftpost.
l_count1 = l_count1 + 1.
CLEAR:lwa_account_gl,
lwa_curr_amount.
ENDIF.
ENDLOOP.
CLEAR: l_count1.
IF li_ftpost IS NOT INITIAL.
MOVE: sy-uname TO lv_userid.
* Interface Start.
CALL FUNCTION 'POSTING_INTERFACE_START'
EXPORTING
i_function = c_function
i_group = c_session
i_keep = c_flag
i_user = lv_userid
EXCEPTIONS
client_incorrect = 1
function_invalid = 2
group_name_missing = 3
mode_invalid = 4
update_invalid = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE eXXX
ENDIF.
* Interface posting
CALL FUNCTION 'POSTING_INTERFACE_DOCUMENT'
EXPORTING
i_tcode = c_tcode
i_sgfunct = c_function1
TABLES
t_blntab = li_blntab
t_ftpost = li_ftpost
t_fttax = li_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
company_code_invalid = 9
screen_not_found = 10
no_authorization = 11
OTHERS = 12.
IF sy-subrc NE 0.
MESSAGE eXXX.
ENDIF.
*Interface end
CALL FUNCTION 'POSTING_INTERFACE_END'
EXCEPTIONS
session_not_processable = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE eXXX.
ENDIF.
Regards.
Tanmoy