Skip to Content
-1

Field "X" is unknown.It's neither in one of the specified tables nor defined by a "DATA"

Hi ABAPers,

I'm getting the error "Field "LS_WEATHER–FORECAST_DATE" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement. "DATA" statement."

I've declared the workarea 'ls_weather' of type 'ZWEATHER' as seen in the code below. The structure 'ZWEATHER' is as seen on the screenshot.

FUNCTION zweather_test.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IM_ZIPCODE) TYPE AD_PSTCD1
*" CHANGING
*" REFERENCE(ET_WEATHER) TYPE ZZWEATHER
*"----------------------------------------------------------------------
 

DATA: ls_weather TYPE zweather,
      lv_node_name TYPE string,
      lv_node_value TYPE string.


lv_node_name = 'date'.
lv_node_value = 'Debugging'.
 
CASE lv_node_name.
 WHEN 'date'.
  REPLACE ALL OCCURRENCES OF '-' IN lv_node_value WITH ''.
  ls_weather–forecast_date = lv_node_value.
 WHEN 'maxtempF'.
  ls_weather–high_temp_f = lv_node_value.
 WHEN 'mintempF'.
  ls_weather–low_temp_f = lv_node_value.
 WHEN 'windspeedKmph'.
  ls_weather–wind_speed = lv_node_value.
 WHEN 'winddirDegree'.
  ls_weather–wind_direction = lv_node_value.
 WHEN 'weatherDesc'.
  ls_weather–description = lv_node_value.
 WHEN 'precipMM'.
  ls_weather–precipitation = lv_node_value.
 WHEN 'humidity'.
  ls_weather–humidity = lv_node_value.
 ENDCASE.

 APPEND ls_weather TO et_weather.
ENDFUNCTION.

Regards,

screenshot.png (51.1 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Apr 17 at 08:45 AM

    Dear Brian,

    This might sound silly, but let's try the following:

    1. Double click on "ZWEATHER" in the data declaration and see, if it navigates to the structure. If navigates, then please check if the structure is active.

    2. If the structure is active, then please try to use code completion (i.e. ctrl + space bar) to assign the values.

    -> How to use code completion: type ls_w and then press ctrl + space, if this is accessible, it'll give the complete name ls_weather. Then add the hyphen, (the code will look like "ls_weather-" at this moment) and again press ctrl + space. All the accessible fields will be listed down at this moment. Please select the necessary fields.

    Let me know if the issue is resolved.

    Regards,

    Pritam

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Brian,

      Please comment out all the code lines except the declaration of ls_weather. Then try to activate the FM. See if it can be activated. If you can activate it this way, then uncomment the code and try to activate. I believe it'll work.

      If the data declaration itself can't be activated, then please share the screenshot here.

      Regards

  • Apr 17 at 06:39 AM

    Brian,

    Is ZZWEATHER a table type with line type as zweather ?

    K.Kiran.

    Add comment
    10|10000 characters needed characters exceeded