This functionality stopped working in IFS Cloud because of command Plsqlap_Server_API.Invoke_Record_Impersonate is giving errors that is no longer supported. Or more specifically, the Batch_Transfer_Handler is no longer supported in IFS Cloud. To quote Here is the full line:
Plsqlap_Server_API.Invoke_Record_Impersonate('BatchTransferHelper', 'readFromFtp', AM, activity_ => TRUE);
So the main issue is that we need to get the fetching and sending of attached document again. Additionally FTP based document managent is being phased out and is being replaced by a "FileStorage" type. We want this script to work in either FTP or Filestorage connected documents.
This is the code:
DECLARE
RECIPIENT_ VARCHAR2(32767) := '&PDF_PARAMETER_1';
file_name_ varchar2(2000);
local_file_name_ varchar2(2000);
location_name_ varchar2(2000);
file_repository_ varchar2(2000);
file_names_ varchar2(32767);
doc_type_ varchar2(2000);
allekirjoitus_ varchar2(2000);
paikkakunta_ varchar2(2000) := PURCHASE_ORDER_API.Get_Contract( '&PDF_PARAMETER_6' ) ;
AM Plsqlap_Record_API.type_record_;
f_ varchar2(2000);
cursor c1 is select doc_class, doc_no, doc_sheet, doc_rev from DOC_REFERENCE_OBJECT D, PURCHASE_ORDER_LINE_PART P
where P.ORDER_NO = '&PDF_PARAMETER_6' AND D.lu_name = 'PartRevision' and P.Objstate <> 'Cancelled'
and D.key_ref = CLIENT_SYS.GET_KEY_REFERENCE('PartRevision','CONTRACT',P.CONTRACT,'ENG_CHG_LEVEL',P.ENG_CHG_LEVEL,'PART_NO',P.PART_NO)
GROUP BY doc_class, doc_no, doc_sheet, doc_rev;
BEGIN
IF paikkakunta_ = 'HML' THEN
allekirjoitus_ := '----------------------------------------------------------------------------
Hello,
here attached our order. Please confirm.
Best Regards,
' || '&USER_DESCRIPTION' || '
Movax Oy
Tölkkimäentie 10
FI-13130 Hämeenlinna, Finland
mobile';
END IF;
IF paikkakunta_ = 'MPK' THEN
allekirjoitus_ := 'Terveisin,
' || '&USER_DESCRIPTION' || '
Metalpower Oy
Takatie 6
90440 - Kempele, Finland
mobile';
END IF;
IF paikkakunta_ = 'TAR' THEN
allekirjoitus_ := 'Terveisin,
' || '&USER_DESCRIPTION' || '
TP Silva Oy
Lahdentie 9
61400 - Ylistaro, Finland
mobile';
END IF;
FOR doc_rec in c1
LOOP
EDM_FILE_API.REFERENCE_EXIST(F_,doc_rec.doc_class, doc_rec.doc_no, doc_rec.doc_sheet, doc_rec.doc_rev,'VIEW');
IF F_ = 'TRUE' THEN
doc_type_ := 'VIEW';
ELSE
doc_type_ := 'ORIGINAL';
END IF;
local_file_name_ := EDM_FILE_API.GET_NEW_LOCAL_FILE_NAME(doc_rec.doc_class, doc_rec.doc_no, doc_rec.doc_sheet, doc_rec.doc_rev,doc_type_,'1');
location_name_ := EDM_FILE_API.GET_LOCATION_NAME(doc_rec.doc_class, doc_rec.doc_no, doc_rec.doc_sheet, doc_rec.doc_rev,doc_type_,'1');
file_name_ := EDM_LOCATION_API.GET_PATH(location_name_) || EDM_FILE_API.GET_FILE_NAME(doc_rec.doc_class, doc_rec.doc_no, doc_rec.doc_sheet, doc_rec.doc_rev,doc_type_,'1');
file_repository_ := EDM_LOCATION_API.GET_LOCATION_ADDRESS(location_name_);
AM := Plsqlap_Record_API.New_record('EDM_REPOSITORY');
Plsqlap_Record_API.Set_Value (AM, 'LOCAL_FILE_NAME', local_file_name_, Plsqlap_Record_API.dt_Text_Key, FALSE);
Plsqlap_Record_API.Set_Value (AM, 'FILE_NAME', file_name_, Plsqlap_Record_API.dt_Text_Key, FALSE);
Plsqlap_Record_API.Set_Value (AM, 'ADDRESS', file_repository_, Plsqlap_Record_API.dt_Text_Key, FALSE);
Plsqlap_Record_API.Set_Value (AM, 'USER', 'ifs-rep', Plsqlap_Record_API.dt_Text_Key, FALSE);
Plsqlap_Record_API.Set_Value (AM, 'PORT', '21', Plsqlap_Record_API.dt_Integer, FALSE);
Plsqlap_Server_API.Invoke_Record_Impersonate('BatchTransferHelper', 'readFromFtp', AM, activity_ => TRUE);
file_names_ := file_names_ || ',' || local_file_name_;
END LOOP;
COMMAND_SYS.MAIL(FROM_USER_NAME_ =>'&REPLY_TO_USER',
TO_USER_NAME_ => '&USER_MAIL_ADDRESS',
TEXT_ => '&PDF_PARAMETER_1' || '
Hei,
Liitteenä tilauksemme. Vahvistatteko pikaisesti kiitos!
'
|| allekirjoitus_ || ' &USER_MOBILE_PHONE ' ||'
' || '&USER_MAIL_ADDRESS',
SUBJECT_ => 'Ostotilauksemme / Purchase Order - ' || '&PDF_PARAMETER_6' ,
ATTACH_ => '&PDF_FILE' || FILE_NAMES_ );
END;
Any help on this is highly appreciated.
Thanks in Advance.