Skip to content

Instantly share code, notes, and snippets.

View captainabap's full-sized avatar
💭
Send me an E-Mail

Jörg Brandeis captainabap

💭
Send me an E-Mail
View GitHub Profile
@captainabap
captainabap / Generate_Plan_Data.sql
Last active June 23, 2020 09:30
Generate_Planing_Data
do begin
declare la_VERSION nvarchar(3) array = array('001', '002') ;
declare la_VTYPE nvarchar(3) array = array('10', '20') ;
declare la_CO_AREA nvarchar(4) array = array('1001') ;
declare la_COSTCENTER nvarchar(10) array = array( 'CC000000',
'CC111111',
'CC222222',
'CC333333',
'CC444444',
-- Listing 10.1.sql
-- Example of complexity in simple queries
SELECT id,
-- format name
lastname || ', ' || firstname AS name,
-- Symbol for gender
CASE
WHEN sex = 'F'
THEN NCHAR('9792')
-- Listing 8.1.abap
-- Example of a simple AMDP method
CLASS zcl_amdp_demo DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_amdp_marker_hdb.
TYPES gty_tt_countries TYPE TABLE OF t005t .
-- Listing 1.1.sql
-- Meldung der SQL-Konsole beim Ausführen einer Anweisung
SELECT * FROM m_cs_tables
SELECT * FROM m_cs_tables
Listing 1.1: Meldung der SQL-Konsole beim Ausführen einer Anweisung
CREATE TABLE namen ( id INT,
last_name VARCHAR(30),
first_name VARCHAR(30) );
INSERT INTO namen VALUES ( 1,'Brandeis','Jörg' );
INSERT INTO namen VALUES ( 2, 'Müller', 'Peter' );
SELECT * FROM namen;
DROP TABLE namen;
@captainabap
captainabap / Demo_Window_Functions.sql
Last active March 26, 2020 13:10
Demo for Window Functions
drop table stock_qty;
drop table stock_delta;
CREATE TABLE STOCK_QTY (
PLANT varchar(4),
MATERIAL varchar(10),
CALDAY date,
QTY int,
primary key (PLANT, MATERIAL, CALDAY)
);
@captainabap
captainabap / MAP_MERGE_Example.sql
Last active November 21, 2019 14:49
Example for the MAP_MERGE Operator
--Anlegen der MAP-Funktion
CREATE FUNCTION map_table_row_count(IN iv_tabname nvarchar(30))
RETURNS TABLE (tabname NVARCHAR(30),
rowcount INT )
AS BEGIN
DECLARE lv_sql NVARCHAR(100);
DECLARE lt_result TABLE( tabname NVARCHAR(30),
rowcount INT );
EXEC 'SELECT '''
|| :iv_tabname
@captainabap
captainabap / Z_UPLOAD_TRANSPORT.abap
Created July 12, 2019 12:26
Upload the transport files to the corresponding folders on the server. First select the K-File
"---------------------------------------------------------------------*
" Report Z_UPLOAD_TRANSPORT
"---------------------------------------------------------------------*
" select the K-File (e.g. K900028.A4H) in the file selection dialog.
"---------------------------------------------------------------------*
REPORT z_upload_transport.
DATA lt_filetable TYPE filetable.
DATA lv_rc TYPE i.
data lv_source_path type SAPB-SAPPFAD.
@captainabap
captainabap / ZCL_VAR_HANA_EXIT.abap
Created November 2, 2018 10:21
ZCL_VAR_HANA_EXIT
CLASS ZCL_VAR_HANA_EXIT IMPLEMENTATION.
METHOD IF_RSROA_VAR_HANA_EXIT~GET_PROPERTIES
by database procedure
for hdb language SQLSCRIPT.
IF :I_VNAM = 'ZJB_CONCAT' THEN
c_is_active := 'X';
c_ts_vnam_index = select 'ZJB_VAL1' as vnam, 1 as index from dummy
union
select 'ZJB_VAL2' as vnam, 2 as index from dummy;
DECLARE size INT := 10;
DECLARE runde INT := 0;
DECLARE pos_x INT := 0;
DECLARE pos_y INT := 0;
lt_anzahl_nachbarn = select * from matrix;
--100 Runden
runde = runde + 1;