首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带过滤器读取的Saprfc表

带过滤器读取的Saprfc表
EN

Stack Overflow用户
提问于 2015-01-05 09:21:11
回答 1查看 1.4K关注 0票数 0

我是新来的。我使用我们的集成函数,但现在我需要从表中读取行。但是,如何只读取几行,根据标准过滤结果,因为这个表有数百万行。

有可能吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-10-17 10:09:35

下面是一个代码部分,即最近使用的代码部分,它在非常大的表上也工作得很好,而且速度也很快。我希望这对其他人也有帮助。

代码语言:javascript
复制
//Try to connect to SAP using our Login array 
    $rfc = saprfc_open ($saplogin);
    IF (! $rfc ) { ECHO "The RFC connection has failed with the following error:".saprfc_error();EXIT; }
    //We must know if the function really exists
    $fce = saprfc_function_discover($rfc, "RFC_READ_TABLE");
    IF (! $fce ) { ECHO "The function module has failed.";ECHO $rfc;EXIT; }
    //Convert to uppercase the name of the table to show
    $Table = "HERE_THE_TABLE_NAME";
    //Pass import parameters
    saprfc_import ($fce,"QUERY_TABLE",$Table);saprfc_import ($fce,"DELIMITER","/");
    //Pass table parameters
    saprfc_table_init ($fce,"OPTIONS");
    saprfc_table_append ($fce,"OPTIONS", array ("TEXT"=>"TABLE_FIELD_NAME = '{$input}'")); //input field, filter by this variable
    saprfc_table_init ($fce,"FIELDS");
    saprfc_table_append ($fce,"FIELDS", array ("FIELDNAME"=>"INT_UI")); //wanted answer field
    saprfc_table_init ($fce,"DATA");
    //Call and execute the function
    $rc = saprfc_call_and_receive ($fce);
    if ($rc != SAPRFC_OK)
      {
       if ($rfc == SAPRFC_EXCEPTION ) { echo ("Exception raised: ".saprfc_exception($fce)); }
        else { echo ("Call error: ".saprfc_error($fce)); }
       exit; 
      }
    //Fetch the data from the internal tables
    $data_row = saprfc_table_rows ($fce,"DATA");$field_row = saprfc_table_rows ($fce,"FIELDS");
    for($i=1; $i<=$data_row ; $i++)
     { $DATA[$i] = saprfc_table_read ($fce,"DATA",$i);$TEST[] = SPLIT("/",$DATA[$i]['WA']); }  // get the rows to $TEST variable


    //release the function and close the connection
  saprfc_function_free($fce);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27776470

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档