Let's follow up this discussion at the Neptune Community

(this forum will be kept in read-only mode)
Solved

Report to find Javascript location in Neptune Application

Hi , Just a small report I wrote to find specific JavaScript in a Neptune Application. might be useful to someone else. 


Types: Attribute = Script on attribute level

            Anonymous = Script in Anonymous script

            Script = Script Control


 

*&---------------------------------------------------------------------*
*& Report  ZRP_NM_FIND_JAVASCRIPT                                      *
*----------------------------------------------------------------------*
* Date             # 16.06.2014                                        *
* Author           # Rikardt Louw                                      *
* Company          # Soltius New Zealand Limited                       *
*----------------------------------------------------------------------*
* Description                                                         *
*----------------------------------------------------------------------*
*& This program finds Javascript texts in a Neptune Application by     *
*& looking at the following                                            *
*& 1. Scripts table (  /NEPTUNE/_SCRIPT )                              *
*& 2. Events  table (  /NEPTUNE/_EVTSCR )                              *
*& 3. Attributes Table (  /NEPTUNE/OBJ_AT  )                           *
*----------------------------------------------------------------------*


REPORT  ZRP_NM_FIND_JAVASCRIPT.


DATA: lt_obj type  table of /NEPTUNE/OBJ,
      lt_run_script type table of /NEPTUNE/_SCRIPT,
      lt_script type table of /NEPTUNE/SCRIPT,
      lt_evtscript type table of /NEPTUNE/_EVTSCR,
      lt_atScript type table of  /NEPTUNE/OBJ_AT.

DATA: ls_run_script type  /NEPTUNE/_SCRIPT,
      ls_script type  /NEPTUNE/SCRIPT,
      ls_evtscript type  /NEPTUNE/_EVTSCR,
      ls_atScript type  /NEPTUNE/OBJ_AT,
      ls_obj type /NEPTUNE/OBJ.



SELECTION-SCREEN BEGIN OF BLOCK b1
  WITH FRAME
  TITLE text-b01.

* Parameters

Parameters: p_applid type /NEPTUNE/APPLID,
            p_txt type /NEPTUNE/TEXT_255.

SELECTION-SCREEN END OF BLOCK b1.


* Retrieve Objects for specific App Id

select  * from /NEPTUNE/OBJ into table  lt_obj where applid = p_applid .

* Write Header

write / p_applid.
write /.

WRITE:  5 'Name', 30 'Line' , 50 'Event' , 70 'Type' ,90 'Code'.

ULINE.


* Loop through scripting tables and find corresponding script

loop at lt_obj into ls_obj.

  select * from /NEPTUNE/_SCRIPT into table lt_run_script where applid = p_applid and FIELD_ID = ls_obj-field_id .

  select * from  /NEPTUNE/_EVTSCR into table   lt_evtscript where applid = p_applid and FIELD_ID = ls_obj-field_id .

  select * from  /NEPTUNE/OBJ_AT  into table lt_atScript  where  applid = p_applid and FIELD_ID = ls_obj-field_id  and grouping = 'Events'.


* Find  Script

  loop at lt_run_script into ls_run_script.

    if ls_run_script-text cs p_txt.

      condense  ls_run_script-text.

      WRITE: / ls_obj-FIELD_NAME  UNDER 'Name',
               ls_run_script-seqnr  UNDER 'Line',
               ls_run_script-text under 'Code',
               'Script' under 'Type'.

    endif.

  endloop.



* Find event based Script -  Anonymous

  loop at lt_evtscript into ls_evtscript.

    if ls_evtscript-text cs p_txt.

      condense  ls_evtscript-text.

      WRITE: / ls_obj-FIELD_NAME  UNDER 'Name',
              ls_evtscript-seqnr  UNDER 'Line',
              ls_evtscript-event  UNDER 'Event',
              'Anonymous' under 'Type',
              ls_evtscript-text under 'Code'.


    endif.

  endloop.


* Find events in attributes

  loop at lt_atScript into ls_atScript.

    if ls_atScript-value cs p_txt.

      condense   ls_atScript-value.

      WRITE: / ls_obj-FIELD_NAME  UNDER 'Name',
               '0'  UNDER 'Line',
               ls_atScript-attribute UNDER 'Event',
              'Attribute' under 'Type',
               ls_atScript-value under 'Code'.



    endif.

  endloop.


endloop.

 

Regards

Rikardt


Great, could use that as well!

Hi Rikardt


Excellent work and thank you for sharing this.


I will put this into our queue for Support Package 4 and include the search functionality inside our Designer. 


Regards 

Ole Andre

Login or Signup to post a comment