avatar image
-2
Former Member

Default Key in hashed table

In a DTP using expert routine I am facing problems to define the unique key for a hashed table.

Introduction:

Source DSO: YADSO04
My target DSO YADSO05:

Code:

DATA:
      LTH_RESULT_PACKAGE  LIKE HASHED TABLE OF RESULT_PACKAGE
                          WITH UNIQUE DEFAULT KEY,
                          "all c, d, t, n, x, string, xstring values
      LS_RESULT_PACKAGE   LIKE LINE OF LTH_RESULT_PACKAGE.

LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.
  IF <SOURCE_FIELDS>-/BIC/YKYFD = 'CASHTO'.
    LS_RESULT_PACKAGE-/BIC/YREVENUE = <SOURCE_FIELDS>-/BIC/YKYFA.
  ENDIF.
ENDLOOP.

Error message: E:The default key can be empty for tables of the standard type only.

I thought after the DATA section the default key would have been 0Calmonth, 0Calyear and YPOS.

Why is it still empty?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Apr 23, 2017 at 10:49 AM

    I guess your line type leads to an empty standard key according to the rules.

    Can you prove that it contains components as you said? Did you check it in the debugger? I assume, it is not a stuctured type.

    Why do you want to use the standard key at all? We do not recommend it any more.

    Add comment
    10|10000 characters needed characters exceeded

    • I just got the exact definition of the "expert routine" method :

          METHODS
            expert_routine
              IMPORTING
                request                  type rsrequest
                datapackid               type rsdatapid
                log                      type ref to cl_rsbm_log_cursor_step
              EXPORTING
                RESULT_PACKAGE              type _ty_t_TG_1
              CHANGING
                SOURCE_PACKAGE              type _ty_t_SC_1.
      
      

      And we have:

      _ty_t_TG_1 TYPE ... TABLE OF _ty_s_TG_1 ...

      So, as you already guessed, it's:

      LTH_RESULT_PACKAGE TYPE HASHED TABLE OF _ty_s_TG_1 WITH UNIQUE DEFAULT KEY.
  • avatar image
    Former Member
    Apr 24, 2017 at 05:04 AM

    Solution:

    LTH_RESULT_PACKAGE TYPE HASHED TABLE OF _ty_s_TG_1 WITH UNIQUE DEFAULT KEY.

    Thank you for your help!

    Add comment
    10|10000 characters needed characters exceeded

Skip to Content