I have declared one local structure as follows,
TYPES : BEGIN OF struct_mara,
matnr TYPE mara-matnr,
vpsta TYPE mara-vpsta,
matkl TYPE mara-matkl,
bismt TYPE mara-bismt,
meins TYPE mara-meins,
END OF struct_mara.
I have declared an internal table and a work area for the corresponding structure as follows,
DATA : itab_mara TYPE STANDARD TABLE OF struct_mara,
wa_mara LIKE LINE OF itab_mara.
now i have fetched data from MARA table into the internal table itab_mara
SELECT matnr vpsta matkl meins FROM mara INTO TABLE itab_mara
UP TO 10 ROWS.
When we run the above select query, it will end up with a run-time error Error in module RSQL of the database interface .
Reason for Runtime Error :
-----------------------------
In the STRUCTURE declaration bismt field is there in 4th position but where as in the select query meins field is there in 4th position. Because of this field mismatch we are getting this runtime error.
Solution 1:
-----------
SELECT matnr vpsta matkl meins FROM mara INTO CORRESPONDIG FIELDS OF TABLE itab_mara
UP TO 10 ROWS.
As per performance issue we are not suppose to use CORRESPONDIG FILEDS keyword.
Solution 2:
------------
TYPES : BEGIN OF struct_mara,
matnr TYPE mara-matnr,
vpsta TYPE mara-vpsta,
matkl TYPE mara-matkl,
meins TYPE mara-meins,
bismt TYPE mara-bismt,
END OF struct_mara.
As per the SELECT query fields sequence ,declare the fields inside the structure.
If you need additional fields in the internal table which are not there in select query but you need those for future purpose, in that case declare those fields after SELECT query fields sequence like bismt field which is shown above.
TYPES : BEGIN OF struct_mara,
matnr TYPE mara-matnr,
vpsta TYPE mara-vpsta,
matkl TYPE mara-matkl,
bismt TYPE mara-bismt,
meins TYPE mara-meins,
END OF struct_mara.
I have declared an internal table and a work area for the corresponding structure as follows,
DATA : itab_mara TYPE STANDARD TABLE OF struct_mara,
wa_mara LIKE LINE OF itab_mara.
now i have fetched data from MARA table into the internal table itab_mara
SELECT matnr vpsta matkl meins FROM mara INTO TABLE itab_mara
UP TO 10 ROWS.
When we run the above select query, it will end up with a run-time error Error in module RSQL of the database interface .
Reason for Runtime Error :
-----------------------------
In the STRUCTURE declaration bismt field is there in 4th position but where as in the select query meins field is there in 4th position. Because of this field mismatch we are getting this runtime error.
Solution 1:
-----------
SELECT matnr vpsta matkl meins FROM mara INTO CORRESPONDIG FIELDS OF TABLE itab_mara
UP TO 10 ROWS.
As per performance issue we are not suppose to use CORRESPONDIG FILEDS keyword.
Solution 2:
------------
TYPES : BEGIN OF struct_mara,
matnr TYPE mara-matnr,
vpsta TYPE mara-vpsta,
matkl TYPE mara-matkl,
meins TYPE mara-meins,
bismt TYPE mara-bismt,
END OF struct_mara.
As per the SELECT query fields sequence ,declare the fields inside the structure.
If you need additional fields in the internal table which are not there in select query but you need those for future purpose, in that case declare those fields after SELECT query fields sequence like bismt field which is shown above.