07-30-2015 12:01 PM
Hi Folks,
Greetings!
I am using all inline declarations and working fine. But facing problem when calling method from other method then all these in line declarations are not working properly.
For reference please check the below code:
IF IV_ENTITY_SET_NAME = 'SFLIGHTSet'.
TRY.
CALL METHOD SPFLISET_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_REQUEST_OBJECT = IO_REQUEST_OBJECT
IO_TECH_REQUEST_CONTEXT = IO_TECH_REQUEST_CONTEXT
IT_NAVIGATION_PATH = IT_NAVIGATION_PATH
IMPORTING
ER_ENTITY = DATA(lr_entity)
* ES_RESPONSE_CONTEXT =
.
CATCH /IWBEP/CX_MGW_BUSI_EXCEPTION .
CATCH /IWBEP/CX_MGW_TECH_EXCEPTION .
IF LR_ENTITY IS NOT INITIAL.
SELECT SINGLE CARRID,
CONNID,
FLDATE,
PRICE,
CURRENCY INTO @ER_ENTITY
FROM SFLIGHT
WHERE CARRID = @lr_entity-AIRLINECODE AND
CONNID = @lr_entity-FLIGHTNUMBER.
ENDIF.
ENDTRY.
ENDIF.
IF IO_TECH_REQUEST_CONTEXT IS BOUND.
DATA(LT_KEY_TAB) = IO_TECH_REQUEST_CONTEXT->GET_KEYS( ).
READ TABLE LT_KEY_TAB WITH KEY NAME = 'AIRLINECODE' INTO DATA(LS_KEY_TAB).
IF SY-SUBRC = 0.
DATA(LV_CARRID) = LS_KEY_TAB-VALUE.
ENDIF.
READ TABLE LT_KEY_TAB WITH KEY NAME = 'FLIGHTNUMBER' INTO LS_KEY_TAB.
IF SY-SUBRC = 0.
DATA(LV_CONNID) = LS_KEY_TAB-VALUE.
ENDIF.
ELSE.
READ TABLE IT_KEY_TAB WITH KEY NAME = 'AIRLINECODE' INTO DATA(LS_KEY_TAB_LINE).
IF SY-SUBRC = 0.
LV_CARRID = LS_KEY_TAB_LINE-VALUE.
ENDIF.
READ TABLE IT_KEY_TAB WITH KEY NAME = 'FLIGHTNUMBER' INTO LS_KEY_TAB_LINE.
IF SY-SUBRC = 0.
LV_CONNID = LS_KEY_TAB_LINE-VALUE.
ENDIF.
ENDIF.
SELECT SINGLE CARRID,
CONNID
INTO @ER_ENTITY
FROM SPFLI
WHERE CARRID = @LV_CARRID AND
CONNID = @LV_CONNID .
thanks,
BR
07-30-2015 12:41 PM
07-30-2015 1:01 PM
Hello,
Directly I will access that code it is working fine. If I will try to access that code(mehtod) by calling in another method like CALL METHOD SPFLISET_GET_ENTITY. Then what ever code I written inside method is not working.
For example:
DATA(LT_KEY_TAB) = IO_TECH_REQUEST_CONTEXT->GET_KEYS( ).
here Get_keys have entries but not able to assigning values to lt_key_tab. and even in read statement also
it fails to pass value to work area.
READ TABLE IT_KEY_TAB WITH KEY NAME = 'AIRLINECODE' INTO DATA(LS_KEY_TAB_LINE).
Note@ it_key_tab has records.
best,
BR
07-30-2015 1:07 PM
Hi Ranadheer,
Have you debugged IO_TECH_REQUEST_CONTEXT->GET_KEYS( ). method, when you are trying to call from another method.
Praveer.
07-30-2015 1:18 PM
Hi Praveen,
Yes I debugged and it has values when triggered this method from another method. Please check the code even I put "else" condition also there IT_KEY_TAB has records. But read statement is not able to assign values to DATA(LS_KEY_TAB_LINE).
READ TABLE IT_KEY_TAB WITH KEY NAME = 'AIRLINECODE' INTODATA(LS_KEY_TAB_LINE).
Thank you!
07-30-2015 1:36 PM
Hi Ranadheer,
Can you replace the HARD Code with proper constant variable? I don't know, it will work or not but you can try.
and could you provide class code so it will easy to analysis.
Regards,
Praveer.
07-30-2015 2:25 PM
Hi Praveer,
Yes, I replaced the Hard code with proper constant variables.But no luck.
it is system generated class at run time in OData gateway service while creating the Project. Here one more important thing is if I replace these inline declarations with normal way that means
declarations part is done initially and use it in the code where ever you want.Then it is working fine and it doesn't care whether it directly access or access through another method.
for example:
DATA: ls_flights TYPE sisa_sflight_flights,
lt_key_tab TYPE /iwbep/t_mgw_tech_pairs,
ls_key_tab LIKE LINE OF lt_key_tab,
ls_key_tab_line LIKE LINE OF it_key_tab,
lr_msg_cont TYPE REF TO /iwbep/if_message_container,
lv_carrid TYPE s_carr_id,
lv_connid TYPE s_conn_id,
lv_fldate TYPE s_date.
IF io_tech_request_context IS BOUND.
lt_key_tab = io_tech_request_context->get_keys( ).
READ TABLE lt_key_tab WITH KEY name = 'CARRID' INTO ls_key_tab.
IF sy-subrc = 0.
lv_carrid = ls_key_tab-value.
ENDIF.
READ TABLE lt_key_tab WITH KEY name = 'CONNID' INTO ls_key_tab.
IF sy-subrc = 0.
lv_connid = ls_key_tab-value.
ENDIF.
READ TABLE lt_key_tab WITH KEY name = 'FLDATE' INTO ls_key_tab.
IF sy-subrc = 0.
lv_fldate = ls_key_tab-value.
ENDIF.
ELSE.
READ TABLE it_key_tab WITH KEY name = 'CARRID' INTO ls_key_tab_line.
IF sy-subrc = 0.
lv_carrid = ls_key_tab_line-value.
ENDIF.
READ TABLE it_key_tab WITH KEY name = 'CONNID' INTO ls_key_tab_line.
IF sy-subrc = 0.
lv_connid = ls_key_tab_line-value.
ENDIF.
READ TABLE it_key_tab WITH KEY name = 'FLDATE' INTO ls_key_tab_line.
IF sy-subrc = 0.
lv_fldate = ls_key_tab_line-value.
ENDIF.
ENDIF.
Hope you understood the problem clearly!
thansk,
BR
07-30-2015 9:09 PM
Hi,
It's certainly possible that there could be errors in ABAP compiler, kernel or "runtime enviroment" (I don't see OSS notes fitting symptoms you claim, however) but extraordinary claims require plenty of supporting evidence... The information you have posted thus far does not amount to evidence nor does it permit anyone to try to reproduce the behavior you are describing. If you could post simple enough and unambiguous test code isolating and demonstrating the problem, which others too can execute, you would get some kind of useful response - yes, we can reproduce the problem, or no - we can't. But if you are confident there is problem in ABAP rather than the data passed to method - just report it to SAP support.
cheers
Jānis