Crash "Field symbol has not yet been assigned" when calling REUSE_ALV_GRID_DISPLAY - abap

While displaying an ALV I get a crash report when executing the program. To create an ALV I have followed a few tutorials and stuff and at the moment it looks like this:
TYPE-POOLS: slis.
*build field catalog
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
repid TYPE sy-repid.
REFRESH it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-reptext_ddic = 'Table ID'.
wa_fieldcat-fieldname = 'table_id'.
wa_fieldcat-tabname = 'lt_where_used_data_of_coll'.
wa_fieldcat-outputlen = '18'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-reptext_ddic = 'Table Description'.
wa_fieldcat-fieldname = 'table_description'.
wa_fieldcat-tabname = 'lt_where_used_data_of_coll'.
wa_fieldcat-outputlen = '40'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-reptext_ddic = 'Numer of Records Found'.
wa_fieldcat-fieldname = 'nr_of_records'.
wa_fieldcat-tabname = 'lt_where_used_data_of_coll'.
wa_fieldcat-outputlen = '30'.
APPEND wa_fieldcat TO it_fieldcat.
*pass data and field catalog to ALV function module
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
it_fieldcat = it_fieldcat
i_structure_name = 'lty_where_used_data_of_coll'
TABLES
t_outtab = lt_where_used_data_of_coll.
'lt_where_used_data_of_coll' is my local table that I have already filled with a working function earlier in my program. This function works and I have tested it and the table fills itself with data. My next step was displaying this data to the end user. The error report I receive when executing this program is:
Short text: Field symbol has not yet been assigned.
What happened?:
Error in the ABAP Application Program.
The current ABAP program "SAPLSLVC" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis:
You attempted to access an unassigned field symbol
(data segment "-1").
Trigger Location of Runtime Error:
Program SAPLSLVC
Include LSLVCF36
Row 3,273
Module type (FORM)
Module Name FILL_DATA_TABLE
I really don't know how to start finding my mistake. It seems like it runs bad when calling a function from ABAP itself.
Any help is much appreciated.
EDIT: As was suggested I implemented another way of displaying an ALV that can be found below. This way works fine and gives no errors. Question still remains why the older method does give me an error.
I replaced the entire block of code above with this:
DATA alv TYPE REF TO cl_salv_table. DATA message TYPE REF TO cx_salv_msg.
*initialize ALV
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = alv
CHANGING
t_table = lt_where_used_data_of_coll ).
CATCH cx_salv_msg INTO message.
" error handling
ENDTRY.
*display ALV
alv->display( ).

why the older method does give me an error
Field catalog names are case sensitive. Capitalize every fieldname and tabname value and see if the error's still there. Also make sure that the names match those of your internal table lt_where_used_data_of_coll

Related

problem during updating standard table lips-lfimg using FM ws_delivery_update [duplicate]

All the flows seen like okay, however when pass through the call function, the update also failed and the field that need to be update not updated, not sure where is the problem, can someone help me with this problem? do i miss any step?
Error message Log in LT_PROT
DATA: LT_PROT LIKE PROTT OCCURS 10 WITH HEADER LINE.
DATA: LT_VBPOK LIKE VBPOK OCCURS 500 WITH HEADER LINE.
DATA: LS_VBKOK LIKE VBKOK.
DATA: GT_LIPS LIKE LT_LIPS.
DATA: WA_LIPS TYPE LTY_LIPS.
DATA: EF_ERROR_ANY_0 TYPE C,
EF_ERROR_IN_ITEM_DELETION_0 TYPE C,
EF_ERROR_IN_POD_UPDATE_0 TYPE C,
EF_ERROR_IN_INTERFACE_0 TYPE C,
EF_ERROR_IN_GOODS_ISSUE_0 TYPE C,
EF_ERROR_IN_FINAL_CHECK_0 TYPE C.
SELECT * FROM LIPS INTO CORRESPONDING FIELDS OF TABLE LT_LIPS
WHERE VGBEL = LT_BCODE_I-VGBEL
AND VGPOS = LT_BCODE_I-VGPOS.
LOOP AT LT_LIPS INTO WA_LIPS.
WA_LIPS-LFIMG = LT_BCODE_I-MENGE.
MODIFY LT_LIPS FROM WA_LIPS INDEX SY-TABIX.
ENDLOOP.
"VBPOK IS CHANGE INDICATOR, AFTERWARD CALL FUNCTION TO CHANGE FIELD LFIMG IN STANDART TABLE LIPS.
LOOP AT LT_LIPS INTO GT_LIPS.
LT_VBPOK-LFIMG = GT_LIPS-LFIMG.
APPEND LT_VBPOK.
ENDLOOP.
ls_vbkok-vbeln_vl = LT_BCODE_I-REF_DOC.
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
vbkok_wa = ls_vbkok " DELIVERY DOCUMENT NUMBER
synchron = 'X'
no_messages_update = ' '
update_picking = 'X'
commit = 'X'
delivery = LT_BCODE_I-REF_DOC "VARIABLE OF DELIVERY DOCUMENT
nicht_sperren = 'X'
if_error_messages_send_0 = space
IMPORTING
ef_error_any_0 = ef_error_any_0
ef_error_in_item_deletion_0 = ef_error_in_item_deletion_0
ef_error_in_pod_update_0 = ef_error_in_pod_update_0
ef_error_in_interface_0 = ef_error_in_interface_0
ef_error_in_goods_issue_0 = ef_error_in_goods_issue_0
ef_error_in_final_check_0 = ef_error_in_final_check_0
TABLES
vbpok_tab = lt_vbpok "TABLE TO BE CHANGE
prot = lt_prot.
First of all, this function model has the status "Not released" on its attribute tab. That means that it should not be used in customer code, because
SAP might change or delete it in a future update without warning, and then your code won't work anymore.
It is very likely not properly documented.
It might have hidden and unexpected gotchas. Like for example only working for specific corner-cases, not doing everything you would expect it to be doing or requiring to call some other function module before or afterwards in order to do something.
The error handling might be missing or might provide information that's misleading outside of the context where the module is usually used
So before you use a "Not Released" function module, you should check the transaction code BAPI if there is an official bapi function module which does what you want. Bapi function modules are specifically intended for use in customer code. They are well-documented, are guaranteed to take care of everything and SAP promises not to break them in future updates.
So much for the preaching, let's look at your actual problem.
Whenever you encounter a data structure with fields like MSGNO, MSGTY, MSGID and up to four generic variables, you are dealing with a message. You can look up message codes like that in transaction SE91. There we can see that the number 280 in message class VL means:
Required field in interface to delivery update missing VBELN 00000 00000
This could refer to the structure ls_vbkok or to the table lt_vbpok. I would recommend you to set a debugger breakpoint in your code and find out where that VBELN field could be missing a value.

Problem during update field LIPS-LFIMG in standard table

All the flows seen like okay, however when pass through the call function, the update also failed and the field that need to be update not updated, not sure where is the problem, can someone help me with this problem? do i miss any step?
Error message Log in LT_PROT
DATA: LT_PROT LIKE PROTT OCCURS 10 WITH HEADER LINE.
DATA: LT_VBPOK LIKE VBPOK OCCURS 500 WITH HEADER LINE.
DATA: LS_VBKOK LIKE VBKOK.
DATA: GT_LIPS LIKE LT_LIPS.
DATA: WA_LIPS TYPE LTY_LIPS.
DATA: EF_ERROR_ANY_0 TYPE C,
EF_ERROR_IN_ITEM_DELETION_0 TYPE C,
EF_ERROR_IN_POD_UPDATE_0 TYPE C,
EF_ERROR_IN_INTERFACE_0 TYPE C,
EF_ERROR_IN_GOODS_ISSUE_0 TYPE C,
EF_ERROR_IN_FINAL_CHECK_0 TYPE C.
SELECT * FROM LIPS INTO CORRESPONDING FIELDS OF TABLE LT_LIPS
WHERE VGBEL = LT_BCODE_I-VGBEL
AND VGPOS = LT_BCODE_I-VGPOS.
LOOP AT LT_LIPS INTO WA_LIPS.
WA_LIPS-LFIMG = LT_BCODE_I-MENGE.
MODIFY LT_LIPS FROM WA_LIPS INDEX SY-TABIX.
ENDLOOP.
"VBPOK IS CHANGE INDICATOR, AFTERWARD CALL FUNCTION TO CHANGE FIELD LFIMG IN STANDART TABLE LIPS.
LOOP AT LT_LIPS INTO GT_LIPS.
LT_VBPOK-LFIMG = GT_LIPS-LFIMG.
APPEND LT_VBPOK.
ENDLOOP.
ls_vbkok-vbeln_vl = LT_BCODE_I-REF_DOC.
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
vbkok_wa = ls_vbkok " DELIVERY DOCUMENT NUMBER
synchron = 'X'
no_messages_update = ' '
update_picking = 'X'
commit = 'X'
delivery = LT_BCODE_I-REF_DOC "VARIABLE OF DELIVERY DOCUMENT
nicht_sperren = 'X'
if_error_messages_send_0 = space
IMPORTING
ef_error_any_0 = ef_error_any_0
ef_error_in_item_deletion_0 = ef_error_in_item_deletion_0
ef_error_in_pod_update_0 = ef_error_in_pod_update_0
ef_error_in_interface_0 = ef_error_in_interface_0
ef_error_in_goods_issue_0 = ef_error_in_goods_issue_0
ef_error_in_final_check_0 = ef_error_in_final_check_0
TABLES
vbpok_tab = lt_vbpok "TABLE TO BE CHANGE
prot = lt_prot.
First of all, this function model has the status "Not released" on its attribute tab. That means that it should not be used in customer code, because
SAP might change or delete it in a future update without warning, and then your code won't work anymore.
It is very likely not properly documented.
It might have hidden and unexpected gotchas. Like for example only working for specific corner-cases, not doing everything you would expect it to be doing or requiring to call some other function module before or afterwards in order to do something.
The error handling might be missing or might provide information that's misleading outside of the context where the module is usually used
So before you use a "Not Released" function module, you should check the transaction code BAPI if there is an official bapi function module which does what you want. Bapi function modules are specifically intended for use in customer code. They are well-documented, are guaranteed to take care of everything and SAP promises not to break them in future updates.
So much for the preaching, let's look at your actual problem.
Whenever you encounter a data structure with fields like MSGNO, MSGTY, MSGID and up to four generic variables, you are dealing with a message. You can look up message codes like that in transaction SE91. There we can see that the number 280 in message class VL means:
Required field in interface to delivery update missing VBELN 00000 00000
This could refer to the structure ls_vbkok or to the table lt_vbpok. I would recommend you to set a debugger breakpoint in your code and find out where that VBELN field could be missing a value.

ALV resfresh working fine in SE80 but not with Z tcode

I'm using this code to refresh my ALV-Grid:
CALL METHOD go_alv->refresh_table_display
EXPORTING
is_stable = is_stable.
go_alv is TYPE REF TO cl_gui_alv_grid.
is_stable is TYPE lvc_s_stbl and set like this:
is_stable-row = 'X'.
is_stable-col = 'X'.
This works with no problems when the Report is started in SE80. But when I open the Report using the T-Code I created for it in SE93, the Grid does get refreshed, but the is_stabale parameter is somehow ignored. As a result, the scroll position is reseted.
I tried playing around with the GUI Options in the TCODE, but it didn't work.
It behaves the same whatever it's started via a report or via a transaction code.
You can check by yourself with this little program, then create a transaction code running this program and check whether the problem still occurs. If not, then check what's different in your code. If you don't find any difference, simplify your code, or recreate a separate program and transaction code, etc., anything which can help you solve the issue.
TABLES sscrfields.
DATA go_alv TYPE REF TO cl_gui_alv_grid.
DATA gt_sflight TYPE TABLE OF sflight.
PARAMETERS dummy.
SELECTION-SCREEN FUNCTION KEY 1.
AT SELECTION-SCREEN OUTPUT.
sscrfields-functxt_01 = 'Refresh'.
IF go_alv IS INITIAL.
CREATE OBJECT go_alv
EXPORTING
i_parent = cl_gui_container=>screen0.
SELECT * FROM sflight INTO TABLE gt_sflight.
go_alv->set_table_for_first_display(
EXPORTING i_structure_name = 'SFLIGHT'
CHANGING it_outtab = gt_sflight ).
ENDIF.
AT SELECTION-SCREEN.
IF sscrfields-ucomm = 'FC01'.
DATA gs_sflight TYPE sflight.
MODIFY gt_sflight FROM gs_sflight TRANSPORTING price currency WHERE price <> 0.
DATA: ls_stbl TYPE lvc_s_stbl.
ls_stbl-col = abap_true.
ls_stbl-row = abap_true.
DATA: l_soft TYPE char01.
l_soft = abap_true. " do not recalculate totals
go_alv->refresh_table_display(
EXPORTING
is_stable = ls_stbl
i_soft_refresh = l_soft " default = false
EXCEPTIONS
finished = 1 ).
ENDIF.
AT SELECTION-SCREEN ON EXIT-COMMAND.
go_alv->free( ).
FREE go_alv.

Set property to empty - SAP CRM WebUI

I am new to SAP, and am encountering an issue I am not sure how to resolve.
I am setting a property to '' (empty), but it is not being displayed as such.
There is existing logic that sets specific fields to 'Display Only' when a checkbox is checked. I am working to extend this to clear any data that is within those fields. Due to how the original logic was implemented, this change is being handled in the "Get_..." method (may be moved to an event handler once I get it working).
Currently, the logic sets the property to be empty (I have confirmed this with debug); however, the webpage keeps the original value. A shortened outline of the code is below (all try catches, etc. removed to keep it short and simple):
DATA: current TYPE REF TO if_bol_bo_property_access.
DATA: dref TYPE REF TO data.
current = collection_wrapper->get_current( ).
dref = current->get_property( 'FIRSTNAME' ).
* If condition
DATA: copy TYPE REF TO data.
FIELD-SYMBOLS:
<nval> TYPE ANY,
<oval> TYPE ANY.
ASSIGN dref->* TO <oval>.
CREATE DATA copy LIKE <oval>.
CLEAR value.
TRY.
CALL METHOD if_bsp_model_util~convert_from_string
EXPORTING
data_ref = copy
value = value
attribute_path = attribute_path.
CATCH cx_sy_conversion_error.
RAISE EXCEPTION TYPE cx_bsp_conv_failed
EXPORTING
name = 'FIRSTNAME'.
ENDTRY.
current->set_property_as_string(
iv_attr_name = 'FIRSTNAME'
iv_value = value ).
value = current->get_property_text( 'FIRSTNAME' ). "Check empty ''
Most of this was pulled from the 'Set_...' method. Any help would be appreciated.
This issue is due to the CRM browser autosaving before the case is complete. This causes the values to be rendered as though they are cached.
Note 2104051 resolves this.

Alv OO program error Message no. 0K534

Everytime i hit enter or any command button the program prompt an error message.
base on this thread http://scn.sap.com/thread/65856 i should declare my internal table
globally on top include.
Even though i already added all variable globally still the error is the same.
Top Include.
data: gr_data type ref to data.
data: la_data type ref to data.
field-symbols: <gt_data> type standard table.
Classs Declaration
me->get_data( CHANGING c_data = <f_tab> ). " Fetch Dynamic Data
METHOD get_data.
GET REFERENCE OF c_data INTO la_data.
move la_data TO gr_data.
assign gr_data->* to <gt_data>.
me->display( ).
assign gr_data->* to <gt_data>.
IF gc_custom_container is initial.
CREATE OBJECT gc_custom_container
EXPORTING
container_name = gv_mycontainer.
ENDIF.
if table is not bound.
try.
"// Create ALV Instance
cl_salv_table=>factory(
exporting
r_container = gc_custom_container
container_name = 'TC_MIXING'
importing
r_salv_table = table
changing
t_table = <gt_data>
).
catch cx_salv_msg. "#EC NO_HANDLER
endtry.
"// Setup ALV Attributes
functions = table->get_functions( ).
functions->set_all( abap_true ).
columns = table->get_columns( ).
columns->set_optimize( abap_true ).
try.
column = columns->get_column( 'MANDT' ).
column->set_technical( if_salv_c_bool_sap=>true ).
catch cx_salv_not_found.
endtry.
"// Dispalay ALV Model
table->display( ).
else.
table->refresh( ).
endif.
ENDMETHOD.
and another question:
how to create structure dynamically base on field-symbol. is this possible?
ls_testvar like line of <f_tab>.
thanks and regards,
Mapet
Question two is possible, with some usage of runtime type services.
Take a look at runtime type services.
se24
CL_ABAP_CLASSDESCR Run Time Type Services
CL_ABAP_DATADESCR Run Time Type Services
CL_ABAP_ELEMDESCR Run Time Type Services
CL_ABAP_INTFDESCR Run Time Type Services
CL_ABAP_OBJECTDESCR Run Time Type Services
CL_ABAP_REFDESCR Run Time Type Services
CL_ABAP_STRUCTDESCR Run Time Type Services
CL_ABAP_TABLEDESCR Run Time Type Services
CL_ABAP_TYPEDESCR Run Time Type Services
You can get the type of the fieldsymbol and create a structure based on it, perhaps You have to iterate through fieldsymbol, if it is composed type and add each component.
I agree, you should not pass a field symbol to the changing parameter for the table data! Use a global or static table. You should also use a typed table instead of data and create your field catalog in design time. This improves the performance a lot.
Cheers
Your table variable holding the ALV must be declared globally as well.
cl_salv_table=>factory(
exporting
r_container = gc_custom_container
container_name = 'TC_MIXING'
importing
r_salv_table = table
changing
t_table = <gt_data>
).
You should separate data retrieving from your displaying code like this:
START-OF-SELECTION.
gr_class->get_data( ).
CALL SCREEN 2000.
PBO:
gr_class->display.
Your display method:
METHOD display IMPLEMENTATION.
IF me->gr_container IS NOT BOUND.
gr_table->display( ).
ELSE.
gr_table->refresh( ).
ENDIF.