Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 hours ago.
Improve this question 开发者_StackOverflow社区How to move values from tabletype into a Structure?
You can use LOOP AT
Assume the following structure and table type:
TYPES: BEGIN OF ty_data,
col1 TYPE i,
col2 TYPE string,
col3 TYPE char3,
END OF ty_data.
TYPES: tt_data TYPE TABLE OF ty_data.
DATA: gs_data TYPE ty_data,
gt_data TYPE tt_data.
The following code would move all values from the table type into the structure:
LOOP AT gt_data INTO gs_data.
gs_data-col1 = gt_data-col1.
gs_data-col2 = gt_data-col2.
gs_data-col3 = gt_data-col3.
ENDLOOP
精彩评论