Skip to Content
-1

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

5 days ago

48

avatar image

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)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Pritam Mondal 5 days ago
1

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Pritam,

  1. The structure is active and I have accessed it via forward navigation.
  2. On using code completion, it doesn't give the complete name of the variable, but does so for the others. Why could that be?
0
Brian Mogambi

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

0
Kiran K 5 days ago
0

Brian,

Is ZZWEATHER a table type with line type as zweather ?

K.Kiran.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Yes, zzweather is a table type of zweather

0
Brian Mogambi

Try as mentioned below

it_zweather TYPE STANDARD TABLE OF zweather,   
wa_zweather TYPE zweather, 
.......
.........
APPEND wa_zweather TO it_zweather.
clear wa_zweather.
et_zweather[] = it_zweather[].
refresh:it_zweather[].

K.Kiran.

0

Hi Kiran,

I'm still getting the same error. Don't understand why ls_weather isn't inside the case statement isn't getting seen globally.

0