Questions tagged [opensql]

Open SQL is used for SAP database access in the ABAP programming language.

Presentation

ABAP SQL (named Open SQL before version 7.53), is a set of ABAP statements that performs operations like reads, modifies or deletes data in the SAP database. ABAP SQL is independent of the database system, so the syntax of the ABAP SQL is uniform for all the databases supported by SAP.

All ABAP SQL statements are passed to the database interface. The DB interface converts the ABAP SQL into native SQL and passes it on to the database.

ABAP SQL Description

  • SELECT : Reads data from database
  • INSERT : Inserts lines to database
  • UPDATE : Changes the contents of lines in database
  • MODIFY : Inserts lines into database or changes the contents of existing lines
  • DELETE : Deletes lines from database

Links

ABAP SQL (ABAP documentation)

A complete guide to OpenSQL statements (SAP Community Blog Post)

Related Tags

288 questions
0
votes
2 answers

Compare duplicates for 4 fields in open SQL

I want to compare if there are duplicates across 4 fields in open SQL. Scenario: User has 4 fields to input. First name (N1), last name (N2), additional first name (N3) and additional last name (N4). Right now the algorithm works this way: It…
qwerty
  • 163
  • 3
  • 12
0
votes
2 answers

Error when SELECT...FOR ALL ENTRIES have currency fields

I get this error: In a SELECT access, the read file could not be placed in the target field provided. when executing this line of code: SELECT vbeln posnr matnr netpr netwr kondm FROM vbap INTO TABLE…
RamonC
  • 31
  • 7
0
votes
3 answers

ABAP Increment value into a select Query

I have a structure in ABAP : id werks name1 My query is : SELECT werks name1 INTO TABLE lt_store FROM t001w WHERE vlfkz EQ 'A'. It is possible to add a field id that contains a incrementable value for example : …
shmoolki
  • 1,551
  • 8
  • 34
  • 57
0
votes
1 answer

Duplicate record read to Internal Table

My internal table have double record when show, ex: 10 in billing documents, but 20 in my internal table. MAKTX were display whereby a SPEC-TEST was added to the duplicate value. SELECT * INTO CORRESPONDING FIELDS OF wa_alv_list FROM VBRK INNER JOIN…
RamonC
  • 31
  • 7
0
votes
1 answer

Open SQL WHERE Condiition between Chars with different length

I want to compare in a where clause of a select statement two variables typed char. The variable of the database table has the length 40 and the comparative variable 32. Is it possible to compare only the first 32 chars of the database's variable in…
0
votes
3 answers

Commit work on table using UPDATE statement

I have problem regarding the ABAP update statement. I am using the 'Commit work' on one update table statement but it is not working properly sometime it is work and sometime it is not work. Check the statements : UPDATE mara SET zzmanu …
Buddhika Samith
  • 305
  • 2
  • 7
  • 20
0
votes
2 answers

Need an efficient select query

I would like to know an efficient to way to fetch the data in the following case. There are two tables say Table1 and Table2 having two common field say contry and pincode and other table "Table3" having key fields of first two tables (DNO,…
0
votes
2 answers

how to fix error on

I have sql request DELETE FROM BC_UDV3_ROLES WHERE PERMISSION_ID = 'x' OR 0 < (SELECT * FROM BC_UDV3_ROLES WHERE "SUBSTR"(PERMISSION_ID, 0, 1)='D') OR '1'='1' when I execute it get this error Please help, how I can fix it?
Vahagn
  • 57
  • 8
0
votes
4 answers

SELECT entries with condition from more than one row

I have a table that looks like this: KID GRP 1 ABS 1 AOR 1 AOR 2 ABS 2 ABS 2 ABS 2 AOR 2 ZVN 3 ABS And I need to find all KID's, which have GRP like ABS and AOR. So the…
SLo
  • 75
  • 1
  • 1
  • 10
0
votes
1 answer

SAP How to create a view with special conditions and aliases

I want to make a view for following SELECT statement: SELECT ma~matnr ma~mtart ma~ernam ma~ersda ma~laeda de~maktx as maktx_de fr~maktx as maktx_fr it~maktx as maktx_it FROM mara as ma LEFT JOIN MAKT as de ON de~matnr = ma~matnr AND de~spras =…
inetphantom
  • 2,498
  • 4
  • 38
  • 61
0
votes
3 answers

Best way to modify a DB Table from a work area in ABAP

I want to find out the best solution for modifying a DB table from work area in a loop. There are several ways to achieve that, first; LOOP AT itab INTO wa. wa-flag = 'X'. MODIFY zblabla FROM wa. ENDLOOP. and field symbol; LOOP AT ITAB ASSIGNING…
Mtok
  • 1,600
  • 11
  • 36
  • 62
0
votes
3 answers

How to combine select max and count?

I've got this: select ordernr from users having count(ordernr) = ( select max(count(ordernr)) from users where ordernr = ordernr group by ordernr ) group by ordernr to get the most used order-number (ordernr) from all users. How to…
T D
  • 115
  • 3
  • 5
  • 17
0
votes
2 answers

Not able to LEFT OUTER JOIN three tables

I've got a problem. Currently I have three tables, the first table is the main table and if there is no record in the second table, write it too. But if a record exists in the second table, so from the third table display "dispo" information.. I…
user1612058
  • 19
  • 1
  • 4
0
votes
2 answers

How to specify a decimal filter in 'select into table where' in ABAP?

I need a query like this in ABAP, but this doesn't work. SELECT * FROM table INTO i_tab WHERE amount = 100,15 I've tried: WHERE amount = '100,15' but that doesn't work either. How to specify the decimal in my where syntax?
Marsha
  • 167
  • 3
  • 3
  • 18
0
votes
2 answers

Different table names in different databases?

Sorry for a very basic question, suppose you have an oracle database with sap system in organisation, then while writing the select queries , will the database tables names differ? Suppose if am retrieving data from standard sap vbak table, then…
I_code
  • 59
  • 3
  • 11