<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Uploading Custom Table data? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-custom-table-data/m-p/2674242#M617689</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;give ten points for the code !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;************************************************************************
* ABAP name : ZBTA0001                                                 *
*                                                                      *
* Created by : Frédéric GIROD / Sébastien COLLOMB                      *
*                                                                      *
* Date : 14/03/2005                                                    *
*                                                                      *
* Description : BCxxxx Chargement / Dechargement de tables             *
* transparentes SAP.                                                   *
*                                                                      *
*                                                                      *
************************************************************************
* MODIFICATIONS                                                        *
************************************************************************
* Date * Author * Marking code * Description                           *
************************************************************************
* * * *                                                                *
************************************************************************
REPORT ZBC_SAUVEGARDE_TABLE
       NO STANDARD PAGE HEADING.







*------------------------------- TABLES -------------------------------*
TABLES : dd02t.







*-------------------------------- DATA --------------------------------*
DATA : wt_fieldcat TYPE lvc_t_fcat ,
       ws_fieldcat TYPE lvc_s_fcat ,

BEGIN OF wt_tablist OCCURS 0 ,
  tabname TYPE tabname ,
  ddtext TYPE as4text ,
END OF wt_tablist .







FIELD-SYMBOLS : &amp;lt;wfv_structname&amp;gt; TYPE typename , " Nom de la table
                &amp;lt;wft_table&amp;gt;      TYPE table , " Table interne dyn
                &amp;lt;wfs_structure&amp;gt;  TYPE ANY . " Structure de la table









*-------------------------- SELECTION SCREEN --------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
PARAMETERS p_table TYPE tabname.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
PARAMETERS : p_imp RADIOBUTTON GROUP ra1 ,
             p_exp RADIOBUTTON GROUP ra1
                   DEFAULT 'X' ,
             p_clear AS CHECKBOX .
SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
PARAMETERS : p_file TYPE localfile
                    OBLIGATORY .
SELECTION-SCREEN SKIP 1.
PARAMETERS : p_excl RADIOBUTTON GROUP ra2 ,
             p_flat RADIOBUTTON GROUP ra2 .
SELECTION-SCREEN END OF BLOCK b3.













*-------------------------------- MAIN --------------------------------*
START-OF-SELECTION.

* Vérification des options de sélection.
  PERFORM p_check.

* Déchargement de la table.
  IF p_exp EQ 'X'.
    PERFORM p_dechargement.

* Chargement de la table.
  ELSE.
    PERFORM p_chargement.

  ENDIF.



END-OF-SELECTION.















*----------------------------------------------------------------------*
* Form P_CHECK.                                                        *
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
FORM p_check.



  DATA : wlv_tabname TYPE tabname.


* Verifie que la table existe.
  SELECT tabname
         UP TO 1 ROWS
         INTO wlv_tabname
         FROM dd02t
         WHERE tabname EQ p_table
         AND as4local EQ 'A'.
  ENDSELECT.

  IF sy-subrc NE space.
    WRITE : /3 text-001.
    STOP.
  ENDIF.

* On ne traite que le chargement des tables Z*.
  IF p_imp EQ 'X' AND p_table+0(1) NE 'Z'.
    WRITE : /1 text-007.
    STOP.
  ENDIF.


ENDFORM. " P_CHECK.







*----------------------------------------------------------------------*
* Form P_DECHARGEMENT.                                                 *
*----------------------------------------------------------------------*
* Déchargement de la table.                                            *
*----------------------------------------------------------------------*
FORM p_dechargement.


* Création de la table interne dynamique du type de la table.
  PERFORM p_create_dyntable
          USING p_table.

* Lecture de la table ( et oui un joli select * ! )
  SELECT *
         INTO TABLE &amp;lt;wft_table&amp;gt;
         FROM (p_table).

* Si déchargen en format Excel.
  IF p_excl EQ 'X'.
    CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
      EXPORTING
        i_filename        = p_file
      TABLES
        i_tab_sap_data    = &amp;lt;wft_table&amp;gt;
      EXCEPTIONS
        conversion_failed = 1
        OTHERS            = 2.
    IF sy-subrc NE space.
      WRITE : /3 text-003.
    ENDIF.

* Si fichier plat.
  ELSEIF p_flat EQ 'X'.

    CALL FUNCTION 'WS_DOWNLOAD'
      EXPORTING
        filename = p_file
        filetype = 'DAT'
      TABLES
        data_tab = &amp;lt;wft_table&amp;gt;
      EXCEPTIONS
        OTHERS   = 10.
    IF sy-subrc NE space.
      WRITE : /3 text-003.
    ENDIF.

  ENDIF.

ENDFORM. " P_DECHARGEMENT.









*----------------------------------------------------------------------*
* Form P_CHARGEMENT.                                                   *
*----------------------------------------------------------------------*
* Chargement.                                                          *
*----------------------------------------------------------------------*
FORM p_chargement.


  DATA : wlv_count_col TYPE i ,
         wlv_flag_row TYPE kcd_ex_row_n ,
         wlt_file TYPE TABLE OF alsmex_tabline
                  WITH HEADER LINE ,
         wlv_char1 TYPE char1.

  FIELD-SYMBOLS : &amp;lt;wlfv_field&amp;gt; TYPE ANY.


* Création de la table interne dynamique du type de la table.
  PERFORM p_create_dyntable
          USING p_table.

* Lecture du fichier.
* Si déchargen en format Excel.
  IF p_excl EQ 'X'.

*   Seek number of column.
    DESCRIBE TABLE wt_fieldcat LINES wlv_count_col.

*   Function to read the Microsoft Excel file.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                = p_file
        i_begin_col             = '1'
        i_begin_row             = '1'
        i_end_col               = wlv_count_col
        i_end_row               = '10000'
      TABLES
        intern                  = wlt_file
      EXCEPTIONS
        inconsistent_parameters = 1
        upload_ole              = 2
        OTHERS                  = 3.
    IF sy-subrc NE space.
      WRITE : /3 text-003.
      STOP.
    ENDIF.

*   Set data.
    LOOP AT wlt_file.

      IF wlt_file-row NE wlv_flag_row.
        MOVE wlt_file-row TO wlv_flag_row.
        IF wlt_file-row NE 1.
          APPEND &amp;lt;wfs_structure&amp;gt; TO &amp;lt;wft_table&amp;gt;.
          CLEAR &amp;lt;wfs_structure&amp;gt;.
        ENDIF.
      ENDIF.

      READ TABLE wt_fieldcat
           INTO ws_fieldcat
           INDEX wlt_file-col.

      CHECK sy-subrc EQ space.
      ASSIGN COMPONENT ws_fieldcat-fieldname
             OF STRUCTURE &amp;lt;wfs_structure&amp;gt;
             TO &amp;lt;wlfv_field&amp;gt;.
      CATCH SYSTEM-EXCEPTIONS conversion_errors = 1.
        MOVE wlt_file-value TO &amp;lt;wlfv_field&amp;gt;.
      ENDCATCH.

      IF sy-subrc EQ 1.
        " A FAIRE
      ENDIF.

    ENDLOOP.

*   Append last time.
    APPEND &amp;lt;wfs_structure&amp;gt; TO &amp;lt;wft_table&amp;gt;.


* Si fichier plat.
  ELSEIF p_flat EQ 'X'.

    CALL FUNCTION 'WS_UPLOAD'
      EXPORTING
        filename = p_file
        filetype = 'DAT'
      TABLES
        data_tab = &amp;lt;wft_table&amp;gt;
      EXCEPTIONS
        OTHERS   = 10.

    IF sy-subrc NE space.
      WRITE : /3 text-003.
      STOP.
    ENDIF.

  ENDIF.





* Si vide la table avant.
  IF p_clear EQ 'X'.

*   Verification avant la suppression de la table.
    CALL FUNCTION 'POPUP_TO_CONFIRM'
      EXPORTING
        titlebar       = text-004
        text_question  = text-005
      IMPORTING
        answer         = wlv_char1
      EXCEPTIONS
        text_not_found = 1
        OTHERS         = 2.
    IF wlv_char1 EQ '2'.
      STOP.
    ENDIF.

*   On supprime tout.
    DELETE FROM (p_table) CLIENT SPECIFIED
           WHERE mandt EQ sy-mandt.

    IF sy-subrc NE space.
      WRITE : /3 text-003.
      STOP.
    ENDIF.

  ENDIF.



* Chargement de la base.
  MODIFY (p_table) FROM TABLE &amp;lt;wft_table&amp;gt;.
  IF sy-subrc NE space.
    WRITE : /3 text-003.
    STOP.
  ENDIF.



ENDFORM. " P_CHARGEMENT.









*----------------------------------------------------------------------*
* Form P_CREATE_DYNTABLE.                                              *
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
FORM p_create_dyntable
     USING wpv_tabname TYPE tabname.


  DATA : wlt_table TYPE REF TO data ,
         wls_table TYPE REF TO data .


* On assigne le nom de la table.
  IF &amp;lt;wfv_structname&amp;gt; IS ASSIGNED.
    UNASSIGN &amp;lt;wfv_structname&amp;gt;.
  ENDIF.
  ASSIGN wpv_tabname TO &amp;lt;wfv_structname&amp;gt;.


* Recherche de la description du dictionnaire.
  REFRESH wt_fieldcat.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name       = &amp;lt;wfv_structname&amp;gt;
      i_bypassing_buffer     = 'X'
    CHANGING
      ct_fieldcat            = wt_fieldcat
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2
      OTHERS                 = 3.

  IF sy-subrc NE space.
    WRITE : /1 text-003.
    STOP.
  ENDIF.



* Création de la table interne dynamique.
  IF &amp;lt;wft_table&amp;gt; IS ASSIGNED.
    UNASSIGN &amp;lt;wft_table&amp;gt;.
  ENDIF.

  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog = wt_fieldcat
    IMPORTING
      ep_table        = wlt_table.

  ASSIGN wlt_table-&amp;gt;* TO &amp;lt;wft_table&amp;gt;.



* Création de la structure du type de la table.
  IF &amp;lt;wfs_structure&amp;gt; IS ASSIGNED.
    UNASSIGN &amp;lt;wfs_structure&amp;gt;.
  ENDIF.
  CREATE DATA wls_table LIKE LINE OF &amp;lt;wft_table&amp;gt;.
  ASSIGN wls_table-&amp;gt;* TO &amp;lt;wfs_structure&amp;gt;.


ENDFORM. " P_CREATE_DYNTABLE.






*------------------------------- EVENTS -------------------------------*
* Au démarage de l'application.
INITIALIZATION.

* On desactive la zone vider la table, elle n'est active que pour
* le chargement.
  LOOP AT SCREEN.
    IF screen-name EQ 'P_CLEAR'.
      MOVE '0' TO screen-active.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

* A l'événement rafraichissement de l'écran.
AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.
* Si on charge alors on active la zone P_CLEAR.
    IF p_imp EQ 'X'.
      IF screen-name EQ 'P_CLEAR'.
        MOVE '1' TO screen-active.
        MODIFY SCREEN.
      ENDIF.
    ELSE.
      IF screen-name EQ 'P_CLEAR'.
        MOVE '0' TO screen-active.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.
  ENDLOOP.

* Evenement F4 sur P_FILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CALL FUNCTION 'F4_FILENAME'
    IMPORTING
      file_name = p_file.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Aug 2007 13:18:59 GMT</pubDate>
    <dc:creator>FredericGirod</dc:creator>
    <dc:date>2007-08-17T13:18:59Z</dc:date>
    <item>
      <title>Uploading Custom Table data?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-custom-table-data/m-p/2674241#M617688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Once I have data in a spreadsheet. Is there an SAP transaction for uploading the data into a custom table? Else, I'll write a utility to do this. Anybody have a generic ABAP utility for this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                      Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Aug 2007 13:17:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-custom-table-data/m-p/2674241#M617688</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-17T13:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: Uploading Custom Table data?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-custom-table-data/m-p/2674242#M617689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;give ten points for the code !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;************************************************************************
* ABAP name : ZBTA0001                                                 *
*                                                                      *
* Created by : Frédéric GIROD / Sébastien COLLOMB                      *
*                                                                      *
* Date : 14/03/2005                                                    *
*                                                                      *
* Description : BCxxxx Chargement / Dechargement de tables             *
* transparentes SAP.                                                   *
*                                                                      *
*                                                                      *
************************************************************************
* MODIFICATIONS                                                        *
************************************************************************
* Date * Author * Marking code * Description                           *
************************************************************************
* * * *                                                                *
************************************************************************
REPORT ZBC_SAUVEGARDE_TABLE
       NO STANDARD PAGE HEADING.







*------------------------------- TABLES -------------------------------*
TABLES : dd02t.







*-------------------------------- DATA --------------------------------*
DATA : wt_fieldcat TYPE lvc_t_fcat ,
       ws_fieldcat TYPE lvc_s_fcat ,

BEGIN OF wt_tablist OCCURS 0 ,
  tabname TYPE tabname ,
  ddtext TYPE as4text ,
END OF wt_tablist .







FIELD-SYMBOLS : &amp;lt;wfv_structname&amp;gt; TYPE typename , " Nom de la table
                &amp;lt;wft_table&amp;gt;      TYPE table , " Table interne dyn
                &amp;lt;wfs_structure&amp;gt;  TYPE ANY . " Structure de la table









*-------------------------- SELECTION SCREEN --------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
PARAMETERS p_table TYPE tabname.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
PARAMETERS : p_imp RADIOBUTTON GROUP ra1 ,
             p_exp RADIOBUTTON GROUP ra1
                   DEFAULT 'X' ,
             p_clear AS CHECKBOX .
SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
PARAMETERS : p_file TYPE localfile
                    OBLIGATORY .
SELECTION-SCREEN SKIP 1.
PARAMETERS : p_excl RADIOBUTTON GROUP ra2 ,
             p_flat RADIOBUTTON GROUP ra2 .
SELECTION-SCREEN END OF BLOCK b3.













*-------------------------------- MAIN --------------------------------*
START-OF-SELECTION.

* Vérification des options de sélection.
  PERFORM p_check.

* Déchargement de la table.
  IF p_exp EQ 'X'.
    PERFORM p_dechargement.

* Chargement de la table.
  ELSE.
    PERFORM p_chargement.

  ENDIF.



END-OF-SELECTION.















*----------------------------------------------------------------------*
* Form P_CHECK.                                                        *
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
FORM p_check.



  DATA : wlv_tabname TYPE tabname.


* Verifie que la table existe.
  SELECT tabname
         UP TO 1 ROWS
         INTO wlv_tabname
         FROM dd02t
         WHERE tabname EQ p_table
         AND as4local EQ 'A'.
  ENDSELECT.

  IF sy-subrc NE space.
    WRITE : /3 text-001.
    STOP.
  ENDIF.

* On ne traite que le chargement des tables Z*.
  IF p_imp EQ 'X' AND p_table+0(1) NE 'Z'.
    WRITE : /1 text-007.
    STOP.
  ENDIF.


ENDFORM. " P_CHECK.







*----------------------------------------------------------------------*
* Form P_DECHARGEMENT.                                                 *
*----------------------------------------------------------------------*
* Déchargement de la table.                                            *
*----------------------------------------------------------------------*
FORM p_dechargement.


* Création de la table interne dynamique du type de la table.
  PERFORM p_create_dyntable
          USING p_table.

* Lecture de la table ( et oui un joli select * ! )
  SELECT *
         INTO TABLE &amp;lt;wft_table&amp;gt;
         FROM (p_table).

* Si déchargen en format Excel.
  IF p_excl EQ 'X'.
    CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
      EXPORTING
        i_filename        = p_file
      TABLES
        i_tab_sap_data    = &amp;lt;wft_table&amp;gt;
      EXCEPTIONS
        conversion_failed = 1
        OTHERS            = 2.
    IF sy-subrc NE space.
      WRITE : /3 text-003.
    ENDIF.

* Si fichier plat.
  ELSEIF p_flat EQ 'X'.

    CALL FUNCTION 'WS_DOWNLOAD'
      EXPORTING
        filename = p_file
        filetype = 'DAT'
      TABLES
        data_tab = &amp;lt;wft_table&amp;gt;
      EXCEPTIONS
        OTHERS   = 10.
    IF sy-subrc NE space.
      WRITE : /3 text-003.
    ENDIF.

  ENDIF.

ENDFORM. " P_DECHARGEMENT.









*----------------------------------------------------------------------*
* Form P_CHARGEMENT.                                                   *
*----------------------------------------------------------------------*
* Chargement.                                                          *
*----------------------------------------------------------------------*
FORM p_chargement.


  DATA : wlv_count_col TYPE i ,
         wlv_flag_row TYPE kcd_ex_row_n ,
         wlt_file TYPE TABLE OF alsmex_tabline
                  WITH HEADER LINE ,
         wlv_char1 TYPE char1.

  FIELD-SYMBOLS : &amp;lt;wlfv_field&amp;gt; TYPE ANY.


* Création de la table interne dynamique du type de la table.
  PERFORM p_create_dyntable
          USING p_table.

* Lecture du fichier.
* Si déchargen en format Excel.
  IF p_excl EQ 'X'.

*   Seek number of column.
    DESCRIBE TABLE wt_fieldcat LINES wlv_count_col.

*   Function to read the Microsoft Excel file.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                = p_file
        i_begin_col             = '1'
        i_begin_row             = '1'
        i_end_col               = wlv_count_col
        i_end_row               = '10000'
      TABLES
        intern                  = wlt_file
      EXCEPTIONS
        inconsistent_parameters = 1
        upload_ole              = 2
        OTHERS                  = 3.
    IF sy-subrc NE space.
      WRITE : /3 text-003.
      STOP.
    ENDIF.

*   Set data.
    LOOP AT wlt_file.

      IF wlt_file-row NE wlv_flag_row.
        MOVE wlt_file-row TO wlv_flag_row.
        IF wlt_file-row NE 1.
          APPEND &amp;lt;wfs_structure&amp;gt; TO &amp;lt;wft_table&amp;gt;.
          CLEAR &amp;lt;wfs_structure&amp;gt;.
        ENDIF.
      ENDIF.

      READ TABLE wt_fieldcat
           INTO ws_fieldcat
           INDEX wlt_file-col.

      CHECK sy-subrc EQ space.
      ASSIGN COMPONENT ws_fieldcat-fieldname
             OF STRUCTURE &amp;lt;wfs_structure&amp;gt;
             TO &amp;lt;wlfv_field&amp;gt;.
      CATCH SYSTEM-EXCEPTIONS conversion_errors = 1.
        MOVE wlt_file-value TO &amp;lt;wlfv_field&amp;gt;.
      ENDCATCH.

      IF sy-subrc EQ 1.
        " A FAIRE
      ENDIF.

    ENDLOOP.

*   Append last time.
    APPEND &amp;lt;wfs_structure&amp;gt; TO &amp;lt;wft_table&amp;gt;.


* Si fichier plat.
  ELSEIF p_flat EQ 'X'.

    CALL FUNCTION 'WS_UPLOAD'
      EXPORTING
        filename = p_file
        filetype = 'DAT'
      TABLES
        data_tab = &amp;lt;wft_table&amp;gt;
      EXCEPTIONS
        OTHERS   = 10.

    IF sy-subrc NE space.
      WRITE : /3 text-003.
      STOP.
    ENDIF.

  ENDIF.





* Si vide la table avant.
  IF p_clear EQ 'X'.

*   Verification avant la suppression de la table.
    CALL FUNCTION 'POPUP_TO_CONFIRM'
      EXPORTING
        titlebar       = text-004
        text_question  = text-005
      IMPORTING
        answer         = wlv_char1
      EXCEPTIONS
        text_not_found = 1
        OTHERS         = 2.
    IF wlv_char1 EQ '2'.
      STOP.
    ENDIF.

*   On supprime tout.
    DELETE FROM (p_table) CLIENT SPECIFIED
           WHERE mandt EQ sy-mandt.

    IF sy-subrc NE space.
      WRITE : /3 text-003.
      STOP.
    ENDIF.

  ENDIF.



* Chargement de la base.
  MODIFY (p_table) FROM TABLE &amp;lt;wft_table&amp;gt;.
  IF sy-subrc NE space.
    WRITE : /3 text-003.
    STOP.
  ENDIF.



ENDFORM. " P_CHARGEMENT.









*----------------------------------------------------------------------*
* Form P_CREATE_DYNTABLE.                                              *
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
FORM p_create_dyntable
     USING wpv_tabname TYPE tabname.


  DATA : wlt_table TYPE REF TO data ,
         wls_table TYPE REF TO data .


* On assigne le nom de la table.
  IF &amp;lt;wfv_structname&amp;gt; IS ASSIGNED.
    UNASSIGN &amp;lt;wfv_structname&amp;gt;.
  ENDIF.
  ASSIGN wpv_tabname TO &amp;lt;wfv_structname&amp;gt;.


* Recherche de la description du dictionnaire.
  REFRESH wt_fieldcat.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name       = &amp;lt;wfv_structname&amp;gt;
      i_bypassing_buffer     = 'X'
    CHANGING
      ct_fieldcat            = wt_fieldcat
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2
      OTHERS                 = 3.

  IF sy-subrc NE space.
    WRITE : /1 text-003.
    STOP.
  ENDIF.



* Création de la table interne dynamique.
  IF &amp;lt;wft_table&amp;gt; IS ASSIGNED.
    UNASSIGN &amp;lt;wft_table&amp;gt;.
  ENDIF.

  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog = wt_fieldcat
    IMPORTING
      ep_table        = wlt_table.

  ASSIGN wlt_table-&amp;gt;* TO &amp;lt;wft_table&amp;gt;.



* Création de la structure du type de la table.
  IF &amp;lt;wfs_structure&amp;gt; IS ASSIGNED.
    UNASSIGN &amp;lt;wfs_structure&amp;gt;.
  ENDIF.
  CREATE DATA wls_table LIKE LINE OF &amp;lt;wft_table&amp;gt;.
  ASSIGN wls_table-&amp;gt;* TO &amp;lt;wfs_structure&amp;gt;.


ENDFORM. " P_CREATE_DYNTABLE.






*------------------------------- EVENTS -------------------------------*
* Au démarage de l'application.
INITIALIZATION.

* On desactive la zone vider la table, elle n'est active que pour
* le chargement.
  LOOP AT SCREEN.
    IF screen-name EQ 'P_CLEAR'.
      MOVE '0' TO screen-active.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

* A l'événement rafraichissement de l'écran.
AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.
* Si on charge alors on active la zone P_CLEAR.
    IF p_imp EQ 'X'.
      IF screen-name EQ 'P_CLEAR'.
        MOVE '1' TO screen-active.
        MODIFY SCREEN.
      ENDIF.
    ELSE.
      IF screen-name EQ 'P_CLEAR'.
        MOVE '0' TO screen-active.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.
  ENDLOOP.

* Evenement F4 sur P_FILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CALL FUNCTION 'F4_FILENAME'
    IMPORTING
      file_name = p_file.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Aug 2007 13:18:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-custom-table-data/m-p/2674242#M617689</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2007-08-17T13:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Uploading Custom Table data?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-custom-table-data/m-p/2674243#M617690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Beautiful!    Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Aug 2007 13:35:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-custom-table-data/m-p/2674243#M617690</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-17T13:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Uploading Custom Table data?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-custom-table-data/m-p/2674244#M617691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ALSM_EXCEL_TO_INTERNAL_TABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use this FM to upload from excel to internal table...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Aug 2007 13:38:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-custom-table-data/m-p/2674244#M617691</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-17T13:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Uploading Custom Table data?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-custom-table-data/m-p/2674245#M617692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fred,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need the full code of for exporting data ..&lt;/P&gt;&lt;P&gt;I am not able to understand the cooments , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Siva.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Jul 2011 17:24:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/uploading-custom-table-data/m-p/2674245#M617692</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-07-02T17:24:28Z</dc:date>
    </item>
  </channel>
</rss>

