I develop a PHP 7.0 program and use sapnwrfc extension to connect to a SAP system.
The program executes the function ZCLSC_SEARCH_OBJECTS
remotely on the SAP system, but the method invoke
returns this error:
ATINN of type RFCTYPE_NUM value=Q1_NUMBER cannot be converted to type RFCTYPE_NUM
If I try with PHP 5.6 using saprfc extension, it works.
What is wrong, what to correct?
$connection = $this->connect_sap();
if ($connection->ping() === true) {
try {
$today_str = date("Ymd");
$f = $connection->getFunction('ZCLSC_SEARCH_OBJECTS');
foreach ($query as $key => $val) {
$qualifier = $val['q1'];
$q1 = "Q1_NUMBER";
// $q1 = settype($q1, 'string');
$r = $f->invoke([
"I_CLASSTYPE" => "001",
"I_TOP_CLASS_STRUC" => array(
"MANDT" => $this->client,
"CLINT" => "0000000017",
"KLART" => "001",
"CLASS" => "ZSP_INFO",
"STATU" => "1",
),
"I_KEYDATE" => $today_str,
"I_LANGUAGE" => "EN",
"I_STATUS_FREE" => "X",
"I_R_OBJECTTYPES_TAB" => array([
"SIGN" => "I",
"OPTION" => "EQ",
"LOW" => "MARA",
]),
"I_SELECTION_CRITERIA_TAB" => array([
"ATINN" => $q1,
"ATWRT" => $qualifier,
"ATCOD" => "1",
"STATU" => "H",
"ATFOR" => "CHAR",
"SLCOD" => "1",
]),
"I_R_CHARACTERISTICS_TAB" => array([
"SIGN" => "I",
"OPTION" => "EQ",
"LOW" => $q1,
]),
]);
echo "result";
print_r($r);
exit;
// // if (is_array($r['MATNRLIST']) and sizeof($r['MATNRLIST']) > 0) {
// // $ret['st'] = 0;
// // $ret['msg'] = 'Have description ' . $val['material_description_1'] . ' already';
// // return $ret;
// // }
// // if ($val['q19'] == 'Krones') { //สลับการค้นหา
// // }
}
// $ret['st'] = 1;
// $ret['msg'] = '';
// return $ret;
} catch (SapException $ex) {
print_r($ex);
print_r($ex->getErrorInfo());
exit;
}
}
$connection->close();