开发者

How to move values from tabletype into a Structure? [closed]

开发者 https://www.devze.com 2022-12-07 20:21 出处:网络
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post.
Closed. This question needs details or clarity. It is not currently accepting answers.

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
0

精彩评论

暂无评论...
验证码 换一张
取 消