Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

append to internal table

Former Member
0 Likes
517

Dear All!

Please can you check what is wrong on appending

of internal table III_YMMM_TBL74.

It's going to be overwriting always.

All what I want to do is populating

III_YMMM_TBL74 while is condition

if sy-subrc = 0 AND linp > 1.

is complied

*CODE
TYPES:   BEGIN OF    YMMM,
           MATNR     LIKE YMMM_TBL74-MATNR,
           VORG_NR   LIKE YMMM_TBL74-VORG_NR,
           LIFNR     LIKE YMMM_TBL74-LIFNR,
           NAME1     LIKE YMMM_TBL74-NAME1,
           UNGUEL_AB LIKE YMMM_TBL74-UNGUEL_AB,
           GUEL_AB   LIKE YMMM_TBL74-GUEL_AB,
           GUEL_BI   LIKE YMMM_TBL74-GUEL_BI,
         END OF YMMM.

data I_YMMM_TBL74   type  YMMM occurs 0 with header line.
data II_YMMM_TBL74  type  YMMM occurs 0 with header line.
data III_YMMM_TBL74 type  YMMM occurs 0 with header line.

select * from YMMM_TBL74
         INTO CORRESPONDING FIELDS OF table I_YMMM_TBL74.

sort I_YMMM_TBL74 by matnr.

DELETE ADJACENT DUPLICATES FROM I_YMMM_TBL74 COMPARING matnr.

data: linp type i,
     fin  type i,
     rin  type i.

LOOP AT I_YMMM_TBL74.

select * from YMMM_TBL74
          INTO CORRESPONDING FIELDS OF table II_YMMM_TBL74
          WHERE MATNR = I_YMMM_TBL74-MATNR .

DESCRIBE TABLE II_YMMM_TBL74 lines linp .
DESCRIBE TABLE I_YMMM_TBL74 lines fin .

if sy-subrc = 0 AND linp > 1.
III_YMMM_TBL74[] = II_YMMM_TBL74[].
append III_YMMM_TBL74[].

endif.

ENDLOOP.

write:/ ''.

3 REPLIES 3
Read only

Former Member
0 Likes
490

Hi,

Since you have already moved using the = statement with the body operator..You don't have use APPEND again..Just comment the append ..

III_YMMM_TBL74[] = II_YMMM_TBL74[].

*<b>append III_YMMM_TBL74[].</b>

Thanks,

Naren

Read only

0 Likes
490

hi,

Narendran is right append statement is not required ..

regards,

Santosh

Read only

Former Member
0 Likes
490

sorry but right anser is

if sy-subrc = 0 AND linp > 1.

APPEND LINES OF II_YMMM_TBL74 TO III_YMMM_TBL74.

endif.

Regards

Ilhan