Search code examples
abapassign

ASSIGN fails with variable from debugger path


I am trying to assign the value of this stucture path to a fieldsymbol, but this path does not work because it has a table in it's path.

But with in the debugger this value of this path is shown correctly.

Is there a way to dynamically assign a component of a table line to a fieldsymbol, by passing one path? If not then I will just read the table line and then use the path to get the wanted value.

ls_struct (Struct)
    - SUPPLYCHAINTRADETRANSACTION (Struct)
        - INCL_SUPP_CHAIN_ITEM (Table)
            - ASSOCIATEDDOCUMENTLINEDOCUMENT (Element)   


i_component_path = |IG_DDIC-SUPPLYCHAINTRADETRANSACTION-INCL_SUPP_CHAIN_ITEM[1]-ASSOCIATEDDOCUMENTLINEDOCUMENT|.
ASSIGN (i_component_path) TO FIELD-SYMBOL(<lg_value>).
IF <lg_value> IS NOT ASSIGNED.
    return.
ENDIF.

<lg_value> won't be assigned 

Solution

  • Solution by Sandra Rossi

    The debugger has its own syntax and own logic, it doesn't apply the ASSIGN algorithm at all. With ABAP source code, you have to use ASSIGN twice, the first one to reach the internal table, then you select the first line, and the second one to reach the component of the line.

    The debugger works completely differently, the debugger code works only in debug mode, you can't call the code from the debugger (i.e. if you call it, the kernel code used by the debugger will fail). No, there's no "abappath". There are the XSL transformation objects (xpath), but it's slow for what you ask.

    Thank you very much