Publish a Transaction script as a web service
If your environment includes Foundation for Enterprise, you can publish a Transaction or Direct script as a web service that you or other script developers can use to create forms in Winshuttle Composer. Users can then fill out these forms and run them to upload data to SAP.
- Only XML forms can be used as the data source type.
- A web service is bound to one SAP server.
- Web services work best for processes that have minimal line items, such as sales orders.
- Only the No Data Review Process setting is available, because no data is attached. The script, however, must be submitted for approval.
- In scripts for web services, make sure that blank fields are converted to the specified skip field indicator ( \ ), or provide explicit skip field instructions in the form. Blank fields will be uploaded to SAP and will overwrite any existing data. For more information, see Run settings for Transaction.
Tip: We recommend turning off Start SAP GUI by unchecking the box.
Features that are not supported in Transaction scripts for web services
- Linked files
- Settings for Backup SAP data
- The Run Only Unprocessed command
Create a script for web publishing
- In Studio Transaction, create a recording.
- Specify XML Forms as the data source.
- Record the script.
- To map the recording, click Upload to SAP for each upload field, or click Auto Map to map all the fields.
- Map any output fields as Download from SAP. No preview is displayed.
- Click the Foundation tab, and then click Submit to Foundation.
- Complete the Script Information page of the wizard, and click Next.
Because no data template can be attached, the wizard skips to the Supporting Documents page.
- Add the Supporting Documents information, if any.
- Click Next, and click Submit.
Studio processes the submission and goes to the File tab. If you do not see your task, click Refresh Tasks.
Because no data is attached, the review process is set to No Data Review Process. You must, however, select a reviewer for the Transaction script.
- Choose a reviewer.
- Select Allow publishing as Web Service. If this option is not selected when the web service is called, the process will not continue, and you must resubmit the script with the option selected.
- Click Complete Task.
Publishing a script as a web service
- After the script is approved, click the Run tab, and then click Publish as Web service.
- Type a unique name for the web service and a description of the service.
If you want to replace a web service of the same name, check the Overwrite existing web service box.
- To specify that data can be split into different jobs that start at the same time, check the Generate asynchronous operations box.
- Click Next.
- Select the SAP system on which the web service will be published.
- Select how the data will be posted. You can delegate posting to the web service user, or you can select a system post.
- Posting can be delegated to the runner who submits the data in the form.
- Posting can be conducted through one of the system post accounts that are available for the selected SAP system. If you are not a system post designer or no system accounts exist for the selected SAP system, the system post option is not available.
- Click Publish.
The web service, or WSDL, URL is generated. Use this URL to create your form in Composer.
Testing
Before you submit a file for approval or while reviewing a file, or after the file is approved but before it is published, you can test the Transaction script. Use the built-in form and, based on the status of the file, run the form on either a non-production system or a production system. Note that your test data is uploaded to SAP.
Test a script using the built-in form
- In the Run pane, click Test or Run.
- Enter data in the fields.
- To enter multiple line items, right-click the box, and then click Add Rows.
- For nested loops, click the button next to each row in the outer loop and fill in the subitems where needed.
- Click Run.
If conditions in web services
Scripts that contain If conditions can be used in web services. Custom field names are required and fields can be compared. For more information, see Add If conditions.
F4 lookup
If the Winshuttle Function Module is installed on your SAP system, you can add F4 lookup capability to your web services. Search options include an exact match, a pattern match using the star symbol (*), all values using either the star symbol (*) or a blank field.
Validate form data
If the Transaction script has Validate enabled, validate will be available in the data fields section in Composer. You can drag it to the form to make it appear in the form as a check box. When you use the Submit button on the form with the Validate option checked, data is not posted into SAP, but the form data is validated. To submit the data to SAP, clear the Validate check box.
We do not recommend that you use Read list BAPI or function modules for publishing a web service.
Applying SAP user settings
During the web service call, date and decimals formats are converted to the format defined in SAP. Conversion applies to all t-codes in all locales. However, fields marked Convert to string in the Transaction Mapper are not changed.
Publishing text boxes by converting field types to strings
When creating forms, you might want to add text boxes in place of the SAP data types. You specify the conversion to strings for each field in the Properties pane. Convert to string applies only to rows that are mapped for upload, and it is available in all data sources.
Displaying SAP data types
When working with legacy scripts or for other reasons, such as after converting data types to strings, you might want to display SAP data types. You do this through the Synchronize function in the Mapper. You can synchronize selected fields or Synchronize All fields.
Running a form in Composer
When you publish the form, you can choose whether the form uses SAP credentials that are saved to the Foundation site or whether the script runner needs to enter their credentials (Run with SAP credentials).
To run a form, the following must be true:
- A Foundation license is assigned to the runner.
- The runner belongs to the Runner group.
- The runner's SAP credentials for the SAP system where the script is being run are saved to Foundation (if you did not specify Run with SAP credentials).
Posting data
You can post forms data in two ways:
- Provide SAP credentials using form fields. For this, choose Operation RunWithSAPCreds when the form is consumed.
- Use your current SAP credentials or system account credentials that are stored on CENTRAL, depending on whether Delegate or System account was selected. For this, choose Operation: Run at the time of consuming the form.