2018年5月3日 星期四

Python - Simple Example & Common Function

Python - Simple Example & Common Function

一、How to concate file path - os.path.join

import os.path

print( os.path.join(os.path.sep, "D:",  "TEMP", "a.txt") )
#result => \D:TEMP\a.txt    #一般不該把根目錄放在 JOIN,會造成分隔字元在最前面

mypath = os.path.join(os.path.sep, 'TEMP', 'a.txt')
#字頭有 os.path.sep 與沒有會影響決對路徑的位置
#目前有 \ 所以會捉到目前 Python 所在磁碟的根目錄 + \TEMP\a.txt
print(os.path.abspath(mypath))
#result => D:\TEMP\a.txt

mypath = ''.join(["C:", mypath])
print(mypath)
#result => C:\TEMP\a.txt

os.path.sep : 目前 os 預設的磁碟分隔符 (Windows : "\", Lundix,Unix : "/")
os.path.abspath : 回傳決對路徑,當傳入的是 os.path.abspath("\TEMP") => 目前程式的錄徑磁碟 + \TEMP => D:\TEMP,但如果是 os.path.abspath("TEMP") => 目前 Python 程式的位置 + \TEMP

2018年3月6日 星期二

SAP CO - Material Master Costing Run Price Inconsistencies ("No current standard cost & Material has a released cost estimate" happen at the same time)

[CAUTION] CKR1 should be avoided. Its main use is to delete test data. FROM NOTE : https://launchpad.support.sap.com/#/notes/1530596

在一次使用了 BAPI : BAPI_COSTESTIMATE_DELETE_MULTI (用 BAPI 取代 CKR1) 進行成品 Costing Run 版本移除後,發現該料號出現以下問題

使用 MM03 查看 Costing 2 Tab,發現 Current Button 顯示 "No current standard cost estimate exists for material"

2018年1月16日 星期二

SAP PP - Confirmation no CO document (No Actual line items were selected)

當 User 反應工單有報工,但沒有 actual cost,造成 Target/Actual Cost Variance in Percent 都是 -100%。

當下直覺是報工 CO14 有問題,但經確認後資料確實有報工

2018年1月2日 星期二

ABAP/4 : Runtime Errors : CONNE_IMPORT_WRONG_COMP_LENG (Load Variant Error)

當 Basis 更新 SAP Kernel 時,有可能造成舊程式 Variant 無法使用,此時則要請 Basis 或自行去執行 NOTE : 1953229 進行修正

2017年12月30日 星期六

ABAP/4 : How to create multi line textbox on screen

在 SAP Screen 中加入 Textbox 不像一般 Visual Studio 把 Textbox multiline 設為 True 即可,需要先建立 Custom Control,再透過 Customer Control 建立 cl_gui_custom_container 用來裝載 cl_gui_textedit。

2017年12月8日 星期五

Python - Using Python With Oracle Database 11g

要使用 Python 連線 Oracle,基本上要準備以下工具,目前要使用的是 Python 2.7 進行 Oracle 11g 的連線

上敘 1, 2 點基本安裝在本文就不說明,從 3, 4 進行說明

cx_oracle 主要是 python 擴充的 Library 用於 Oracle 資料庫的連線存取,而 Oracle Instance Client 則是連線時會需要使用到 oci.dll, oraociei12.dll 這兩個 dll 檔

首先先到 https://pypi.python.org/pypi/cx_Oracle/5.2.1 下載 cx_oracle,目前我使用的是 32bit windows 7 且 Python 2.7,因此選擇的版本是 32bit

2017年9月20日 星期三

GCP - Create google cloud SDK environment with python in windows

本文將介紹如何使用 google cloud SDK 在本機進行 python 程式開發環境的建置與測試,過程中因為需要使用到 Google Cloud Platform 上的帳號,Project 以及 App Engine,因此需參照前一篇: GCP - How to create PostgreSQL + Python environment in Google Cloud Platform 進行帳號與 Project 的建置

2017年9月17日 星期日

GCP - How to create PostgreSQL + Python environment in Google Cloud Platform

當要自行架設網站時,不想花錢購買系統軟體的前題下,一般都會選擇 Linux + MySQL/PostgreSQL + Java/Python,如果還要架設 WEB server 還可以選擇 Apache + Tomcat + JSP/PHP,加上伺服器的管理,這樣對只想專注在程式語言開發的人,往往在環境架設上就會花費大量的時間,隨著 Google 提供的 Google Cloud Platform 以上環境的建置不需要任何硬體的花費,安裝上也因相對簡單與快速,甚至很容易就可以重建環境,目前第一年試用免費,未來則會依要使用的環境進行付費。

2017年8月19日 星期六

ABAP/4 : BAPI:BAPI_INCOMINGINVOICE_CANCEL Reversed Invoice (MR8M)

接續前面一篇 ABAP/4 : BAPI:BAPI_GOODSMVT_CANCEL Reversed MM DOC (MBST) 迴轉 MM Document 的 BAPI,基於資料一致性,通常如果收貨文件回轉後就需要連同發票驗證一起迴轉,而發票驗證的迴轉則會使用 BAPI_INCOMINGINVOICE_CANCEL

ABAP/4 : BAPI:BAPI_GOODSMVT_CANCEL Reversed MM DOC (MBST)

當 MM Document 過帳後,如果須要進行迴轉時,一般透過 MBST 進行迴轉,有時需要透過系統自動迴轉時,則可以使用 BAPI:BAPI_GOODSMVT_CANCEL,進行

How to install & specified python version or distreibtuion package version in google colab

在買了 RTX 3080 要來 挖礦...  嗯~是跑機器學習後,結果發現了 GOOGLE COLAB,其實之前在「GAN 對抗式生成網路」一書就有看到,但資訊人就是什麼都想自己安裝,在本機用 Anaconda + pyCharm 弄了 GPU 環境,結果有天從新竹回家發現家裡沒...