cancel
Showing results for 
Search instead for 
Did you mean: 

Field symbol has not been assigned yet. oData/Gateway

Former Member
0 Kudos

Hi, Im getting the following error when doing create method with odata model:

Call of service /sap/opu/odata/SAP/ZASD_EMPLOYEEFORM_SRV/FamilyMemberCollection terminated because of an error. The following error text was processed in system ZZZ: Field symbol has not been assigned yet.The error occurred on the application server saturn. The termination type was: RABAX_STATE. If the termination type is RABAX_STATE, you will find more information on the cause of termination in system ZZZ in transaction ST22. If the termination type is ABORT_MESSAGE_STATE, you will find more information on the cause of termination on the application server saturn in transaction SM21. If the termination type is ERROR_MESSAGE_STATE, you can search for further information in the trace file for the work process in transaction ST11 on the application server saturn. You may also need to analyze the trace files of other work processes. If you do not yet have a user ID, contact your system adminmistrator.

I have checked most of the possible errors. I imported the entity using DDIC and added ALL the fields from that table. My FM for adding data to the table is:

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     VALUE(IT_EMP_FAMILYMEMBERS) TYPE  ZHREC_IT0021_TT OPTIONAL

*"  EXPORTING

*"     VALUE(EV_SUCCESS) TYPE  BOOLEAN

*"----------------------------------------------------------------------

   DATA: wa_familymembers TYPE zhrec_it0021.

   DATA: linenumber TYPE zhrec_it0021-linenumber.

   DATA: formid TYPE zhrec_form_id.

   DATA: version TYPE zhrec_version.

   LOOP AT it_emp_familymembers INTO wa_familymembers.

   ENDLOOP.

   formid = wa_familymembers-formid.

   IF formid IS NOT INITIAL.

     CALL FUNCTION 'ZHREC_GET_LATEST_VERSION'

       EXPORTING

         im_formid  = formid

       IMPORTING

         ev_version = version.

     version = version + 1.

     SELECT SINGLE linenumber FROM zhrec_it0021 INTO linenumber WHERE formid = formid.

     IF linenumber IS NOT INITIAL.

       linenumber = linenumber + 1.

     ELSE.

       linenumber = 1.

     ENDIF.


     wa_familymembers-linenumber = linenumber.

     wa_familymembers-mandt = sy-mandt.

     wa_familymembers-version = version.

     INSERT zhrec_it0021 FROM wa_familymembers.

     IF sy-subrc = 0.

       ev_success = 'X'.

     ELSE.

       ev_success = '-'.

     ENDIF.

   ENDIF.


Basically I'm getting the data the user inserted and adding them into import table it_emp_familymembers. Next I'm putting all the data from import table into work area because i need to add values to fields that where not meant for user like mandt and version. And finally I add the data from the user and the data i added manually in the FM from the workarea into the table zhrec_it0021.


I tested the FM and it works fine. I clean the cache of the service model, generated objects and still get this not very helpful error.


Note: It feels that if I breathe in a certain direction at exactly calculated moment, then It works fine...and then again I get this error.


What could be the problem here?  Or how can I get to the source of the problem?

Accepted Solutions (0)

Answers (4)

Answers (4)

FiratAsan
Active Participant
0 Kudos

I had same problem and can finally solved. My problem was that create method works proplerly but after creating get method was not working. Please check your other methods first. After create methods always trigger get method

My old code for get method:

SELECT SINGLE FROM zfrt_tbl_ehliyet
INTO CORRESPONDING FIELDS OF et_list
WHERE tckimlikno EQ is_data-tckimlikno.

And new code:

SELECT * FROM zfrt_tbl_ehliyet
INTO CORRESPONDING FIELDS OF TABLE et_list
WHERE tckimlikno EQ is_data-tckimlikno.

Former Member
0 Kudos

Found my problem. Rather silly one but thank you all for explaining to me some details about how create_entity works.

Former Member
0 Kudos

In the DPC method FAMILYMEMBERCOLL_CREATE_ENTITY at the end there is this code:

* Call read after create

  /iwbep/if_mgw_appl_srv_runtime~get_entity(

    EXPORTING

      iv_entity_name     = iv_entity_name

      iv_entity_set_name = iv_entity_set_name

      iv_source_name     = iv_source_name

      it_key_tab         = it_key_tab

      io_tech_request_context = lo_tech_read_request_context

      it_navigation_path = it_navigation_path

    IMPORTING

      er_entity          = ls_entity ).

* Send the read response to the caller interface

  ASSIGN ls_entity->* TO <ls_data>.

  er_entity = <ls_data>.


ls_entity value is {A:INITIAL} before the ASSIGN ls_entity->* part. This is why the form_symbol ls_data is not assigned.


1) Why do I need this form symbol?

2) And why could the ls_entity be value as {A:INITIAL}?

AshwinDutt
Active Contributor
0 Kudos

Hello German,

Implementing Create using 'Map to Data Source' requires implementation of Read and performs a Read after a Successful Create operation.

After Successful Create, GW will fire Read and get the newly created data and display as part of response.

You need to first check if data is created from GW and then check GW is able to read the same data with key which you would have defined.

Put a Break Point and debug and see Insert is successful first. ls_entity is initial because of GW is unable to read the newly created data with the key or data insertion would have failed.

Regards,

Ashwin

EkanshCapgemini
Active Contributor
0 Kudos

Hi,

The code you mentioned, is for firing a READ call to ensure that the newly created record is actually created in SAP. The gateway framework behaviour (using SEGW tool) is:

1) map a create operation: pass any number of properties as input and take key properties(like employeeid if you are creating employee) as output

2) map a read operation: pass all key fields as input.

This code is failing because you have not taken any key value as output and may not mapped the read operation. You need to change the export signature of your FM so that it will send the newly created key values as well (for example employeeid). And if there is any error while creating the record, use return table with type BAPIRET2 to pass the error message to the UI.

This link may help you

However, you can skip this GET call after CREATE operation from UI as well. Please check this link

Regards,

Ekansh

Former Member
0 Kudos

Tried that. Insert worked like a charm. sy-subrc was 0 and ev_success was X and data was inserted into the table.

AshwinDutt
Active Contributor
0 Kudos

Did you check after Create what is happening to read ? what is being filled with the it_key_tab ? ls_entity is initial because read is failing. Check this.

You need to make sure Read is called only if ev_success is  'X' and based on the Key Defined in the GW Model it_key_tab will be filled and this key is used to read the newly created data.

Former Member
0 Kudos

I did the following: I put a breakpoint into the FM for reading the table based on the formid which is the key. Now when i send the post request then the insert part worked, but when the read was fired after insert and stopped at the brakepoint then  the select statement didnt retreive anything for some reason while the import value iv_formid was set with the correct key value.

After that I tried to run the same FM for reading the table in se37, i put the same formid that i just created and it retreived the correct record with no problem....

AshwinDutt
Active Contributor
0 Kudos

What is the data Type of iv_formid ? Leading Zeros are correctly passed ?

kammaje_cis
Active Contributor
0 Kudos

-> Most probably you did not 'Commit' after update. Once you complete the execution cycle, automatic commit happens, and hence you are able to fetch the record.

->If the create is successful (no error returned), I would not do a read again. I would just plug the input to output.

Former Member
0 Kudos

iv_formid is of data type char(32) with an example like 021FEA12EF631ED58AD9B5E9616E9E8B which is a generated guid

AshwinDutt
Active Contributor
0 Kudos

Did you check the Select written to read the data on table with key?

Former Member
0 Kudos

The insert works fine: all the data i send gets into the table. It seems that the error happens when sap tries to do it's extra curricular activities after my FM executed successfully.

What might be causing this "inconvenience" for sap?