02-01-2010 3:42 PM
Hello,
I m trying to update the table VBAP using a function module ZZ_SET_DISTANCE call by a php code.
But I have this problem:
the saprfc seems to work well but when I look to the table VBAP the fields have not been update.
I tried the function module in debug mode and it work good. The fields are update.
I also handle the saprfc call function and the return SAPRFC_OK
This are the function module ZZ_SET_DISTANCE, and the php code
//PHP CODE
$fce = saprfc_function_discover($sap,"ZZ_SET_DISTANCE");
if (! $fce ) {echo "Echec d'ouverture du module fonction "; exit;}
saprfc_import ($fce,"COMMANDE", '0000001998');
saprfc_table_init($fce,"TBLE_CMDE");
$val=array();
$val['NUM_POST']='000030';
$val['HN_EXP']='';
$val['ST_EXP']='';
$val['PC_EXP']='';
$val['CI_EXP']='';
$val['CO_EXP']='';
$val['HN_REC']='';
$val['ST_REC']='';
$val['PC_REC']='';
$val['CI_REC']='';
$val['CO_REC']='';
$val['DIST']='popo';
saprfc_table_append ($fce,"TBLE_CMDE", $val);
$rfc_rc = saprfc_call_and_receive ($fce);
echo "\n".$rfc_rc;
if ($rfc_rc != SAPRFC_OK) { if ($sap == SAPRFC_EXCEPTION ) echo ("Exception raised: ".saprfc_exception($fce)); else echo (saprfc_error($fce)); }else{echo '/execution de la function ;}
saprfc_function_free($fce);
//FUNCTION MODULE ZZ_SET_DISTANCE
FUNCTION ZZ_SET_DISTANCE.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(COMMANDE) TYPE VBELN
*" TABLES
*" TBLE_CMDE STRUCTURE ZADD_COM_LOXAN
*"----
DATA : NUMC TYPE VBELN.
NUMC = COMMANDE .
WHILE STRLEN( NUMC ) < 10 .
CONCATENATE '0' NUMC INTO NUMC .
ENDWHILE .
DATA tble_addrcomm LIKE LINE OF TBLE_CMDE .
LOOP AT TBLE_CMDE INTO tble_addrcomm.
DATA : NUMP TYPE POSNR.
NUMP = tble_addrcomm-NUM_POST.
WHILE STRLEN( NUMP ) < 6 .
CONCATENATE '0' NUMP INTO NUMP .
ENDWHILE .
UPDATE VBAP SET ARKTX = tble_addrcomm-DIST
WHERE VBELN EQ COMMANDE
AND POSNR EQ NUMP.
ENDLOOP.
ENDFUNCTION.
Is anybody can help me?
thank.
02-26-2010 3:00 PM
03-11-2010 5:07 PM
Well done! That's exactly what you were missing. Glad you found it for yourself.
03-23-2015 1:45 PM
Hello Marie,
I am facing same problem. It will be great help if you could provide more information on the solution.
Thanks !
04-09-2015 12:56 AM
Marie, create a Blog please, about more details for dummies....
1) how to connect to sap system?
2) you run the php code where? in a webserver or where?
3) wich is the url for run the FM: ZZ_SET_DISTANCE
4) you placed some dlls files on the web server?
please is interesting this...
Thanks