IS ASSIGNED:对于检测的field symbol(类似于指针,可以指代任何变量),该关键字判断该field symbol是否分配有内存区域。
一个field symbol定义之后,如果不为其分配内存区域,则IS ASSIGNED返回abap_false。
例如:
FIELD-SYMBOLS: <f_node_item> TYPE any.
IF <f_node_item> IS ASSIGNED.
LOOP AT gt_xml_nodes_item_tabix INTO gs_xml_nodes_item_tabix.
LOOP AT gt_xml_nodes_items INTO gs_xml_node_item FROM gs_xml_nodes_item_tabix-tabix_b
TO gs_xml_nodes_item_tabix-tabix_e.
ASSIGN COMPONENT gs_xml_node_item-ele_name_case OF STRUCTURE <f_node_item> TO <f_node_item_fld>.
IF sy-subrc EQ 0 AND <f_node_item_fld> IS ASSIGNED.
<f_node_item_fld> = gs_xml_node_item-ele_value.
UNASSIGN <f_node_item_fld>.
ENDIF.
ENDLOOP.
APPEND <f_node_item> TO t_items.
ENDLOOP.
ENDIF.