Posts

SAP HANA 2.0 - Database Procedures - Snippets

DATABASE PROCEDURE USING 'FOR' TO CREATE A TABLE & USAGE OF EXIT HANDLER: CREATE PROCEDURE ZAG_FOR_001 (out count1 integer)  LANGUAGE SQLSCRIPT DEFAULT SCHEMA "<ENTER_SCHEMA>" AS BEGIN DECLARE i INTEGER = 0; BEGIN DECLARE EXIT HANDLER FOR SQL_ERROR_CODE 288 DROP TABLE ZAG_EMP_001; CREATE COLUMN TABLE zag_emp_001 ( empid integer, empname varchar(20), primary key(empid) ); END; FOR i in 1..10 DO  INSERT INTO zag_emp_001 VALUES (:i, 'Employee: ' || :i);  END FOR; count1 = i; select count(*) into count1 from <ENTER.SCHEMA>.zag_emp_001; END; DATABASE PROCEDURE USING CURSOR: CREATE OR REPLACE PROCEDURE ZAG_CURSOR_001(OUT ev_matnr varchar(40)) LANGUAGE SQLSCRIPT DEFAULT SCHEMA "UMAMAHESWARA" AS BEGIN DECLARE lv_matnr varchar(40); DECLARE CURSOR c1 FOR SELECT MATNR FROM SAPHANADB.MARA; OPEN c1; FETCH c1 INTO lv_matnr; select lv_matnr into ev_matnr from dummy; CLOSE c1; END; DATABASE PROCEDURE USING INLINE TABLE DECLARATION: CREATE PROCEDURE Z

Relationship: OData Operation, HTTP Method and ABAP Statement (General Methods used during OData Service Development)

The table below shows the relationship between an OData operation, the corresponding HTTP method call and the corresponding ABAP statement call. These methods are mostly used by the Developer to implement their own functionality in the corresponding DPC extension class. OData Operation HTTP Method ABAP Statement Comments Front-end method Create (CREATE_ENTITY) POST INSERT Call create( ) Read (GET_ENTITY) GET SELECT SINGLE * Call bindElement( ) Read (GET_ENTITYSET) GET SELECT Call bindRows( ) Update (UPDATE_ENTITY) PUT UPDATE Call update( ) Delete (DELETE_ENTITY) DELETE DELETE Call remove( ) Function Import GET, POST SELECT, INSERT Custom Operations Call callfunction( ) Create File (CREATE_STREAM) POST INSERT Upload a file to a database table

Useful Transaction Codes / Tools in OData ABAP Service / SAP UI5/ SAP Fiori

Tips:   1) FND stands for 'Front End' 2) GW stands for Gate Way / Gateway S. No. Transaction Code Description 1 SEGW SAP Service Gateway Builder 2 /IWFND/ERROR_LOG SAP Gateway Error Log 3 /IWFND/APPS_LOG SAP Gateway Application Log Viewer 4 /IWFND/VIEW_LOG SAP Gateway Application Log Viewer 5 /IWFND/CACHE_CLEANUP Cleanup of GW Model Cache - GW stands for Gateway 6 /IWFND/TRACES SAP Gateway Traces 7 /IWFND/SRV_VALIDATE This transaction exists only on SAP Gateway 2.0 (Netweaver 7.31 and below) systems 8 /IWFND/REG_SERVICE Activate Services (Unavailable in latest releases) 9 /IWFND/MAINT_SERVICE Activate and Maintain Services 10 /IWFND/VIRUS_SCAN Configuration of SAP GW Virus Scan 11 SICF Edit HTTP Service Hierarchy 12

OData Supported Data Types

OData ABAP service data types are also knows as ' EDM ' data types. The supported data types are: EDM. Binary > Fixed or variable length binary data EDM. Boolean > To represent binary value logic (True/False) EDM. Byte > Unsigned 8-bit integer value EDM. DateTime > Date and time values EDM. Decimal > Numeric values with fixed precision and scale EDM. Double > Floating point number with 15 digit precision EDM. Float > Floating point number with 7 digit precision EDM. Sbyte > Signed 8-bit integer value EDM. Int16 > Signed 16-bit integer value EDM. Int32 > Signed 32-bit integer value EDM. Int64 > Signed 64-bit integer value EDM. Single > Floating point number with 7-digit precision EDM. String > Fixed or variable length character data EDM. Time > Time of the day with values ranging from 00:00:00 to 23:59:59 The above are not ABAP Data Types. They are OData service data types used at OData level, and are called EDM data types. EDM stands f

Get structure names used in a database table

Aim: To get the structure name of the .INCLUDE structures used in a database table. Tip:  Navigate  to  PRECFIELD  field in the output  to  see the  Structure  name  of  the  include Report: REPORT  zag_test_extract_structures . PARAMETERS :  p_table  TYPE  tabname16  DEFAULT  'EKKO' . DATA :  lt_fields  TYPE  TABLE  OF  dd03p ,       lv_name    TYPE  ddobjname . DATA ( lref_structype )  =  cl_abap_typedescr => describe_by_name (  p_table  ) . lv_name  =  p_table . CALL  FUNCTION  'DDIF_TABL_GET'    EXPORTING     name           =  lv_name    TABLES     dd03p_tab      =  lt_fields    EXCEPTIONS     illegal_input  =  1      OTHERS         =  2 . IF  sy - subrc  =  0 .    CALL  METHOD  cl_demo_output => display_data      EXPORTING        value  =  lt_fields       name   =  'Navigate to PRECFIELD field to see the Structure name of the include' . ELSE .    WRITE  'Error' . ENDIF . <End of Document>

Table fetch tips

1) How to get Vendor/Plant combination data? Ans: Inner join between tables LFM1 and T024W