Skip to Content
September of last year I created a series of weblogs exploring BSP development, this weblog series went step by step through the various aspects of creating a BSP application. The series was intended to give everyone a very overall and general idea of the possibilities of BSP and to help get a better working understanding of the process behind the development.

For those of you not familiar with the series,

Standard BSP

Or for those of you wanting to take it in one large lump, you can view the article.

Again, the series was not intended to develop a high end production application but rather to give each person completing the tasks at hand a chance get their feet wet in terms of standard BSP development.

image With a half a year behind us now and the forums beginning to fill up with more and more questions regarding MVC, I guess it is time. MVC, may sound strange at first but if you have been around object oriented programming long enough then the concept is not that unusual. For more information about this you can check out the following links:

The second link mentioned there also contains several examples and graphics from SAP about this topic. My attempt here is to try to simply things a bit with a working example similiar to the first tutorial series on standard BSP. With that all said, I thought this would be an apporpriate time to actually publish the second half of my tutorial series. “Exploring BSP development with MVC”, although I’m not 100% sure at the moment but I believe this series will also be broken up into 5 parts, however this could change so please bare with me. I try to keep my weblogs at a reasonable length as to not overload everyone.

As most developers will tell you there is really no need to reinvent the wheel and so to get us started we are simply going to take from the previous series as much as we can. For those of you who have not reviewed the previous series don’t despair I’ll put all the data in here as well.

Getting started

You will need to start by creating a new package, unless the package already exists.

Package Name: ZCSC_FAQ

image

The package is basically the container for all the elements, objects and pieces of our application.

Once the package is there we will then need to create our Dictionary Objects, these are our database tables and structures and types.

ZFAQ_CATCategories for your F.A.Q.
 
ID INT4  
NAME CHAR32 Name of the Category
SRC CHAR10 Image source of the category e.g. @IY@
CAT_DESC CHAR255 Description for the category
 
ZFAQ_DATAYour F.A.Q.’s
 
ID INT4 ID of Item
CAT_ID INT4 Category ID
SUBJECT CHAR255 Subject of the FAQ
TITLE CHAR255 Title of the FAQ
SHORT_DESC CHAR255 Short Description
LONG_DESC TEXT Long Text description
URL CHAR255 URL
RATING INT4 Rating
AUTHOR CHAR50 Author
CDATE CHAR10 Creation Date
 
ZFAQ_SDNRSSFor accessing SDN RSS Feeds
 
TITLE CHAR120  
LINK CHAR255  
DESCRIPTION CHAR255  
CREATOR CHAR50  
PDATE CHAR10  
SUBJECT CHAR255  
 
ZFAQ_SUBJECTFAQ Subjects
 
ID INT4 ID of Item
NAME CHAR32 Name of the subject
SUBJECT_DESC CHAR255 Subject description
 
ZFAQ_SDNRSSLINKSDN RSS Links
 
ID INT4 ID of Item
NAME CHAR32 Name of the RSS link
LINK CHAR255 Link

Really, we’ll use each of them in this exercise. So now that you have those in place, you will now need to create a corresponding Table Type for each item. This is done by right clicking on your Dictionary Objects and choosing “Create” followed by “Table Type”

image

For ease of use and to try for some sort of naming convention I use the name of the table without spaces followed by the word TYPE on the end.

image

So when you are finished you should have 5 tables and 5 corresponding table types.

Now that you have the tables in place it’s time to fill them up with some initial data, just to help us get started. Just create a Program under your Package called ZFAQ_INITIAL_DATA and give it the following code.

> REPORT ZFAQ_INITIAL_DATA                  .

PARAMETERS: SetCat TYPE CHAR1,
     SetSubj TYPE CHAR1,
     SetRSS TYPE CHAR1.

DATA: wa_cat TYPE ZFAQ_CAT.
DATA: wa_subject TYPE ZFAQ_SUBJECT.
DATA: wa_rss TYPE ZFAQ_SDNRSSLINK.

IF SetCat EQ ‘X’.
   wa_cat-ID = 1.
   wa_cat-NAME = ‘SDN:Weblog’.
   wa_cat-SRC = ‘@IY@’.
   wa_cat-CAT_DESC = ‘Weblogs from the SAP Developer Network’.

   insert into ZFAQ_CAT values wa_cat.
ENDIF.

IF SetSubj EQ ‘X’.
   wa_subject-ID = 1.
   wa_subject-NAME = ‘ABAP’.
   wa_subject-SUBJECT_DESC = ‘ABAP Technology’.

   insert into ZFAQ_SUBJECT values wa_subject.

   wa_subject-ID = 2.
   wa_subject-NAME = ‘BSP’.
   wa_subject-SUBJECT_DESC = ‘Business Server Pages’.

   insert into ZFAQ_SUBJECT values wa_subject.
ENDIF.

IF SetRSS EQ ‘X’.
   wa_rss-ID = 1.
   wa_rss-NAME = ‘SDN: Recent’.
   wa_rss-LINK = ‘http://weblogs.sdn.sap.com/pub/q/weblogs_rss?x-ver=1.0‘.

   insert into ZFAQ_SDNRSSLINK values wa_rss.

   wa_rss-ID = 2.
   wa_rss-NAME = ‘SDN: Craig Cmehil’.
   wa_rss-LINK = ‘http://weblogs.sdn.sap.com/pub/q/weblog_rss_author?x-author=2538&x-ver=1.0‘.

   insert into ZFAQ_SDNRSSLINK values wa_rss.

   wa_rss-ID = 3.
   wa_rss-NAME = ‘SDN: Brian McKellar’.
   wa_rss-LINK = ‘http://weblogs.sdn.sap.com/pub/q/weblog_rss_author?x-author=164&x-ver=1.0‘.

   insert into ZFAQ_SDNRSSLINK values wa_rss.

   wa_rss-ID = 4.
   wa_rss-NAME = ‘SDN: Thomas Jung’.
   wa_rss-LINK = ‘http://weblogs.sdn.sap.com/pub/q/weblog_rss_author?x-author=1918&x-ver=1.0‘.

   insert into ZFAQ_SDNRSSLINK values wa_rss.
ENDIF.

For those of you desiring the quick copy and paste method of code:

With that all in place we should be ready to move on to the actual application now and barring typing errors on my part and yours we should move along quite quickly.

Look for the next section coming soon!

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Doug Grant
    This is excellent – thanks for the example. What would be a good learning resource for the MVC concepts, either within SAP or general usage? Thanks, Doug Grant
    (0) 
    1. Craig Cmehil
      Thank you! I’ve still got to finish up the last part of this series but with SDN Meets Labs was a bit busy. I’m hoping to get everything finished up here soon though.
      (0) 

Leave a Reply