Abap sql convert to native sql fuction

hi expert!
exist a function can do follow things:
  convert selection-screen's select-options which user key in
     to oracle where condition expression
or exist one function can convert abap sql to oracle sql
thank you very much

example:
  EXEC SQL.
        CONNECT TO :'DATA BASE NAME'
      ENDEXEC.
      IF sy-subrc EQ 0 .
         TRY.
              EXEC SQL .
                SELECT COUNT(*) FROM <TABLE NAME>
                INTO :recount
                WHERE code = :itab-<FIELD>
              ENDEXEC .
            CATCH cx_sy_native_sql_error INTO exc_ref.
              error_text = exc_ref->get_text( ).
              MESSAGE error_text TYPE 'I'.
          ENDTRY.

Similar Messages

  • Where to do the abap sql statement in sapscript (PO)

    Hi, all.
    Hope anybody can guide me to find a solution.
    My situation now is i have to do a purchase order in SAPSCRIPT starting from a standard po. I already found out all the related details as below:
    Program           SAPFM06P
    FORM routine      ENTRY_NEU
    Form              MEDRUCK
    So, now the problem now is I have to add some more data on my print out PO. After figure out for some time, I don't know where to do my abap sql statement. Like example, I want to retriece some data from the ADRC table. I opened the standard program SAPFM06P to add in the some sql statement, but i dun know where should i add in. Bcz if we straight away put the related ADRC field in our sapscript, it is useless, right?
    Thanks in advance.

    Thanks a lot.
    So, how should i add in code in order to fetch the data frm ADRC by using that routine. Because i only the codes like below. I don't where should i start add in.
    Form entry_neu using ent_retco ent_screen.
      data: l_druvo like t166k-druvo,
            l_nast  like nast,
            l_from_memory,
            l_doc   type meein_purchase_doc_print.
      clear ent_retco.
      if nast-aende eq space.
        l_druvo = '1'.
      else.
        l_druvo = '2'.
      endif.
      call function 'ME_READ_PO_FOR_PRINTING'
           exporting
                ix_nast        = nast
                ix_screen      = ent_screen
           importing
                ex_retco       = ent_retco
                ex_nast        = l_nast
                doc            = l_doc
           changing
                cx_druvo       = l_druvo
                cx_from_memory = l_from_memory.
      check ent_retco eq 0.
      call function 'ME_PRINT_PO'
           exporting
                ix_nast        = l_nast
                ix_druvo       = l_druvo
                doc            = l_doc
                ix_screen      = ent_screen
                ix_from_memory = l_from_memory
                ix_toa_dara    = toa_dara
                ix_arc_params  = arc_params
                ix_fonam       = tnapr-fonam          "HW 214570
           importing
                ex_retco       = ent_retco.
    endform.
    Or i come wrong place to add in any coding. Plz guide me.
    Thanks in advance.

  • ABAP SQL Doubt

    Hi ABAP Gurus,
    Please help me in solving following ABAP SQL doubt.
    In the table Zonfig there are two fields: FNAME and REQFLAG
    FNAME.....REQFLAG
    S1...........X
    S2...........X
    S3..........._
    S4...........X
    Other table T_Zconfig has one field : XNAME
    XNAME
    S1
    S3
    Now I have to select REQFLAG from Zconfig table for the values of field XNAME in T_Zconfig table.
    That is in this case for FNAME S1 and S2 in Zonfig I need to fetch REQFLAG since in XNAME in T_Zonfig we just have S1 and S2.
    Points will be surly awarded...
    Thanks.

    Hi ABAP Gurus,
    Please help me in solving following ABAP SQL doubt.
    In the table Zonfig there are two fields: FNAME and REQFLAG
    FNAME.....REQFLAG
    S1...........X
    S2...........X
    S3..........._
    S4...........X
    Other table T_Zconfig has one field : XNAME
    XNAME
    S1
    S3
    Now I have to select REQFLAG from Zconfig table for the values of field XNAME in T_Zconfig table.
    That is in this case for FNAME S1 and S3 in Zonfig I need to fetch REQFLAG since in XNAME in T_Zonfig we just have S1 and S3.
    Points will be surly awarded...
    Thanks.

  • Capture pl/sql fuction return into XML

    Hi all,
    I currently have a pl/sql fuction if which returns an array. I am calling the function from an xsql page within a DML statement.
    Does anyone know if there is a way of capturing the return value inside a xsql:page-param for output of xml when the page in loaded into the browser or bind params are given to the fuction?
    Any advice on this would be great.
    Thanks in advance!
    Stefan

    Hi all,
    I currently have a pl/sql fuction if which returns an array. I am calling the function from an xsql page within a DML statement.
    Does anyone know if there is a way of capturing the return value inside a xsql:page-param for output of xml when the page in loaded into the browser or bind params are given to the fuction?
    Any advice on this would be great.
    Thanks in advance!
    Stefan

  • ABAP SQL manager

    Please, advice ABAP SQL manager.
    Program which allows to execute any SQL queries.

    hi ;
    İf you want execute T-sql in sap , u can use this program ;
    Regards.
    İrfan
    << cut and paste without attribution from https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7168fa07-0b01-0010-7698-87fbfc556f1d
    removed. Points unassigned. >>
    Edited by: Rob Burbank on Mar 27, 2009 5:35 PM

  • "Failed to convert to native blob" error

    Can someone else me?  Whenever I go into the slideshow module, I get the error "failed to convert to native blog"  Any suggestions?

    Success!  I have been having this issue with the slideshow module for over a year.  The issue was that I had an old identity plate that was trying to use a font that I no longer have installed.  I opened the identity plate and updated it to use a font that I have currently.  Now I can finally use the slideshow module again!  Adobe - if you are listening - it would be nice to have a more descriptive error message when this happens, or to alert the user when lightroom starts that the font is now missing and will be replaced or similar.  Thanks all!

  • The Maxl command convert a native user in external user

    Is there a command MAXL to convert a native user in user external
    Thank you in advance

    Are you thinking of alter user? It has a set type external option as well as a set sss_mode.
    See: http://docs.oracle.com/cd/E17236_01/epm.1112/esb_tech_ref/maxl_altusr.html
    Regards,
    Cameron Lackpour

  • Read data from SharePoint using ABAP sql command

    We need to read data from a SharePoint site and update the sap object services with the information. There is a lot of information on how to put data into Sharepoint from SAP, but we need to get data from SharePoint and put it into SAP. Is it possible to retrieve data from SharePoint using sql command in ABAP program? If it is possible, what do we need to do to have SAP recognize where to get the SharePoint data?
    Richard Newman

    Hi Newman,
    You can use native sql in your abap code to read data from SharePoint's database. But I would suggest you to generate a SharePoint webservice which can provide you the neccessary data so that you can consume this webservice in ABAP
    (Will be quite faster than native sql).
    Regards,
    Ozcan.

  • ABAP SQL: Multiplication in Select-Statement

    Hi everybody,
    in native SQL it should be possible to use a statement like:
    SELECT preisstueck, (anzahl*preisstueck) as gesamtpreis FROM kaufteile
    in ABAP I tried:
      SELECT profile
         (SUM( val2300 ) AS val2300    ) + ( SUM( val2315 ) AS val2315    ) + ( SUM( val2330 ) AS val2330 )    + (SUM( val2345 ) AS val2345 )
    But I get an Error: Unknown row: (
    Could anybody pls help?
    Thanks
    Regards
    Mario

    I would never recommend using native SQL. Please try to use OpenSQL so that other abapers can easily understand the code (in future). Suppose in future the customer decides to migrate from Oracle to DB2 or HANA then the sql has to be changed too.
    but if you still insist in using it here is a sample code. Please note that it works only for transparent tables.
    REPORT demo_native_sql.
    DATA: BEGIN OF wa,
            connid   TYPE spfli-connid,
            cityfrom TYPE spfli-cityfrom,
            cityto   TYPE spfli-cityto,
          END OF wa.
    DATA c1 TYPE spfli-carrid VALUE 'LH'.
    EXEC SQL PERFORMING loop_output.
      SELECT connid, cityfrom, cityto
      INTO   :wa
      FROM   spfli
      WHERE  carrid = :c1
    ENDEXEC.
    FORM loop_output.
      WRITE: / wa-connid, wa-cityfrom, wa-cityto.
    ENDFORM.
    Please note:
    Native SQL statements bypass the R/3 database interface. There is no table logging, and no synchronization with the database buffer on the application server. For this reason, you should, wherever possible, use Open SQL to change database tables declared in the ABAP Dictionary. In particular, tables declared in the ABAP Dictionary that contain long columns with the types LCHR or LRAW should only be addressed using Open SQL, since the columns contain extra, database-specific length information for the column. Native SQL does not take this information into account, and may therefore produce incorrect results. Furthermore, Native SQL does not support automatic client handling. Instead, you must treat client fields like any other.
    See native SQL syntax for
    Oracle:Native SQL for Oracle (SAP Library - ABAP Programming (BC-ABA))
    Informix: Native SQL for Informix (SAP Library - ABAP Programming (BC-ABA))
    DB2: Native SQL for DB2 Common Server (SAP Library - ABAP Programming (BC-ABA))

  • UNION statement in ABAP SQL

    Hi,
    How to achieve the UNION SQL operation results in ABAP? To be specific, I want to retrieve STCD1 field value from vendor master table (LFA1) for all vendors (LIFNR) that exist in table BSIK or BSAK.
    And I want to achieve the results in single SQL statement. So in essence, the resultant SQL would be something like:
    SELECT STCD1
    INTO TABLE my_internal_table
    FROM LFA1
    WHERE LIFNR IN (SELECT DISTINCT LIFNR
                                                FROM BSIK
                                UNION
                                SELECT DISTINCT LIFNR
                                               FROM BSAK)
    But the UNION is not a valid keyword in ABAP. Any idea how to achieve this?
    Regards,
    Chetan

    hi chetan,
    do you have any where condition to filter the records from bsak and bsik?
    your requirement cannot be realized in a single statement.
    you have to use two separate selects from bsak and bsik, then, collect all the vendors in one internal table and at last you have to use this table to get the vendor info from lfa1.
    regards,
    ravi

  • How to check whether a value is empty in ABAP Sql

    Select matnr from mara where
    MARA~LVORM is null
    Basically if LVORM is blank, i.e., not popoulated, I want to get matnr.
    Will above query accomplish this in ABAP OPEN SQL.

    Hi,
    LVORM column is defined as a NOT NULL column.. so the values will be either a initial value (space, in this case) or filled with some value
    SELECT matnr
      INTO TABLE t_matnr
      FROM mara
      WHERE LVORM = space.
    https://cw.sdn.sap.com/cw/docs/DOC-40206
    http://learnsapmdm.blogspot.com/2009/01/data-modelling-and-database-design-in.html
    regards,
    Paulo Carvalho

  • BSP (ABAP, SQL & ITABS)

    Hi SCN Community,
    Today I have a question for the more experienced ABAP developers.
    I have a BSP Application which is based on HTML files.  The purpose of this BSP Application is to provide the front end user, with an interface where they can supply certain information which then needs to be executed in the BSP as SQL Queries.
    My environment for this purpose is as follows:
    The BSP Application is running on my SAP BW Dev server.
    The SQL Database which contains the information related to the queries, is an external (Same Domain) MS SQL Host.
    From what i've read, is that best practice would be to store that external DB in the Internal Tables (Temporary), so that the SQL Queries can be executed accordingly.
    My problem is, I have no SQL experience.  I do however have someone who can help me write the required SQL Queries to supply the required information to the Front End User, but I do not know how to approach this.  I have no clue how ITABS work, or how to implement and use them properly.
    I have already set up a DBCON entry for the external SQL Host and that part works, connection tested and is functional.
    Is there anyone who would be willing to assist me in getting this working?  Any technical advice would be highly appreciated.  If you do try to assist, please do so in as much detail as possible so that I can fully understand.
    Thank you,
    Kind Regards,

    hi ;
    İf you want execute T-sql in sap , u can use this program ;
    Regards.
    İrfan
    << cut and paste without attribution from https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7168fa07-0b01-0010-7698-87fbfc556f1d
    removed. Points unassigned. >>
    Edited by: Rob Burbank on Mar 27, 2009 5:35 PM

  • ABAP SQL error!

    Hi,
    I had installed ABAP on application server WAS 6.4 to enable ABAP engine along with the J2EE engine. but when i started the the server it is giving me the error " an sql error occured when accessing the table" in SAP management console.it is in the current status and the color has turned red on the current status.i had actually restarted the system after  installing ABAP on WAS.
    any remedy to the posted problem?

    Hi Ravi,
    May I ask how you solved this issue,I have the same problem.
    Thanks,
       Maryam

  • ABAP & SQL performance

    Hi all.
    I have the following sql wich performance isn't good enough because one of the tables used in the join as a lot of data.
    So i Want to know how i can improve it ?
    SELECT DISTINCT ordered_prod
      INTO TABLE ht_data-ordered_prod
      FROM crmd_orderadm_i as i
      JOIN crmd_link as l ON i~header = l~guid_hi
      JOIN crmd_partner as p on l~guid_set = p~guid
      WHERE l~objtype_set = '07'
      AND p~partner_no = wa_but000-partner_guid.
    Will it be more efficient if i make separe select from the 3 table and then process it with loops for example ?
    Thanks for your suggestions.

    hi
    use select for all entries it will improve ur perfromance
    for an beeter result try to get the relation in tables and flow of data   lets take and Example of three table
    i_tab1  with key A
    i_tab2  with key A B
    i_tab3 with key A B C
    now frist
    apply only select query
    to it
    like select * from SDR into table ZXS
    where ......
    now apply for all entries in this manner
    select * from RET in SDER
    for all entries in ZXS
    where
       ...= ZXS-A
    similarly for last table and this time use for all entry for table SDER.
    Cheerts
    Snehi
    Cheers
    Snehi
    Edited by: snehi chouhan on Jul 10, 2008 10:10 AM

  • Abap SQL question

    Hi,
    I need to select the set of records only in Table A, but not in Table B. I think that the correct SQL is:
    select k~vbeln
    into data
    from vbak as k
    inner join vbfa as f on kvbeln = fvbelv
    where f~vbelv is null.
    But the following message appears: u201CNo fields from the right-hand table of a LEFT OUTER JOIN may appear in the WHERE condition: u201CF~VBELBu201Du201D.
    Thanks in advance,
    Ricard.

    Hi Oscar & William,
    first of all: The database meaning of NULL is that for the field in question no value is stored for an existing record.
    In SAP tables we rarely have any NULL values. Only if you extend an existing table, i.e. append a new field, the database will expand the structure but not store INITIAL values for the new field in all records.
    Second, just a hint: although the SAP example uses the mystifying ALIAS (AS) addition for joins, it does not help except reducing the code transparency:
    SELECT vbak~vbeln
           INTO lw_data
           FROM vbak
           INNER JOIN vbfa ON vbak~vbeln = vbfa~vbelv
           WHERE vbfa~vbelv IS NULL.
        <you can do your process here>
    ENDSELECT.
    Is 100 % the same. Nevertheless it will never retrieve a single record because vbelv is never stored as a NULL value.
    I think this can be solved using a subquery
    DATA : lt_data TYPE table of vbak-vbeln.
    SELECT vbeln
           INTO  lt_data  
           FROM vbak
           WHERE NOT EXISTS
              ( SELECT * FROM vbfa WHERE vbelv = vbak~vbeln ).
        <you can do your process here>
    ENDSELECT.
    To be honest: I did not try the code, never played with subqueries though I should do so.
    Regards,
    Clemens

Maybe you are looking for

  • Place multiple PDF files (or a folder of PDF files) into one InDesign document

    Hi, I know there are several scripts to place multipage Pdf's in InDesign. Based on those scripts I made one myself which places a PDF file with multiple pages as an InLine graphic where the name of the PDF file is inserted as a heading. Works great.

  • Stop motion in FCP7

    Hi there, Sorry for the stupid questions that are about to be asked...I'm a bit of a beginner. I'm looking to prepare stop motion animations using hundreds of photographs and FCP7....and I have three questions: - How do I adjust the speed? I've been

  • Impairment of Fixed Assets

    Hi All, Can any one help me in understanding what is Impairment of Fixed Assets, As you must be aware, the Institute of Chartered Accountants of India has made it mandatory for all entities to account for impairment of assets. The institute has broug

  • Query Regarding SM30

    Dear all, I have created table maintance generator for 1 ztable. When i see it through t-code sm30.. In this user maintance screen , some columns are displaying without heading name ? So , please anybody help me regarding it........  Thank You ,

  • Time Capsule dropping off network after only a few minutes?

    Right, I've had a good look through the forums and found a few similar issues to mine but none that are exactly the same or provide any answers, so I'll give it a go and see if anyone has a clue what is going on because I'm stumped. I've got a new Ti