hi this is my sample code can u tell me where and how to put my code for clearing and refresh work areas and internal table!! i have never used them before.
CLEAR gi_cstctr.
REFRESH gi_cstctr.
SELECT hkont
FROM bseg
INTO
TABLE gi_cstctr
WHERE
kostl = bseg-kostl AND prctr = bseg-prctr.
IF sy-subrc EQ 0. "if rows are returned
SORT gi_cstctr BY hkont. "sorting the internal table.
ENDIF.
*if cost centers are there in the internal table then loop the internal table into corresponding work area and if the G/L account matches any costcenter in the table
CLEAR gw_cstctr.
IF NOT gi_cstctr[] IS INITIAL.
LOOP AT gi_cstctr INTO gw_cstctr.
IF gw_cstctr-hkont EQ lv_hkont.
lv_flag = gc_x.
EXIT. "set the flag to x
ENDIF.
ENDLOOP.
ENDIF.