Posting interface – check if field required

I had a problem when implementing some posting’n’clearing action (FM POSTING_INTERFACE_CLEARING).
Once I’ve filled correctly all required fields I’ve found that with other account it doesn’t work.
The answer is simple – the field requirement is handled with configuration in OB14 transaction.

Underneath you’ll find some slides with an example.
OB14 main list
OB14 – main list (Field status group is assigned to an account and company code)
OB14 - group overview
OB14 – usually for standard posting/clearing “Payment transactions” is used
OB14 - details
OB14 – details for “Payment transactions”. As we can see “Value date” is required in this group.

From OB14 transaction it looks great and clear, but if we go deeper in technical details you’ll find it’s not so easy as in other SAP areas.
The configuration is stored in F004F tab and an entry for “Payment transactions” may look like this:
..-.-+——————————————–
As you can see it’s not so obvious to find which field’s are obligatory and which not.

During posting when you use an account with this group – our field (Value date) be visible and required – so when you code your fields for Posting Interface input or for batch processing you need to know if this field is required or not. Otherwise you’ll get an error.

To resolve this issue I’ve created an method to calculate if this field is required or not. Underneath you’ll find an interface for this meth.:

  class-methods CHECK_IF_FIELD_REQ_FOR_ACC

    importing

      !TABNAME type TABNM

      !FIELDNAME type FIELDNAME

      !ACCOUNT_TYPE type KOART default ‘S’

      !ACCOUNT_NR type BSEGHKONT

      !CO_CODE type BSEGBUKRS

    returning

      value(FIELD_REQUIRED) type BOOLEAN .

As you can see input parameters are: Company code, Acount number, tabname, fieldname, account type (as default S – for G/L accounts).
Tabname and fieldname you can obtain from a transaction where you enter FI document manually (fe. F-02, F-04…) – just check with F1.
Underneath is an example of usage of this method, which usually should be call when filling fields for t_ftpost table.

      "check if value
date required

      if ( ‘X’ = zcl_tool_fi=>check_if_field_req_for_acc(

            tabname        = ‘BSEG’

            fieldname      = ‘VALUT’

            account_nr     = itmaccnt1

            co_code        = hdrcomp_code ) ).

        ftpostfnam = ‘BSEG-VALUT’.

        WRITE itmcurr_date TO ftpostfval.

        APPEND ftpost TO t_ftpost.

      endif.

Finally – what’s most interesting for all of you probably a copy-paste ABAP code of this method.

  method CHECK_IF_FIELD_REQ_FOR_ACC.

 

    data: TAX_CODE type SKB1MWSKZ,

          FIELD_STATUS type T004FFAUS1,

          shift type sytabix.

 

 

    "1. get modif by fieldname

 

    select single *

      into @data(tmodu)

      from tmodu

      where tabnm = @tabname

        and feldn = @fieldname

        and koart = @account_type.

   if sysubrc <> 0.

     return.

   endif.

 

   "2. get config string

    call function ‘GET_FIELDSTATUS_FOR_GL_ACCT’

         exporting

              i_account_nr    = account_nr

              i_company_code  = co_code

              i_account_type  = account_type

       "      
i_sei           = l_special_entry_indicator

         importing

              e_tax_code      = tax_code

              e_field_status  = field_status

         exceptions

              no_account_type = 01

              no_account      = 02

              no_company_code = 03

              no_master_data  = 04

              no_status_found = 05.

    if sysubrc = 0.

 

 

  "3. field status/config
verification

      data(len) = STRLEN( field_status ).

      shift = tmodumodif1. "need
to shift – first one starts with 0

 

      if shift < len.

        if field_status+shift(1) = ‘+’.

          field_required = ‘X’.

        endif.

      endif.

 

    endif.

 

  endmethod.

Enjoy using it. Should be helpful running Posting interface including both POSTING_INTERFACE_DOCUMENT and POSTING_INTERFACE_CLEARING FMs…

Published by

Captain SAP

Captain SAP is a technical consultant with over 15 yeras of expierience in integrated systems implementation.

Leave a Reply

Your email address will not be published. Required fields are marked *