Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Export Sap table to Sql Server or any database with index

Former Member
0 Likes
610

Hi friends

I want export selected (at selection screen) table structure to Sql Server (or Access,Paradox etc.) with Indexes (if not possible only primary key). How can I do that? Does anybody have an example application for that?

Thanks

3 REPLIES 3
Read only

Former Member
0 Likes
429

Uggh... Does anybody know anything?

Read only

0 Likes
429

Hi Mehmet

FM: DDIF_NAMETAB_GET should server your requirement in extracting. You can download the data into an internal table and then transfer the same to SQL Server.

Below code can help you in using the same:

parameters: p_table type DDOBJNAME obligatory.
data: it_x031l type table of x031l,
      it_dfies type table of dfies.

CALL FUNCTION 'DDIF_NAMETAB_GET'
  EXPORTING
    TABNAME           = p_table
 TABLES
   X031L_TAB         = it_x031l
   DFIES_TAB         = it_dfies
 EXCEPTIONS
   NOT_FOUND         = 1
   OTHERS            = 2.
IF SY-SUBRC eq 0.

   CALL FUNCTION 'GUI_DOWNLOAD'
     EXPORTING
       FILENAME                        = 'C:T100.xls'
      WRITE_FIELD_SEPARATOR           =
cl_abap_char_utilities=>horizontal_tab
     TABLES
       DATA_TAB                        = it_dfies
    EXCEPTIONS
      FILE_WRITE_ERROR                = 1
      NO_BATCH                        = 2
      GUI_REFUSE_FILETRANSFER         = 3
      INVALID_TYPE                    = 4
      NO_AUTHORITY                    = 5
      UNKNOWN_ERROR                   = 6
      HEADER_NOT_ALLOWED              = 7
      SEPARATOR_NOT_ALLOWED           = 8
      FILESIZE_NOT_ALLOWED            = 9
      HEADER_TOO_LONG                 = 10
      DP_ERROR_CREATE                 = 11
      DP_ERROR_SEND                   = 12
      DP_ERROR_WRITE                  = 13
      UNKNOWN_DP_ERROR                = 14
      ACCESS_DENIED                   = 15
      DP_OUT_OF_MEMORY                = 16
      DISK_FULL                       = 17
      DP_TIMEOUT                      = 18
      FILE_NOT_FOUND                  = 19
      DATAPROVIDER_EXCEPTION          = 20
      CONTROL_FLUSH_ERROR             = 21
      OTHERS                          = 22
             .
   IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
   ENDIF.

ENDIF.

We can pass both Table or Structure Names for paramter.

Kind Regards

Eswar

<b>Code for using the above FM</b>

Read only

0 Likes
429

Hi,

I will explain you my requirement.

Whenever there is a change in HR master data like insertion of new personnel number or deletion of personnel number or change in cost center , those changes should get updated immediately in the SQL sever.

That means the updation should be event driven like whenver there is a change in HR master data then only SQL Server should get updated.

Can this functionality be achieved programatically ??

Best Regards

Chandrika.