<legend id='M5NHx'><style id='M5NHx'><dir id='M5NHx'><q id='M5NHx'></q></dir></style></legend>
    • <bdo id='M5NHx'></bdo><ul id='M5NHx'></ul>

      <tfoot id='M5NHx'></tfoot>
    1. <i id='M5NHx'><tr id='M5NHx'><dt id='M5NHx'><q id='M5NHx'><span id='M5NHx'><b id='M5NHx'><form id='M5NHx'><ins id='M5NHx'></ins><ul id='M5NHx'></ul><sub id='M5NHx'></sub></form><legend id='M5NHx'></legend><bdo id='M5NHx'><pre id='M5NHx'><center id='M5NHx'></center></pre></bdo></b><th id='M5NHx'></th></span></q></dt></tr></i><div id='M5NHx'><tfoot id='M5NHx'></tfoot><dl id='M5NHx'><fieldset id='M5NHx'></fieldset></dl></div>

      <small id='M5NHx'></small><noframes id='M5NHx'>

    2. 如何将 SQL Server 表导入 itab?

      时间:2023-06-25
        <bdo id='HsGJF'></bdo><ul id='HsGJF'></ul>
      • <i id='HsGJF'><tr id='HsGJF'><dt id='HsGJF'><q id='HsGJF'><span id='HsGJF'><b id='HsGJF'><form id='HsGJF'><ins id='HsGJF'></ins><ul id='HsGJF'></ul><sub id='HsGJF'></sub></form><legend id='HsGJF'></legend><bdo id='HsGJF'><pre id='HsGJF'><center id='HsGJF'></center></pre></bdo></b><th id='HsGJF'></th></span></q></dt></tr></i><div id='HsGJF'><tfoot id='HsGJF'></tfoot><dl id='HsGJF'><fieldset id='HsGJF'></fieldset></dl></div>

      • <tfoot id='HsGJF'></tfoot>

          <tbody id='HsGJF'></tbody>

              <small id='HsGJF'></small><noframes id='HsGJF'>

              <legend id='HsGJF'><style id='HsGJF'><dir id='HsGJF'><q id='HsGJF'></q></dir></style></legend>

                本文介绍了如何将 SQL Server 表导入 itab?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                是否可以将SQL Server表中的数据直接导入到内表(itab)中?

                is it possible to import data in SQL Server table to internal table (itab) directly?

                我想在 SE37 函数中使用这个 itab.提前致谢

                I want to use this itab in a SE37 function. thanks in advance

                推荐答案

                对于您的任务,您可以使用功能模块 (SE37),也可以使用模块池或报告(SE38、SE80).检查此报告:

                For your task you can use a function module (SE37) or you can use module pool, or a report (SE38, SE80). Check this report:

                report zinsertdb.
                
                data: oref   type ref to cx_root,
                      p_conex type dbcon_name value 'YOUR_DB_CONNECTION_STRING', " Ask the basis for this
                      lv_sw type c,
                      errormessage type string.
                
                data it_mydata type standard table of mara.
                
                start-of-selection.
                
                  perform connect.
                  perform insert_into_db.
                  perform disconnect.
                
                form connect.
                  try.
                      EXEC SQL.
                        CONNECT TO :p_conex
                      ENDEXEC.
                      lv_sw = 'X'.
                    catch cx_sy_native_sql_error into oref.
                      lv_sw = space.
                      errormessage = oref->get_text( ).
                  endtry.
                endform.
                
                form disconnect.
                  clear errormessage.
                  if lv_sw = 'X'.
                    try.
                        EXEC SQL.
                          COMMIT
                        ENDEXEC.
                      catch cx_sy_native_sql_error into oref.
                        errormessage = oref->get_text( ).     
                    endtry.
                  endif.
                endform.
                
                form insert_into_db.
                
                   data wa_mydata like line of it_mydata.
                   data zcount type i.
                
                   select * from mara into corresponding fields of table it_mydata.
                
                   if sy-subrc EQ 0.
                
                     loop at it_mydata into wa_mydata.
                
                        try .
                
                            exec sql. 
                              EXECUTE PROCEDURE sp_get_data ( IN :wa_mydata-EAN11, IN :wa_mydata-MEINS, OUT :zcount ) 
                            endexec.
                
                            if zcount eq 0.
                              exec sql.
                                INSERT INTO "Your_Database".dbo.[Your_table]
                                (Field1, Field2, Field3, FieldN)
                                 VALUES (:wa_mydata-matnr,
                                         :wa_mydata-ean11,
                                         :wa_mydata-matkl,
                                         :wa_mydata-meins)
                              endexec.
                              lv_sw = 'X'.
                            endif.
                
                          catch cx_sy_native_sql_error into oref.
                            lv_sw = space.
                            errormessage = oref->get_text( ).   
                        endtry.
                
                     endloop.
                
                   endif.
                
                endform.
                

                希望有帮助.

                这篇关于如何将 SQL Server 表导入 itab?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:在 Win7 64 位上启动 XAMPP 或 WAMP 的最快方法? 下一篇:如何从 SAP ABAP 系统中提取数据?

                相关文章

                  <bdo id='ecOEL'></bdo><ul id='ecOEL'></ul>

                <small id='ecOEL'></small><noframes id='ecOEL'>

                    <i id='ecOEL'><tr id='ecOEL'><dt id='ecOEL'><q id='ecOEL'><span id='ecOEL'><b id='ecOEL'><form id='ecOEL'><ins id='ecOEL'></ins><ul id='ecOEL'></ul><sub id='ecOEL'></sub></form><legend id='ecOEL'></legend><bdo id='ecOEL'><pre id='ecOEL'><center id='ecOEL'></center></pre></bdo></b><th id='ecOEL'></th></span></q></dt></tr></i><div id='ecOEL'><tfoot id='ecOEL'></tfoot><dl id='ecOEL'><fieldset id='ecOEL'></fieldset></dl></div>
                  1. <legend id='ecOEL'><style id='ecOEL'><dir id='ecOEL'><q id='ecOEL'></q></dir></style></legend>
                    <tfoot id='ecOEL'></tfoot>