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,
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
Hi Pritam,
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
Brian,
Is ZZWEATHER a table type with line type as zweather ?
K.Kiran.
Yes, zzweather is a table type of zweather
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.
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.