How to send Chinese characters from SAP to PHP through RFC? -
i communicating php through rfc using function module.i tried send chinese characters function module php , in php side getting chinese charcters in form of ###### ,
i don't understand side problem ,either php side or sap side? give me suggestion side need focus rectify problem ? or other way send chinese character php?
sap fm code:fn name: zmm_php_to_sap
t_log-msgty = 'e'. concatenate p_uname '用户无检料权限' t_log-msgtx separated space. append t_log.
php code:
$login = array ("ashost"=>$row_login1["sap_server"], "sysnr"=>$row_login1["sap_system_number"], "client"=>$row_login1["sap_client"], "user"=>$row_login1["sap_username"], "passwd"=>$row_login1["sap_password"], "codepage"=>"8300"); $rfc = saprfc_open ($login); if(!$rfc){ $error=saprfc_error(); return "the rfc connection has failed following error:".saprfc_error(); exit;} $fce = saprfc_function_discover($rfc,"zmm_php_to_sap"); if(!$fce){ return "the function module has failed."; return $rfc; exit;}saprfc_import ($fce,"p_uname","demo-china"); saprfc_table_init ($fce,"t_log"); // call , execute function $rc = saprfc_call_and_receive ($fce); if ($rfc_rc != saprfc_ok){ if ($rfc == saprfc_exception ){ echo ("exception raised: ".saprfc_exception($fce)); } else { echo ("call error: ".saprfc_error($fce)); } echo "failure"; exit; } $data_row = saprfc_table_rows ($fce,"t_log"); $log_msg=''; if($data_row != 0 || $data_row != '') { ($i=1; $i<=$data_row; $i++) { $data = saprfc_table_read ($fce,"t_log",$i); echo $data['msgtx']; if($data['msgty'] == "e") { $log_msg =$data['msgtx']; } if($data['msgno'] == "d") { $log_msg ="d"; } } }
when itry print $data['msgtx'] output demo-china ¥Î###®Æ# , how exact chinese characters. in advance.
first of all, should never hardcode character characters/strings in programming language , particularly in abap. in cases sap systems multilingual systems, utulized internationally, therefore symbols hardcoded in 1 environment interpreted differently in environment. under term environment mean logon language, user parameters , et cetera.
hence don't know way how literals treated during call of fm, possible steps can make in case following:
- first , foremost, convert literal in
concatenate
statement text-symbol. text symbols recommended way storing character strings in abap. then recommend check whether sap system unicode. can done via system > status > unicode system menu. highly unlikely system non-unicode but, nevertheless, check appreciated.
[optional] step optional , makes sense if system non-unicode, nevertheless, useful anyway. set environment codepage chinese statement
set locale language 1.
put statement start fo fm.
also sensible ensure unicode system checks enabled in function module. should go go > main program > go > attributes , make sure unicode checks active checkbox active.
Comments
Post a Comment