*&---------------------------------------------------------------------* *& Include ZIBPERLMACROS *& Copyright Piers Harding 2004 - all rights reserved. *& This code is distributed under the same terms as Perl itself. *&---------------------------------------------------------------------* data: %pdest like rfcdes-rfcdest value 'PERL'. data: %res like tab512 occurs 0 with header line. data: %parms like tab512 occurs 0 with header line. data: %rc like sy-subrc. define prfc_exec. call function 'RFC_EXEC_PERL' destination %pdest exporting type = &1 command = &2 tables params = &4 results = &3 exceptions EXEC_ERROR = 1 ILLEGAL_CALL = 2 NO_OBJECT = 3 OTHERS = 4. case sy-subrc. when 0. * break-point 1. when others. * break-point 1. endcase. %rc = sy-subrc. end-of-definition. * pexec * execute string of perl code - no return define pexec. refresh: %res, %parms. prfc_exec 'E' &1 %res %parms. end-of-definition. * pexec_return * execute string of perl code - return one string value define pexec_return. refresh: %res, %parms. prfc_exec 'ER' &1 %res %parms. if %rc = 0. read table %res index 1. &2 = %res. endif. sy-subrc = %rc. end-of-definition. * pexec_returnn * execute string of perl code - return a table string values define pexec_returnn. refresh: %parms. %parms = &1. append %parms. prfc_exec 'ENRN' &1 &2 %parms. end-of-definition. * pnexecn * execute string of perl code - return a table string values define pnexecn. prfc_exec 'ENRN' ' ' &2 &1. end-of-definition. * pregex * apply a regex against a string - return one string value define pregex. refresh: %res, %parms. %parms = &2. append %parms. prfc_exec 'R' &1 %res %parms. if %rc = 0. read table %res index 1. &3 = %res. endif. sy-subrc = %rc. end-of-definition. * pregex * * apply a regex against a string - return 2 string values define pregex2. refresh: %res, %parms. %parms = &2. append %parms. prfc_exec 'RN' &1 %res %parms. if %rc = 0. read table %res index 1. &3 = %res. read table %res index 2. &4 = %res. endif. sy-subrc = %rc. end-of-definition. * pregex * * apply a regex against a string - return 3 string values define pregex3. refresh: %res, %parms. %parms = &2. append %parms. prfc_exec 'RN' &1 %res %parms. if %rc = 0. read table %res index 1. &3 = %res. read table %res index 2. &4 = %res. read table %res index 3. &5 = %res. endif. sy-subrc = %rc. end-of-definition. * pregexn * apply a regex against a string - return N string values define pregexn. refresh: %parms. %parms = &2. append %parms. prfc_exec 'RN' &1 &3 %parms. end-of-definition. * pnregexn * apply a regex against all the strings in a table * - return N string values define pnregexn. prfc_exec 'RN' &1 &3 &2. end-of-definition. * pcreate_object * * create a Perl object with given parameters, and then return a * reference to that object in the form of an ID define pcreate_object. refresh: %res. %parms = &2. append %parms. prfc_exec 'C' &1 %res &2. if %rc = 0. read table %res index 1. &3 = %res. endif. sy-subrc = %rc. end-of-definition. * pstatic_method * * Execute a static method name (or subroutine) passing a list of * parameters, and return a list of results define pstatic_method. prfc_exec 'S' &1 &3 &2. end-of-definition. * pmethod_call * * Execute a static method name (or subroutine) passing a list of * parameters, and return a list of results define pmethod_call. refresh %parms. %parms = &1. append %parms. append lines of &3 to %parms. prfc_exec 'M' &2 &4 %parms. end-of-definition. * pmethod_call * * Execute a static method name (or subroutine) passing a list of * parameters, and return a list of results define pdelete. refresh: %parms, %res. prfc_exec 'D' &1 %res %parms. end-of-definition. *