user1667845
user1667845

Reputation: 57

PHP SAP RFC callfunction Import-Parameter could not be set

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.

<?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())
                            ));                                
          
       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();
              ?> 

This code so some error like this

saprfc::callFunction('ZBAPI')

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

But I comment the import parameter means it's fetching the data from SAPRFC what's wrong in this code..

Upvotes: 0

Views: 2120

Answers (1)

Senthilkumar
Senthilkumar

Reputation: 100

Import values like this --- array("IMPORT","name",array( "fieldname"=>"1000"))

Upvotes: 1

Related Questions