-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_po_infos.py
43 lines (33 loc) · 1.83 KB
/
get_po_infos.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# after the login, you could using this function to get a Dataframe for the PO you want to check
# if you want to save it to an excel, you can add this:
# get_po_infos("your po").to_excel(r'save_path\po_name.xlsx', index = None)
# it makes copy some values more easier and prepare for future management system co-search
def get_po_infos(po):
session.FindById("wnd[0]/tbar[0]/okcd").text = "/nme23"
session.findById("wnd[0]").sendVKey(0)
session.findById("wnd[0]/usr/ctxtRM06E-BSTNR").text = po
session.findById("wnd[0]").sendVKey(0)
numbers = len(session.FindById("wnd[0]/usr/tblSAPMM06ETC_0120").Children)/22
item = []
material = []
des = []
po_qty = []
price_per_1000pc = []
plnt = []
currency = []
for i in range(int(numbers)):
item.append(session.FindById("wnd[0]/usr/tblSAPMM06ETC_0120/txtRM06E-BSTPO[0,{}]".format(i)).text) # Item number
material.append(session.findById("wnd[0]/usr/tblSAPMM06ETC_0120/ctxtEKPO-EMATN[3,{}]".format(i)).text) # material number
des.append(session.FindById("wnd[0]/usr/tblSAPMM06ETC_0120/txtEKPO-TXZ01[4,{}]".format(i)).text) # description
po_qty.append(session.findById("wnd[0]/usr/tblSAPMM06ETC_0120/txtEKPO-MENGE[5,{}]".format(i)).text) # PO quantities
price_per_1000pc.append(session.findById("wnd[0]/usr/tblSAPMM06ETC_0120/txtEKPO-NETPR[9,{}]".format(i)).text) # PN price/1000 pcs
currency.append(session.FindById("wnd[0]/usr/ctxtEKKO-WAERS").text)
plnt.append(session.FindById("wnd[0]/usr/tblSAPMM06ETC_0120/ctxtEKPO-WERKS[13,{}]".format(i)).text) # plant
infos = {}
infos['item'] = item
infos['material'] = material
infos['des'] = des
infos['po_qty'] = po_qty
infos['price_per_1000pc'] = price_per_1000pc
infos['plnt'] = plnt
return (pd.DataFrame(infos))