DUPLICATE ENTRIES IN INTERNAL TABLE SAMPLE CODE

DATA: BEGIN OF itab OCCURS 0,
f1(1) TYPE c,
f2(1) TYPE c,
f3(1) TYPE c,
f4(1) TYPE c,
f5(1) type c,
END OF itab.

REFRESH: itab.

itab-f1 = 'A'.
itab-f2 = '1'.
itab-f3 = '0'.
append itab.
clear: itab.

itab-f1 = 'B'.
itab-f2 = '1'.
itab-f3 = '1'.
append itab.
clear: itab.

itab-f1 = 'C'.
itab-f2 = '2'.
itab-f3 = '1'.
append itab.
clear: itab.

data: c1 type i.
data: c2 type i.
clear: c1, c2.
data: wa like itab.

loop at itab.
clear: c1, c2.
loop at itab into wa where f2 = itab-f2.
c1 = C1 + 1.
endloop.
loop at itab into wa where f3 = itab-f3.
c2 = C2 + 1.
endloop.
if c1 gt 1.
itab-f4 = 'N'.
else.
itab-f4 = 'Y' .
endif.
if c2 gt 1.
itab-f5 = 'N'.
else.
itab-f5 = 'Y' .
endif.
modify itab.
write:/ itab-f1, itab-f2,itab-f3,itab-f4, itab-f5.
endloop.

RELATED POST

POSTING INTERFACE DOCUMENT SAMPLE CODE

Happy coding.

ADD CORRESPONDINg syntax for sap abap

ASSIGN PART ONEsyntax for sap abap

ASSIGN PART TWOsyntax for sap abap

CONTROL BREAKsyntax for sap abap

No comments:

Post a Comment