z745oops8

2
report z745oops8. Exporting parameters (return values assigned to class instance attributes) class abc definition. public section. methods getvendor importing i_lifnr type lfa1-lifnr exporting e_land1 type lfa1-land1 e_name1 type lfa1-name1. protected section. data : lv_land1 type lfa1-land1, lv_name1 type lfa1-name1. endclass. class abc implementation. method getvendor. select single land1 name1 from lfa1 into (e_land1,e_name1) where lifnr = i_lifnr. if sy-subrc eq 0. lv_land1 = e_land1. lv_name1 = e_name1. write :/ 'Vendor Country key :' ,lv_land1, / 'Vendor name :' ,lv_name1. endif. endmethod. endclass. start-of-selection. data ob type ref to abc. create object ob. parameters p_lifnr type lfa1-lifnr.

description

obj oriented

Transcript of z745oops8

Page 1: z745oops8

report  z745oops8. Exporting parameters (return values assigned to class instance attributes)

class abc definition.  public section.     methods getvendor importing i_lifnr type lfa1-lifnr                       exporting e_land1 type lfa1-land1                                 e_name1 type lfa1-name1.  protected section.   data : lv_land1 type lfa1-land1,          lv_name1 type lfa1-name1.endclass.

class abc implementation.  method getvendor.    select single land1 name1 from lfa1 into (e_land1,e_name1) where lifnr = i_lifnr.    if sy-subrc eq 0.      lv_land1 = e_land1.      lv_name1 = e_name1.    write :/ 'Vendor Country key :',lv_land1,           / 'Vendor name        :',lv_name1.    endif.  endmethod.endclass.

start-of-selection.data ob type ref to abc.create object ob.

parameters p_lifnr type lfa1-lifnr.

uline.call method ob->getvendor   exporting      i_lifnr = p_lifnr.