cancel
Showing results for 
Search instead for 
Did you mean: 

How to fill the fields KATYP, MGEFL and MSEHI in the segment E1SKB1M of GLMAST01?

Sandra_Rossi
Active Contributor
0 Kudos
134

I'm creating a custom program which creates G/L accounts (FS00, tables SKA1, etc.) by creating an Inbound IDoc of type GLMAST01, and to make it easier, I'm using a G/L account created manually, by looking at the columns of the tables SKA1, SKAT and SKB1 and passing their values to the eponymous fields of the segments E1SKA1M, E1SKATM and E1SKB1M.

NB: it has been decided to create a custom program, instead of using migration tools like LSMW, Migration Cockpit or whatever, for some reasons I won't discuss here.

It's all fine, except that I don't understand how to fill the fields KATYP, MGEFL and MSEHI in the segment E1SKB1M, there are no corresponding columns in the table SKB1.

Thanks.

Sandra

System: S/4HANA ONPREMISE 2023 FPS 01.

NB: there is also the field RESERVE of 20 characters (in the segments E1SKA1M and E1SKB1M), which seems to not be used now but I guess it's reserved for feature use, as can be deduced for instance from the description in the note 1515852 - ALE FIDCCP02: Tax reporting date is not sent - SAP for Me (E1FIKPF-RESERVE in IDOC message types FIDCC1 and FIDCC2.

View Entire Topic
Sandra_Rossi
Active Contributor
0 Kudos

The 3 fields KATYP, MGEFL and MSEHI of the segment E1SKB1M come from the table CSKB.

Fill them the same way as done by the function module MASTERIDOC_CREATE_GLMAST (it's the one called by the transaction BD18 which generates outbound IDocs for existing G/L accounts):

 

        IF lv_glaccount_type <> if_gl_account_master=>gc_glaccount_type-pl_neutral.
          SELECT SINGLE katyp mgefl msehi INTO CORRESPONDING FIELDS OF e1skb1m
          FROM cskb JOIN tka02 ON tka02~kokrs = cskb~kokrs "#EC CI_BUFFJOIN
          WHERE tka02~bukrs = skb1key-bukrs
          AND   cskb~kstar  = skb1key-saknr
          AND   cskb~datbi >= sy-datum
          AND   cskb~datab <= sy-datum.
        ENDIF.
        IF sy-subrc <> 0 OR
           lv_glaccount_type = if_gl_account_master=>gc_glaccount_type-pl_neutral.
          e1skb1m-katyp = '!'.
        ELSEIF e1skb1m-msehi IS NOT INITIAL.
          CALL FUNCTION 'UNIT_OF_MEASURE_SAP_TO_ISO'
            EXPORTING
              sap_code = e1skb1m-msehi
            IMPORTING
              iso_code = e1skb1m-msehi
            EXCEPTIONS
              OTHERS   = 0.
        ENDIF.

 

LV_GLACCOUNT_TYPE is SKA1-GLACCOUNT_TYPE and the constant PL_NEUTRAL is "N".

The table TKA02 assigns one controlling area for each company code, which is needed to join SKB1 (key: G/L account and company code) to CSKB (key: cost element and controlling area).