Monday, December 20, 2010
This program illustrates you on how to create dynamic internal table, how to use TEXT_CONVERT_TEX_TO_SAP function module.
REPORT znpmmm0201. TYPES:BEGIN OF ty_file, data(4096) TYPE c, END OF ty_file. TYPE-POOLS:truxs. DATA: wa_file TYPE ty_file. DATA: it_file TYPE STANDARD TABLE OF ty_file, it_data TYPE truxs_t_text_data. DATA: gv_dref TYPE REF TO data, file_name TYPE string. FIELD-SYMBOLS: <gf_itab> TYPE STANDARD TABLE, <wa> TYPE ANY. PARAMETERS:p_table TYPE rsrd1-tbma_val, p_file TYPE string. *&---------------------------------------------------------------------* *& START-OF-SELECTION *&---------------------------------------------------------------------* START-OF-SELECTION. "Create Dynamic internal table CREATE DATA gv_dref TYPE TABLE OF (p_table). ASSIGN gv_dref->* TO <gf_itab>. "Upload file p_file = 'C:\temp\upload_data.txt'. CALL FUNCTION 'GUI_UPLOAD' EXPORTING filename = p_file filetype = 'ASC' TABLES data_tab = it_file. "Convert to SAP Standards APPEND LINES OF it_file TO it_data. CLASS cl_abap_char_utilities DEFINITION LOAD. DATA: l_field_seperator. l_field_seperator = cl_abap_char_utilities=>horizontal_tab. REPLACE ALL OCCURRENCES OF '|' IN TABLE it_data WITH l_field_seperator. CALL FUNCTION 'TEXT_CONVERT_TEX_TO_SAP' EXPORTING i_field_seperator = l_field_seperator i_tab_raw_data = it_data TABLES i_tab_converted_data = <gf_itab>. "Update database table given on S-Screen MODIFY (p_table) FROM TABLE <gf_itab>.
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Step by step tutorial on Smart Forms - Template Node
- ABAP - Sending email with pdf attachment
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
0 comments:
Post a Comment
Your useful comments, suggestions are appreciated.Your comments are moderated.