Skip to Content
Technical Articles

S/4HANA Commodity Code

What is the commodity code and how is it defined in the material master data?

 

One of the innovations that comes with S/4HANA is the change in commodity codes.

Sap Note: https://launchpad.support.sap.com/#/notes/2432527

Thread : https://answers.sap.com/questions/651551/where-is-the-configuration-of-commodity-codes-to-s.html?childToView=664237#answer-664237

What is Commodity Code?

If you import or export goods from within the European Union (EU) or outside it, you should understand the importance of commodity codes.

When trading internationally, you will need to find the correct commodity code for your goods so you can fill out customs paperwork accurately. The code is an eight-digit number for exports outside the EU or goods moving within the EU, but is a ten-digit number for imports from outside the EU. Once you know the commodity code, you can look up other important information such as duty rates and any import or export restrictions.

Classifying goods and how to do it

When trading internationally, you need to choose the right commodity code for your goods. The following describes how to define the classification codes.

Classifying your goods correctly will help ensure that you:

  • Pay the right duty and VAT
  • Know whether an import or export licence is needed

You are legally responsible for the correct classification of your goods, even if you use an agent. Incorrect classification can lead to your goods being delayed or seized and you will have to pay any duty and tax owed, plus possible financial penalties.

 

Identification of commodity codes to the system

The SAP GUI has an operation code / SAPSLL / CLSNR_01 where you can define commodity codes.

When you continue by entering the Number Scheme which you defined in the SAP GUI System, a screen appears as follows

You can define or delete the Commodity Codes on this screen.

A new commodity code is defined as follows.

The defined Commodity Codes be seen in the following tables as stated in SAP Note.

”Even though this information is not saved in the obsolete tables (MARC, T604, T604T) anymore, it still visible there anyway”

These datas are stored in  /SAPSLL/CLSNR (Trade Classification Number) tables. You can find the description of commodity codes in  /SAPSLL/CLSNRT (description of commodity codes) tables.

There are 2 methods to use the Commodity Code generated at the SAP GUI. The first one is the Migration Cockpit and the second one is / SAPSLL / CL_PRCLS_API. We will examine these two methods

  1. The first one is the transaction code of LTMC (Migration Cockpit).

In the Name field, enter the corresponding description and press the Create button.

There are commodity codes from the Migration Objects field. To start the process, the document is selected and opened.

The corresponding template is downloaded from the next screen.

Before making changes, I want to show where the change is made from the Material main data screen. The commodity code in the material master data is not open for data entry.

Relevant fields are entered in the Downloaded Material Commodity Code template.

On the Migration Cockpit screen, You can save the template with the “Upload” button.

After loading, we activate the process by “Activate” button and start the transfer.

4 Steps process. After uploading the information as in the screenshot below, the next step is called “Close”

When the data in Excell is loaded on the system, information is given about whether there is a missing, incorrect data entry in the description field. If there isnt any the incorrect data entry, the process is going on.

After you select all to match the values, the Confirm Mapping Values button is pressed. Or it can be done in manuel matching by entering the values from the name field.

On the last step, you can finish the process by “Finish” button.

We’ll see that the Commodity Code field is full when we go to check the material change to the main data screen

We entered the commodity code with the migration cockpit in this field which is closed to the data entry on the SAP GUI screen.

  1. The other method is that using /SAPSLL/CL_PRCLS_API. The related fields are entered by running Create_Classification

A constant value can be entered in the IV_STCTS, IV_DATAB, IV_DATBI fields.

The commodity code can be entered in the IV_CCNGN fields.  The material number can be entered in the IT_PRODUCTS fields.

Before the testing, The Commodity Code field in the material main data  screen as follows.

Enter the necessary parameters for changing and run the program.



The Commodity Code field in the material main data screen, as in the following screenshot, has changed.

As a result, it is seen that data can be entered into the commodity code field on the material main data screen using API and Migration Cockpit.

 

Hopefully, this blog will be helpful for everyone

Orhan Akman

13 Comments
You must be Logged on to comment or reply to a post.
  • Hi ,

     

    This is just uploading the Commodity code in S/4 HANA. It didn’t cover the working functionality of commodity code. But it will help us in implementation.

     

    Thanks,

    Sush K

  • Hi all,

    that’s the way to assign a commodity code to a material. But how can I create the commodity codes? Not 10, not 20, thousands. With BTCI on transaction /SAPSLL/CLSNR_01 I can not assign the description. Is there a method available?

     

    Kind Regards

    Norbert

    • Hi Norbert Bürger ,

      We have made a development as follows to be able to assign Commodity Codes to materials. We’re downloading an Excel template.

       

      After entering the Material and Commodity codes, we are doing excel upload.

      The code is as follows.

      *&---------------------------------------------------------------------*
      *& Report ZMM_MALZEME_GTIP
      *&---------------------------------------------------------------------*
      *&
      *&---------------------------------------------------------------------*
      *   Report         :  ZMM_MALZEME_GTIP
      *   Author         :  EBRU ZORLU
      *   Date           :  25.10.2018
      *   Program Type   :  Report/Program
      *   Tcode          :  -
      *   TS Number      :
      *   Program Purpose:  GTIP ATAMA
      
      *----------------------------------------------------------------------*
      *  MODIFICATION LOG:
      *----------------------------------------------------------------------*
      * CORR NO    |  DATE    |   PROGRAMMER  |   CHANGES DESCRIPTION
      *----------------------------------------------------------------------*
      *               25.10.2018  EBRU ZORLU   Initial Version
      *----------------------------------------------------------------------*
      REPORT zmm_malzeme_gtip.
      
      TYPE-POOLS: slis, icon.
      
      TABLES rlgrap.
      
      TYPES : BEGIN OF gty_rprt,
        cell,
        matnr  TYPE matnr,
        gtip  TYPE /sapsll/ccngn,
              END OF gty_rprt.
      
      TYPES : BEGIN OF gty_exc,
        field01(50) TYPE c,
        field02(50) TYPE c,
              END OF gty_exc.
      
      DATA: gt_exc TYPE TABLE OF gty_exc,
            gs_exc TYPE gty_exc.
      
      DATA: gt_rprt TYPE TABLE OF gty_rprt,
            gs_rprt TYPE gty_rprt.
      
      DATA: gt_intern TYPE TABLE OF alsmex_tabline,
            gs_intern TYPE alsmex_tabline.
      
      DATA: gv_string TYPE string.
      
      DATA: gt_fcat TYPE lvc_t_fcat,
            gs_fcat TYPE lvc_s_fcat,
            gs_layo TYPE lvc_s_layo.
      
      DATA: me TYPE REF TO /sapsll/cl_prcls_api.
      DATA: gv_datab TYPE /sapsll/datab,
            gv_datbi TYPE /sapsll/datbi,
            gv_stcts TYPE /sapsll/stcts.
      
      DATA: gs_product TYPE LINE OF /sapsll/matnr_t. " ? excelden mi gelcek?
      DATA: gt_product TYPE /sapsll/matnr_t. " ? excelden mi gelcek?
      
      DATA: gt_bapiret2_t TYPE bapiret2_t.
      
      
      SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
      SELECTION-SCREEN SKIP 1.
      PARAMETERS:  p_file TYPE rlgrap-filename MODIF ID sc1.
      SELECTION-SCREEN END OF BLOCK b1.
      
      SKIP.
      
      SELECTION-SCREEN PUSHBUTTON 1(20) TEXT-002 USER-COMMAND btn.
      
      **********************************************************************
      
      START-OF-SELECTION.
      
      gv_stcts =  'EU01'.
      gv_datab = '20180101'.
      gv_datbi = '29990101'.
      
      INITIALIZATION.
        PERFORM get_path.
      
      AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
        PERFORM open_file.
      
      AT SELECTION-SCREEN.
        PERFORM download_template.
      
      END-OF-SELECTION.
        PERFORM get_data.
      
        IF gt_rprt[] IS NOT INITIAL.
        PERFORM set_data.
        ENDIF.
      
      **********************************************************************
      
      FORM get_path.
        CALL METHOD cl_gui_frontend_services=>get_desktop_directory
          CHANGING
            desktop_directory    = gv_string
          EXCEPTIONS
            cntl_error           = 1
            error_no_gui         = 2
            not_supported_by_gui = 3
            OTHERS               = 4.
      
        CALL METHOD cl_gui_cfw=>update_view.
      ENDFORM.                    "get_path
      
      "excel şablonu indirir
      FORM download_template.
      
        DATA: lv_pos    TYPE numc2,
              lv_field  TYPE lvc_fname,
              lv_string TYPE string.
      
        FIELD-SYMBOLS <flv_field>.
      
        CONCATENATE gv_string '\malzeme_gtip_sablonu.xls' INTO lv_string.
      
        IF sy-ucomm EQ 'BTN'.
          CLEAR gt_exc.
          PERFORM create_fcat.
      
          LOOP AT gt_fcat INTO gs_fcat.
            CLEAR lv_pos.
      
            lv_pos = gs_fcat-col_pos.
      
            CONCATENATE 'FIELD' lv_pos INTO lv_field.
      
            ASSIGN COMPONENT lv_field OF STRUCTURE gs_exc TO <flv_field>.
      
            <flv_field> = gs_fcat-scrtext_m.
          ENDLOOP.
      
          APPEND gs_exc TO gt_exc.
      
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              filename = lv_string
              filetype = 'DAT'
            TABLES
              data_tab = gt_exc.
        ENDIF.
      ENDFORM.                    "download_template
      ********************************************************************
      
      FORM open_file.
        DATA: rc      TYPE i,
              lt_file TYPE filetable WITH HEADER LINE.
      
        REFRESH lt_file.
        CLEAR lt_file.
      
        CALL METHOD cl_gui_frontend_services=>file_open_dialog
          EXPORTING
            window_title            = 'Dosya adi..'
            default_extension       = '*'
            initial_directory       = gv_string
          CHANGING
            file_table              = lt_file[]
            rc                      = rc
          EXCEPTIONS
            file_open_dialog_failed = 1
            cntl_error              = 2
            error_no_gui            = 3
            not_supported_by_gui    = 4
            OTHERS                  = 5.
      
        READ TABLE lt_file INDEX 1.
        rlgrap-filename = lt_file-filename.
        p_file = rlgrap-filename.
      ENDFORM.                    "open_file
      
      **********************************************************************
      
      "excel verisini itaba atar
      FORM get_data.
      
        DATA lv_matnr TYPE matnr.
      
        DATA: lv_start_col TYPE i VALUE '1',
              lv_start_row TYPE i VALUE '2',
              lv_end_col   TYPE i VALUE '2',
              lv_end_row   TYPE i VALUE '10000'.
      
        FIELD-SYMBOLS: <fs>.
      
        DATA: lv_count    TYPE i,
              lv_totcount TYPE i,
              lv_percent  TYPE i,
              lv_index    TYPE i.
      
        IF p_file IS NOT INITIAL.
          rlgrap-filename = p_file.
          CLEAR: gt_exc, gt_rprt.
      
          CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
            EXPORTING
              filename                = rlgrap-filename
              i_begin_col             = lv_start_col
              i_begin_row             = lv_start_row
              i_end_col               = lv_end_col
              i_end_row               = lv_end_row
            TABLES
              intern                  = gt_intern
            EXCEPTIONS
              inconsistent_parameters = 1
              upload_ole              = 2
              OTHERS                  = 3.
      
          IF sy-subrc > 0.
            FORMAT COLOR COL_BACKGROUND INTENSIFIED.
            WRITE : / 'DOSYA OKUMA HATASI!'.
            WRITE : / 'TEKRAR DENEYINIZ!'.
            EXIT.
          ENDIF.
      
          DESCRIBE TABLE gt_intern LINES lv_totcount.
          CLEAR lv_count.
      
          IF gt_intern IS NOT INITIAL.
            SORT gt_intern BY row col.
            LOOP AT gt_intern INTO gs_intern.
              MOVE gs_intern-col TO lv_index.
              ASSIGN COMPONENT lv_index OF STRUCTURE gs_exc TO <fs>.
              MOVE gs_intern-value TO <fs>.
              AT END OF row.
                APPEND gs_exc TO gt_exc.
                CLEAR gs_exc.
              ENDAT.
            ENDLOOP.
          ENDIF.
      
          LOOP AT gt_exc INTO gs_exc.
            CLEAR gs_rprt.
      
            gs_rprt-matnr  = gs_exc-field01.
            gs_rprt-gtip   = gs_exc-field02.
            APPEND gs_rprt TO gt_rprt.
      
      *      ls_product =  gs_rprt-matnr .
      *      APPEND ls_product TO lt_product.
      
          ENDLOOP.
        ENDIF.
      ENDFORM.                    "get_data
      
      **********************************************************************
      
      FORM set_data.
      
        PERFORM create_layout.
        PERFORM create_fcat.
        PERFORM gtip.
      ENDFORM.
      
      **********************************************************************
      
      FORM create_layout.
        gs_layo-sel_mode  = 'D'.
        gs_layo-zebra     = 'X'.
        gs_layo-col_opt   = 'X'.
        gs_layo-box_fname = 'CELL'.
      ENDFORM.                    "create_layout
      
      **********************************************************************
      
      FORM create_fcat.
        CLEAR gt_fcat.
        PERFORM set_fcat USING '01' 'MATNR'  'Malzeme'.
        PERFORM set_fcat USING '02' 'GTIP'  'GTIP'.
      ENDFORM.                    "create_fcat
      
      **********************************************************************
      
      FORM set_fcat USING pv_cpos pv_fname pv_text.
        CLEAR gs_fcat.
        gs_fcat-col_pos   = pv_cpos.
        gs_fcat-fieldname = pv_fname.
        gs_fcat-scrtext_s =
        gs_fcat-scrtext_l =
        gs_fcat-scrtext_m =
        gs_fcat-reptext   =
        gs_fcat-coltext   = pv_text.
      
      
        APPEND gs_fcat TO gt_fcat.
      ENDFORM.                    "set_fcat
      
      **********************************************************************
      
      FORM display_alv.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
          EXPORTING
            i_callback_program       = sy-repid
            i_save                   = 'A'
            is_layout_lvc            = gs_layo
            it_fieldcat_lvc          = gt_fcat
            i_callback_pf_status_set = 'GUI'
            i_callback_user_command  = 'COMM'
          TABLES
            t_outtab                 = gt_rprt
          EXCEPTIONS
            program_error            = 1
            OTHERS                   = 2.
      ENDFORM.                    "display_alv
      
      **********************************************************************
      
      FORM gui USING rt_extab TYPE slis_t_extab.
        SET PF-STATUS 'MENU'.
      ENDFORM.                    "gui
      
      **********************************************************************
      
      FORM comm USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
        rs_selfield-refresh = 'X'.
      
        CASE r_ucomm.
          WHEN '&F03' OR '&F04' OR '&F05'.
            LEAVE PROGRAM.
      *    WHEN '&SAVE'.
      *      PERFORM aktar.
        ENDCASE.
      ENDFORM.                    "comm
      
      **********************************************************************
      
      FORM aktar CHANGING p_matnr.
      
      DATA lv_matnr TYPE matnr.
      
      *CLEAR lt_product.
      *  LOOP AT gt_rprt INTO gs_rprt .
      *    CLEAR lv_matnr.
      
          CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
            EXPORTING
              input  = p_matnr
            IMPORTING
              output = lv_matnr.
      
          p_matnr = lv_matnr.
      
      *      gs_product = lv_matnr.
      *      APPEND gs_product TO gt_product.
      
      *  ENDLOOP.
      
      ENDFORM.                                                    "aktar
      
      *&---------------------------------------------------------------------*
      *& Form GTIP
      *&---------------------------------------------------------------------*
      *& text
      *&---------------------------------------------------------------------*
      *& -->  p1        text
      *& <--  p2        text
      *&---------------------------------------------------------------------*
      FORM gtip .
      DATA: lv_matnr TYPE matnr,
            lt_bapiret2_t TYPE bapiret2_t.
      IF me IS INITIAL.
      CREATE OBJECT me.
      ENDIF.
      
      LOOP AT gt_rprt INTO gs_rprt .
      
         CLEAR lv_matnr.
         lv_matnr = gs_rprt-matnr.
         PERFORM aktar CHANGING lv_matnr.
      
         CLEAR : gt_product,gs_product.
         gs_product = lv_matnr.
         APPEND gs_product TO gt_product.
         CLEAR lt_bapiret2_t.
      
          CALL METHOD me->create_classification
            EXPORTING
              iv_stcts    = gv_stcts  "sabit
              iv_ccngn    = gs_rprt-gtip    "excelden
              iv_datab    = gv_datab  "sabit
              iv_datbi    = gv_datbi  "sabit
              it_products = gt_product      "excelden
            IMPORTING
              et_messages = lt_bapiret2_t.
      
          APPEND LINES OF lt_bapiret2_t TO gt_bapiret2_t.
      
      ENDLOOP.
      
      
        CALL FUNCTION 'RSCRMBW_DISPLAY_BAPIRET2'
          TABLES
            it_return = gt_bapiret2_t.
      
      
      
      ENDFORM. 
      
      
      
      
  • Hi Orhan, I think i have the same issue like Norbert Burger. You described the way to migrate the commodity code with the material numbers. Thanks for this, it works fine here.
    But i need way for creation the commodty codes .As far as i understood there is no custmoizing anymore and the user have the Transaction /SAPSLL/CLSNR_01 in the S/HANA System and also a fiori app to create the commodity codes by himself.

    But we have thousand of commodity codes and we need to take them over to the new system.
    I know table T604 are obsolete but how can I migrate the codes into table /SAPSLL/CLSNR?  

    Thanks for your help

    Best regards
    Christian

    • Hello christian nesser

      Actually, i don’t know more details about how can you transfer all commodity code from T604 table to new /SAPSLL/CLSNR table.

      You can directly create commodity codes from T-Code SAPSLL/CLSNR_01 and i’m thinking that development can be done from this T-Code.

      Brds

      Orhan Akman