Internal table with Import and Export

Hi All,
Hi all
Please let me know the use of <b>Internal table with Import and Export parameters and SET/GET parameters</b>, on what type of cases we can use these? Plese give me the syntax with some examples.
Please give me detailed analysis on the above.
Regards,
Prabhu

Hi Prabhakar,
There are three types of memories.
1. ABAP MEMORY
2. SAP MEMORY
3. EXTERNAL MEMORY.
1.we will use EXPORT/ IMPORT TO/ FROM MEMORY-ID when we want to transfer between ABAP memory
2. we will use GET PARAMETER ID/ SET PARAMETER ID to transfer between SAP MEMORY
3. we will use EXPORT/IMPORT TO/FROM SHARED BUFFER to transfer between external memory.
ABAP MEMORY : we can say that two reports in the same session will be in ABAP MEMORY
SAP MEMORY: TWO DIFFERENT SESSIONS WILL BE IN SAP MEMORY.
for ex: IF WE CALL TWO DIFFERENT TRANSACTIONS SE38, SE11
then they both are in SAP MEMORY.
EXTERNAL MEMORY: TWO different logons will be in EXTERNAL MEMORY.
<b>Syntax</b>
To fill the input fields of a called transaction with data from the calling program, you can use the SPA/GPA technique. SPA/GPA parameters are values that the system stores in the global, user-specific SAP memory. SAP memory allows you to pass values between programs. A user can access the values stored in the SAP memory during one terminal session for all parallel sessions. Each SPA/GPA parameter is identified by a 20-character code. You can maintain them in the Repository Browser in the ABAP Workbench. The values in SPA/GPA parameters are user-specific.
ABAP programs can access the parameters using the SET PARAMETER and GET PARAMETER statements.
To fill one, use:
SET PARAMETER ID <pid> FIELD <f>.
This statement saves the contents of field <f> under the ID <pid> in the SAP memory. The code <pid> can be up to 20 characters long. If there was already a value stored under <pid>, this statement overwrites it. If the ID <pid> does not exist, double-click <pid> in the ABAP Editor to create a new parameter object.
To read an SPA/GPA parameter, use:
GET PARAMETER ID <pid> FIELD <f>.
This statement fills the value stored under the ID <pid> into the variable <f>. If the system does not find a value for <pid> in the SAP memory, it sets SY-SUBRC to 4, otherwise to 0.
To fill the initial screen of a program using SPA/GPA parameters, you normally only need the SET PARAMETER statement.
The relevant fields must each be linked to an SPA/GPA parameter.
On a selection screen, you link fields to parameters using the MEMORY ID addition in the PARAMETERS or SELECT-OPTIONS statement. If you specify an SPA/GPA parameter ID when you declare a parameter or selection option, the corresponding input field is linked to that input field.
On a screen, you link fields to parameters in the Screen Painter. When you define the field attributes of an input field, you can enter the name of an SPA/GPA parameter in the Parameter ID field in the screen attributes. The SET parameter and GET parameter checkboxes allow you to specify whether the field should be filled from the corresponding SPA/GPA parameter in the PBO event, and whether the SPA/GPA parameter should be filled with the value from the screen in the PAI event.
When an input field is linked to an SPA/GPA parameter, it is initialized with the current value of the parameter each time the screen is displayed. This is the reason why fields on screens in the R/3 System often already contain values when you call them more than once.
When you call programs, you can use SPA/GPA parameters with no additional programming overhead if, for example, you need to fill obligatory fields on the initial screen of the called program. The system simply transfers the values from the parameters into the input fields of the called program.
However, you can control the contents of the parameters from your program by using the SET PARAMETER statement before the actual program call. This technique is particularly useful if you want to skip the initial screen of the called program and that screen contains obligatory fields.
Reading Data Objects from Memory
To read data objects from ABAP memory into an ABAP program, use the following statement:
Syntax
IMPORT <f1> [TO <g 1>] <f 2> [TO <g 2>] ... FROM MEMORY ID <key>.
This statement reads the data objects specified in the list from a cluster in memory. If you do not use the TO <g i > option, the data object <f i > in memory is assigned to the data object in the program with the same name. If you do use the option, the data object <f i > is read from memory into the field <g i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.
You do not have to read all of the objects stored under a particular name <key>. You can restrict the number of objects by specifying their names. If the memory does not contain any objects under the name <key>, SY-SUBRC is set to 4. If, on the other hand, there is a data cluster in memory with the name <key>, SY-SUBRC is always 0, regardless of whether it contained the data object <f i >. If the cluster does not contain the data object <f i >, the target field remains unchanged.
Saving Data Objects in Memory
To read data objects from an ABAP program into ABAP memory, use the following statement:
Syntax
EXPORT <f1> [FROM <g 1>] <f 2> [FROM <g 2>] ... TO MEMORY ID <key>.
This statement stores the data objects specified in the list as a cluster in memory. If you do not use the option FROM <f i >, the data object <f i > is saved under its own name. If you use the FROM <g i > option, the data objet <g i > is saved under the name <f i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.
Check this link.
http://www.sap-img.com/abap/difference-between-sap-and-abap-memory.htm
Thanks,
Susmitha.
Reward points for helpful answers.

Similar Messages

  • JCA IConnection call to BAPI with table in table as import and export param

    Is it possible to call a BAPI with a table in table as import and export data?
    Please give small code example if this is possible.
    Thanks in advance.

    Inner tables can be handled with:
    IRecordSet innerTable = (IRecordSet)outerTable.getObject("INNER_TABLE");

  • Internal table with Dynamic and Non dynamic fileds

    Hi Experts,
    How to get the internal table with Dynamic and Non-Dynamic Fields.
    Could u please help me.
    Thanks,
    Varun

    Hi,
       Execute the below sample code or analyze it there is appropriate description provided.
    *& Report  ZTEST_PRM_DYN_ALV
    REPORT  ZTEST_PRM_DYN_ALV.
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
    <dyn_wa>.
    data: alv_fldcat type slis_t_fieldcat_alv,
    it_fldcat type lvc_t_fcat.
    selection-screen begin of block b1 with frame title text-001.
    parameters: p_flds(5) type c.
    selection-screen end of block b1.
    start-of-selection.
    *build the dynamic internal table
    perform build_dyn_itab.
    *write 5 records to the alv grid
    do 5 times.
    perform build_report.
    enddo.
    *call the alv grid.
    perform call_alv.
    *Build_dyn_itab
    form build_dyn_itab.
    data: new_table type ref to data,
    new_line type ref to data,
    wa_it_fldcat type lvc_s_fcat.
    *Create fields .
    clear wa_it_fldcat.
    wa_it_fldcat-fieldname = 'name1'.
    wa_it_fldcat-datatype = 'mara-matnr'.
    wa_it_fldcat-intlen = 5.
    append wa_it_fldcat to it_fldcat .
    *clear wa_it_fldcat.
    wa_it_fldcat-fieldname = sy-index.
    wa_it_fldcat-datatype = 'CHAR'.
    wa_it_fldcat-intlen = 5.
    append wa_it_fldcat to it_fldcat .
    do p_flds times.
    clear wa_it_fldcat.
    wa_it_fldcat-fieldname = sy-index.
    wa_it_fldcat-datatype = 'CHAR'.
    wa_it_fldcat-intlen = 6.
    append wa_it_fldcat to it_fldcat .
    enddo.
    *Create dynamic internal table and assign to FS
    call method cl_alv_table_create=>create_dynamic_table
    exporting
    it_fieldcatalog = it_fldcat
    importing
    ep_table = new_table.
    assign new_table->* to <dyn_table>.
    *Create dynamic work area and assign to FS
    create data new_line like line of <dyn_table>.
    assign new_line->* to <dyn_wa>.
    endform.
    *Form build_report
    form build_report.
    data: fieldname(20) type c.
    data: fieldvalue(5) type c.
    data: index(3) type c.
    field-symbols: <fs1>.
    do p_flds times.
    index = sy-index.
    *Set up fieldvalue
    concatenate 'FLD' index into
    fieldvalue.
    condense fieldvalue no-gaps.
    assign component index of structure <dyn_wa> to <fs1>.
    <fs1> = fieldvalue.
    enddo.
    *Append to the dynamic internal table
    append <dyn_wa> to <dyn_table>.
    endform.
    *CALL_ALV
    form call_alv.
    data: wa_cat like line of alv_fldcat.
    *clear wa_cat.
    wa_cat-fieldname = 'matnr'.
    wa_cat-seltext_s = sy-index.
    wa_cat-outputlen = '10'.
    append wa_cat to alv_fldcat.
    do p_flds times.
    clear wa_cat.
    wa_cat-fieldname = sy-index.
    wa_cat-seltext_s = sy-index.
    wa_cat-outputlen = '6'.
    append wa_cat to alv_fldcat.
    enddo.
    *Call ABAP List Viewer (ALV)
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
    it_fieldcat = alv_fldcat
    tables
    t_outtab = <dyn_table>.
    endform.
    Hope this will help, reward if found usefull.
    Cheers,
    Ram.

  • Runtime error in Dynamic internal table with AMOUNT and Quantity Fields..

    Dear friends,
    I am attempting write a dymanic Select Statement (with joins).
    And the sleect query looks like this..
      SELECT (LT_SEL_LIST)
      INTO CORRESPONDING FIELDS OF
      TABLE <DYN_TABLE>
      FROM (LT_FROM_LIST)
      WHERE (LT_WHERE3).
    Here the into table is a dynamically created internal table..
    which is created by ...this
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = IT_OUTPUT2[]
        IMPORTING
          EP_TABLE        = DY_TABLE.
    the it_output2 contains the the fieldcatlog information of dynamically given fields :-
    like:-
           TABNAME
           FIELDNAME
           DATATYPE
           LENG
           INTTYPE
           ROLLNAME
           DECIMALS
           REFTABLE
           REFFIELD
    i mean the internal table is constructed with reference to all the bove metadata.
    Problem:- This query run fine with all the fields Except AMOUNT AND QUANTITY fields....
    When the selection list contain VBAK-NETWR or MSEG-MENGE..It throws a runtime error.
    "The data read during a SLECT access couldnt be inserted into the target field,either conversion is not supported for
    the target field's type or the target field is too short."
    after this I even tried to construct the dynamic table with CFILEDNAME and QFIELDNAME in the Fieldcatalog.
    so now my fieldcatlog looks like this:---
    LOOP AT IT_DD03L..
      IF IT_DD03L-DATATYPE = 'CURR'.
           TABLEFIELD-CFIELDNAME = IT_DD03L-FIELDNAME .
           ENDIF.
       IF IT_FIELDCAT3-DATATYPE = 'QUAN'.
           TABLEFIELD-QFIELDNAME = IT_DD03L-FIELDNAME .
      ENDIF.
           TABLEFIELD-TABNAME     = IT_DD03L-TABNAME.
           TABLEFIELD-FIELDNAME   = IT_DD03L-FIELDNAME.
           TABLEFIELD-DATATYPE    = IT_DD03L-DATATYPE.
           TABLEFIELD-INTLEN      = IT_DD03L-LENG.
           TABLEFIELD-INTTYPE     = IT_DD03L-INTTYPE .
           TABLEFIELD-ROLLNAME    = IT_DD03L-ROLLNAME.
           TABLEFIELD-DECIMALS    = IT_DD03L-DECIMALS.
           TABLEFIELD-REF_TABLE   = IT_DD03L-REFTABLE.
           TABLEFIELD-REF_FIELD   = IT_DD03L-REFFIELD.
    APPEND TABLEFIELD.
    CLEAR TABLEFIELD.
    ENDLOOP.
    Note:- this is a test code so ignore performance issues...
    Please help me with some code ...to avoid the Runtime erorr.
    Thanks,
    jeevan.

    Hi Jeevan,
    Why are moving only few fields from DD03L table to your field catalog? Why don't you use move-corresponding? The following code works for me in ECC6.0.
    data: it_dd03l type table of dd03l initial size 0,
          ls_dd03l type dd03l,
          lt_fldcat TYPE lvc_t_fcat,
          ls_fldcat TYPE lvc_s_fcat,
          ls_where(72) TYPE c,
          lt_where LIKE TABLE OF ls_where,
          lt_fld LIKE TABLE OF ls_where,
          lt_data_dy TYPE REF TO data.
    field-symbols: <ft_data> TYPE STANDARD TABLE.
    select * into table it_dd03l from dd03l
        where tabname = 'VBAK'
          and ( fieldname = 'VBELN' or fieldname = 'NETWR' ).
    check sy-subrc eq 0.
    loop at it_dd03l into ls_dd03l.
      move-corresponding ls_dd03l to ls_fldcat.
      append ls_fldcat to lt_fldcat.
      move ls_dd03l-fieldname to ls_where.
      append ls_where to lt_fld.
      if ls_dd03l-fieldname = 'VBELN'.
        clear ls_where.
        concatenate ls_dd03l-fieldname ' <> ''''' into ls_where.
        append ls_where to lt_where.
      endif.
    endloop.
    check not lt_fldcat is initial.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
          EXPORTING
            it_fieldcatalog           = lt_fldcat
          IMPORTING
            ep_table                  = lt_data_dy
          EXCEPTIONS
            generate_subpool_dir_full = 1
            OTHERS                    = 2.
        IF sy-subrc <> 0.
          RAISE no_configuration_data.
        ENDIF.
        ASSIGN lt_data_dy->*  TO <ft_data>.
    check sy-subrc eq 0.
    select (lt_fld) from VBAK into corresponding fields of table
        <ft_data>
        where (lt_where).
    Thanks
    Bala

  • Table in import and export parameters

    Hi,
    this is a general doubt. can we pass an internal table in import/export parameters of FMs. I know there are table parameters, but can this be done in import export parameters.
    Regards,
    Vijay

    Hi vijay,
    1. if we pass thru TABLES,
      then we can pass an internal table,
      WITH HEADER LINE
    2. But if we use import/export,
       it has to be a TABLE TYPE
       defined in the data dictionary.
      (This table type will not have any header line).
    regards,
    amit m.

  • Problem with Import and Export Data Wizard

    Downloaded and installed SQL Server Express 2008 R2 today because I want to explore how Access interacts with SQL Server (using my home computer). I'm using Access 2010 (under Windows 7), so the 2008 version of SQL Server Express seemed to be the version
    to use.
    After a couple of false starts, installation appeared to go okay. After the installation. My Start menu listed Microsoft SQL Server 2008 and Microsoft SQL Server 2008 R2. The latter listed Import and Export Data (64-bit). When I clicked that, the first Import
    and Export Data Wizard page was displayed. I wasn't ready at that time to explore the wizard, so I closed it. An hour or so later I again attempted to open the Import and Export Data wizard. This time, the wizard didn't open. Instead this error message was
    displayed: "The SSIS Runtime object could not be created. Verify that DTS.dll is available and registered."
    I found DTS.dll on my computer at C:\Program Files\Microsoft SQL Server\100\DTS\Binn, so the file is available, but don't know whether it is registered.
    How can I correct this problem?

    First can you please post all log file errors
    >> I can't really give you a solution or specific recommendation since I did not saw this error yet myself, but on your own risk you can try:
    1. You may try to just register 'dts.dll' using regsvr32.exe, but this error may indicate a bigger problem with setup.
    If you are running SQL Server 64bit then try running this at the command prompt: %windir%\syswow64\regsvr32 "%ProgramFiles(x86)%\Microsoft SQL Server\90\dts\binn\dts.dll"
    2. You can try reinstall from start (In this case you have to make sure that you un-install all)
    [Personal Site] [Blog] [Facebook]

  • WHEN DO U NEED CREATE AN INTERNAL TABLE WITH HEADERLINE AND WITH OUT HEADER

    HI
    EXPERTS CAN U HELP ME FOR THIS

    Hi,
    PLEASE CHECK OUT THE LINK BELOW FOR INTERNAL TABLE WITH HEADER LINE IT MIGHT HELP YOU
    http://sap.mis.cmich.edu/sap-abap/abap04/sld012.htm
    PLEASE CHECK OUT THE LINK BELOW FOR INTERNAL TABLE WITHOUT HEADER LINE IT MIGHT HELP YOU
    http://sap.mis.cmich.edu/sap-abap/abap04/sld013.htm
    DIFFERENCES BEWTEEN WORK AREA AND HEADER LINE PLEASE CHECK OUT THE LINK BELOW IT MIGHT HELP YOU
    http://www.sap-img.com/abap/difference-between-work-area-and-header-line.htm
    *************please reward points if the information is helpful to you***********

  • Internal table with vbao and vbap data.

    I am getting a sales order number from input and i need to fetch the data based on that to a table. so i have declared like below.
    one table itab1 for the final fields i need
    and itab2 for the item data fields. and then i am looping and updating it.
    So please suggest me mdoifications in this code  and  how to handle bukrs filed in the final table.
    TYPES : BEGIN OF titab1,
      bukrs like mseg-bukrs,
      vbeln  LIKE vbak-vbeln,
      erdat LIKE vbak-erdat,
      erzet LIKE vbak-erzet,
      vkorg LIKE vbak-vkorg,
      vtweg LIKE vbak-vtweg,
      bstnk LIKE vbak-bstnk,
      kunnr LIKE vbak-kunnr,
      posnr LIKE vbap-posnr,
      matnr LIKE vbap-matnr,
      zmeng LIKE vbap-zmeng,
      MATKL like vbap-matkl,
      ZIEME like vbap-zieme,
      END OF titab1.
    TYPES : BEGIN OF titab2,
      vbeln like vbap-vbeln,
      posnr LIKE vbap-posnr,
      matnr LIKE vbap-matnr,
      zmeng LIKE vbap-zmeng,
      MATKL like vbap-matkl,
      ZIEME like vbap-zieme,
      END OF titab2.
    DATA : iTab2 TYPE STANDARD TABLE OF Titab2.
    DATA : waitab2 TYPE titab2.
    DATA : itab1 TYPE STANDARD TABLE OF titab1.
    DATA : waitab1 TYPE titab1.
    FIELD-SYMBOLS : <field> type titab1.
    SELECT vbeln erdat erzet vkorg vtweg  bstnk kunnr
                        FROM vbak INTO TABLE itab1
                       WHERE
                        vbeln = p_vbeln.
    SELECT vbeln posnr
           matnr
           zmeng  MATKL  ZIEME FROM vbap INTO TABLE itab2
      WHERE vbeln = p_vbeln.
    LOOP AT itab1 ASSIGNING <field>.
    read table itab2 into waitab2 WITH  KEY vbeln = <field>-vbeln.
    <field>-bukrs = '5120'.
    <field>-posnr = waitba2-posnr.
    <field>-matnr = waitba2-matnr.
    <field>-zmeng = waitba2-zmeng.
    <field>-matkl = waitba2-matkl.
    <field>-zieme = waitba2-zieme.
    endloop.

    Hi,
    Then you can try using a inner join select statement to directly get the required fields in itab1
    SELECT a~vbeln a~erdat a~erzet a~vkorg a~vtweg a~bstnk a~kunnr
                 b~posnr b~matnr b~zmeng b~MATKL b~ZIEME
    into itab1
    from ( vbak as a inner join vbap as b
                           ON a~vbeln = b~vbeln)
    where a~vbeln = p_vbeln.
    Else use FOR ALL ENTRIES like this
    SELECT vbeln erdat erzet vkorg vtweg bstnk kunnr
    FROM vbak INTO TABLE itab1
    WHERE
    vbeln = p_vbeln.
    if sy-subrc = 0.
    SELECT vbeln posnr matnr zmeng MATKL ZIEME
    FROM vbap
    INTO TABLE itab2
    FOR ALL ENTRIES in itab1
    WHERE vbeln = itab1-vbeln.
    endif.
    loop at itab1.
    read table itab2 with key vbeln = itab1-vbeln.
    if sy-subrc = 0.
    itab1-posnr = itab2-posnr.
    itab1-matnr = itab2-matnr.
    itab1-zmeng = itab2-zmeng.
    itab1-matkl = itab2-matkl.
    itab1-zieme = itab2-zieme.
    modify itab1
    endif.
    endloop.
    Regards,
    Vik

  • Import and Export Vs. Tables in a Function module interface

    Hi,
    i need to import and export internal tables to/from a Function Module.
    Passing internal tables using import and export is good enough or do i need to use 'Tables' option. Please let me know the reasons if possible.
    thanks for your help.
    GK.

    you can use changing but you have declare a table type and use it in changing..
    however TABLES is declared aas oblselete in ECC version 6.0
    No Points Plz

  • Help on export sybase iq tables with data and import in another database ?

    Help on export Sybase iq 16 tables with data and import into another database ?

    Hi Nilesh,
    If you have table/index create commands (DDLs), you can create them in Developper and import data using one of methods below
    Extract/ Load table
    Insert location method : require IQ servers to be entered in interfaces file
    Backup/Restore : copy entire database content
    If you have not the DDLs, you can generate them using IQ cockpit or SCC.
    http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01773.1604/doc/html/san1288042631955.html
    http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01840.1604/doc/html/san1281564927196.html
    Regards,
    Tayeb.

  • Import from database an internal table with generic Type : Web Dynpro ABAP

    Hi everyone,
    i have a requirement in which i'm asked to transfer data flow between two frameworks, from WD Component to another. The problem is that i have to transfer internal tables with generic types. i used the import/ export from database approache but in that way i get an error message saying "Object references and data references not yet supported".
    Here is my code to extract a generic internal table from memory.
        DATA l_table_f4 TYPE TABLE OF REF TO data.
      FIELD-SYMBOLS: <l_table_f4> TYPE STANDARD TABLE.
      DATA lo_componentcontroller TYPE REF TO ig_componentcontroller .
      DATA: ls_indx TYPE indx.
      lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
      lo_componentcontroller->fire_vh_search_action_evt( ).
      ASSIGN l_table_f4 TO <l_table_f4>.
    *-- Import table for Help F4
      IMPORT l_table_f4 TO <l_table_f4> FROM DATABASE indx(v1) TO ls_indx ID 'table_help_f4_ID'.
    The error message is desplayed when last instruction is executed " IMPORT l_table_f4...".
    I saw another post facing the same problem but never solved "Generic Type for import Database".
    Please can anyone help ?
    Thanks & Kind regards.

    hi KIan,
    go:
    general type
    TYPE : BEGIN OF ty_itab,
               field1 TYPE ztab-field1,
               field2 TYPE ztab-field2,
    *your own fields here:
               field TYPE i,
               field(30) TYPE c,
               END OF ty_itab.
    work area
    DATA : gw_itab TYPE ty_itab.
    internal table
    DATA : gt_itab TYPE TABLE OF ty_itab.
    hope this helps
    ec

  • Internal table with and with out work area.

    Hi all,
    in performance terms which one is better 1) internal table with header line or 2) itab w/o header line and explicit work area for that itab.
    which one is better and how?
    Thanks in advance.
    SAI

    Hai Sai Ram
    Internal Table with header Line Improves the Performence
    1)
    TABLES CUSTOMERS.
    Defining an internal table with header line
    DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100
                       WITH HEADER LINE.
    Reading all entries of the database table into the internal table
    SELECT * FROM CUSTOMERS INTO TABLE ALL_CUSTOMERS.
    2)
    Check the following code for the Difference
    REPORT ZWRITEDOC LINE-SIZE 124 NO STANDARD PAGE HEADING.
       TABLES: DD03L, "
               DD04T, "R/3-DD: Textos de los elementos de datos
               DD02T. "R/3-DD: Textos de tablas SAP
    Tabla temporal con las lineas de cada tabla
       DATA: BEGIN OF I_LINEAS OCCURS 100,
                LINEA(80),
             END OF I_LINEAS.
    Tabla con las caracteristicas de la tabla
       DATA: BEGIN OF I_TABLA OCCURS 100,
                CAMPO(12),
                TIPO(4),
                LONG(5) TYPE I,
                REF(20),
                DESCR(40),
             END OF I_TABLA.
       DATA: D_NOMBRE(80),
             D_DESCRIPCION(80).
       DATA :  BEGIN OF SOURCE OCCURS 1000,
            LINE(72),
       END OF SOURCE.
       PARAMETERS: PROGRAM LIKE SY-REPID DEFAULT SY-REPID.
       AT USER-COMMAND.
         CASE SY-UCOMM.
           WHEN 'GRAB'.
             PERFORM GRABAR.
         ENDCASE.
       START-OF-SELECTION.
         SET PF-STATUS  'ZSTATUS1'.
         READ REPORT PROGRAM INTO SOURCE.
         DATA L_GRAB.
         CLEAR L_GRAB.
    LOOP AT SOURCE.
       translate source to upper case.
           IF L_GRAB IS INITIAL.
             D_DESCRIPCION = I_LINEAS-LINEA.
           ENDIF.
           I_LINEAS = SOURCE.
           SEARCH I_LINEAS-LINEA FOR 'BEGIN OF'.
           IF SY-SUBRC = 0.
             SEARCH I_LINEAS-LINEA FOR 'DATA'.
             IF SY-SUBRC = 0.
               L_GRAB = 'X'.
               FREE I_LINEAS.
             ENDIF.
           ENDIF.
           IF L_GRAB = 'X'.
             I_LINEAS = SOURCE.
             APPEND I_LINEAS.
             SEARCH I_LINEAS-LINEA FOR 'END OF'.
             IF SY-SUBRC = 0.
               CLEAR L_GRAB.
               PERFORM PROCESAR_FICHERO.
               PERFORM IMPRIMIR.
               FREE I_LINEAS.
               CLEAR D_DESCRIPCION.
             ENDIF.
           ENDIF.
           SEARCH I_LINEAS-LINEA FOR 'WITH HEADER LINE'.
           IF SY-SUBRC = 0.
             APPEND I_LINEAS.
             PERFORM PROCESAR_FICHERO.
             PERFORM IMPRIMIR.
           ENDIF.
         ENDLOOP.
    *&      Form  GRABAR
          Graba el fichero en c:\temp\p.rtf y lo abre con word.
       FORM GRABAR.
         CALL FUNCTION 'LIST_DOWNLOAD'
             EXPORTING
            LIST_INDEX = SLIST_INDEX_DEFAULT
                  METHOD     = 'RTF'
              EXCEPTIONS
                   OTHERS     = 1.
         CALL FUNCTION 'EXECUTE_WINWORD'
              EXPORTING
                   I_FILE = 'C:\TEMP\P.RTF'
              EXCEPTIONS
                   OTHERS = 1.
       ENDFORM.                               " GRABAR
    *&      Form  PROCESAR_FICHERO
       FORM PROCESAR_FICHERO.
         DATA: L_AUX1(80),
              L_AUX2(80).
         FREE I_TABLA.
         LOOP AT I_LINEAS.
           CLEAR I_TABLA.
       translate i_lineas-linea to upper case.
           SEARCH I_LINEAS-LINEA FOR 'BEGIN OF'.
           IF SY-SUBRC = 0.
             SPLIT I_LINEAS-LINEA AT 'BEGIN OF' INTO L_AUX1 D_NOMBRE.
             SPLIT D_NOMBRE AT 'OCCURS' INTO D_NOMBRE L_AUX1.
           ENDIF.
           SEARCH I_LINEAS-LINEA FOR '('.
           IF SY-SUBRC = 0.
              SPLIT I_LINEAS-LINEA AT '(' INTO L_AUX1 L_AUX2.
             CONDENSE L_AUX1.
             I_TABLA-CAMPO = L_AUX1.
             SPLIT L_AUX2 AT ')' INTO L_AUX1 L_AUX2.
             CONDENSE L_AUX1.
             IF L_AUX1 CO '0123456789 '.
               I_TABLA-LONG = L_AUX1.
             ENDIF.
             I_TABLA-TIPO = 'CHAR'.
           ENDIF.
           SEARCH I_LINEAS-LINEA FOR 'LIKE'.
           IF SY-SUBRC = 0.
             SPLIT I_LINEAS-LINEA AT 'LIKE' INTO L_AUX1 L_AUX2.
             CONDENSE L_AUX1.
             I_TABLA-CAMPO = L_AUX1.
               SPLIT L_AUX2 AT ',' INTO L_AUX1 L_AUX2.
             CONDENSE L_AUX1.
             I_TABLA-REF = L_AUX1.
           ENDIF.
           SEARCH I_LINEAS-LINEA FOR 'TYPE'.
           IF SY-SUBRC = 0.
             SPLIT I_LINEAS-LINEA AT 'TYPE' INTO L_AUX1 L_AUX2.
             IF I_TABLA-CAMPO IS INITIAL.
               CONDENSE L_AUX1.
               I_TABLA-CAMPO = L_AUX1.
             ENDIF.
                 SPLIT L_AUX2 AT ',' INTO L_AUX1 L_AUX2.
            CONDENSE L_AUX1.
             CASE L_AUX1.
               WHEN 'I'.
                 I_TABLA-TIPO = 'INT'.
                 I_TABLA-LONG = 4.
               WHEN 'C'.
                 I_TABLA-TIPO = 'CHAR'.
               WHEN 'N'.
                 I_TABLA-TIPO = 'NUMC'.
               WHEN 'T'.
                 I_TABLA-TIPO = 'TIME'.
                 I_TABLA-LONG = 8.
               WHEN OTHERS.
                 I_TABLA-TIPO = L_AUX1.
             ENDCASE.
           ENDIF.
           SEARCH I_LINEAS-LINEA FOR '"'.
           IF SY-SUBRC = 0.
             SPLIT I_LINEAS-LINEA AT '"' INTO L_AUX1 L_AUX2.
             CONDENSE L_AUX2.
             I_TABLA-DESCR = L_AUX2.
           ENDIF.
           SEARCH I_LINEAS-LINEA FOR 'INCLUDE STRUCTURE'.
           IF SY-SUBRC = 0.
             SPLIT I_LINEAS-LINEA AT 'INCLUDE STRUCTURE' INTO L_AUX1 L_AUX2.
             SPLIT L_AUX2 AT '.' INTO L_AUX1 L_AUX2.
             CONDENSE L_AUX1.
             I_TABLA-CAMPO = 'INCLUDE STR'.
             I_TABLA-REF   = L_AUX1.
           ENDIF.
           SEARCH I_LINEAS-LINEA FOR 'WITH HEADER LINE'.
             IF SY-SUBRC = 0.
               IF NOT I_LINEAS-LINEA CA '"'.
                 SPLIT I_LINEAS-LINEA AT 'OCCURS' INTO L_AUX1 L_AUX2.
                 IF SY-SUBRC = 0.
                   SPLIT L_AUX1 AT 'LIKE' INTO L_AUX1 L_AUX2.
                   IF SY-SUBRC = 0.
                     CONDENSE L_AUX2.
                     IF NOT L_AUX2 IS INITIAL.
                       I_TABLA-CAMPO = '...'.
                       I_TABLA-TIPO  = 'TABI'.
                       I_TABLA-REF   = L_AUX2.
                       SELECT SINGLE * FROM DD02T
                        WHERE TABNAME = L_AUX2
                          AND DDLANGUAGE = SY-LANGU.
                       IF SY-SUBRC = 0.
                       I_TABLA-TIPO  = 'TABE'.
                       I_TABLA-DESCR   = DD02T-DDTEXT.
                       ENDIF.
                       IF L_AUX1 CA ':'.
                         SPLIT L_AUX1 AT 'DATA:' INTO L_AUX1 L_AUX2.
                       ELSE.
                         SPLIT L_AUX1 AT 'DATA' INTO L_AUX1 L_AUX2.
                       ENDIF.
                       D_NOMBRE = L_AUX2.
                     ENDIF.
                   ENDIF.
                 ENDIF.
               ENDIF.
             ENDIF.
           IF NOT I_TABLA-CAMPO IS INITIAL.
             APPEND I_TABLA.
           ENDIF.
         ENDLOOP.
         LOOP AT I_TABLA WHERE NOT REF IS INITIAL.
            SPLIT I_TABLA-REF AT '-' INTO L_AUX1 L_AUX2.
           SELECT SINGLE * FROM DD03L
            WHERE TABNAME = L_AUX1
              AND FIELDNAME = L_AUX2.
           IF SY-SUBRC = 0.
             I_TABLA-TIPO = DD03L-DATATYPE.
             I_TABLA-LONG = DD03L-INTLEN.
             IF I_TABLA-DESCR IS INITIAL.
               SELECT SINGLE * FROM DD04T
                WHERE ROLLNAME = DD03L-ROLLNAME
                  AND DDLANGUAGE = SY-LANGU.
               IF SY-SUBRC = 0.
                 I_TABLA-DESCR = DD04T-DDTEXT.
               ENDIF.
             ENDIF.
             MODIFY I_TABLA.
           ENDIF.
         ENDLOOP.
       ENDFORM.                               " PROCESAR_FICHERO
    *&      Form  IMPRIMIR
       FORM IMPRIMIR.
       DATA L_AUX(80).
         FORMAT COLOR COL_NORMAL INTENSIFIED ON.
         ULINE AT 1(80).
         WRITE: / SY-VLINE,
                 (76)     D_NOMBRE CENTERED,
                  SY-VLINE.
         SPLIT D_DESCRIPCION AT '*' INTO L_AUX D_DESCRIPCION.
         WRITE: / SY-VLINE,
                 (76)     D_DESCRIPCION CENTERED,
                  SY-VLINE.
         NEW-LINE.
         ULINE AT 1(80).
         DETAIL.
         FORMAT COLOR OFF.
         WRITE: /
               SY-VLINE,
             (10) 'CAMPO',
               SY-VLINE,
             (4)  'TIPO',
               SY-VLINE,
             (4) 'LONG',
               SY-VLINE,
             (16)  'REFERENCIA',
               SY-VLINE,
             (30)  'DESCRIPCION',
               SY-VLINE.
         NEW-LINE.
         ULINE AT 1(80).
         DETAIL.
         LOOP AT I_TABLA.
           WRITE: /
                 SY-VLINE,
              (10)   I_TABLA-CAMPO,
                 SY-VLINE,
                 I_TABLA-TIPO,
                 SY-VLINE,
              (4)   I_TABLA-LONG,
                 SY-VLINE,
              (16)   I_TABLA-REF,
                 SY-VLINE,
              (30)   I_TABLA-DESCR,
                 SY-VLINE.
         ENDLOOP.
         NEW-LINE.
         ULINE AT 1(80).
         SKIP 2.
       ENDFORM.                               " IMPRIMIR
    Thanks & regards
    Sreeni

  • Error message using SQL import and Export Wizard with Excel spread sheet

    I am trying to import an Excel spreadsheet using the Import export wizard that is provided with SQL 2014.  
    Everything seems to set up OK but then when I go to do the transfer "error message" comes up saying:
    External Table is not in the expected format.(Microsoft Jet Database Engine).   
    This is a spreadsheet and there is no database, that is why I want to import it into a database!!  So the reference to JET is a tad disappointing.
    So why the error and how do I fix the problem?
    As there are over 100 variables in the spread sheet rows, it would be great to have this automatically create the database and populate the fields.
    I am using SQL 2014  Express and Office Excel 2013.
    Thank you in  advance for taking the time to read this, and hopefully sheading some light on the issue.

    Hi AWlcurrent,
    When import a .xlsx file to SQL Server using SQL Server Import and Export Wizard, you see a “External Table is not in the expected format.(Microsoft Jet Database Engine).” error message. This error message seems that the Microsoft JET Database Engine is
    unable to handle something that is contained in the file.
    So please make sure there is no unsupported content in the Excel file. Alternatively, we can use ‘Microsoft Excel’ as the Data Source, then Select ‘Microsoft Excel 2007’ as the Excel version to import the excel file.
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

  • Importing and Exporting Data with a Clob datatype with HTML DB

    I would like to know what to do and what to be aware of when Importing and Exporting data with a Clob Datatype with HTML DB?

    Colin - what kind of import/export operation would that be, which pages are you referring to?
    Scott

  • Import and export of word files with references (iPAD)

    Hi,
    Does Pages for iPAD supports importing and exporting of files with references generated by the prog "ENDNOTE" (http://www.endnote.com/). it s a must for grants and papers writing.
    is their any way to ask the apple guys directly (new to the apple world...)
    Thanks,

    obsidan wrote:
    Hi,
    Does Pages for iPAD supports importing and exporting of files with references generated by the prog "ENDNOTE" (http://www.endnote.com/). it s a must for grants and papers writing.
    Pages for iPad does not support export/import of Endnote references in the form of formatted bibliography.
    is their any way to ask the apple guys directly (new to the apple world...)
    Yes, indeed, feedback directly to Apple is possible
    http://www.apple.com/feedback/ipad.html
    While Pages does not currently import/export and preserve the Endnote formatted bibliography, another app known as Documents to go does; there is not citation software for adding references though, but preservation is good.

Maybe you are looking for