GOS Tables

GOS Fonksiyonları ile ekleri tespit etmek en kestirme yol olmasına rağmen bazen performans problemi ortaya çıkabiliyor.  GOS Tablolarına doğrudan erişerek performans arttırmak mümkün....
SRGBTBREL  & SOOD

Obje numarası ile SRGBTBREL tablosuna gidilir. 
SRGBTBREL -INSTID_A  = OBJE NUMARASI
SRGBTBREL -TYPEID_A = `BUS2054`  "benim üzerinde çalıştığım obje
SRGBTBREL -CATID_A =  `BO`           "Instances of BOR Object Types
SOOD-OBJYR = SRGBTBREL-INSTID_B+20(2)
SOOD-OBJNO = SRGBTBREL-INSTID_B+22(12) 

SOOD-FILE_EXT : jpg
SOOD-OBJDES   :     23731 (3) PALANGA SK (Small)






REPORT ZMEHO_TEST_001.
tables: qmel.



types: begin of ty_rng_qmnum,
      SIGN    Type  DDSIGN,
      OPTION  Type  DDOPTION,
      LOW     Type  qmnum,
      HIGH    Type  qmnum,
      END OF ty_rng_qmnum.
types: tty_rng_qmnum type standard table of ty_rng_qmnum.




types: begin of ty_notify ,
      qmnum    Type  qmnum,
      INSTID_A  type SIBFBORIID,"==qmnum
      END OF ty_notify.
types: tty_notify type standard table of ty_notify.




types: begin of ty_notify_files ,
      qmnum    Type  qmnum,
      reltype  type OBLRELTYPE,"
      INSTID_A  type SIBFBORIID,"==qmnum
      TYPEID_A  type SIBFTYPEID,
      CATID_A    type SIBFCATID,
      INSTID_B  type SIBFBORIID,
      OBJTP      type SO_OBJ_TP,
      OBJYR      type SO_OBJ_YR,
      OBJNO      type SO_OBJ_NO,
      OBJNAM    type SO_OBJ_NAM,
      OBJDES    type SO_OBJ_DES,
      FILE_EXT      type SO_FILEEXT,
      END OF ty_notify_files.
types: tty_notify_files type standard table of ty_notify_files.







select-options : s_qmnum for qmel-qmnum.


start-of-selection.

data: gt_notify_files type tty_notify_files.
PERform f_get_data using s_qmnum[] `BUS2038` `BO` changing gt_notify_files.

end-of-selection.




form f_get_data using prm_rng_qmnum TYPE tty_rng_qmnum
                      prm_typeid_a type SIBFTYPEID
                      prm_catid_a type  SIBFCATID
                CHANGING cht_notfiy_files type tty_notify_files.
  data: lv_xndx type int4.
  data: lt_notify type tty_notify.
  data: ls_notify type ty_notify.

  DATA: lt_SRGBTBREL  type sorted table of SRGBTBREL WITH NON-UNIQUE key instid_a.
  DATA: ls_SRGBTBREL  type   SRGBTBREL .


  DATA: lt_Sood type sorted table of  sood WITH NON-UNIQUE key  objyr OBJNO        ."OBJTP fix EXT
  DATA: lS_Sood  type   sood .

  data: ls_notify_file type ty_notify_files.
  refresh cht_notfiy_files.
  check prm_rng_qmnum[] is not initial.

  select qmnum
         qmnum as  instid_a" char12 => char70 !!!!
         into table lt_notify from qmel
         where qmnum in prm_rng_qmnum.

  check lt_notify[] is not initial.

* Conversion
*  loop at lt_notify into ls_notify.
*    lv_xndx = sy-tabix.
*    ls_notify-instid_a = ls_notify-qmnum.
*    modify lt_notify from ls_notify index lv_xndx transporting instid_a.
*  endloop.

  select * into table lt_SRGBTBREL
        from SRGBTBREL
        for all entries in   lt_notify
        where reltype = `ATTA`
           and instid_a = lt_notify-instid_a
           and typeid_a = prm_typeid_a
           and catid_a = prm_catid_a   .


  CHECK lt_SRGBTBREL[] is not initial.

  select * into table lt_Sood
           from sood
           for all entries in lt_SRGBTBREL
           where   objtp =  `EXT`
             AND   objyr =  lt_SRGBTBREL-instid_b+20(2)
             AND   OBJNO =  lt_SRGBTBREL-instid_b+22(12).


    loop at lt_notify into ls_notify.
      loop at lt_SRGBTBREL into ls_SRGBTBREL where instid_a = ls_notify-instid_a.

        loop at lt_Sood into ls_Sood where objyr = ls_SRGBTBREL-instid_b+20(2)
                                        and OBJNO =  ls_SRGBTBREL-instid_b+22(12).
            clear ls_notify_file.
            ls_notify_file-qmnum = ls_notify-qmnum.
            ls_notify_file-reltype = ls_SRGBTBREL-reltype.
            ls_notify_file-instid_a = ls_SRGBTBREL-instid_a.
            ls_notify_file-typeid_a = ls_SRGBTBREL-typeid_a.
            ls_notify_file-catid_a = ls_SRGBTBREL-catid_a.
            ls_notify_file-INSTID_B = ls_SRGBTBREL-INSTID_B.
            ls_notify_file-objtp = ls_Sood-objtp.
            ls_notify_file-objyr = ls_Sood-objyr.
            ls_notify_file-OBJNO = ls_Sood-OBJNO.
            ls_notify_file-OBJNAM = ls_Sood-OBJNAM.
            ls_notify_file-OBJDES = ls_Sood-OBJDES.
            ls_notify_file-FILE_EXT = ls_Sood-FILE_EXT.

            append ls_notify_file to cht_notfiy_files.

        endloop.  "lt_SRGBTBREL
      endloop.  "lt_SRGBTBREL
    endloop. "lt_notify


endform.