我正在使用模块RSAQ_QUERY_CALL
,取回一个表
DATA: gr_data TYPE REF TO data
.
CALL FUNCTION 'RSAQ_QUERY_CALL'
EXPORTING
query = 'ZXXXXXXXX'
usergroup = 'XXX'
VARIANT = 'TEST'
SKIP_SELSCREEN = 'X'
DATA_TO_MEMORY = 'X'
IMPORTING
ref_to_ldata = gr_data
EXCEPTIONS
OTHERS = 11
.
现在我该如何在那张桌子上循环?我尝试了什么:
两者都不起作用。
答案 0 :(得分:2)
我找到了解决方案(在询问高级开发人员之后......)
FIELD-SYMBOLS: <gt_data> type table,
<fs_value> type any
.
ASSIGN gr_data->* to <gt_data>.
LOOP AT <gt_data> ASSIGNING <fs_value>.
ENDLOOP.
答案 1 :(得分:-2)
参考此代码:
$filename = "testing-exports.csv";
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=$filename");
header("Pragma: no-cache");
header("Expires: 0");
$insquery = "SELECT username FROM r_institution where status=1";
//$exportstmt = $conn->query($insquery);
$insresults = $conn->query($insquery);
//$insresults = mysqli_fetch_assoc($exportstmt);
foreach ($insresults as $rs) {
$row = array();
$row[] = stripslashes($rs["username"]);
$content[] = $row;
}
$content = array();
$title = array("Institution Emails");
foreach ($insresults as $rs) {
$row = array();
$row[] = stripslashes($rs["username"]);
$content[] = $row;
}
$output = fopen('php://output', 'w');
fputcsv($output, $title);
foreach ($content as $con) {
fputcsv($output, $con);
}