Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8944

Re: Return a class instance from a static method?

$
0
0


ABAP USER CLASS

 

 

  1. class ZCMCL_USER definition 
  2.    public 
  3.    final 
  4.    create public
  5. public section. 
  6.    METHODS CONSTRUCTOR importing
  7.         value(USERNAME) type ZCM_DUS_USERNAME 
  8.          value(PASSWORD) type ZCM_DUS_PASSWORD. 
  9.    class-methods LOGIN 
  10.      importing 
  11.        value(USERNAME) type ZCM_DUS_USERNAME 
  12.        value(PASSWORD) type ZCM_DUS_PASSWORD 
  13.      returning 
  14.        value(STATUS) type ref to ZCMCL_USER . 

 

ABAP - STATIC METHOD OF USER CLASS

 

 

    1. method LOGIN. 
    2.    
    3.    CREATE OBJECT status
    4.        EXPORTING
    5.             username = username
    6.             password = password.
    7.     
    8. endmethod. 

    9. method CONSTRCUTOR.
    10.          "Copy the importing parameters to Class variables so that it could be used in other methods
    11. ENDMETHOD.

     

    Thanks,

    Sharath


    Viewing all articles
    Browse latest Browse all 8944

    Trending Articles



    <script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>