cancel
Showing results for 
Search instead for 
Did you mean: 

PHP SAP RFC Function call not working

Former Member
0 Kudos

This is the first time I used PHP to call a SAP function.  Ran into this problem that I couldn’t figure until someone with experience helped me.

This is the code used -- to fetch data from Saprfc to php

<html>

<h1>SAPRFC-Class</h1>

<?php

   

   

   

    // saprfc-class-library   

    require_once("saprfc.php");

   

    // Create saprfc-instance

    $sap = new saprfc(array(

                            "logindata"=>array(

                            "ASHOST"=>""        // application server

                            ,"SYSNR"=>""                // system number

                            ,"CLIENT"=>""            // client

                            ,"USER"=>""            // user

                            ,"PASSWD"=>""        // password

                            )

                        ,"show_errors"=>false            // let class printout errors

                        ,"debug"=>true)) ;                 // detailed debugging information

    // Call-Function

    $result=$sap->callFunction("ZBAPI",

                                          

                                array(     array("IMPORT","FROM_","100"),

                                 array("EXPORT","RETURN",""),

                                        array("TABLE","Namesdata",array())

                                ));                                

                //var_dump($result);

    // Call successfull?

    if ($sap->getStatus() == SAPRFC_OK) {

        // Yes, print out the Userlist

        ?><table>

            <?php

                    //$sap->printStatus();

                     foreach ($result["Namesdata"] as $orders) {

            

                          echo "<tr><td>", $orders["name"],"</td><td>",$orders["form"],"</td> <td>",$orders["Names"],"</td></tr>";

          }

       

        ?></table><?php

    } else {

     

        $sap->printStatus();

      

    }

    $sap->logoff();

?>

error appers like

saprfc::callFunction('ZBAPI')

Import-Parameter=FROM_ could not be set. (Does it exist?)

if i comment the IMPORT array means its displays data  how to solve the issue ..  whats wrong in this line -- array("IMPORT","FROM_","100"),

Accepted Solutions (0)

Answers (1)

Answers (1)

acelikbilek
Explorer
0 Kudos