Archive for March, 2015

SAP ABAP Example for Creating dynamic internal table

In SAP sometimes we need to create internal table at runtime, in this case we can make use of the method create_dynamic_table from the class cl_alv_table_create. Steps: 1. Create the field catalogue for the internal table. 2. Call the method  create_dynamic_table from the class cl_alv_table_create. Example: Data: wa_fieldcat TYPE lvc_s_fcat, it_fieldcat TYPE lvc_t_fcat.   DATA: t_newtable TYPE REF TO data, wa_newline  TYPE REF TO data. FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,  " Dynamic internal table name <fs_dyntable>.  "Field symbol to create work area *****Build feild catalogue      CLEAR wa_fieldcat. wa_fieldcat-fieldname = 'PERNR'. wa_fieldcat-datatype  = 'CHAR'. wa_fieldcat-intlen    = 8. APPEND wa_fieldcat TO it_fieldcat.    CLEAR wa_fieldcat. wa_fieldcat-fieldname = 'BUKRS'. wa_fieldcat-datatype  = 'CHAR'. wa_fieldcat-intlen    = 4. APPEND wa_fieldcat TO it_fieldcat. *add more fields like this depending on ...

. Read More →

SAP ABAP ALV – Removing extra unit field in total sum

In SAP ABAP ALV lsit display time, while calculating the total sum, there will be a character * in the total line. But we can remove this * symbol from the total line, by using the following: data: wa_layout     TYPE slis_layout_alv. wa_layout-no_unit_splitting = 'X'.   CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING i_callback_program = sy-repid is_layout          = wa_layout  "work area for the layout it_fieldcat        = it_fcat "field catalogue TABLES t_outtab           = p_table "Output table EXCEPTIONS program_error      = 1 OTHERS             = 2.

. Read More →