Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

execute .sap file from program

Former Member
0 Likes
6,959

Hi All,

I have a requirement in which i need to create a .sap file from the abap program and saving it somewhere and then executing the same file.

Not sure whether i should store it on the local system or on the appli server.

Another ques is how should i execute the .sap file.

Can somebody please help.

Thanks.

Linda

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
5,353

''''Now i am left with one thing i want to open the transaction and directly want to go to the second screen of the transaction and skipping the first one''''

this is also done, to move to the second screen the command must start with * so in the handler class you have to somehow change the shortcut string so that the command starts with * .

for ex.Command=*tcode parameters.....

Thanks

16 REPLIES 16
Read only

Former Member
0 Likes
5,353

When you create shortcut of SAP session on desktop, .sap file is created, it can be opened in Notepad.

Last icon in application toolbar gives create shortcut option.

If SAP GUI is installed, double clicking on .sap file launches it.

So it should be on local system.

Read only

0 Likes
5,353

Hi Manish,

so far search on internet reveals that it should be done with ICF and handler class CL_SWN_HTTP_SHORTCUT but no clear idea so far about how ...

do you have any idea?

Clearing my question in simple words. From abap program / web dynpro i have to open a transaction in sapgui.

Thanks

Read only

0 Likes
5,353

A wiki article suggests using FM SWN_CREATE_SHORTCUT to create data for shortcut file (internal table), which can then be written to local file with extension .sap. Method CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD can be used.

http://wiki.sdn.sap.com/wiki/display/ABAP/SAPGUI+shortcuts

Shortcut file is just a text file which can be opened in notepad. The source code of FM SWN_CREATE_SHORTCUT also creates text lines which should be present in shortcut file.

In order to run this shortcut from SAP, it would be just like opening any document on local machine.

You can called method CL_GUI_FRONTEND_SERVICES=>EXECUTE to open the shortcut file.

Something like this:

CALL METHOD cl_gui_frontend_services=>execute
   EXPORTING
     document               = 'C:\temp\ppf.sap'
     operation              = 'OPEN'
   EXCEPTIONS
     cntl_error             = 1
     error_no_gui           = 2
     bad_parameter          = 3
     file_not_found         = 4
     path_not_found         = 5
     file_extension_unknown = 6
     error_execute_failed   = 7
     synchronous_failed     = 8
     not_supported_by_gui   = 9
     OTHERS                 = 10.
Read only

Former Member
0 Likes
5,353

Thanks Manish..

Can you further help me with ICF service. I dont want to save the .sap file rather calling an icf service with the parameters and the icf service will open the sapgui using these parameters.

P.S

the hanadler of the new service that i will create will be the CL_SWN_HTTP_SHORTCUT.

Thanks in advance for any further help

L.S

Read only

Former Member
0 Likes
5,353

I found a discussion

http://scn.sap.com/thread/74529

that is what i need but there is no explanation on how i can call the service and pass it the required parameters.

can anybody help me with how from witin the ABAP program i can call the icf service and pass the required parameters and further within the service what configurations to be done to so that the service should be able to receive the paramaters passed and open the sapgui using the paramaters received.

Thanks

Linda

Read only

0 Likes
5,353

Here is what I am able to do.

SICF transaction used to create new service zicf_mk in path /default_host/sap/bc/icf/demo/.

Handler list of service has class CL_SWN_HTTP_SHORTCUT, keeping every other setting default.

Test service option results in Internet Explorer window, with no output.

Non-working URL ends with /sap/bc/icf/demo/zicf_mk?sap-client=200

I then modified the URL so that it ends with /sap/bc/icf/demo/zicf_mk?sap-client=200&client=200&transaction=SE93&sysid=DEV

Choosing OK takes me to password popup, and then to transaction SE93.

If you move this discussion to ABAP sub-space or to Internet Transaction Server, people over there would be able to give better replies.

http://scn.sap.com/community/abap/connectivity

http://scn.sap.com/community/its

Read only

0 Likes
5,353

Hi Manish,

Thanks for your detailed reply. i also did exactly the same here is the modified url ...

/sap/bc/icf/demo/zdoc_open?sap-client=010&~TRANSACTION=SE93&sysid=dev

but havnt workd fr me.

Another question is will it be possible to pass the values for various fields from the icf service to the sap transaction screen that will be opened.

P.S

Do you know how can i move the discussion to some other forum ?

Thanks a lot fr your help sofar

Read only

0 Likes
5,353

I think your SYSID is incorrect, and transaction parameter is being passed incorrectly.

SYSID or system id can be checked in debug mode using value of SY-SYSID variable.

My R/3 sysid is DEV, yours may be DR1, RD1 or something similar.

Check this in properties of your development system entry in SAP Logon Pad.

Assuming you want to launch SE93 transaction, and your development system is DR1, correct URL ending could be:

/sap/bc/icf/demo/zdoc_open?sap-client=010&TRANSACTION=SE93&sysid=DR1

Note: I have removed ~ character that was present before transaction parameter name.

My ICF knowledge is extremely limited. I don't know how to pass values from ICF service to transaction. Perhaps a custom handler is needed.

I think discussion can be moved by Space Moderator. Moderators are listed on left side in below link.

http://scn.sap.com/community/abap/people

Message can be sent to them by clicking on 'Communications' > 'Send Direct Message'.

Read only

0 Likes
5,353

Hi Manish,

Thanks for the reply.

The sysid i had already used the correct one , the one i written in previous post was just fr reference.

I removed the tilde sign from the transaction but still it doesnt work.

I try to move the discussion as you mentioned.

Thanks a lot for your help.

Read only

0 Likes
5,353

Hi Manish, Hi Linda,

FYI this is not an ITS service; ITS would not be using a handler: CL_SWN_HTTP_SHORTCUT

Standard ITS handler would be: CL_HTTP_EXT_ITS

ICF area is perhaps a better forum?

Most ICF queries are in the forum

http://scn.sap.com/community/netweaver-as

Regards,

Oisin

ITS/WGU SDN Moderator

Add forum link. Message was edited by: Oisin ONidh

Read only

0 Likes
5,353

Hi Oisin

Thanks for letting us know. We don't know much about using services. Progress done so far is just by searching tutorials on internet.

Read only

0 Likes
5,353

Hi Oisin,

Thanks for the info. I will post my question in that forum then for further help.

Thanks all for your help so far.

Thanks

Read only

former_member585060
Active Contributor
0 Likes
5,353

Hi,

Analyse the SAP program 'RSWNSENDMAIL1' to create .SAP file. Use the class CL_GUI_FRONTEND_SERVICES method Execute the .SAP file.

Thanks & Regards

Bala Krishna

Read only

Former Member
0 Likes
5,353

I finally achieved what i wanted to. Just one problem remaining (explained at the end) Following steps followed.

1) transaction create SICF service anywhere. give the handler name as CL_SWN_HTTP_SHORTCUT

2) activate and test service. it will open a explorer with the following link

http://xyz.com:8000/sap/bc/icf/demo/zdoc_open?sap-client=010

3)this wont do anything. just change the link to the following

https://xyz.com:8000/sap/bc/icf/demo/zdoc_open?client=010&sysid=PLD&langu=EN&transaction=se38&client...

now this will open the se38 transaction when this link will be pasted in the explorer.

Things to note is that the handler written above is expecting the parameter name as client and not sap-client. further the standard handler does not allow any transaction to be opened. so i copied the standard to custom and remove the restriction of the transaction.

Further if you want to send some parameter as well then append the link with &param= value and within the custom handler code then you can use these values and do whatever you want to do.

Now i am left with one thing i want to open the transaction and directly want to go to the second screen of the transaction and skipping the first one.

Please if someone knows that how can i achieve that..

Thanks

Read only

0 Likes
5,353

Perhaps you can call a custom transaction from URL, whose program does CALL TRANSACTION..AND SKIP FIRST SCREEN.

Another option could be to use transaction variant.

Read only

Former Member
0 Likes
5,354

''''Now i am left with one thing i want to open the transaction and directly want to go to the second screen of the transaction and skipping the first one''''

this is also done, to move to the second screen the command must start with * so in the handler class you have to somehow change the shortcut string so that the command starts with * .

for ex.Command=*tcode parameters.....

Thanks