S A P B u si n e s s O n e H o w -T o Gu Gu i d e
PUBLIC
How t o D De e s i g n an a n El E l e c t r o n i c Fi Fi l e F o r m a t i n El E l e c t r o n i c F i l e M a n a ge ge r : Fo r m a t De f i n i t i o n
A p p l i c a b l e R el el e a s e s : SAP Busi ness One 8.8, SAP Busi ness One 8.81 and SAP Busi ness One 20 07 A SP01 SP01
A l l C o u nt nt r i e s English December 2010
Table of Contents Purpose .................................................. .................................................................................................................. ......................................................................................... ......................... 3 Creating a Format to Export Business Partners from SAP Business One .............................. 4 Mapping between the source format tree and the target format tree ..................................... 10 Creating Runtime Validation Rules for Target Nodes .............................................................. .............................................................. 15 Other Reference Reference Material ............................................................. ............................................................................................................. ................................................ 26 Copyrights, Copyrights, Trademarks, Trademarks, and Disclaimers ................................................................................ ................................................................................ 27
© SAP AG 2010
2
How to Design an Electronic File Format in Electronic File Manager: Format Definition
Purpose This how-to guide provides an example of using the Electronic File Manager: Format Definition add-on to design a GEP (Generic Electronic File Format Project) format to export business partners from SAP Business One. You can use the source file (BPList.rpt) and the target file (BPList.xsd or BPList.xml ) that are attached to the how-to guide to complete the example. SAP also provides you with the completed format (BPList.gep ). The how-to guide describes in detail each of the following steps used to create the format: 1.
Create a format project.
2.
Add a source file. You can use the attached source file (BPList.rpt ).
3.
Add a target file. You can use the attached target file (BPList.xsd or BPList.xml ).
4.
Set up property.
5.
Map the format between source tree and target tree.
6.
Add the validation rules.
7.
Verify the format.
8.
Conduct a test run of the format.
For other formats, such as BPP (Bank Payment File Format Project) and SSP (Special-Purpose File Format Project), you can use the example as a reference. For more information about the Electronic File Manager: Format Definition add-on, see the online help for Electronic File Manager: Format Definition.
© SAP AG 2010
3
How to Design an Electronic File Format in Electronic File Manager: Format Definition
Cr e a t i n g a Fo r m a t t o Ex p o r t B u s i n e s s Pa r t n e r s f r o m SA P B u s i n e s s O n e Prerequisites You have started SAP Business One.
Procedure 1. From the SAP Business One Main Menu , choose Tools → Electronic File Manager: Format Definition . 2. To create a GEP format, do one of the following:
On the Start Page tab, under Create a new format project , click Generic Electronic File Format Project .
Choose
(New) or choose File → New and do the following:
i.
In the Create a New Format window, select Format Project).
ii.
To specify the path, choose the
iii.
Specify the format name and choose the OK button.
(Generic Electronic File
ellipsis button and choose the path.
A default mapping is created. 3. To add the source file for the GEP format, do the following: a. Right-click the Source folder and choose Source → Add → RPT .
b. In the Open window, select the BPList.rpt file, and choose the Open button. The source file is added in the Source folder and its format structure appears in a tree structure on the mapping tab.
© SAP AG 2010
4
How to Design an Electronic File Format in Electronic File Manager: Format Definition
4. In the Format Explorer area, select the root node of the format. 5. In the Properties area, under the Deployment property, do the following: a. In the Module field, select Business Partner . After the format is imported, it appears under the business partner module. b. In the Menu Name field, specify BP List . “BP List” appears as a menu name in the menu of SAP Business One. The Menu Path field displays the full menu path of the format in SAP Business One:
\Business Partner\Business Partner Reports\Electronic Report\BP List . c. Specify the other fields.
© SAP AG 2010
5
How to Design an Electronic File Format in Electronic File Manager: Format Definition
6. To add a target file for the GEP format, right-click the Target folder, choose Add, and select XML.
7. In the Add XML Target window, do one of the following:
Select Import an XML schema and choose the OK button. In the Open… window, select the BPList.xsd and choose the Open button.
The imported XML schema file is added to the Target folder and its format structure appears in a tree structure as read only on the mapping tab. In the opened window, select BPList as the root node for the XML structure and choose the OK button.
Select Import the structure from an XML document and choose the OK button, In the Open… window, select the BPList.xml and choose the Open button.
© SAP AG 2010
6
How to Design an Electronic File Format in Electronic File Manager: Format Definition
The imported XML file is added to the Target folder and its format structure appears in a tree structure on the mapping tab. 8. To view the target format tree in different views, do one of the following:
Full view or compact view: Right-click the format tree head and choose the view to which you want to switch.
Customized compact view: do the following: i.
Display the XML format tree in full view.
ii.
To hide a non technical node, click the non technical node until the node is greyed out, for example, . To display the non technical node, click the until the node is enabled, for example,
(Eye) icon attached to the node .
Note
All , Choice, and Sequence are technical nodes. iii.
Display the XML format tree in compact view.
9. Map between the source format tree and the target format tree by mapping the following target nodes to the relevant source nodes and configure the relevant mapping settings:
Source Node
Target Node
Group Header #1
Country
GroupNameCountry1
Name
Details
BP
CardType1
IsSupplier
CardName1
Name
Balance1
Balance
© SAP AG 2010
7
How to Design an Electronic File Format in Electronic File Manager: Format Definition
For more information, see Mapping Between the Source Format Tree and the Target Format Tree. 10. Create runtime validation rules for all the target nodes except for the target node BPList . For more information, see Creating Runtime Validation Rules for Target Nodes. 11. To verify the format for the mapping settings or the validation rules of the target tree, do one of the following: (Verify ).
Click
Choose Project → Verify.
Press F6.
The verification checks the mapping settings of only the nodes required by the imported XML schema and the validation settings of all the nodes. After the verification is finished, a message listing errors, warnings, or information appears on the Message tab.
To display different types of messages, choose the Error(s) , Warning(s) , or Information button. By default, all types of messages are displayed on the Message tab. To export messages, right-click any space on the Message tab and choose Export All . In the Save As window, specify the file name, and choose the Save button. 12. To start a test run, do one of the following:
(Test Run).
Click
Choose Project → Test Run.
© SAP AG 2010
8
How to Design an Electronic File Format in Electronic File Manager: Format Definition
Press F5.
You test run the format with the embedded value in the source .rpt file. If the test run succeeds, the Output tab automatically displays the simulated XML content. To save the test run results, right-click any space on the Output tab and choose Export All . In the Save As window, specify the file name, and choose the Save button.
If the test run fails, the messages are displayed on the Message tab. For runtime data validation failure, the messages you specify on the Validation tab appear. You can test run the format with external data. For more information, see the Test Running Formats in the online help of the Electronic File Manager: Format Definition add-on. 13. To save the formats, do one of the following:
Choose File → Save.
Click
Choose File → Save As… and specify the new format name.
(Save) .
Result You can import the format into SAP Business One.
© SAP AG 2010
9
How to Design an Electronic File Format in Electronic File Manager: Format Definition
M a pp i ng B e t w e e n t h e So u r c e Fo r m a t T r e e a n d t h e T a r g e t Fo r m a t T r e e You can map between the source format tree and the target format tree by creating connections and mapping rules for each node required in your format solution.
Procedure ...
1. To map a source node to a target node, do the following: a. Click the node in the source format tree. b. Drag and drop on the node to which you want to map in the target format tree. A connection line is created. c. To enable mapping setting, right-click the target node and choose Mapping Setting. The Mapping Setting tab is enabled. 2. For the target node: Country , select No Value for Value . No value is outputted; however, for each Group Header#1 node in the source file, a Country node is created in the XML file. Note
The No Value option is automatically selected for the target nodes that are element containers. The element container node cannot be filled with any value.
© SAP AG 2010
10
How to Design an Electronic File Format in Electronic File Manager: Format Definition
3. For the target node: Name (under the Country node), select Copy Value From Source Node for Value .
The output value for Name is its source node value.
4. For the target node: BP , select No Value for Value . No value is outputted; however, for each Details node in the source file, a BP node is created in the XML file. 5. For the target node: IsSupplier , specify the following mapping condition details: Mapping rules determine the value output at runtime execution. Condition: If the condition is met at runtime, the relevant output value is used. Else condition: If none of the conditions are met at runtime, the relevant output value is used. a. Select the source node: CardType1 . b. In the Properties area, in the Reference No . field, specify CardType .
© SAP AG 2010
11
How to Design an Electronic File Format in Electronic File Manager: Format Definition
c. To add a condition, choose
.
d. Specify the following details of the expression for the condition: i.
For Type1, select Function .
ii.
For Arg1, specify substring(%CardType,1,1).
iii.
For Op , select Equals to.
iv.
For Type2 , select Constant.
v.
For Arg2 , specify S.
The condition is met when the first character of CardType1 is “S”. Note
You use %CardType as the reference no. for the source node CardType1 . Reference no. is the reference code or alias of the node. You can use the reference code or alias to refer to the node in the function or the condition of another node. substring(string, number, number?) Description: Returns the substring of the first argument starting at the position specified in the second argument and having the length specified in the third argument. The index begins at 1. Sample: substring(“12345”,2,3) returns “234”.
© SAP AG 2010
12
How to Design an Electronic File Format in Electronic File Manager: Format Definition
Select the Constant Value radio button and specify True. If the condition is met at runtime, no value will be outputted. e. Select the Else Condition checkbox. f. Select the Constant Value radio button and specify False . If the condition is not met at runtime, the output value is the constant value: False.
6. For the target node: Name (under the Sequence node), select Copy Value From Source Node for Value .
© SAP AG 2010
13
How to Design an Electronic File Format in Electronic File Manager: Format Definition
The output value for Name is its source node value. 7. For the target node: Balance , select Copy Value From Source Node for Value . The output value for Balance is its source node value.
© SAP AG 2010
14
How to Design an Electronic File Format in Electronic File Manager: Format Definition
Cr e a t i n g Ru n t i m e V a l i d a t i o n Ru l e s f o r Target Nodes At runtime, the validation rules check the relevant values retrieved from SAP Business One. You can provide a warning or error message for any error that may occur during runtime validation: •
•
Error message: If any error occurs, the message appears and the validation process fails. Warning message: If any error occurs, the message appears but the validation process continues.
Procedure ...
1. To add a validation rule for a target node, do the following: a. Click a node in the target tree. b. Select the Validation tab. c. Choose
and select one of the following validation parameters:
Length
Number of Occurrence
Valid Value
Data Range
Customize
d. Specify the details for the validation rule. Note
If you import the XML schema file BPList.xsd as the target file in step 6, the validation rules are already included in the file. 2. To add validation rules for the target node: Sequence , select Number of Occurrence and specify 1 in the From field and 1 in the To field.
© SAP AG 2010
15
How to Design an Electronic File Format in Electronic File Manager: Format Definition
The error message is automatically changed to “format(‘{0} - Number of occurrence is outside range “1” to “1”,’Sequence’)”.
3. To add a validation rule for the target node: Country , select Number of Occurrence and specify 1 in the From field.
© SAP AG 2010
16
How to Design an Electronic File Format in Electronic File Manager: Format Definition
The error message is automatically changed to “format(‘{0} - Number of occurrence is outside range “1” to “infinity”, ’Country’)”. The country name is allowed to appear more than once at runtime. If the validation rule is broken, the error message appears.
4. To add validation rules for the target node: Name , do the following:
© SAP AG 2010
17
How to Design an Electronic File Format in Electronic File Manager: Format Definition
Number of Occurrence : 1 in the From field and 1 in the To field The error message is automatically changed to “format(‘{0} - Number of occurrence is outside range “1” to “1”,’Name’)”. The country name is allowed to appear only once at runtime. If the validation rule is broken, the error message appears.
Valid Values : Add DE , GB , and US to the valid value list. The error message is automatically changed to “format( “Name” - “{0}” is not a valid value in list “DE, GB, US”’,.)”. Only the value covered in the valid value list is allowed at runtime. If the validation rule is broken, the error message appears.
© SAP AG 2010
18
How to Design an Electronic File Format in Electronic File Manager: Format Definition
5. To add a validation rule for the target node: Sequence , select Number of Occurrence and specify 1 in the From field and 1 in the To field.
The error message is automatically changed to “format(‘{0} - Number of occurrence is outside range “1” to “1”,’Sequence’)”.
© SAP AG 2010
19
How to Design an Electronic File Format in Electronic File Manager: Format Definition
6. To add a validation rule for the target node: BP , select Number of Occurrence and specify 1 in the From field.
The error message is automatically changed to “format(‘{0} - Number of occurrence is outside range “1” to “infinity”, ’BP’)”. The BP element container is allowed to appear more than once at runtime. If the validation rule is broken, the error message appears.
7. To add validation rules for the target node: IsSupplier , do the following:
© SAP AG 2010
20
How to Design an Electronic File Format in Electronic File Manager: Format Definition
Number of Occurrence : 1 in the From field and 1 in the To field The error message is automatically changed to “format(‘{0} - Number of occurrence is outside range “1” to “1”,’IsSupplier’)”. The IsSupplier attribute is allowed to appear only once at runtime. If the validation rule is broken, the error message appears.
Valid Values : Add False and True to the valid values list. The error message is automatically changed to “format( ‘“IsSupplier” - “{0}” is not a valid value in list “False, True”’,.)”. Only the value covered in the valid values list is allowed. If the validation rule is broken, the error message appears.
© SAP AG 2010
21
How to Design an Electronic File Format in Electronic File Manager: Format Definition
8.
To add a validation rule for the target node: Sequence , select Number of Occurrence and specify 1 in the From field and 1 in the To field.
The error message is automatically changed to “format(‘{0} - Number of occurrence is outside range “1” to “1”,’Sequence’)”.
© SAP AG 2010
22
How to Design an Electronic File Format in Electronic File Manager: Format Definition
9. To add validation rules for the target node: Name , select Number of Occurrence and specify 1 in the From field and 1 in the To field. The error message is automatically changed to “format(‘{0} - Number of occurrence is outside range “1” to “1”,’Name’)”.
The name is allowed to appear only once at runtime. If the validation rule is broken, the error message appears.
© SAP AG 2010
23
How to Design an Electronic File Format in Electronic File Manager: Format Definition
10. To add validation rules for the target node: Balance , do the following:
Number of Occurrence : 1 in the From field and 1 in the To field The error message is automatically changed to “format(‘{0} - Number of occurrence is outside range “1” to “1”,’Balance’)”. The Balance attribute is allowed to appear only once at runtime. If the validation rule is broken, the error message appears.
Data Range: Specify 0 in the From field and select the Inclusive checkbox. Leave the To field empty and select the Inclusive checkbox. The error message is automatically changed to “format(‘Balance – Value “{0}” is outside range “0” to “infinity”,.). The allowed balance range is from zero to infinity. If the validation rule is broken, the error message appears.
© SAP AG 2010
24
How to Design an Electronic File Format in Electronic File Manager: Format Definition
Note You can create validation rule of data range for the only target fields with the type as Number or Date. The target field type is determined in the XML schema. If you manually create a target field, you cannot set the field type in the Electronic File Manager: Format Definition add-on. You can only create validation rule of data range for the target fields with the type as Number or Date that are imported from an XML schema.
© SAP AG 2010
25
How to Design an Electronic File Format in Electronic File Manager: Format Definition
Ot h e r Re f e r e n c e M a t e r i a l In addition to the format GEP, the Electronic File Manager: Format Definition add-on for SAP Business One 8.81 provides the following formats: •
Bank Payment File Format Project (BPP): Bank payment format used for exporting payment data from SAP Business One This format is used to generate a bank payment file in the payment wizard.
•
Bank Statement File Format Project (BFP): Bank statement format used for parsing and importing bank statement data into SAP Business One BFP is the same format you edit in the Format Definition add-on of SAP Business One 2007 and 8.8.
For more information about the Electronic File Manager: Format Definition add-on, see the online help for Electronic File Manager: Format Definition.
The Electronic File Manager: Format Definition add-on for SAP Business One 2007 A SP01 and 8.8 provides the following formats: •
Special-Purpose File Format Project (SPP): A generic format used for various special business purposes with predefined structure
•
BFP: Bank statement file format used for parsing and importing bank statement data into SAP Business One BFP is the same format you edit in the Format Definition add-on of SAP Business One 2007 and 8.8.
For more information, see the online help for Electronic File Manager: Format Definition and SAP Note 1531223.
© SAP AG 2010
26
How to Design an Electronic File Format in Electronic File Manager: Format Definition
Co p y r i g h t s , T r a d e m a r k s , a n d Di s c l a i m e r s © Copyright 2010 SAP AG. All rights reserved.
The current version of the copyrights, trademarks, and disclaimers at http://service.sap.com/smb/sbocustomer/documentation is valid for this document.
© SAP AG 2010
27