Code Optimierung

Getting started ... Alles für einen gelungenen Start.

Code Optimierung

Postby Bjarne3246 » Thu Mar 23, 2017 2:22 pm

Hallo,

ich weiß nicht ob es hier hergehört, aber mich würde interessieren, ob es möglich ist, dieses Coding zu optimieren:

Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
  1. DATA: CS_goitem type goitem,
  2.       lv_matnr type matnr,
  3.       ls_mara type mara,
  4.       lv_condition type i,
  5.       lv_text1 type string,
  6.       lv_text2 type string,
  7.       lv_text3 type string,
  8.       lv_text4 type string,
  9.       lv_bwart type mseg-bwart.
  10. DATA: lv_id TYPE icon-id.
  11.  
  12.  
  13.       lv_text1 = 'Prüfprotokoll erforderlich / inspection certificate necessary'.
  14.       lv_text2 = 'Proz./med. rel. Teil - Reinigung erford. / contam.crit.part - cleaning necessary'.
  15.  
  16.  
  17. import cs_goitem = cs_goitem from memory id 'MIGO_POPUP'.
  18.  
  19. * Bewegungsart prüfen
  20.  
  21. case cs_goitem-bwart.
  22.  
  23. when '101' or '222' or '262' or '202'.
  24.  
  25. * Materialnummer holen
  26.  
  27. select single * from mara into ls_mara where matnr eq cs_goitem-matnr.
  28.  
  29. if ls_mara-zzext eq abap_true and ls_mara-zzplbl eq abap_true.
  30.  
  31. lv_text3 = lv_text1.
  32. lv_text4 = lv_text2.
  33.  
  34. SELECT SINGLE id
  35.   FROM icon
  36.   INTO lv_id
  37.   WHERE name = 'ICON_MESSAGE_WARNING'.
  38.  
  39. CALL FUNCTION 'POPUP_TO_INFORM'
  40.   EXPORTING
  41.     titel         = 'Information'
  42.     txt1          = lv_id
  43.     txt2          = lv_text3
  44.     txt3          = lv_text4
  45. *   TXT4          = ' '
  46.           .
  47.  
  48.  
  49. if ls_mara-zzext eq abap_false and ls_mara-zzplbl eq abap_true.
  50.  
  51. lv_text3 = lv_text2.
  52. lv_text4 = ''.
  53.  
  54. SELECT SINGLE id
  55.   FROM icon
  56.   INTO lv_id
  57.   WHERE name = 'ICON_MESSAGE_WARNING'.
  58.  
  59. CALL FUNCTION 'POPUP_TO_INFORM'
  60.   EXPORTING
  61.     titel         = 'Information'
  62.     txt1          = lv_id
  63.     txt2          = lv_text3
  64.     txt3          = lv_text4
  65. *   TXT4          = ' '
  66.           .
  67.  
  68.  
  69. if ls_mara-zzext eq abap_true and ls_mara-zzplbl eq abap_false.
  70.  
  71. lv_text3 = lv_text1.
  72. lv_text4 = ''.
  73.  
  74. SELECT SINGLE id
  75.   FROM icon
  76.   INTO lv_id
  77.   WHERE name = 'ICON_MESSAGE_WARNING'.
  78.  
  79. CALL FUNCTION 'POPUP_TO_INFORM'
  80.   EXPORTING
  81.     titel         = 'Information'
  82.     txt1          = lv_id
  83.     txt2          = lv_text3
  84.     txt3          = lv_text4
  85. *   TXT4          = ' '
  86.           .
  87.  
  88.  
  89. when others.
  90.  
GeSHi ©
Bjarne3246
..
..
 
Posts: 17
Joined: Wed Aug 07, 2013 2:10 pm

Re: Code Optimierung

Postby Ida3633 » Thu May 18, 2017 9:50 am

Hey Mischi83,

ich hätte da eine Frage an dich.
Aus welchem Grund selektierst du dir die Icons aus der Datenbanktabelle ?

Ist das beabsichtigt ?
Ida3633
.
.
 
Posts: 2
Joined: Thu May 18, 2017 9:42 am


Return to ABAP® für Anfänger

Who is online

Users browsing this forum: No registered users and 1 guest

cron