DevEpos / abap-code-search-tools

ABAP Code Search
MIT License
22 stars 8 forks source link

Syntax error in R3 System #4

Closed Jules1337dev closed 1 year ago

Jules1337dev commented 1 year ago

Hi Ludwig,

first: thanks for the great plugins and the effort you put in. I have an issue regarding the abap code search plugin. After installing the backend and the plugin the following error occured: image image

I think using offset is not possible in R3.

Maybe you can fix this or provide one branch for R3 and one for S4?

Thank in advance Julian

stockbal commented 1 year ago

Hi Julian,

the plug-in is compatible with R3. But the minimum requirement is NW 7.40 SP08. image

Currently it is not planned from my side to release a version that is compatible with a lower SP on 7.40 or even a version compatible with < 7.40.

Best regards, Ludwig

Jules1337dev commented 1 year ago

Hi Ludwig,

ahh we got 7.50 but SP only 0025 :/ Sorry, my bad.

Best regards, Julian

stockbal commented 1 year ago

Hm... I would have thought that 7.50 would have all changes of 7.40 SP08 image

I have the Code Search installed and running on another system with 7.50 SP18

Jules1337dev commented 1 year ago

Hi Ludwig,

i asked our basis team internally. The following answer was received:

With the next kernel patch all 7.40 and 7.50 will get the bug, see sap note 3279914: https://launchpad.support.sap.com/#/notes/3279914/D.

Can you possibly rebuild it?

Maybe you can use the coding in the note: The "SELECT .... INTO TABLE @itab LIMIT @limit@ OFFSET @offset." can be simulated like this:

OPEN CURSOR @ FOR SELECT ....

FETCH NEXT CURSOR @ INTO TABLE @itab PACKAGE SIZE @offset.

if offset < lines( itab ).

FETCH NEXT CURSOR @ INTO TABLE @itab PACKAGE SIZE @limit.

else.

clear itab. "offset >= lines( itab ) means nothing found.

endif.

Best regards, Julian

stockbal commented 1 year ago

Hi Julian,

I am not sure SAP knows how the OPEN/FETCH CURSOR clause is working. Or at least not the person who added this workaround in the note. This approach would never return any data in my case and the search would run endlessly without ever returning any data.

I think the best/only solution would be to implement the SELECT in native SQL for NW < 7.51. Could you tell me the DB you are using on your ABAP system, then I would try to implement a solution that works with that one first.

BR Ludwig

Jules1337dev commented 1 year ago

Hi Ludwig,

i haven´t used the OPEN/FETCH CURSOR clause yet. Feel free to fix it the way you want :)

We are using an oracle database based on release 19.6.0.0.0. Do you need any further information?

Thanks for your effort.

Best regards, Julian

stockbal commented 1 year ago

I am not sure how the chances are that SAP only added a syntax check for the OFFSET clause, but in a dynamic context it would still work.
Could check on your system if the following code snippet would run successfully or not 😊?.

DATA: source_lines   TYPE TABLE OF string,
      temp_prog_name TYPE progname.

source_lines = VALUE #(
( |REPORT z_open_sql_offset_test.| )
( || )
( |FORM run_select.| )
( | SELECT obj_name| )
( |   FROM tadir| )
( |   ORDER BY obj_name| )
( |   INTO TABLE @DATA(result)| )
( |   OFFSET 20| )
( |   UP TO 10 ROWS.| )
( || )
( | cl_demo_output=>display_data( result ).| )
( |ENDFORM.| )
).

GENERATE SUBROUTINE POOL source_lines
  NAME temp_prog_name
  MESSAGE DATA(message).

IF temp_prog_name IS NOT INITIAL.
  PERFORM ('RUN_SELECT') IN PROGRAM (temp_prog_name) IF FOUND.
ENDIF.
Jules1337dev commented 1 year ago

Unfortunately it didn't work :/ The same error occurs when calling the offset statement dynamically

dynamicOffsetCall

stockbal commented 1 year ago

Ok, too bad. Then I will go ahead and try to build a first solution for Oracle DB.

BR, Ludwig

stockbal commented 1 year ago

I just created a solution that works with Oracle DB. I tested it on our 7.40 with the following parameters: image

You can test it by pulling the branch nw-740

stockbal commented 1 year ago

An update to abapGit should solve the problem. If you experience dumps during the update of abapGit, you may have to first update the standalone version of abapGit (zabapgit_standalone) and then start this report to update the development version of abapGit. After that the pull should work without problems

Jules1337dev commented 1 year ago

I recoginzed it by myself and updated the abapGit. Now the pull works.

I had to activate some inactive objects but then it works! Great! :)

If you want, you can close the issue.

stockbal commented 1 year ago

Ok, great. If the issue with the transformation ZADCOSET_SEARCH_SCOPE_PARAMS persists, please open a new issue.

BR, Ludwig

Jules1337dev commented 1 year ago

Yes, I will do that, but I don't think so. The class was inactive, so I think the new version will run

Jules1337dev commented 1 year ago

I have one last question: It affects the code search only indirectly. I´ve also installed the abap tags plugin and it works fine.

Why can´t i use the Tags within the Code Search? image

I believe i was able to select tags here when pulling the main branch.

stockbal commented 1 year ago

Hm, the branch nw-740 should not affect this - I also tested it on my 7.40 system where ABAP Tags is installed and it still works. The method that tests if ABAP Tags can be used with the Code Search resides in zcl_adcoset_extensions_util=>is_abap_tags_available

Jules1337dev commented 1 year ago

Regarding your previous post, i got the backend and the plugin otherwise the "usual" tag search won´t work

Jules1337dev commented 1 year ago

Hm, okay. I set a breakpoint at the first statement in this method, but the debugger do not stop when pressing STRG + H

Jules1337dev commented 1 year ago

Well okay I restarted eclipse and now it works. I just do not ask any questions :D

stockbal commented 1 year ago

Check this setting please: image

It could also be that you have to debug it via SAP GUI if eclipse blocks it

Jules1337dev commented 1 year ago

You´re right this setting was not set. But now that it works, it fits for me Thank you!