cancel
Showing results for 
Search instead for 
Did you mean: 

Swish insted of flash

TMNielsen
Contributor
0 Kudos
346

Hello

In a privious posting was a discussion about loading data into a flash movie.

I'm using a simpler flash-like Tool called Swishmax.

One way to load data into this tool is via a php script (would it be wrong to call this PHP script a web service ?)

In this example the variable this.time will get a time value in the format HH:MM:

In the Swishmax script i write something like:

this.time = "time";

this.loadVariables("http://www.someurl.dk/time.php",'GET');

The time.php file is something like:

<?php

   echo "&time=";

   print (date ("H:i"));

?>

I'm a BSP beginner and my question is: How would this PHP script look like in BSP ?

Best regards

Thomas Madsen Nielsen

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member181879
Active Contributor
0 Kudos

Hallo Thomas,

An interesting problem the morning brings.

First, let me give you a perspective approach that I always use. You must image the browser and server as two boxes. In between them is a long pipe. Now we put our eye into this pipe and look at what is happening. And we realize immediately that all we see in this pipe is HTTP traffic. The pipe (and therefor the browser) knows nothing about BSP, PHP, JSP, Java, etc. All the pipe knows is that somebody wrote HTTP traffic into it. But I suspect you already know this :).

So first step, let us fix the Swishmax script to load a BSP page directly from your application.

  this.time = "time";

  this.loadVariables("time.php",'GET');

You see in the above I leave the ".php" extension. Theorectically it plays no role. However, what I change, and I am not sure if SwishMax can handle this, is the URL. Now we use a relative URL which should be relative to the place from where the script was loaded. It is your homework to check that Swishmax (nice sound) can actually handle relative URLs. Otherwise back to full URL.

Next step we create a new BSP page in our application, and call it: "time.php". Now comes my biggest problem, I don't know PHP, and am not sure what means the &Time, nor how the date will be formatted with "H:i". The first version of the BSP page will be:

  Time=<%=sy-uzeit%>

You might require a little more to get the formatting correct. I have previously post in this forum a list of string operators and commands available in ABAP. You can read up on this in ABAP online documentation.

The last thing you must check is the mimetype. I don't know what PHP sets by default for a .php page. And what mimetype Swishmax expects. By default, for this extension we set "application/octet-stream". You can goto properties tab and change it to "text/html" if you want.

Output from text: "Time=073225"

brian

TMNielsen
Contributor
0 Kudos

Hello Brian

Thank you for your reply.

I also don't know php, but the formatting is not important and as an old ABAP'er I know about this issue.

I'm not very experienced with fundamental internet theory so your pipe explenation was usefull and I now understand how the GET senario should work with BSP.

the Swishmax script could also use POST instead of GET:

this.time = "time";

this.loadVariables("time.php",'POST');

Would that change the BSP coding ?

You write:    for this extension we set "application/octet-stream"

By "this extension" you mean php or .. ?

Thanks

Thomas Madsen Nielsen

former_member181879
Active Contributor
0 Kudos

> By "this extension" you mean php or .. ?

Yes. The important part when sending a HTTP response to the browser is the Content-Type. Depending on the extention of you page (.htm, .js, .bsp, .css, etc), we try to guess this correctly. But sometimes one have to help a little. See properties tab of page.

Difference between GET and POST at the simple level is just the way that the form fields are transported. There a number of subtle differences. But for all your beginner experiments, always use GET. Don't worry about POST until you get to file upload. On the server side, you will never really worry about how the request came in. GET and POST is processed exactly the same way.

> I'm not very experienced with fundamental internet theory

I would seriously recommend a simple introduction text on HTML and JavaScript. There is nothing that beats a good book. Only, one thing better, and that is years of experience.

brian (gone for the next week)

Former Member
0 Kudos

Hi Brian,

any recommendations regarding some 'good books'?

Thanks

Jim

Former Member
0 Kudos

Jurgen:

You might want to try books24x7.com .....

This is a web-based technical library that has several thousand books on-line. All books have full text, graphics, and also CD contents are available if a CD is packaged with the book. Several SAP books in this library. All of the major publishers like SAMS, etc are on there. Beats the heck oot of carrying text books around to project sites.

Regards,

D.

former_member181879
Active Contributor
0 Kudos

Hallo Jim, (from JM?)

Yes, the book that will I write one day.

Actually to tell you the truth, I can not really recommend any specific book. Let me give you some ideas of what I do (and would recommend!).

(*) My preference, if I want to learn something new, such as HTML, JavaScript, SVG, etc. is to buy two to three books on the topic. Then I sit down in a few days and quickly read through them. This gives the overview required, and later one always goes back and reread some sections. In my opinion reading any two books on a topic will already make the big difference.

(*) Of course one would prefer the "best" books. For this, I usually browser Amazon for all books on a specific topic, look at the scan pages of the book, and read all the reviews. From this I can already judge if the book will fit my reading style. If yes, add to list. Order top three.

(*) Search engines! Use google, yahoo, etc. extensively for knowledge. Specifically for HTML rendering questions. Typical question: "How does Content-Disposition HTTP header works?". A quick search with these keywords will always bring a number of interesting hits. Specifically, if I am stuck with a problem, an hour is always allocated for just freestyle searching. It has paid for itself everytime.

(*) Documentation! Bookmark SAP documentation is, specifically the entry point for BSP. Also keep in mind that if any tag is selected in editor, pressing F1 brings up runtime help if available.

(*) Microsoft Developer Network: Bookmark the HMTL chapters where all HTML is explained. This is the fasted help to any HTML rendering questions. Typical example: what is the syntax of window.open() call. Bookmark URL that I use: "http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_window.asp?"frame=true". Left in the tree are all HTML elements. This is a good website, and recommended.

(*) SAP Developer Network--Weblogs: We are writing at the moment some interesting articles, addressing questions found here, in high detail. There are already 10 articles published, and each one should be worth the time reading it. If not, return to author!

(*) SAP Developer Network--Forum: Read the total forum. Even when joining later, first read it completely. There is nothing so irritating and timewasting as to answer the same question twice. And if no answer if found, consider to ask a question (PLEASE HELP scream is not required). And keep in mind, once you become guru (after all this reading:) to also answer one question someday. It keeps the community alive. Life is about giving and taking.

(*) For German speaking developers there is actually one book on BSP. I will find the title and append later.

regards, brian

former_member181879
Active Contributor
0 Kudos

> (*) For German speaking developers there is actually one book on BSP.

http://www.sap-press.de/download/dateien/413/sappress_web_application_server.pdf

Former Member
0 Kudos

Hi,

just an additional info about documentation mentioned by Brian. Here'e the link to the BSP documentation:

http://help.sap.com/saphelp_webas630/helpdata/en

/e9/bb153aab4a0c0ee10000000a114084/content.htm

Regards,

Heidi

Former Member
0 Kudos

Hi,

for german readers try selfHTML (http://selfhtml.teamone.de). It is an online documentation and free of charge.

Very nice manual for HTML, XHTML, CSS, XML, DTDs, JavaScript, DOM, DHTML, CGI, Perl and PHP. Especially the HTML, CSS, JavaScript and DOM parts are great.

I'm using it on a every-day basis and it saves me a lot of time...

Bye,

Alex