SAP Jobsuche bei DV-Treff


Suchen
KleinerEisbaer
vor 15 Jahre
Hallo,

nachdem ich nun schon Ewigkeiten mit einer Fehlermeldung rum mache, möchte ich Euch nun den Code mit der Meldung präsentieren.

Die Meldung lautet:

Code:

 

Feld "’NAME" unbekannt. Es existiert aber ein Feld mit dem ähnlichen Namen "NAME".

 


Soweit so gut. Und hier der Code.
Das Main-Programm, bei welchem bei der Aktivierung die Fehlermeldung erscheint:

Code:

  1.  
  2. REPORT  ZZ_BC401_AIRS_MAIN.
  3.  
  4. TYPE-POOLS  icon.
  5.  
  6. INCLUDE ZZ_BC401_AIRS.
  7.  
  8. DATA:  r_plane  TYPE  REF  TO  lcl_airplane,
  9. plane_list  TYPE  TABLE  OF  REF  TO  lcl_airplane.
  10.  
  11. START-OF-SELECTION.
  12.  
  13. lcl_airplane=>display_n_o_airplanes(  ).
  14.  
  15. CREATE  OBJECT  r_plane  EXPORTING  im_name  =  ’LH  Berlin’
  16. im_planetype  =  ’A321’.
  17. APPEND  r_plane  TO  plane_list.
  18.  
  19. r_plane->display_attributes(  ).
  20.  
  21. CREATE  OBJECT  r_plane  EXPORTING  im_name  =  ’AA  New  York’
  22. im_planetype  =  ’747-400’.
  23. APPEND  r_plane  TO  plane_list.
  24.  
  25. r_plane->display_attributes(  ).
  26.  
  27. CREATE  OBJECT  r_plane  EXPORTING  im_name  =  ’US  Hercules’
  28. im_planetype  =  ’747-500’.
  29. APPEND  r_plane  TO  plane_list.
  30.  
  31. r_plane->display_attributes(  ).
  32. lcl_airplane=>display_n_o_airplanes(  ).
  33.  


Das Include-Programm (mit Fehlerstelle):

Code:

  1.  
  2. *------------------------------------------------------------------*
  3. * CLASS  lcl_airplane  DEFINITION *
  4. *------------------------------------------------------------------*
  5. CLASS  lcl_airplane  DEFINITION.
  6.  
  7.   PUBLIC  SECTION.
  8.  
  9.     CONSTANTS:  pos_1  TYPE  i  VALUE  30.
  10.  
  11.     METHODS:  constructor  IMPORTING
  12.     im_name TYPE  string
  13.     im_planetype  TYPE  saplane-planetype,
  14.     display_attributes.
  15.  
  16.     CLASS-METHODS:  display_n_o_airplanes.
  17.     CLASS-METHODS:  class_constructor.
  18.  
  19.  
  20.   PRIVATE  SECTION.
  21.  
  22.     CLASS-METHODS:  get_technical_attributes
  23.     IMPORTING  im_type TYPE  saplane-planetype
  24.     EXPORTING  ex_weight      TYPE  s_plan_wei
  25.     ex_tankcap    TYPE  s_capacity
  26.     EXCEPTIONS  wrong_planetype.
  27.  
  28.     DATA:  name TYPE  string.
  29.     DATA: planetype  TYPE  saplane-planetype.
  30.  
  31.     CLASS-DATA:  list_of_planetypes TYPE TABLE OF saplane.
  32.     CLASS-DATA:  n_o_airplanes  TYPE  i.
  33.  
  34. ENDCLASS. "lcl_airplane  DEFINITION
  35.  
  36.  
  37. *------------------------------------------------------------------*
  38. * CLASS  lcl_airplane  IMPLEMENTATION *
  39. *------------------------------------------------------------------*
  40. CLASS  lcl_airplane  IMPLEMENTATION.
  41.  
  42.   METHOD  class_constructor.
  43.     SELECT * FROM  saplane  INTO  TABLE  list_of_planetypes.
  44.   ENDMETHOD. "class_constructor
  45.  
  46.   METHOD  constructor.
  47.     name =  im_name.
  48.     planetype =  im_planetype.
  49.     n_o_airplanes  =  n_o_airplanes  +  1.
  50.   ENDMETHOD. "constructor
  51.  
  52.   METHOD  display_attributes.
  53.     DATA:  weight  TYPE  saplane-weight,
  54.     cap  TYPE  saplane-tankcap.
  55.  
  56.     get_technical_attributes(
  57.     EXPORTING  im_type  =  planetype
  58.     IMPORTING  ex_weight  =  weight
  59.     ex_tankcap  =  cap
  60.     EXCEPTIONS  wrong_planetype  =  4  ).
  61.     WRITE: / icon_ws_plane  AS  ICON,
  62.  >>>   / ’name of airplane: ’ , name,    " <<< FEHLERSTELLE !
  63.     / ’typ of  airplane:’ , planetype.
  64.  
  65.     IF  sy-subrc  <>  0.
  66.       WRITE:  /  icon_failure  AS  ICON,  ’wrong_planetype’.
  67.     ELSE    .
  68.       WRITE:  /  ’weight  of  airplane’(003),
  69.       AT  pos_1  weight  LEFT-JUSTIFIED,
  70.       /  ’tankcapacity  of  airplane  ’(004),
  71.       AT  pos_1  cap  LEFT-JUSTIFIED.
  72.     ENDIF.
  73.  
  74.   ENDMETHOD. "display_attributes
  75.  
  76.  
  77.   METHOD  display_n_o_airplanes.
  78.     WRITE:  /,  /  ’number  of  airplanes:  ’(ca1),
  79.     AT  pos_1  n_o_airplanes  LEFT-JUSTIFIED,  /.
  80.   ENDMETHOD. "display_n_o_airplanes
  81.   METHOD  get_technical_attributes.
  82.     DATA:  wa  TYPE  saplane.
  83.  
  84.     READ  TABLE  list_of_planetypes  INTO  wa
  85.     WITH  TABLE  KEY  planetype  =  im_type
  86.     TRANSPORTING  weight  tankcap.
  87.  
  88.     IF  sy-subrc  =  0.
  89.       ex_weight  =  wa-weight.
  90.       ex_tankcap  =  wa-tankcap.
  91.     ELSE.
  92.       RAISE  wrong_planetype.
  93.     ENDIF.
  94.  
  95.   ENDMETHOD. "get_technical_attributes
  96.  
  97. ENDCLASS. "lcl_airplane  IMPLEMENTATION
  98.  



DANKE für Deine Hilfe  Idea

LupusF
vor 15 Jahre

versuche es mal so:

WRITE: / icon_ws_plane AS ICON.

WRITE: / 'name of airplane: ' , name.

WRITE: / 'typ of airplane: ', planetype.

KleinerEisbaer
vor 15 Jahre

Danke für den Hinweis.

Es lag letztendlich daran, dass ich den Quellcode von einer Vorlage nach SAP kopiert hatte. Da musste ich noch mal händisch die Anführungszeichen(') setzen, weil sie sonst falsch interpretiert wurden.