Posted: Thu Jul 19, 2012 5:19 pm Post subject: Ошибка в определении внутренней таблицы.
Доброго времени суток.
Недавно при программировании на ABAP столкнулся с проблемой:
есть код:
Code:
REPORT ZTEST_1.
tables: IFLOT, IFLOTX, IMPTT, IMRG.
types: BEGIN OF temp_type,
TPLNR like IFLOT-TPLNR,
PLTXT like IFLOTX-PLTXT,
POINT like IMPTT-POINT,
PTTXT like IMPTT-PTTXT,
ATINN like IMPTT-ATINN,
MDOCM like IMRG-MDOCM,
IDATE like IMRG-IDATE,
READG like IMRG-READG,
CNTRR like IMRG-CNTRR,
CDIFF like IMRG-CDIFF,
MRNGU like IMPTT-MRNGU,
END OF temp_type.
data: temp_data_table type temp_type occurs 100 with header line.
select-options num_TP for temp_data_table-TPLNR.
select-options num_MP for temp_data_table-POINT.
select-options ind_MP for temp_data_table-ATINN.
select-options lab_Meas for temp_data_table-MRNGU.
select-options date_DOC for temp_data_table-IDATE.
select * into corresponding fields of table temp_data_table
(36) from temp_data_table
where temp_data_table-TPLNR in num_TP
and temp_data_table-POINT in num_MP
and temp_data_table-ATINN in ind_MP
and temp_data_table-MRNGU in lab_Meas
and temp_data_table-IDATE in date_DOC.
LOOP AT temp_data_table.
WRITE: / temp_data_table-EQUNR color col_key, temp_data_table-OBJNR, temp_data_table-EQKTX, temp_data_table-EQUNR, temp_data_table-MPOBJ, temp_data_table-POINT, temp_data_table-ATINN, temp_data_table-IDATE, temp_data_table-POINT.
На строке (36) возникает ошибка: "TEMP_DATA_TABLE" is not defined in the ABAP Dictionary as a table, projection view or database view.
Описывал внутреннюю таблицу согласно документации по созданию внутренних таблиц.
select из внутренних таблиц не выбирает - только из БД
А как должно быть?
Сделал немного по-другому:
Code:
REPORT ZTEST_1.
tables: IFLOT, IFLOTX, IMPTT, IMRG.
types: BEGIN OF temp_type,
TPLNR like IFLOT-TPLNR,
PLTXT like IFLOTX-PLTXT,
POINT like IMPTT-POINT,
PTTXT like IMPTT-PTTXT,
ATINN like IMPTT-ATINN,
MDOCM like IMRG-MDOCM,
IDATE like IMRG-IDATE,
READG like IMRG-READG,
CNTRR like IMRG-CNTRR,
CDIFF like IMRG-CDIFF,
MRNGU like IMPTT-MRNGU,
END OF temp_type.
data: temp_data_table type temp_type occurs 100 with header line.
select-options num_TP for temp_data_table-TPLNR.
select-options num_MP for temp_data_table-POINT.
select-options ind_MP for temp_data_table-ATINN.
select-options lab_Meas for temp_data_table-MRNGU.
select-options date_DOC for temp_data_table-IDATE.
select TPLNR from IFLOT into corresponding fields of table temp_data_table
where TPLNR in num_TP.
select PLTXT from IFLOTX into corresponding fields of table temp_data_table.
select POINT PTTXT ATINN MRNGU from IMPTT into corresponding fields of table temp_data_table
where POINT in num_MP
and ATINN in ind_MP
and MRNGU in lab_Meas.
select MDOCM IDATE READG CNTRR CDIFF from IMRG into corresponding fields of table temp_data_table
where IDATE in date_DOC.
select TPLNR PLTXT POINT PTTXT ATINN MDOCM IDATE READG CNTRR CDIFF MRNGU
from temp_data_table
where temp_data_table-TPLNR in num_TP
and POINT in num_MP
and ATINN in ind_MP
and MRNGU in lab_Meas
and IDATE in date_DOC.
LOOP AT temp_data_table.
WRITE: / temp_data_table-TPLNR color col_key,
temp_data_table-PLTXT,
temp_data_table-POINT,
temp_data_table-PTTXT,
temp_data_table-ATINN,
temp_data_table-MDOCM,
temp_data_table-IDATE,
temp_data_table-READG,
temp_data_table-CNTRR,
temp_data_table-CDIFF,
temp_data_table-MRNGU.
ENDLOOP.
Таблица, которую Вы указываете в предложении FROM оператора SELECT, должна обязательно существовать в словаре данных. Вы же указываете внутреннюю таблицу. Поэтому и ошибка.
Code:
select TPLNR PLTXT POINT PTTXT ATINN MDOCM IDATE READG CNTRR CDIFF MRNGU
from temp_data_table "<- FROM DDIC-table
...
Age: 48 Joined: 25 Jan 2008 Posts: 580 Location: Москва
Posted: Mon Jul 23, 2012 2:11 pm Post subject:
Другими словами, для выбора данных из внутренней таблицы могут использоваться только операторы LOOP и READ TABLE.
Для выбора во внутреннюю таблицу в SELECT .. FROM нужно указывать таблицу, которая существует в БД, например IFLOT.
Посмотрите транзакцию ABAPDOCU, раздел "Язык программирования ABAP - Обработка больших массивов данных" _________________ С уважением,
Удав.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.