Sunday, December 19, 2010


Love God, Love others. That is the essence of all that we have been commanded to do by God. Anything added to that is religion.  Be yourself Don't try to be what the box thinkers think you should be, Don't put God in a box, He made you just the way you are, He is the only one who knows what needs to be polished in your life to make you more like Christ. We go to church for worship, fellowship and teaching, God uses the teaching to change us, the worship to free us, and the fellowship to remind us that we are not in this alone. He doesn't use the church to condemn us, that was mans idea, an idea used for control. a problem that even plagued the early church. Paul tells us that "there is therefor, no more condemnation for those who are in Christ Jesus." Be free.

Thursday, October 28, 2010

Creating a class to use the functionality of the persistent class CL_BCS

Creating a class to use the functionality of the persistent class CL_BCS:
I was searching for a way to use the newer class based methods for sending e-mail instead of the old function module "CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'".
I searched Google, SDN, SAP etc, and came up with a blog by Thomas Jung that came real close to doing what I was looking for. He actually created a function module to encapsulate the persistent class and then a special user interface to call it with which was real good. You can see his blog here.
After looking over his blog and getting a grasp on how the e-mail class worked, I thought I would put together something similar but keep it in its own class that my fellow developers could leverage in some of their requirements where e-mailing would be required. I developed a global class named ZCL_EMAIL_CLASS which can then send the e-mail with or without an attachment. 

I started by going to SE24 (Class builder) and creating me a new class which I named ZCL_EMAIL_CLASS and then gave it the following attributes:

I started by declaring my first attribute called ca_x - level constant - visibility private type char1 with a value of abap_true. It looked like this:

I then pressed the right arrow: 


which took me to the definitions page where
I did some old fashioned coding which turned out to be pretty cool.

I typed in the remaining constants, data types and tables here and it looked like this:

Press 'save' and the class builder will setup your attributes for you:

Now comes the fun part. Create three methods. One is the main method to call from your program and the other two are to setup the email message and optional attachment.

Set up importing and returning parameters in the main method.

*note added another importing parameter called copy_me importing, pass by value, optional type checkbox so that you won't always get a copy, just when you want one. put a check box parameter in the main program called p_copy to pass to the class.

These are the tables and variables that are to be passed to the class from your programs to be e-mailed.
Now let's put some code into the methods:

*Protect your program from shortdumps by wrapping it in try catch endtry.
      send_request = cl_bcs=>create_persistent( ).

      me->cl_message_prep( EXPORTING subject_email = subject_email
                                     i_email_body  = i_email_body
                           RECEIVING return        = return ).
      "set up the body of the e-mail
      me->cl_attachment_prep( EXPORTING subject_attachment = subject_attachment
                                        i_attachment       = i_attachment
                              RECEIVING return             = return ).
      "create the attachemnt

* load the document and the attachment into the perrsistent class
      CALL METHOD send_request->set_document( document_bcs ).

*set the sender. (using sy-uname)
      sender = cl_sapuser_bcs=>create( sy-uname ).
      CALL METHOD send_request->set_sender
          i_sender = sender.

      LOOP AT to INTO wa_to.
*    create recipients using from and to where "from" is you and "to" is from the selection screen.
        recipient = cl_cam_address_bcs=>create_internet_address( wa_to ).
*     create the list for the e-mail class:
        CALL METHOD send_request->add_recipient
            i_recipient = recipient
            i_express   = ca_x.
*    create recipients using from and to where "from" is you and "to" is from the selection screen.
      if copy_me = 'X'.
*    (This is used if you want a copy of the output.)
      recipient = cl_cam_address_bcs=>create_internet_address( from ).
      CALL METHOD send_request->add_recipient
          i_recipient = recipient
          i_express   = ca_x.

* Set that you don't need a Return Status E-mail
      CALL METHOD send_request->set_status_attributes
          i_requested_status = 'E'
          i_status_mail      = 'E'.

*     sets the send immediate flag bypassing the background job wait time.
      CALL METHOD send_request->set_send_immediately
          i_send_immediately = ca_x.

*     This actually sends the e-mail using all of the wonderfulness you just created above.
      CALL METHOD send_request->send(
          i_with_error_screen = ca_x
          result              = sent_to_all ).

    CATCH cx_bcs INTO bcs_exception.
      DATA: l_message TYPE string.
      l_message = bcs_exception->get_text( ).
      return-message = l_message.


And for the other two as well:

METHOD cl_message_prep.
  att_type = ca_raw.
  DESCRIBE TABLE i_email_body LINES n10.
  n10 = ( n10 - 1 ) * 255 + STRLEN( wa_text ).
  i_length = n10.
      document_bcs = cl_document_bcs=>create_document(
                i_type          = att_type
                i_text          = i_email_body[]
                i_length        = i_length
                i_subject       = subject_email ).
    CATCH cx_bcs INTO bcs_exception.
      DATA: l_message TYPE string.
      l_message = bcs_exception->get_text( ).
      return-message = l_message.

METHOD cl_attachment_prep.
  DATA : lw_error LIKE LINE OF i_attachment.
  att_type = ca_raw."raw format used for sending human readable
  IF i_attachment IS INITIAL.
* length of Att_Text
    DESCRIBE TABLE i_attachment LINES n10.
    READ TABLE i_attachment INTO lw_error INDEX n10.
    n10 = ( n10 - 1 ) * 255 + STRLEN( lw_error ).
    i_length = n10.
        CALL METHOD document_bcs->add_attachment
            i_attachment_type    = att_type
            i_att_content_text   = i_attachment[]
            i_attachment_size    = i_length
            i_attachment_subject = subject_attachment.
*Error Message
      CATCH cx_bcs INTO bcs_exception.
        DATA: l_message TYPE string.
        l_message = bcs_exception->get_text( ).
        return-message = l_message.

Now in the attachment method I put the "if initial" for the table statement so I don't create a blank attachment if I only wanted to send my data in the body of the e-mail.

The hard part is done. Save and activate your class.

It's time to play with a program to use it. I created a sample program called ZTST_EMAIL_CLASS_USAGE_OO to use as an example of how this will all work together.


REPORT  ztst_email_class_usage_oo.
DATA: lv_index TYPE sy-tabix VALUE 0,
      lv_text  TYPE char8,
      lv_num   TYPE char1.
DATA: to                 TYPE bcsy_smtpa,
      wa_to              LIKE LINE OF to,
      from               TYPE adr6-smtp_addr,
      subject_email      TYPE              so_obj_des,
      subject_attachment TYPE      so_obj_des,
      i_attachment       TYPE zsolisti_tab,"Table for the attachement.
      i_email_body       TYPE bcsy_text,"Table for the e-mail body.
      i_attachment_s     TYPE solisti1,"line of attachment table.
      i_email_body_s     LIKE LINE OF i_email_body,"line of e-mail body table.
      send_mail          TYPE REF TO zcl_email_class,
      return             TYPE bapiret2.
      ca_email           TYPE string VALUE '@yourDNS.COM'.

PARAMETER : p_to         TYPE adr6-smtp_addr DEFAULT '',
            p_send       AS CHECKBOX,
            p_body       AS CHECKBOX DEFAULT 'X',
            p_file       AS CHECKBOX,
            p_copy   AS CHECKBOX.

  CONCATENATE sy-uname ca_email INTO from.
  CONDENSE from.
* suppose you want to just send the data in the body of the e-mail.
  IF p_body = 'X' AND p_file = ' '.
    DO 10 TIMES.
      lv_num = lv_index.
      CONCATENATE 'text' '-' 'wa' lv_num INTO lv_text.
      CONDENSE lv_text.
      i_email_body_s  = lv_text.
      APPEND i_email_body_s  TO i_email_body.
      lv_index = lv_index + 1.
  ELSEIF p_file = 'X' AND p_body = ' '.
*Suppose you want to send the contents of the internal table i_attachment in the attchment to the group/ID
    DO 10 TIMES.
      lv_num = lv_index.
      CONCATENATE 'text' '-' 'wa' lv_num INTO lv_text.
      CONDENSE lv_text.
      i_attachment_s-line = lv_text.
      APPEND i_attachment_s TO i_attachment.
      lv_index = lv_index + 1.
    "this becomes the attachment
  ELSEIF p_body = 'X' AND p_file = 'X'.
    DO 10 TIMES.
      lv_num = lv_index.
      CONCATENATE 'text' '-' 'wa' lv_num INTO lv_text.
      CONDENSE lv_text.
      i_attachment_s-line = lv_text.
      APPEND i_attachment_s TO i_attachment.
      i_email_body_s  = lv_text.
      APPEND i_email_body_s  TO i_email_body.
      lv_index = lv_index + 1.
    MESSAGE i208(00) WITH 'No attachemnt or email body will be processed'(001).
  subject_email = 'This is the subject line of the e-mail'.
  IF p_file = 'X'.
    subject_attachment = 'attachment_name'.
  MOVE p_to TO wa_to.
  APPEND wa_to TO to.
  IF p_send = 'X'.
    CREATE OBJECT send_mail.
        i_email_body               = i_email_body[]
        subject_email              = subject_email
        subject_attachment     = subject_attachment
        i_attachment               = i_attachment[]
        from                           = from
        to                               = to
       copy_me                    = p_copy       
        return = return ).
    DATA: l_message TYPE string.
    IF NOT return IS INITIAL.
      return-message = l_message.
      MESSAGE i208(00) WITH l_message.

Execute the program and you will see the options that are available for e-mailing with. If the 'ready to send' check box is not checked the program will not send the e-mail and if the 'send data as an attachment' is not checked no attachment will be sent. If all three are checked you will get both data in the e-mail body and in the attachment.  You are completely flexible in this as the attachment table, the attachment title, the email subject and the message body tables are all separate and you can load them as you wish in your program.

With the send data in e-mail body, you get an email that looks like this:

The table passed to the class (I_EMAIL_BODY) had ten lines in it as text_wa0 - text-wa9.
A good way to pass information to the class is to concatenate variable_1 through variable_~ into your work area (type line of table) respecting space (of needed) separated by c_tab (data element abap_char1). This will put your data in columns as a string to be passed to the table and laid out accordingly.

The e-mail that was returned with the attachment checkbox, and the "data in the email box checked" looks like this:

So you would get a message in the e-mail and an attachment.
(They are the same because I was coding a simple test using the same data.)

And with just the attachment only checked you would get the same as above but without anything in the message body.

If you have any positive suggestion, or even constructive criticism that will be helpful in making this better and maybe even simpler post a comment.

Wednesday, October 27, 2010

Webdynpro abap from enterprise geeks

Our friends over at have created another series of training video's for us newbies in the SAP world to help us learn with. This new group of video's is on Webdynpro ABAP. As usual when I find a great learning series like this I plan to share it with my programming friends so below I will have embedded the videos for the entire series. Thanks to Thomas Jung for sharing his wisdom and expertise with us once again. His insight and knowledge is a valuable resource to the programming communnity as a whole and we are thankful for it. So lets get started. Learning SAP is not something that can be done overnight or even at a class or course. SAP requires that you do it yourself. This way you can see how the compiler works, get a feel for the GUI and see how the program responds to what you are coding it to do. It is these learning processes that give us the best advantage at learning as we learn best when we learn from our own mistakes.
So without further ado, here is video 1 from enterprise geeks...

Video 2...

Video 3...

Video 4...

Video 5...

Video 6...

Video 7...

I know that many of us can thank Thomas and the rest of the ABAP freakshow team for their willingness to share all that knowledge with the rest of us, I know I have learned a great deal from these video's and have added to my programming abilities oo coding that I learned from the last group of video's that I had previously blogged with links to the aap frakshow. I see that they have recently posted a blog listing several links to more video series on several topics. you can find that post by following this link...

May we alway strive to continue learning for as technology evolves, we will miss it if we don't strive to keep up with it and we will become as irrelevant as our ancient coding practices.Remember good enough is never good enough.

Monday, September 27, 2010

FW: Onions

From the internet…

More on Onions.

An onion a day?

chivesSound a bit far-fetched? It's actually not such a bad idea healthwise. Onions are highly recommended for people trying to prevent cardiovascular disease, cancer and infections. Like most vegetables, sweet, yellow onions are fat- and cholesterol-free, and contain very little sodium.

The 4,000-Year-Old Healer
For over 4,000 years onions have been used for medical purposes. Egyptians numbered over 8000 onion-alleviated ailments. The esteemed Greek physician Hippocrates prescribed onions as a diuretic, wound healer and pneumonia fighter. During World War II, Russian soldiers applied onions to battle wounds as an antiseptic. And throughout the ages there have been countless folk remedies that have ascribed their curative powers to onions, such as putting a sliced onion under your pillow to fight off insomnia.

The Modern Day Preventative

Sweet onions are a member of the 500-plus allium family. While garlic, another allium, has been highly touted as a cancer preventative, most people consume far greater quantities of onions. As Americans search for low-fat, low-salt, but tasty meals, they're eating more onions - almost 18 pounds per person, which is 50% more than a decade ago.

"Egyptians numbered over 8,000 onion-alleviated ailments."

Therefore, there is greater hope that the onion will be a key in producing long-term health benefits. In addition to tasting great, onions contain 25 active compounds that appear to inhibit the growth of cancerous cells, help combat heart disease, inhibit strokes, lower blood pressure and cholesterol, and stimulate the immune system. Alliums are also antibacterial and antifungal, so they can help ward off colds and relieve stomach upset and other gastrointestinal disorders.

What Makes Them So Good for You?

Of all the healthy benefits of onions, two elements stand out: sulfur (a compound) and quercetin (a flavonoid). They each have been shown to help neutralize the free radicals in the body, and protect the membranes of the body's cells from damage. Quercetin, an antioxidant, is also found in red wine and tea, but in much lower quantities. Interestingly, white onions contain very little quercetin, so it's better to stick with the yellow and red varieties. Most health professionals recommend eating raw onions for maximum benefit, but cooking makes them more versatile and doesn't significantly reduce their potency. In fact, unlike sulfur compounds, quercetin can withstand the heat of cooking. One researcher, Dr. Leonard Pike, director of the Vegetable Improvement Center at Texas A&M University, is working on producing onions with even higher levels of quercetin.

Onions And Your Heart

As with garlic, onions help prevent thrombosis and reduce hypertension, according to the American H eart Association. The juice of one yellow or white onion a day can raise HDL cholesterol (the good stuff) by 30% over time, according to Dr. Victor Gurewich, director of the Tufts University Vascular Laboratory at St. Elizabeth's Hospital in Boston. Red onions don't provide the same effect.

Sweet Onions - The Tasty Way to Better Health

What tastier way to eat healthier than with sweet onions. Because they are milder and easier to digest, you can consume "sweets" in abundance, thus obtaining all the many health benefits that these delicious alliums offer. Best of all, you won't shed any tears in the process.

Serving Size: 1 medium onion (148g)

Amount Per Serving: 60 from Fat: 0

% of Daily Value Fat: 0g 0% Fat: 0g 0% 0mg 0% 5mg 0% Carbohydrate:14g 5% Fiber: 3g 12% 9g 2g A: 0% C: 20% 4% 2%




Onions are Beneficial for Your Health


Onions are beneficial to health

What would life be like without onions? The onion has been used as an ingredient in various dishes for thousands of years by many cultures around the world. World onion production is steadily increasing so that onion is now the second most important horticultural crop after tomatoes.

There are many different varieties of onion, red, yellow, white, and green, each with their own unique flavor, from very strong to mildly sweet. Onions can be eaten raw, cooked, fried, dried or roasted. They are commonly used to flavor dips, salads, soups, spreads, stir-fry and other dishes.

Onions (Allium cepa) belong to the lily family, the same family as garlic, leeks, chives, scallions and shallots.There are over 600 species of Allium, distributed all over Europe, North America, Northern Africa and Asia. The plants can be used as ornamentals, vegetables, spices, or as medicine. There are over 120 different documented uses of the Alliums.

Onion and other Allium vegetables are characterized by their rich content of thiosulfinates, sulfides, sulfoxides, and other odoriferous sulfur compounds. The cysteine sulfoxides are primarily responsible for the onion flavor and produce the eye-irritating compounds that induce lacrimation. The thiosulfinates exhibit antimicrobial properties. Onion is effective against many bacteria including Bacillus subtilis, Salmonella, and E. coli. Onion is not as potent as garlic since the sulfur compounds in onion are only about one-quarter the level found in garlic.

The Value of Onions

Onions have a variety of medicinal effects. Early American settlers used wild onions to treat colds, coughs, and asthma, and to repel insects. In Chinese medicine, onions have been used to treat angina, coughs, bacterial infections, and breathing problems.

The World Health Organization (WHO) supports the use of onions for the treatment of poor appetite and to prevent atherosclerosis. In addition, onion extracts are recognized by WHO for providing relief in the treatment of coughs and colds, asthma and bronchitis. Onions are known to decrease bronchial spasms. An onion extract was found to decrease allergy-induced bronchial constriction in asthma patients.

Onions are a very rich source of fructo-oligosaccharides. These oligomers stimulate the growth of healthy bifidobacteria and suppress the growth of potentially harmful bacteria in the colon. In addition, they can reduce the risk of tumors developing in the colon.

Cardiovascular Help

Onions contain a number of sulfides similar to those found in garlic which may lower blood lipids and blood pressure. In India, communities that never consumed onions or garlic had blood cholesterol and triglyceride levels substantially higher, and blood clotting times shorter, than the communities that ate liberal amounts of garlic and onions. Onions are a rich source of flavonoids, substances known to provide protection against cardiovascular disease. Onions are also natural anticlotting agents since they possess substances with fibrinolytic activity and can suppress platelet-clumping. The anticlotting effect of onions closely correlates with their sulfur content.

Cancer Prevention

Onion extracts, rich in a variety of sulfides, provide some protection against tumor growth. In central Georgia where Vidalia onions are grown, mortality rates from stomach cancer are about one-half the average level for the United States. Studies in Greece have shown a high consumption of onions, garlic and other allium herbs to be protective against stomach cancer.

Chinese with the highest intake of onions, garlic, and other Allium vegetables have a risk of stomach cancer 40 percent less than those with the lowest intake. Elderly Dutch men and women with the highest onion consumption (at least one-half onion/day) had one-half the level of stomach cancer compared with those consuming no onions at all.

Western Yellow, New York Bold, and Northern Red onions have the richest concentration of flavonoids and phenolics, providing them with the greatest antioxidant and anti-proliferative activity of 10 onions tested. The mild-tasting Western White and Vidalia onions had the lowest antioxidant content and lowest anti-proliferative activity. The consumer trend to increasingly purchase the less pungent, milder onion varieties may not be the best, since the onions with a stronger flavor and higher astringency appear to have superior health-promoting properties.

Use and Safety

Onions have a universal appeal. They are safely consumed by most people. However, consuming large quantities of onions can lead to stomach distress and gastrointestinal irritation that may result in nausea and diarrhea. There are no known interactions with drugs except that they can potentiate the action of anticoagulants.


Onions, and other Allium species, are highly valued herbs possessing culinary and medicinal value. Some of their beneficial properties are seen after long-term usage. Onion may be a useful herb for the prevention of cardiovascular disease, especially since they diminish the risk of blood clots. Onion also protects against stomach and other cancers, as well as protecting against certain infections. Onion can improve lung function, especially in asthmatics. The more pungent varieties of onion appear to possess the greatest concentration of health-promoting phytochemicals.


Tuesday, September 21, 2010

Jessies song from Toy story 2

Many times, in many ways I feel like this. It is important to remember though that Love conquers all, God is Love, and God loves me, and He also loves you. The best way to over come a love deficit though is by loving someone else. I am so blessed to have good friends who not only love me but I can be privileged to love back.

Thursday, September 16, 2010


This is probably the most politically incorrect commercial ever for the "Johnson" outboard motor.

Monday, September 13, 2010

pet pieve #57



Just because something works doesn’t mean that there is not a better way or a more efficient way to do it.

In the depression era if a bank wanted to count pennys, you would sit at a table and dump the pennys out and count them by hand. You would roll them up in a special sleeve and have .50 if you counted them right. You may have .49, you may have .51.

Of course today if you went to a bank and you saw a bunch of people sitting around tables manually sorting coins and putting them into sleeves, you would probably think of banking elsewhere.

Don’t discount a process because it is new, and don’t hang onto a process just because “we have always done it that way”. Just because it has always been done that way doesn’t mean that it is the right way, it is just the only way you know how to do it. There may be more efficient ways to do something or even better ways to do it that are more cost effective, more accurate, and overall better for your business.

I step off the soup box now.


Tuesday, August 10, 2010


“Have you ever had a dream that was so real? What if you couldn’t wake from that dream, How could you tell the difference from the dream world and the real world?...Morpheus The Matrix




Sunday, July 18, 2010

Friday, July 16, 2010

another cool reason to be an iphone developer


Here are a couple of links for my ABAP friends from the latest edition of the Developers newsletter. There now is an iphone app that does an sap netweaver quiz that seems to be pretty cool. Put together by a developer that was learning objective-c on the side. I was happy to see that working in abap and objective-c has it similarities so as soon as I can get my Mac upgraded so that I can put snow leopard on it, I will also be trying my hand at learning objective-c and developing app for the ipad to go with the SAP interface that already exists for the ipad.

My dream is to be able to develop useful apps for the IPAD that sap developers could find useful. Time will tell as upgrading a Mac is almost as expensive as buying a new one.



Monday, July 12, 2010

SAPGUI on MAC os x

I have been reading blogs recently on how SAP does work on Mac os x, but that developers would lose some functionality like the screen painter. Personally speaking, I don’t see a whole lot of difference between the sap screen painter and visual basics screen painter. If that is indeed the correlation, that the sap screen painter uses visual basic functionality to perform its thing, then I would then conclude that the screen painter can be modified to work using a mac friendly version of visual basic called Real basic. From what I have been reading, Real basic is almost exactly like visual basic with some minor coding styles that would have to be addressed to get it to work, but for most top dog programmers at sap who have been translating their stuff into different program languages for years, should find the differences to be just in keywords.

The main reason that it would be great to get the sap gui to work natively on mac is because of the new IPAD. The new IPAD is going to be as big as the iphone and may eventually replace the iphone in a later version as you can Bluetooth into it and use a VOIP like skype to make your phone calls on it through the no contract service provided by AT&T. So to have apps developed that would link your IPAD to your companies MAC server would be cool at the least but also be a boost to productivity out in the field. The IPAD can link to your MAC also so if you have a presentation program like Renewed visions pro-presenter, you can present your presentations to clients and potential clients in a level of professionalism that Microsoft can only dream about. So let the fun begin.




Thursday, June 24, 2010

LIPS / LIKP table join efficency

Had a bit of a poser with a report that was taking 9.43 minutes to run. The problem was at the LIPS and LIKP table join. The only search criteria available was the EBELN and EBELP fields from the EKKO / EKPO table. What was needed was to get the value of VBELN using VGBEL in LIPS so a link to LIKP could be established and a couple of fields could be retrieved from LIKP that way for the report based on an entire ITAB full of EBELN entries gathered from the PO tables. The secondary index of VGBEL is not active for the LIPS table so the SQL optimisers were ineffective. Tried many ways to get the efficiency up on the report but with over a million records to search though there was just no easy way for the program to get the information needed using this configuration.

There is good news though. There is a table that holds the delivery document numbers that are associated to the Purchase order documents numbers that is other than LIPS.
The EKES table hold the cross reference and is a table that has just Purchase Order related documents stored in it. So I joined the EKES table with my LIPS / LIKP join at LIPS-VBELN = EKES-VBELN and in the "for all entries in ITAB where" used Where EKES~EBELN = ITAB-EBELN. This linked my group of PO EBELN's to the VBELN numbers supplying the link I needed to join the LIPS and LIKP tables using their primary keys. The run time of the report is now .45 minutes.
Here is a runtime charting of the two versions of the program as it ran in the ECD test environment: Figure 1 show with just LIPS / LIKP joined using VGBEL as the search and Figure 2 shows the runtime after adding in the EKES table as the cross reference.

Sunday, May 30, 2010

Sunday, May 23, 2010

tested new camera and captured this...

Went to a Beloit Snappers baseball game last night. A lot of fun, Marcus went with me and also enjoyed it. This video I took with my new (bought used) digital camera which also can take video's. I was testing out the video and captured the following...

Friday, April 30, 2010

song "things left unsaid"



I heard this song on the radio.

You can watch the music video here:

The song is about the things that have been left unsaid and how we wish after the fact that we would have told those we love how much we love them while they were still here to tell.



Tuesday, April 27, 2010




To start, now that I am getting the correlation between ABAP and COBOL it is now time to increase value by learning JAVA.

In doing some research, I believe I will start here:

It looks like a good place to start.

Nice thing about learning JAVA, is that it works even outside of SAP.

In this economy, its best to learn as much as you can while you can.


Using JAVA script in the ABAP workbench...



I have been reading up in the ABAPDOCU in SAP that there is a class available to use in ABAP that will simulate a JAVA Script engine.

The class is CL_JAVA_SCRIPT.


According to the documentation there are 4 things you need to do to get the JAVA Script engine to function in the ABAP environment.

The following in exerpted from the ABAPDOCU:

Executing JavaScript Programs

You can use the CL_JAVA_SCRIPT class to execute JavaScript programs that, for example, have been loaded from external resources or programmed in an Editor you have written yourself: The following are the methods you use, in the sequence in which they are called:

  1. CREATE to create a JavaScript context
  2. CREATE to compile a JavaScript source in the current context
  3. EXECUTE to execute a compiled JavaScript
  4. EXECUTE to delete a compiled JavaScript from the context

Methods 2 to 4 are combined in the method EVALUATE.

I just used their class to write a hello world in JAVA SCRIPT also taken from their docu section…

REPORT  zjava_demo_abap_1.
DATA: js_processor TYPE REF TO cl_java_script,
      return_value TYPE string.

js_processor = cl_java_script=>create( ).

js_processor->compile( script_name = 'SCR.JS'
                 script = 'var Field = "Hello World!";' ).
js_processor->execute( script_name = 'SCR.JS' ).
return_value =
   js_processor->evaluate( java_script = 'Field;' ).

WRITE return_value.



So I guess my question is, If we have to have the PI environment to run certain programs because they require JAVA Script to run, WHY not convert them to use the JAVA_SCRIPT class?



Monday, April 26, 2010


Watched AVATAR 3 times since buying the video Friday.

There is a lot of truth packed into that movie.





Interview with James Cameron

For Neytiri my Best friend...

Wednesday, April 14, 2010

Using a status bar in ABAP Programs

Thought this would be cool to share with my ABAPer friends:


When writing a report that you know is going to take a long time to run, and it is an interactive report, use the status bar function to help your user see how far into the processing the report is, and give them a little bit of an idea how long it may be before it is finished and it displays. Start at the start of selection and use the status function module…

          percentage = 05
        text       = 'starting load 5%'.

“SAPGUI_PROGRESS_INDICATOR” is a SAP function module for doing just that. I started my program out with one just inside the start of selection. This didn’t seem to do much because it skips past the start of selection and into the form routines rather quickly. I put another one after the sequel statement loading the bulk of the data into the internal tables.


  IF NOT sy-subrc IS INITIAL.
    ps_flag = 'N'.
        percentage = 10
        text       = '...Main table loaded 10% done'.


The percentage export tells the function module how much in percentage to shade the clock that is on the status bar.

The text is what appears on the status bar next to the clock.




      percentage = 20
      text       = '...Processing data. 20% '.

In the form routines that take a while to run put another one to help keep track of the progress.


When you are about to list the report put your final one in with 100% loaded and a message telling your user that their report is coming.

  IF ws_flag = 'Y' AND NOT gt_dump IS INITIAL.
        percentage = 100
        text       = '.....Here comes your report. 100% '.

MESSAGE i208(00WITH 'No information returned.'(001).