title: MVC implementation - Concept (ABAP SAP)
body: <p>I am having issue's wrapping my head around an MVC approach in ABAP (SAP). Though my problem is not code related but rather concept related.</p>
  
  <h1>Situation:</h1>
  
  <p>The view takes 1 parameter. It creates an object of the controller and hands the parameter to the controller. The controller reroutes that input to the model. The model requests the data from the Data Access Class, retrieves the data, creates an object for that data and returns the object to the controller. The controller passes along the data to the view. It reads the attributes of the object and prints them out to the screen.</p>
  
  <h1>Specific Setup:</h1>
  
  <p>I need to read 'Business Partner' (Firstname &amp; Lastname) from a table in SAP and print it out to the screen. The approach should be MVC, OO and a seperate Data Access Layer (DAL).
  - My controller is instantiated in the view. There it calls 'RETRIEVE_BP ( iv_BPart)'.
  - My controller basicly repeats the call to the model (just passing along data?)
  - My model creates a local object based on the returning data from the DAL. This model gets returned when the controller calls the model.
  - My is a Singleton for accessing and retrieving the Data from the Internal SAP Tables. This returns a type unique to this table.</p>
  
  <p>Method in the model to retrieve from the DAL:</p>
  
  <pre><code>method RETRIEVE_BP.
  
    data ls_bp TYPE BAPIBUS1006_CENTRAL_PERSON.
    ls_bp = mo_dal-&gt;get_buspartner( EXPORTING iv_bpart = iv_bpart ).
    create OBJECT mo_bp EXPORTING firstname = ls_bp-firstname lastname = ls_bp-lastname.
    rv_bpart = mo_bp.
  
  endmethod.
  </code></pre>
  
  <p>Method in the Controller:</p>
  
  <pre><code>method GET_BUSPARTNER.
  
    rv_bpart = mo_mdl_bp-&gt;retrieve_BP( exporting iv_BPART = iv_BPART ).
  
  endmethod.
  </code></pre>
  
  <h1>Questions:</h1>
  
  <ul>
  <li>Since my controller is just passing along information. Should this be a static class? Otherwise where should my controller be instantiated?</li>
  <li>Should I keep a local reference in my controller to my models. Thus being able to access my models directly in the view through the controller object. Removing the need to repeat the call with the incoming parameter from the view.</li>
  <li>Where do I construct my 'Business Partner' object to pass it back to the controller. And from there to the view?</li>
  <li>Where should I call my DAL?</li>
  <li>If I seperate my model from my Business Partner Class. Should the model be a Singleton?</li>
  </ul>
  
  <p>In answering, It is perfectly fine to make abstraction of the ABAP code and just stick with examples in Java or C#. I already have a working solution. I am asking to improve my understanding. </p>
  
  <p>I refrained from producing code examples due to this code being part of the SAP system and it being quite messy to distribute ABAP code without the UI components. </p>
  
  <p>As always if I made any mistakes regarding posting here. Please correct me and direct me to the correct place. If any information is missing I am happy to produce this.</p>