cancel
Showing results for 
Search instead for 
Did you mean: 

SAPScript_forms - print an example

Former Member
0 Kudos

Hi,

excuse me for not simply reading the manual - I have never worked with SAPScript forms and in the last week I have devised a way to draw meta-information on all the tables involved from the layout of any SAPScript_form - but I've never read the manual in detail, there was no time.

We only have all the standard SAPScript_forms on our system, no custom ones.

I have found out how I can do a "test printout" of a form which will give me the basic layout - the windows - but not much text in them.

Is there any way I can, without going to the length of designing a new form, possible to print an example form with some real data? I know SAPScript_forms is a really old product and I'm really not sure. If it is not possible "just so" - I'd need it this afternoon, actually - then I'll just read the manual. I just need to know if it is possible to have an "immediate example" or whether I need to design a new form to have that. I will try myself and search in the manual, but any help to speed up that process would be very welcome.

Thanks a lot!

Best regards,

Sapperdapper

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I don't think there is much you can do. but if you want to see a block layout it can be done.
goto se71  put name of script there. in settings select graphical layout check box. this will just show you the block layout for script.

If you are familiar with smartforms here is a worka round
goto smartforms give a new z smartform name. now goto utilities--> migration--> import script

this will chnage script to a smartform.
activate this smartform and run it. it will ask for some interface values try to give enter or some dummy values (*)

this will solve your problem.

Reward if useful.

Former Member
0 Kudos

Hi Ankitesh,

today is the first day I have to actually do this - tomorrow the last 😉 Unfortunately, I am not familiar with SmartForms, either, but from your post I guess that SmartForms do offer a more comfortable interface. I will try that first - we have the forms already, so that seems easier than devising a new one.

Best regards,

Sapperdapper

P.S.: Sry, asking for points, just like offering them, is against the forum rules, I have learned just shortly.

Answers (2)

Answers (2)

Venkat_Sesha
Advisor
Advisor
0 Kudos

Hi Friedrich,

If you are looking for some basic information for how to develop a SAP script there are lot of materials available in the Internet. As you want to check the Sample SAP Script you can check the below standard Scripts which are simple and can give you some idea. You need to execute the way as the deepti suggested. Coming to Debugging of SAP Scripts. Place a break point in the program RSNAT00 at line number 875 and change the FORM name to your Y or Z form...to attach a Y FORM to a Standard output type for testing purpose. To Debug a FORM you first need to set Debug Activate from the Utilities in SE71. Also I would like to give the below link for my first explanation.

http://saptechnical.com/Tutorials/SAPScripts/AddressPrinting/Page3.htm

http://scn.sap.com/message/3333940

http://scn.sap.com/message/3267177#3267177

In the First Link there is a clear information with screen shots how to develop a SAP Script and in the third link you have sample codes what is used for to do so. Hope this helps

Former Member
0 Kudos

Hi Venkat,

I am just going through your links once again - I had just shortly looked at them yesterday - and, well, the screenshot shown in that tutorial your first link leads to - that is just about what I am looking for, in the case of my chosen example SAPScript_form MEDRUCK, if possible - if not, any other would do as well.

Unfortunately, I have no time for developing my own SAPScript_form including learning how to do so. It is not essential right now, though learning how to use it would help me understand. What I want to do in the long run is not use SAPScript_forms or redo what they do, but provide the data that was used to design such a form for another product. It is just to that end that I need to print an example of a form - so I know what I have to provide, so that I have a finishing_line.

I think there was a link in the message you linked that lead me to an example, I will look for that. It would be great if I could get an example based on the form I picked for testing, MEDRUCK (a purchase_order form), but any other would do (nearly) as well.

Best regards,

Sapperdapper

P.S.: Sry, I think that sounds a bit lazy - but I'm not, I AM trying to get there myself. I'm reading your first link - the issue is just, that looks easy and that PrintProgram code is understandable and I see how it works - but SAPFM06P (assoc. with form MEDRUCK in table TNAPR) looks nothing like that, I don't recognize a thing I saw in that code, the "Tables:" part was completely deactivated and I didn't find that OPEN FORM routine, for instance.

P.P.S.: That program RSNAT00 you mentioned - that is not a program I can display in SE38. What is it then, and how can I view it?

P.P.P.S.: Okay, forget MEDRUCK - it might have been a bad choice. I will look at some others. If there is a form where the PrintProgram looks like it should, acc. to that tutorial, then I'll be happy to use that. If the PrintProgram looks like that, I can explain what it does and I can use the code to get what I need.

Former Member
0 Kudos

Hi,

from all the examples I have looked at up to now, I conclude that generally a PrintProgram consists of four or five parts:

- First the internal tables (and structures) to be used are filled from the DB_tables.

- Then come the "layout-related" events: OPEN_FORM, WRITE_FORM, CLOSE_FORM.

I will try to confirm - by looking at different ones - that this is really so in most of cases - there seem to be exceptions, like that MEDRUCK form I picked first where the PrintProgram looks quite different. That bothers me a bit, exceptions from the rule are something annoying.

I'm still trying to find a form that I can actually print with data, without going to the length of designing one myself. Parallely, however, I am trying to find out what part of a PrintProgram I need and whether I can do with anything other than actually copying that part to a program of my own and executing - which I'd have to do m.o.l. once for every form.

Best regards,

Sapperdapper

Former Member
0 Kudos

Hi all,

I have now m.o.l. given up on finding a form among those we have already that I can print. Instead, I have followed an online tutorial and designed my own form. Quite a simple one, but I can build on that basis later.

This has the very happy effect that I now see that - at least in this example, probably in custom-made ones - everything I need to build something alike (data-wise) is in the layout.

What I need to do now (I'll try and get somewhere first, but lateron I'll be grateful for any help) is write a PrintProgram for that (that tutorial only mentions that vaguely, I have it in the tutorial proposed by Venkat, but I'll have to adapt it of course). Then I need to find out how to actually print that so it contains some actual data.

Best regards,

Sapperdapper

Former Member
0 Kudos

Hi,

here I am again at long last. Now I've completed everything else - for the moment - and the last thing I have to do before Christmas is writing my own PrintProgram for the example document I have created and getting it to run.

As I said I would, I have taken the example of the one in Venkat's link for address printint and begun to adapt it. I have to replace all the names in the TABLES command and the names of the internal table(s) and I have to multiply some parts since my test_document is using four tables, not one.

I am curious what will happen.

Best regards,

Sapperdapper

P.S..: And here is the first stone I stumble at: In the original "address printing" example (first link by Venkat), the function call for >write_form< has three parameters: 'ADDRESS' - which is correct for one of the windows I have - 'MAIN' - I changed that into 'CUSTADDR', my window, in both places - and 'APPEND' - I cannot find that in the function in the example - is that the line with 'SET' that is deactivated? What would I have to select in that case? Can I leave it deactivated as it is? In that case, I'd just delete it from the >CALL FUNCTION ...< line so there is no confusion.

P.P.S.: I realize that keyword "element" refers to that >/E< that is in the corresp. text element in the document. I don't have that in the document - do I need that or can I delete it from the function call as well? The window name is important, of course, but that is in another place.

P.P.P.S.: Ah, I just realized that >PERFORM WRITE_FORM< command does not actually have parameters - it's just comments. So the trick is in the internal table that is LOOPed through - the window_name must correspond to that, that's further down in the actual function call. So I need to do that four times, for four windows I have on that form.

I will try to hard-code that at first - well, I will probably leave it at that. I could put it all in a LOOP then, but what for... that is, after all, not the actual task - it's just for demonstration purposes (comparison) that I need to have that.

Former Member
0 Kudos

Hi,

I am just adapting those WRITE_FORM calls and I wonder, can I use four separate calls of that function?

Well, I cannot actually do it with just one function call as the window has to be passed to the function and I have four windows.

Everything else is actually quite simple - I imagine that, thinking of the future readability of the code, a custom-made PrintProgram should actually not be any more complicated than it has to be. Unfortunately, the reality often turns out to be not so neatly ordered and easy to understand...

Best regards,

Sapperdapper

P.S.: It seems to work - it prints - but still without data. I will try the Data_query part once more and make sure I have a filter that actually gets some data. Then I'll look at the text_elements in the windows on my form once more to make sure the table_names and wa_names are the same in form and PrintProgram.

Former Member
0 Kudos

Hi,

it is solved now - at least the one example form I have generated myself runs and prints neatly, so I have something to present.

Unfortunately I have realized that the PrintProgram is very flexible and depending on what I write there, there do not necessarily have to be the names of DB_tables in the layout. It seems to make sense to name the internal tables KNA_int or the like so others can understand it, so it would probably be advisable to do so to avoid colleagues having to spend hours to understand a form, but it is not necessary. An internal table might also be called Teddybear and its workarea Buggy, so you'd have the command >LOOP AT Teddybear INTO Buggy< 😉

Well, one step at a time - the principle works, that is most important.

Best regards,

Sapperdapper

Former Member
0 Kudos

Hello Friedrich,

You mean to say you would like to see real time data in standard sap scripts, currently you are doing print preview via se71.

Let me know if i understood correctly.

For sapscripts, there will be print program/ output type attached to it that will generate output.you can see this config in tcode NACE or you can get print program name from table TNAPR.

Regards,

Deepti

Former Member
0 Kudos

Hi Depti,

yes, you understood me quite correctly. I have a little more time now - till Friday - so if necessary I will build my own form if I can learn how to do that in three days.

I know the print program, I know that table TNAPR and I have studied the PrintProgram. It is seven or eight levels "deep", so it's immensely complex. I have just never run it, it seems it cannot be run independent, but only out of a SAPScript_form. In my understanding, the PrintProgram takes meta-info on the tables required from the layout, accesses the DB, fetches the data and puts it in the respective places on a form.

Best regards,

Sapperdapper

Former Member
0 Kudos
Yes you are correct. Also sometimes output type is attached with a form to generate output.  For ex : if you hav created some billing related form and  you can see output for tht billing document with the help of output type through billing transaction.   You can refer material provided by SAP or you can go through below link to learn more about scripts.  http://saptechnical.com/Tutorials : go through sap script tutorials.  Regards,  Deepti   
Former Member
0 Kudos

Hi Deepti,

thanks for helping! I think it is not possible to start the PrintProgram that is attached to a form independently, only through the form. For instance, take SAPScript_form MEDRUCK - acc. to table TNAPR, the PrintProgram associated with that is SAPFM06P. That is not a standalone report, however, and it cannot be started just so.

The GUI for SAPScript_forms is not very comfortable. Okay, it is from '93, that is a few years gone - but is it really impossible to run one of the standard forms (available when none has been expressly generated) and get a sample of what it looks like when it's filled with actual data from the DB, not only those few and partly cryptic text_elements you get on the printing test?

@ Ankitesh

On my system, there is no menu-point "Migration", only "Download form", that one asks for an xml structure - which is probably generated when you output any of the SAPScript_forms? The issue is, I don't have one.

Thanks a lot!

Best regards,

Sapperdapper