Thursday, February 8, 2018

TSQL: PIVOT table with hours

TSQL: PIVOT table with hours

Transact-SQL


1. Table containg names and time

Columns: Name, CreatedOn
Table: RegisterTime

2. Query

SELECT * FROM
(SELECT Name, DATEPART(HOUR, CreatedOn) AS RcpHour 
          FROM RegisterTime) sourceTable
 PIVOT (COUNT(RcpHour) FOR RcpHour IN 
         ( [0],  [1],  [2],  [3],  [4],  [5], 
           [6],  [7],  [8],  [9], [10], [11], 
          [12], [13], [14], [15], [16], [17], 
          [18], [19], [20], [21], [22], [23])) as pvtTable

Tuesday, February 6, 2018

SAP: Stock movement (313,315)

SAP: Stock movement


1. Check current reference stock with transaction i.e.. MB53

Reference: 123456
Plant: PLA1


2. Go into MB1B - Transfer Posting

Reference: 123456
Plant: PLA1
Movement: 313
Storage location: SOUR


3. Fill material, receiving location, quantity and confirm.


Document posted message should appear.


4. Go to MB1B again fill data and confirm.

Reference: 123456
Plant: PLA1
Movement: 315
Storage location: DEST








ORACLE: Microsoft Access x64 connect to x86 oracle data source (workaround)

ORACLE: Microsoft Access x64 connect to x86 oracle data source (workaround)

Microsoft Access, Oracle

1. Install oracle drivers

2. Fill tnsnames.ora oracle file with connection to your server

Location i.e. : 
\oracle\product\10.2.0\client_1\network\admin
C:\app\oracle\product\11.2.0\client_1\Network\Admin

3. Add odbc connection 
C:\Windows\syswow64\odbcad32.exe

User: Oracle user name
Server: Server name from TNS names



4. Create symbolic link, junction to C:\Program Files (x86)

cmd

mklink /J "C:\Program Files (x86)\" "Program_Files_86"




5. Create shortcut "Micorsoft Access (x86) to Microsoft Access application with path below:

Location i.e. : 
 C:\Program_Files_86\Microsoft Office\OFFICE11\MSACCESS.exe
 C:\Program_Files_86\Microsoft Office\OFFICE12\MSACCESS.exe

6. Start Microsoft Access from shortcut and run odbc connection

SAP/ABAP: Delete dupliacates from grid (alv, lv)

SAP/ABAP: Delete dupliacates from grid (alv, lv)

ABAP/SQ02

1. Data code section

Declare alv as '%G00[]'

dataalv_t type char100 value '%G00[]'.
field-symbols<table> type any table.

2. End of selection code section

- assign alv to any table
- sort table
- delete duplicates

assign (alv_t) to <table>.
if <table> is assigned.
  sort <table>.
  delete adjacent duplicates from <table>.
endif.

Problem with database open ORA-19804, ORA-19809, ORA-03113

1. Try to login to database with SYS AS SYSDBA user. If the instance is idle, run the startup command. 2. If ORA-03113 occured, check the la...