ASSIGN失败,调试器路径中的变量 [英] 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.
有没有一种方法可以通过传递一条路径来动态地将表行的一部分分配给fieldymbol?
如果不是,那么我将只读取表行,然后使用路径获取所需的值。
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
推荐答案
调试器具有自己的语法和逻辑,它完全不使用 ASSIGN
算法。使用ABAP源代码,您必须使用两次 ASSIGN
,第一个进入内部表,然后选择第一行,第二个到达以下组件
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.
调试器的工作原理完全不同,调试器代码仅在调试模式下工作,您无法从调试器中调用代码(即,如果调用它,调试器使用的内核代码将失败)。不,没有 abappath。有XSL转换对象(xpath),但是您输入的内容很慢。
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.
非常感谢
这篇关于ASSIGN失败,调试器路径中的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!