get_listboxvalue() aus dem Customizing Helper Modul implementiert lediglich ein Mapping zwischen tatsächlichen Werten in Datentabellen und den IDs festgelegter Listboxwerte in der entsprechenden Tabelle, kann aber kein X-beliebigen Werte aus einem Listbox-Datensatz auslesen. def computeOutput(di):
record = di.get_dtp_record()
key0 = record.get_di_by_id(<key0_numeric_di_no>).get_value()
# etc. für weitere DIs
multicol_key_template = '{0}|{1}|{2}'
multicol_key_value = multicol_key_template.format(key0, key1, key2)
return multicol_key_value
computeOutput.deps = ('DI<key0_textual_di_no>', 'DI<key1_textual_di_no>', ) # etc. für weitere DIsdef processInput(di, oldvalue):
record = di.get_dtp_record()
key0_di = record.get_di_by_id(<key0_numeric_di_no>)
# etc. für weitere DIs
new_value = di.get_value()
key_values = new_value.split('|', 3)
key0_di.set_value(key_values[0])
return new_value
processInput.deps = ('DI<key0_textual_di_no>', 'DI<key1_textual_di_no>', ) # etc. für weitere DIssubject_text = "" body_text = ""
subject_text = record.name.get_raw_value()
from ppms import ppms_cu
di_prefix = "DI: "
di_prefix_lenghth = len(di_prefix)
def get_df_cust_name(di):
df_name = di.get_dtp_record().df_customizing_name.get_value()
if df_name: return df_name # return name on DF level if set
return None
def get_di_cust_name(di):
di_nr = di.get_dtp_record().di.get_value()
di_cust_name = str()
if not di_nr: return None
di_record = ppms.search_record(412,[di_nr],[41035], True)
if di_record: di_cust_name = di_record.di_customizing_name.get_value()
else: return None
if di_cust_name: return di_cust_name
def computeOutput(di):
name = str()
if get_df_cust_name(di):
return get_df_cust_name(di)
elif get_di_cust_name(di):
return di_prefix + get_di_cust_name(di)
return ""
computeOutput.deps = ("DI041036","DI000213","DI000984")
def checkInput(di, old_value):
return ppms_cu.Helper.validate_python_id(di,di.get_value())
checkInput.deps=("DI001862",)
def processInput(di, old_value):
new_value = di.get_value()
rec = di.get_dtp_record()
#in case of copy
if new_value[:4]==di_prefix:
rec.df_customizing_name.set_string_value("")
return di_prefix + get_di_cust_name(di)
#in case of empty python ID
if not new_value.strip():
rec.df_customizing_name.set_string_value("")
if not get_di_cust_name(di):
return ""
return di_prefix + get_di_cust_name(di)
#in case of new value = old value
if new_value.strip() == old_value:
return ppms_cu.Helper.get_python_id_by_license(new_value)
rec.df_customizing_name.set_string_value(ppms_cu.Helper.get_python_id_by_license(new_value))
return ppms_cu.Helper.get_python_id_by_license(new_value)
processInput.deps = ("DI041036",)# get module object mod_obj=ppms.get_target_module() #mark all records of all datareas in the module ppms.echo_off() [[mts_rec.mark() for mts_rec in mts_rec_list]for mts_rec_list in [da_obj.get_records() for da_obj in mod_obj.get_das()]] ppms.echo_on()
# get module object mod_obj=ppms.get_target_module() #unmark all marked records of all dataareas in the module ppms.echo_off() [[mts_rec.unmark() for mts_rec in mts_rec_list]for mts_rec_list in [da_obj.get_marked_records() for da_obj in mod_obj.get_das()]] ppms.echo_on()
def call_resource(resource_id=ppms.get_target_module().get_current_L_var()[5]):
rec467=ppms.search_record(467, [resource_id[0]], [1218,3414], True)
if rec467 == None:
message=ppms_cu.Helper.get_const_title("001247")
ppms.ui_message_box(message.replace("@user_id",resource_id[0]), blocking=1)
mod_obj.menu(49)
elif rec467.get_di("resource_type").get_value() == "2":
ppms.ui_message_id("0860")
mod_obj.menu(49)
else:
mod_obj.set_current_L_var(5, [resource_id[0]])from ppms import ppms_cu
mod_obj = ppms.get_target_module()
rm_modul=ppms_cu.Helper.get_global_setting("L100_employee_board_for_reporting").alpha120.get_value()
inv_rec=ppms.get_context_df().get_record()
res_id = inv_rec.res_id.get_raw_value()
mod_obj.set_new_L_var(5, [res_id])
mod_obj.open_module(rm_modul)def processInput (di, oldvalue):
rec = di.get_dtp_record()
rec.get_di ("L100_prognose_vom").set_value(ppms.uvar_get ("@15"))
rec.get_di ("L100_prognose_von").set_value(ppms.uvar_get ("@1"))
return di.get_value()
processInput.deps = ("DI100102","DI100103")mod_obj = ppms.get_target_module()
current_user="ORA"
rwdu="775"
sql="""
MERGE INTO DT600 b
USING (
select
di001395 as pr_id,
TO_CHAR(di001519, 'YY-MM') as monat,
di001395||'-'||TO_CHAR (di001519, 'YY-MM') as pr_id_monat,
sum (dI001509) as soll,
sum (dI001510) as ist,
sum (dI001511) as rest,
min (di001519) as min_datum,
(select di001052 from dt461
wehre di001001=di001395) as hpr_id
from dt472
group by di 001395||'-'||TO_CHAR (di001519, 'YY-MM') , TO_CHAR (di001519, 'YY-MM' ) , TO_CHAR (di001519 , 'YY-MM' ) , di001395
)e
ON (b.di504132 = e.pr_id_monat)
WHEN MATCHED THEN
UPDATE SET
b.DI504135 = e.soll, -- Soll
b.DI504134 = e.ist. -- Ist
b.DI504133 = e.rest, -- Rest
b.DI504146 = sysdate, -- geaendert datum
b.DI504136 = e.min_datum -- min Datum
WHEN NOT MATCHED THEN
INSERT (
b.di504132, b.di504137, b.di504136, b.di504131,b.di504148, -- keys
b.di504135, b.di504134, b.di504133, -- aufwand
b.di504144, b.di504143, b.di504147, b.di504146, -- obs user and date
b.DI504145, b.DI504140, b.DI504139, b.DI504138 -- rwdu
)
VALUES (e.pr_id_monat,e.pr_id,e.min_datum,e.monat,e.hpr_id,
e.soll,e.ist,e.rest,
'{0}','{0}',sysdate,sysdate,
'{1}','{1}','{1}','{1}'
)
""".format(current_user,rwdu)
affected=ppms.db_modify(sql)
mod_obj.set_statusbar(str(affected))mod_obj = ppms.get_target_module()
mod_obj.menu(12)
for rec in mod_obj.get_da ("L504_values").get_records():
rec.L504_planned_load_fixed.set_raw_value (rec.L504_planned_load.get_raw_value())
mod_obj.menu(34)
mod_obj.menu(49)PATH = r'C:\Program Files (x86)\Applikation\anwendung.exe'
# Der String, der den Pfad zur Applikation darstellt, wird mit "r" vorangestellt,
# weil sonst der Backslash \ als Escape-Zeichen interpretiert werden würde.
# Siehe http://docs.python.org/reference/lexical_analysis.html#string-literals
ARGS = 'argument1=PLANTA argument2=Nocheins'
# Die Argumente, die an die Applikation übertragen werden sollen, einfach als
# einen fortlaufenden String deklarieren.
def execute_client_script(path, args):
ppms.client_exec("""import clr
clr.AddReference('System')
from System.Diagnostics import Process
Process.Start(r'{path}', r'{args}')""".format(path=path, args=args))
execute_client_script(PATH, ARGS)