opensql

Default comparison operand in SELECT WHERE condition

一个人想着一个人 提交于 2021-01-29 04:42:30
问题 I have a table CategoryColours , if a category is not found, it should return the colors from the default category "*". Example if the table contains these lines: Category Color * white * black 1 red 1 blue 1 green 1 black If I search the category "1", the query should get the 4 colors. If I search the category "2", which has no records in the table, the query should get the 2 colors from the category "*". Is it possible to use OpenSQL to get the exact list that I need in a single statement?

Default comparison operand in SELECT WHERE condition

谁说胖子不能爱 提交于 2021-01-29 04:37:33
问题 I have a table CategoryColours , if a category is not found, it should return the colors from the default category "*". Example if the table contains these lines: Category Color * white * black 1 red 1 blue 1 green 1 black If I search the category "1", the query should get the 4 colors. If I search the category "2", which has no records in the table, the query should get the 2 colors from the category "*". Is it possible to use OpenSQL to get the exact list that I need in a single statement?

How to get the max date per month

烂漫一生 提交于 2021-01-08 09:46:36
问题 I have a table like kunnr date posnr 30001 28/5/2017 1 30001 25/5/2017 2 30001 15/5/2017 3 30001 25/4/2017 4 30001 20/4/2017 5 30002 15/5/2017 6 30002 25/4/2017 7 I want for every new kunnr to get the record with the max date per month, namely the max for May and max for April etc. OK, I will sort the table loop at it and for every new kunnr .... how I will get the record for max date for each month? Thanks in advance Elias PS: sth went wrong and I realise that I do not get what I want. I

Open SQL equivalent for ROW_NUMBER()

久未见 提交于 2019-12-31 02:25:28
问题 Is there an equivalent for the ROW_NUMBER() function for ABAP programs? This function is used as follows in SQL: SELECT ROW_NUMBER() OVER (ORDER BY SomeField) AS Row, * FROM SomeTable Where it should return the line number as the first column in the resulting rows (I'm unsure if it will be the line number in the result set or the line number in the source table). I've found that this statement can be used in SAP Business One but can't seem to find an Open SQL equivalent. Is there one or will

Open SQL equivalent for ROW_NUMBER()

╄→гoц情女王★ 提交于 2019-12-31 02:25:27
问题 Is there an equivalent for the ROW_NUMBER() function for ABAP programs? This function is used as follows in SQL: SELECT ROW_NUMBER() OVER (ORDER BY SomeField) AS Row, * FROM SomeTable Where it should return the line number as the first column in the resulting rows (I'm unsure if it will be the line number in the result set or the line number in the source table). I've found that this statement can be used in SAP Business One but can't seem to find an Open SQL equivalent. Is there one or will

How do I use substring in OpenSQL ABAP WHERE clause?

允我心安 提交于 2019-12-11 16:47:22
问题 My expression in OpenSQL is: SELECT * FROM J_1BNFLIN AS B WHERE SUBSTRING(REFKEY , 1 , 10 ) The substring portion of the where clause is not working. What am I doing wrong? 回答1: You can use LIKE in the WHERE condition. For example: DATA: gv_refkey TYPE j_1bnflin-refkey. gv_refkey = '123%'. SELECT * INTO TABLE ... FROM j_1bnflin WHERE refkey LIKE gv_refkey. This will select all entries where the field refkey starts with '123' (pls. note a % is used as wildcard) 来源: https://stackoverflow.com

List of BUKRS which the current user is allowed to see

耗尽温柔 提交于 2019-12-02 03:41:13
问题 Is there a way to get a list of all BUKRS which the current user is allowed to see? I want to use this list as a filter in open sql. Imagine the result of the method I search stored the result in bk_list . Then I could use bk_list like this: SELECT * FROM some_table WHERE bukrs IN bk_list 回答1: Another way to do it, based on the class CL_AUTH_OBJECTS_TO_SQL (>= 7.50), here the program reads the flights from the read-authorized airline carriers : DATA(authsql) = cl_auth_objects_to_sql=>create

List of BUKRS which the current user is allowed to see

為{幸葍}努か 提交于 2019-12-01 23:09:06
Is there a way to get a list of all BUKRS which the current user is allowed to see? I want to use this list as a filter in open sql. Imagine the result of the method I search stored the result in bk_list . Then I could use bk_list like this: SELECT * FROM some_table WHERE bukrs IN bk_list Another way to do it, based on the class CL_AUTH_OBJECTS_TO_SQL (>= 7.50), here the program reads the flights from the read-authorized airline carriers : DATA(authsql) = cl_auth_objects_to_sql=>create_for_open_sql( ). authsql->add_authorization_object( EXPORTING iv_authorization_object = 'S_CARRID' it