You can check that easily using the memory analysis tools of the ABAP debugger. But the internal table is only initial regarding the number of lines but not regarding the memory occupied. Therefore as a rule:ĭeleting lines of an internal table using the DELETE stament does not release the table’s memory.įor an internal table that was filled and where all lines are deleted using the DELETE statement the predicate IS INITIAL in fact is true. Instead, there seem to be people deleting lines of internal tables in order to release memory. Assigning an initial internal table to a filled internal table does also release the target table’s memory in the same way as CLEAR does.īut last week a colleague pointed out to me that it is not such a well known fact that deleting lines of internal tables with DELETE normally does not release the memory occupied by the deleted lines. You normally use CLEAR, if you want to reuse the table and you use FREE, if you really want to get rid of it and don’t want to refill it later on. GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( LV_COLUMNNAME ).It is a well known fact, that you release the memory occupied by an internal table using either CLEAR or FREE, where FREE releases also the initial memory area. SPLIT WA_COMP-NAME AT '_' INTO LV_PART1 LV_NB.ĬONCATENATE 'Start Date' LV_NB INTO LV_FIELDVALUE SEPARATED BY SPACE.ĬONCATENATE 'End Date' LV_NB INTO LV_FIELDVALUE SEPARATED BY SPACE.ĬONCATENATE 'Position' LV_NB INTO LV_FIELDVALUE SEPARATED BY SPACE. GR_FUNCTIONS = GR_TABLE->GET_FUNCTIONS( ). SHIFT LV_INDEX LEFT DELETING LEADING SPACE.ĬONCATENATE '-begda_' LV_INDEX INTO FIELD.ĬONCATENATE '-endda_' LV_INDEX INTO FIELD.ĬONCATENATE '-plans_' LV_INDEX INTO FIELD. " Keep only the fields with the same PERNRĭELETE LT_INTER WHERE PERNR NE LWA_POSITION-PERNR. * For every employee get the number of occupied positionsĭATA: LT_INTER LIKE IT_PA0001 OCCURS 0 WITH HEADER LINE.ĭATA: LWA_POSITION LIKE LINE OF LT_POSITION. ĬONCATENATE 'PLANS_' LV_NUMC INTO COMP-NAME. ĬOMP-TYPE = CL_ABAP_ELEMDESCR=>GET_C( 10 ).ĬONCATENATE 'ENDDA_' LV_NUMC INTO COMP-NAME. SHIFT LV_NUMC LEFT DELETING LEADING SPACE.ĬONCATENATE 'BEGDA_' LV_NUMC INTO COMP-NAME. *- Create the structure for the dynamic table *- get the maximum number of positions for every employee SELECT-OPTIONS: S_WERKS FOR PA0001-WERKS, SELECTION-SCREEN: BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-001. STR_COMP TYPE CL_ABAP_STRUCTDESCR=>COMPONENT_TABLE,ĬOMP_TAB TYPE CL_ABAP_STRUCTDESCR=>COMPONENT_TABLE,ĭATA: GR_TABLE TYPE REF TO CL_SALV_TABLE.ĭATA: GR_COLUMNS TYPE REF TO CL_SALV_COLUMNS_TABLE.ĭATA: GR_COLUMN TYPE REF TO CL_SALV_COLUMN_TABLE.ĭATA: GR_FUNCTIONS TYPE REF TO CL_SALV_FUNCTIONS. Source code REPORT Z_RIM_ABASSI MESSAGE-ID ZF.ĭATA: STR_TYPE TYPE REF TO CL_ABAP_STRUCTDESCR, Then start date 2, end date 2 and position 2 etc … The output will contains the personnel area, personnel number, start date 1, end date 1 and position 1. The dynamic part will be the start date, end date and position fields. Our example will have a selection-screen with personnel area, personnel number. A smart solution is to use a dynamic table and create as needed new fields to store our positions. Any developer will think that we should use as example 20 or 30 positions which leads to create 20 or 30 fields in the internal table to store the values. The difficulty in this example is that we don’t know exactly the maximum number of positions to be displayed. In this Blog post article I will show you how to use Dynamic tables.įor this blog post, I’m gone create a report to display the list of positions for each employee in a specific personnel area. In this case we need to use Dynamic tables. Sometimes you don’t know how many columns you need to use in internal tables especially if that table will be used for output. Internal tables are used to obtain data from a fixed structure for dynamic use in ABAP. In SAP reports we use internal tables to store data in the program.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |