SAP PI Node functions
Hi
Can anyone send the link that tells with the examples about the node functions in SAP PI
Thanks
RP
a) Remove Contexts: - remove all higher level contents of the source level message in order to map with the target message field. So you can get the node contexts removal.
b) Split by value: - Insert Context change for an element split by value is some as counter part of remove context. Here instead of delivering the context you can insert a context change in the source value queue.
c) Collapse contexts: - Copies first values of the all contexts to one context empty context are replaced by empty string.
d) Copy Value: - How many ever times I occur I am copied just once". This is not a node function but I am explaining it as it is used very frequently in real-time. Let us take an instance of material group, which can occur as many times as the item node. But since we are mapping it to the header in the target node I just want to copy the first occurrence of material group and map it to the header node. CopyValue exactly does that.
e) Create if: - It will create a target node or element based on some condition.
f) Exists: - Function to determine whether a particular source field exists in instance to be processed. If it does it gives true or else false.
g) Use one as many: if a field that only occurs once needs to be replicated as often as another field occurs in the outbound message so that the fields can be written to the target structure in pairs as a record.
h) Replace value: - Replace the value I with the value that you desired in the dialogue for function properties.
i) Sort: - Sorts all values of the multiply occurring inbound field with in the existing or set context.
Regards...
Saathi
Similar Messages
-
I want to know about Node functions
can anyone explain with example about node functions in PI with an example as i am knew to PI
Hi Chandra,
Using google or SCN search you will find a lot of examples...
https://www.google.es/search?q=SAP+PI+node+functions&ie=utf-8&oe=utf-8&rls=org.mozilla:es-ES:official&client=firefox-a&c…
Redirecting...
Try to read the SAP documentation and later ask to the forum if you have any doubt with a specif function and/or example. You would consider to research a bit before to ask because the question is so generic.
Regards, -
Node functions in Message Mapping
Hi,
Could someone help me with some good exercises for node functions such as splitbyvalue, collapsecontents, removecontexts.
I am a newbie to these functions and have absolutely no idea on how to use them. Would appreciate if someone could give very detailed examples to these functions in a step by step manner, so that I can create them just by following your instructions.
Any links to video presentations are welcome too.
Cheers,
SHi ,
For a fresher, the informationa and examples given in the help.com would be more helpful and it will help you in building string fundamentals. Once your basics and funcdamentals concepts becomes strong then you can go for more complex exmples. Here is help.sap link where you can leran Node functions of MM of PI.
http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/frameset.htm
Thanks,
RK -
Hi All,
Can anybody tell me what are the new node function(s) added in PI 7 compare to XI 3? Apart from node fucntions what are the new functions available in PI 7?
Regards
FaisalRefer PI 7.1 Blogs:
/people/peter.gutsche/blog/2008/10/27/what146s-new-in-sap-netweaver-pi-71
SAP NetWeaver Process Integration 7.1 - Details [original link is broken]
New in SAP PI 7.1
Mapping enhancements:
http://help.sap.com/saphelp_nwpi71/helpdata/en/44/a7b4355d867455e10000000a11466f/frameset.htm
1. Graphical variables:
/people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable
2. Function library: In lower releases, you were able to save and manage user-defined functions as part of one message mapping only. You can now create function libraries independently of specific message mappings, and can use the functions you define in them in multiple message mappings.
http://wiki.sdn.sap.com/wiki/display/XI/PI7.1ConceptofFunctionLibraryinProcessIntegration
http://help.sap.com/saphelp_nwpi71/helpdata/en/43/78bd467afa345ae10000000a422035/frameset.htm
3. Correcting Structural Inconsistencies
http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417400)ID1636393650DB10213226047035219960End?blog=/pub/wlg/8662
http://help.sap.com/saphelp_nwpi71/helpdata/en/07/0c13f257f94c6089894b62f3568b9d/frameset.htm
http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417400)ID1636393650DB10213226047035219960End?blog=/pub/wlg/8282 -
Advanced functions,UDF's and node function
Dear all,
Can you kindly let me know about Advanced functions,UDF's and node function.Differences and Uses.
Also Let me know about the advantages,Disadvantages of Graphical,XSLT,Java,ABAP and ABAP XSLT mappings.
Thanks,
SriniHi,
The term Mapping means:
1. The transformation process, and/or
2. The transformation rules.
Independently from XI, you can distinguish two different mappings
Structure mappings transform entire message structures.
Value mappings transform values within messages.
Mapping Programs to Map Messages :
Message Mapping
Designed by using the graphical mapping editor of Integration Builder
Result: Generated Java Code.
Imported Archives
Import externally defined mapping programs into repository
Java mapping:
Implemented by using a specific interface
XSLT mapping:
Runtime supports XSLT processor
Java methods can be called from within a Style Sheet
ABAP Mapping
You can execute mapping programs in a sequence
The exchange infrastructure supports three types of mappings:
Message mappings that can be designed using a graphical mapping editor in the Integration Builder. As a result, Java code is generated from the graphical representation that is compiled before it can be executed on the integration server.
You can implement your own Java mapping by implementing a specific interface of the mapping API.
You can implement an XSLT mapping
For the latter two, there is no tool support in XI. It is expected that they are developed using external development tools. To make them available for the integration server, they have to be imported into the integration repository as JAR
files before (JAR: Java Archives).
Developers can even decide to combine the different mapping technologies:
Message mappings, XSLT mappings and Java mappings can be combined in a sequence by means of an interface mapping.
XSLT mappings can use java functions
Message mappings support user-defined functions that can use imported java packages of the same namespace.
In SAP XI, there is 3 types of mappings. Namely
XSLT Mapping
Java Mapping
ABAP Mapping
Here is the details of each mapping.
XSLT Mappings (ABAP Engine)
Interface descriptions are in the form of XML documents. XSL Transformation (XSLT) is a member of the XML family of languages. It describes how an XML structure is transformed into another XML structure.
Customers can develop an XSLT mapping by using the Transformation Editor of the ABAP Workbench. Such XSLT mappings are executed at runtime on the ABAP Engine of the Integration Server.
To simplify matters, this section refers to XSLT mappings of the ABAP Engine as transformation programs to differentiate them from XSLT mappings from imported archives that are executed on the J2EE Engine.
Features
XPath and <xsl:include>
You can define mappings using XSLT together with XPath. XPath is also a specification of the XML family. Using XPath you can address any node in an XML document. XSLT implements XPath expressions to select substructures of an XML document. Using templates in XSLT you can define the mapping rules for the selected substructures.
You can use the XSLT tags <xsl:include> and <xsl:import> to include predefined templates for substructures in a complete mapping definition. In this way, you can reuse mappings for data types.
Java Mapping
You can implement mapping programs in Java. To process XML documents, use Java API for XML Processing (JAXP), for example. The JAXP supports the Document Object Model (DOM) and the Simple API for XML (SAX). This gives you great flexibility for mapping definitions with Java.
Implementation Considerations
Java mapping programs are not permitted to be stateful. You are therefore not permitted to perform actions such as writing data to a database table during a Java mapping. The Integration Server cannot track such side effects. Therefore, if an attempt is made to resend a message that has not been received by the receiver, the data may inadvertently be written to the database twice in a Java mapping.
If you use JRE classes in your Java mapping programs then the same program restrictions apply as for Enterprise Java Beans (EJBs). For a detailed description of these restrictions, see the relevant EJB specification. It is important that you also refer to the information under Scope of Functions in Runtime Environment (Java Mappings).
The runtime environment for Java mappings has an mapping API. To use Java mapping, you must define a Java class that implements the Java interface com.sap.aii.mapping.api.StreamTransformation. This interface has two methods:
● public void execute(java.io.InputStream in, java.io.OutputStream out)
At runtime, the Integration Engine calls this method to execute a mapping. This method contains an input stream for the source document and an output stream for the target document as parameters. These streams are usually XML documents. You can import the substructures to be converted from the input stream and output the converted target document in the output stream.
● public void setParameter(java.util.Map param)
The Integration Engine transfers parameters to the mapping program with this method. It evaluates these parameters at runtime in the method execute(). This enables you to control the process flow of the mapping.
The transferred object that implements the Java interface java.util.Map contains seven key/value pairs as parameters. These correspond to corresponding fields in the message header. Apart from the MAPPING_TRACE constant, the value objects are of type java.lang.String. The key objects are defined in the class com.sap.aii.mapping.api.StreamTransformationConstants
ABAP Mappings
ABAP mappings are mapping programs in ABAP objects that customers can implement using the ABAP Workbench.
Features
An ABAP mapping comprises an ABAP class that implements the interface IF_MAPPING in the package SAI_MAPPING.
Exception: CX_MAPPING_FAULT
Applications can decide themselves in the method EXECUTE how to import and change the source XML document. If you want to use the XSLT processor of SAP Web AS, you can use the ABAP Workbench to develop a stylesheet directly (see XSLT Mappings (ABAP Engine)) rather than using ABAP mappings.
Runtime Constants
In ABAP mapping you can read access message header fields. To do this, an object of type IF_MAPPING_PARAM is transferred to the EXECUTE method. The interface has constants for the names of the available parameters and a method GET, which returns the respective value for the parameter name. The constants are the same as in Java mappings, although the constant MAPPING_TRACE does not exist for ABAP mappings. Instead, the trace object is transferred directly using the parameter TRACE of the method IF_MAPPING~EXECUTE
Example: Accessing a Runtime Constant
Method IF_MAPPING~EXECUTE.
Get mapping constant SENDER_SERVICE
data: l_sender_service type string.
l_sender_service = param->get( IF_MAPPING_PARAM=>SENDER_SERVICE ).
ENDMETHOD.
These r excellent websites which contain PPT & PDF documents on mapping:
Excellent PDF Document on Mapping
http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf
Mapping Development with the ABAP Workbench
http://help.sap.com/saphelp_nw04/helpdata/en/10/5abb2d9df242f6a62e22e027a6c382/content.htm
ABAP Mappings
http://help.sap.com/saphelp_nw04/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/content.htm
how to create a flat file out of an IDoc-XML by means of an ABAP mapping program and the J2EE File Adapter.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
How to Use ABAP Mapping in XI 3.0
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
Hope this will help you, and don't forget to close this thread.
Regards
Aashish Sinha
PS : reward points if helpful -
Where is the node function:SOAP Lookup
Hi:
I can see the SOAP Lookup exists in SAP BASIS 7.11 when i define parameter in Operation Mapping.
But in Message Mapping,i can just find node functions of JDBC Lookup and RFC Lookup without SOAP Lookup,it can only be
used in UDF?
regards
Yu MingI think you are right, I could not find node function for SOAP lookup in PI 7.1.
I recently need to do SOAP lookup, so need to go for UDF only to create SOAP req message and parsing SOAP response and mapped to target field.
Divyesh Vasani -
Hi all,
Does PCK provide Node Functions in Message Mapping?Hi Krishna,
All the node functions in Message Mappings are provided by PCK..
Also please go through the below link which gives you in detail about the node functions...
http://help.sap.com/saphelp_nw04/helpdata/en/ee/bf9640dc522f28e10000000a1550b0/frameset.htm
Hope this helps...
Do get back to me in case you need any other details..
Regards
Kiran.. -
Node Functions in XI, I am new to XI
Hi ,
i am new to XI, i need some documentation regarding Node Functions.
Regards,
kumarHi,
.SplitByValue:
The SplitByValue() function is the counterpart to removeContexts(): Instead of deleting a context, you can insert a context change in the source value queue. You then receive this element for each inserted context change instead of a top node element. However, for this to be possible, the top node source field must be assigned a top node target field and minOccurs must be >0. You can insert a context change in the queue after each value, after each change to the value, or after each tag without a value.
2.RemoveContexts:
You use removeContexts () to delete all the top contexts for an element. This removes all top hierarchy levels, so that all elements of the target queue are assigned to a root element of the source queue.
Advanced user-defined functions can import either just one context into the input arrays, or complete queues. Make your selection by selecting or deselecting the Save Entire Queue in Cache checkbox in the function editor.
3.CreateIf:
CreateIf node function is used to create a node if true value is passed to it otherwise suppress it.
4.collapseContext
To remove the context in between the value and transfer only one value at a time
5.: useOneAsMany
First Input:
The value which is needed to be repeated.
Second Input:
It defines how many times the first input should be repeated.
Third Input:
It define when the context should be changed (on the basis of the required output
Please go through the given link hope it will be helpful to you.
/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
http://help.sap.com/saphelp_nw04/helpdata/en/79/2835b7848c458bb42cf8de0bcc1ace/frameset.htm
Message Mapping Simplified Part II
/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
Replication of Nodes Using the Graphical Mapping Tool
/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool
Message Splitting Using the Graphical Mapping Tool
/people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool
Refer these links for more information on Node function:
http://help.sap.com/saphelp_nw04/helpdata/en/ee/bf9640dc522f28e10000000a1550b0/frameset.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6658bd90-0201-0010-fbb6-afe25fb398d3
/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool
Check this weblog where claus have mentioned with examples:
/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool
/people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool
/people/claus.wallacher/blog/2006/08/15/duplicating-subtrees-and-numbering-them-using-the-graphical-mapping-tool
Also check this weblogs:
/people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i
/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
Split by value -
http://help.sap.com/saphelp_nw04/helpdata/en/21/3bb8c495125e4eb5969f0377885fe0/content.htm
For value mapping check this video presentation and weblog:
/people/sreekanth.babu2/blog/2005/02/23/value-mapping-replication
/people/community.user/blog/2007/01/08/valuemapping-using-the-graphical-mapping-tool
https://www.sdn.sap.com/irj/sdn/docs?rid=/webcontent/uuid/110ff05d-0501-0010-a19d-958247c9f798#xi [original link is broken]
/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool
Function formatByExample:
/people/sundararamaprasad.subbaraman/blog/2006/02/21/real-example-for-formatbyexample
Split by value, remove context and collapse context:
/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
Please reward points if it helps
Thanks
Vikranth -
Node functions in real time scenario
can any one tell me where node functions used in realtime explain with examples?
thanx®ards
narenHey,
1. remove context:
You use removeContexts () to delete all the top contexts for an element. This removes all top hierarchy levels, so that all elements of the target queue are assigned to a root element of the source queue.
Advanced user-defined functions can import either just one context into the input arrays, or complete queues. Make your selection by selecting or deselecting the Save Entire Queue in Cache checkbox in the function editor.
2. split by value:
The SplitByValue() function is the counterpart to removeContexts(): Instead of deleting a context, you can insert a context change in the source value queue. You then receive this element for each inserted context change instead of a top node element. However, for this to be possible, the top node source field must be assigned a top node target field and minOccurs must be >0. You can insert a context change in the queue after each value, after each change to the value, or after each tag without a value.
3. collapse context:
Using collapseContexts() puts the first values of all contexts into a context. Empty contexts are replaced with an empty string:
This can be useful if an upper-level node is to be created each time a lower-level node exists, for example. The function is useful in combination with the SplitByValue function.
4. Use one as many
You require the function useOneAsMany() if a field that only occurs once needs to be replicated as often as another field occurs in the outbound message so that the fields can be written to the target structure in pairs as a record.
http://help.sap.com/saphelp_nw04/helpdata/en/2c/2d8c4024d26e1de10000000a1550b0/frameset.htm
5. Map with default
6.copyValue
You use CopyValue() for a frequently occurring element to copy the value of a position in the source structure and assign it to a target field. The value is copied each time the target field occurs in the target structure. However, it is copied a maximum of maxOccurs times
7.createIf
You use createIf() to create a tag in the target structure depending on a condition.
8.exists
You use this function to determine whether a particular source field exists in the XML instance to be processed. If it does, exists() returns the value true, otherwise it returns the value false.
9.Use
You use this function if you need to synchronize two queues of equal length with reference to their context change. The mapping runtime takes the values from the first queue, and the context change from the second queue. If the two inbound queues do not have the same number of values, the mapping runtime triggers an exception.
Link for Node function.
/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool
Example:
removeContext:
We use remove context to remove the context of a queue
A ->removeContext-> A
B B
C C
here each line under an alphabet denotes context change.
One thing about context change is it will not show you null values coming in input.
A ->removeContext-> A
C
C
in above example -- represents only context change no value in this place(null).
Collapscontext :
It works very much same way of removecontext but it also considers null values and gives [] for null values (if Context of Field is on its Preceeding parent otherwice it will work as remove context)
A ->CollapsContext-> A
[] (Blank value)
C C
One more chane is if there are multiple values in a context then it will only select first value from that queue
A ->CollapsContext-> A
D B
B C
C
As you can see in above example A & D falls under one context hence D is Removed
Split ByValue :
Used to Change the Context of Input
it has three options in it
1)each value
2)value change
3)emptyValue
The link given by Rohit is Self Explanatry for this .
FormateByExample :
it changes the Context of input1 as per the Context of Second input but the number of values in both the input must be same .
eg.
Input1 Input2 ->FormateByExample-> Out
A P A
B Q B
C R C
As you can see Context of input1 is Changed as per input 2
Sorry Guest Seems To Be Some Problem With Formating
Give me you Email ID Will Send You in Proper Formate
reward points if useful.
regards,
Milan -
node functions in xi
.SplitByValue:
The SplitByValue() function is the counterpart to removeContexts(): Instead of deleting a context, you can insert a context change in the source value queue. You then receive this element for each inserted context change instead of a top node element. However, for this to be possible, the top node source field must be assigned a top node target field and minOccurs must be >0. You can insert a context change in the queue after each value, after each change to the value, or after each tag without a value.
2.RemoveContexts:
You use removeContexts () to delete all the top contexts for an element. This removes all top hierarchy levels, so that all elements of the target queue are assigned to a root element of the source queue.
Advanced user-defined functions can import either just one context into the input arrays, or complete queues. Make your selection by selecting or deselecting the Save Entire Queue in Cache checkbox in the function editor.
3.CreateIf:
CreateIf node function is used to create a node if true value is passed to it otherwise suppress it.
4.collapseContext
To remove the context in between the value and transfer only one value at a time
5.: useOneAsMany
First Input:
The value which is needed to be repeated.
Second Input:
It defines how many times the first input should be repeated.
Third Input:
It define when the context should be changed (on the basis of the required output
Please go through the given link hope it will be helpful to you.
/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
http://help.sap.com/saphelp_nw04/helpdata/en/79/2835b7848c458bb42cf8de0bcc1ace/frameset.htm
Message Mapping Simplified Part II
/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
Replication of Nodes Using the Graphical Mapping Tool
/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool
Message Splitting Using the Graphical Mapping Tool
/people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool
Refer these links for more information on Node function:
http://help.sap.com/saphelp_nw04/helpdata/en/ee/bf9640dc522f28e10000000a1550b0/frameset.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6658bd90-0201-0010-fbb6-afe25fb398d3
/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool
Check this weblog where claus have mentioned with examples:
/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool
/people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool
/people/claus.wallacher/blog/2006/08/15/duplicating-subtrees-and-numbering-them-using-the-graphical-mapping-tool
Also check this weblogs:
/people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i
/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
Split by value -
http://help.sap.com/saphelp_nw04/helpdata/en/21/3bb8c495125e4eb5969f0377885fe0/content.htm
For value mapping check this video presentation and weblog:
/people/sreekanth.babu2/blog/2005/02/23/value-mapping-replication
/people/community.user/blog/2007/01/08/valuemapping-using-the-graphical-mapping-tool
https://www.sdn.sap.com/irj/sdn/docs?rid=/webcontent/uuid/110ff05d-0501-0010-a19d-958247c9f798#xi [original link is broken]
/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool
Function formatByExample:
/people/sundararamaprasad.subbaraman/blog/2006/02/21/real-example-for-formatbyexample
Split by value, remove context and collapse context:
/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii -
Node function to use for relating two idoc segments from source in mesmapp
Hi Sap All.
here i have got a requirement to do a graphical mapping between Souce Idoc Structure to target file structure .
here i have got aspecific requirement from the Functional saying that they want
for a segment from source idoc with name E1EDL24-NTGEW should be mapped with shipment_detail-nett_weight
and the conditon here is There should be a corresponding entry in E1EDL24 for each E1EDL44?(other) segment type.
can nay body help me in guiding how and what node functions do i need to use here to ge the solution.
regards.
VarmaVarma,
If you could give a sample that would be great!
raj. -
Need Basic Materials for Node Functions
I Need Basic Materials for Using Node Functions in Mappings.
HI Ragu
you can base these as your reference;
Have a look at this help link - http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
Also these weblogs will help you -
/people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool
/people/stefan.grube/blog/2005/12/29/new-functions-in-the-graphical-mapping-tool-xi-30-sp13
/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
Split by value -
http://help.sap.com/saphelp_nw04/helpdata/en/21/3bb8c495125e4eb5969f0377885fe0/content.htm
U can also refer to the follwoing link
http://help.sap.com/saphelp_nw2004s/helpdata/en/2c/2d8c4024d26e1de10000000a1550b0/frameset.htm
Cheers..
Vasu
<i>** Reward Points if found useful **</i> -
How to Send Internal table to SAP Spool using Function Modules or Methods?
Hi Experts,
How to Send Internal table to SAP Spool using Function Modules or Methods?
Thanks ,
KiranThis is my code.
I still get the no ABAP list data for the spool, even tho I can see it sp01?
REPORT Z_MAIL_PAYSLIP.
* Declaration Part *
tables: PERNR, PV000, T549Q, V_T514D, HRPY_RGDIR.
infotypes: 0000, 0001, 0105, 0655.
data: begin of ITAB occurs 0,
MTEXT(25) type C,
PERNR like PA0001-PERNR,
ABKRS like PA0001-ABKRS,
ENAME like PA0001-ENAME,
USRID_LONG like PA0105-USRID_LONG,
end of ITAB.
data: W_BEGDA like HRPY_RGDIR-FPBEG,
W_ENDDA like HRPY_RGDIR-FPEND.
data: RETURN like BAPIRETURN1 occurs 0 with header line.
data: P_INFO like PC407,
P_FORM like PC408 occurs 0 with header line.
data: P_IDX type I,
MY_MONTH type T549Q-PABRP,
STR_MY_MONTH(2) type C,
MY_YEAR type T549Q-PABRJ,
STR_MY_YEAR(4) type C,
CRLF(2) type x value '0D0A'.
data: W_CMONTH(10) type C.
data: TAB_LINES type I,
ATT_TYPE like SOODK-OBJTP.
data: begin of P_INDEX occurs 0,
INDEX type I,
end of P_INDEX.
constants: begin of F__LTYPE, "type of line
CMD like PC408-LTYPE value '/:', "command
TXT like PC408-LTYPE value 's', "textline
end of F__LTYPE.
constants: begin of F__CMD, "commands
NEWPAGE like PC408-LINDA value '',
end of F__CMD.
data: P_LIST like ABAPLIST occurs 1 with header line.
*data: OBJBIN like SOLISTI1 occurs 10 with header line,
data: OBJBIN like LVC_S_1022 occurs 10 with header line,
DOCDATA like SODOCCHGI1,
OBJTXT like SOLISTI1 occurs 10 with header line,
OBJPACK like SOPCKLSTI1 occurs 1 with header line,
RECLIST like SOMLRECI1 occurs 1 with header line,
OBJHEAD like SOLISTI1 occurs 1 with header line,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_buffer type string,
l_no_of_bytes TYPE i,
l_pdf_spoolid LIKE tsp01-rqident,
l_jobname LIKE tbtcjob-jobname.
data: file_length type int4,
spool_id type rspoid,
line_cnt type i.
*-------------------------------------------------------------------* * INITIALIZATION *
OBJBIN = ' | '.
append OBJBIN.
OBJPACK-HEAD_START = 1.
data: S_ABKRS like PV000-ABKRS.
data: S_PABRP like T549Q-PABRP.
data: S_PABRJ like T549Q-PABRJ.
* SELECTION SCREEN *
selection-screen begin of block BL1.
parameters: PAY_VAR like BAPI7004-PAYSLIP_VARIANT default 'ESS_PAYSLIPS' obligatory.
selection-screen end of block BL1.
START-OF-SELECTION.
s_ABKRS = PNPXABKR.
S_PABRP = PNPPABRP.
s_pabrj = PNPPABRJ.
w_begda = PN-BEGDA.
w_endda = PN-ENDDA.
get pernr.
* "Check active employees
rp-provide-from-last p0000 space pn-begda pn-endda.
CHECK P0000-STAT2 IN PNPSTAT2.
* "Check Payslip Mail flag
rp-provide-from-last p0655 space pn-begda pn-endda.
CHECK P0655-ESSONLY = 'X'.
rp-provide-from-last p0001 space pn-begda pn-endda.
* "Find email address
RP-PROVIDE-FROM-LAST P0105 '0030' PN-BEGDA PN-ENDDA.
if p0105-usrid_LONG ne ''.
ITAB-PERNR = P0001-PERNR.
ITAB-ABKRS = P0001-ABKRS.
ITAB-ENAME = P0001-ENAME.
ITAB-USRID_LONG = P0105-USRID_LONG.
append itab.
clear itab.
endif.
"SY-UCOMM ='ONLI'
END-OF-SELECTION.
*------------------------------------------------------------------* start-of-selection.
write : / 'Payroll Area : ', S_ABKRS.
write : / 'Payroll Period/Year : ',STR_MY_MONTH,'-',STR_MY_YEAR. write : / 'System Date : ', SY-DATUM.
write : / 'System Time : ', SY-UZEIT.
write : / 'User Name : ', SY-UNAME.
write : / SY-ULINE.
sort ITAB by PERNR.
loop at ITAB.
clear : P_INFO, P_FORM, P_INDEX, P_LIST, OBJBIN, DOCDATA, OBJTXT, OBJPACK, RECLIST, TAB_LINES.
refresh : P_FORM, P_INDEX, P_LIST, OBJBIN, OBJTXT, OBJPACK, RECLIST.
* Retrieve Payroll results sequence number for this run
select single * from HRPY_RGDIR where PERNR eq ITAB-PERNR
and FPBEG ge W_BEGDA
and FPEND le W_ENDDA
and SRTZA eq 'A'.
* Produce payslip for those payroll results
if SY-SUBRC = 0.
call function 'GET_PAYSLIP'
EXPORTING
EMPLOYEE_NUMBER = ITAB-PERNR
SEQUENCE_NUMBER = HRPY_RGDIR-SEQNR
PAYSLIP_VARIANT = PAY_VAR
IMPORTING
RETURN = RETURN
P_INFO = P_INFO
TABLES
P_FORM = P_FORM.
check RETURN is initial.
* remove linetype from generated payslip
loop at p_form.
objbin = p_form-linda.
append objbin.
line_cnt = line_cnt + 1.
endloop.
file_length = line_cnt * 1022.
* create spool file of paylsip
CALL FUNCTION 'SLVC_TABLE_PS_TO_SPOOL'
EXPORTING
i_file_length = file_length
IMPORTING
e_spoolid = spool_id
TABLES
it_textdata = objbin.
IF sy-subrc EQ 0.
WRITE spool_id.
ENDIF.
DESCRIBE table objbin.
DATA PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = spool_id
NO_DIALOG = ' '
DST_DEVICE = 'MAIL'
* PDF_DESTINATION =
* IMPORTING
* PDF_BYTECOUNT = l_no_of_bytes
* PDF_SPOOLID = l_pdf_spoolid
* LIST_PAGECOUNT =
* BTC_JOBNAME =
* BTC_JOBCOUNT =
TABLES
PDF = pdf
EXCEPTIONS
ERR_NO_ABAP_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DESTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 11
OTHERS = 12
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Download PDF file C Drive
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\itab_to_pdf.pdf'
filetype = 'BIN'
TABLES
data_tab = pdf.
* Transfer the 132-long strings to 255-long strings
* LOOP AT pdf.
* TRANSLATE pdf USING ' ~'.
* CONCATENATE gd_buffer pdf INTO gd_buffer.
* ENDLOOP.
* TRANSLATE gd_buffer USING '~ '.
* DO.
* it_mess_att = gd_buffer.
* APPEND it_mess_att.
* SHIFT gd_buffer LEFT BY 255 PLACES.
* IF gd_buffer IS INITIAL.
* EXIT.
* ENDIF.
* ENDDO.
OBJHEAD = 'Objhead'.
append OBJHEAD.
* preparing email subject
concatenate W_ENDDA(6)
' Payslip-'
ITAB-ENAME+0(28)
ITAB-PERNR+4(4) ')'
into DOCDATA-OBJ_DESCR.
DOCDATA-OBJ_NAME = 'Pay Slip'.
DOCDATA-OBJ_LANGU = SY-LANGU.
OBJTXT = 'Pay Slip.'.
append OBJTXT.
*prepare email lines
OBJTXT = DOCDATA-OBJ_DESCR.
append OBJTXT.
OBJTXT = 'Please find enclosed your current payslip.'.
append OBJTXT.
* Write Attachment(Main)
* 3 has been fixed because OBJTXT has fix three lines
read table OBJTXT index 3.
* DOCDATA-DOC_SIZE = ( 3 - 1 ) * 255 + strlen( OBJTXT ).
clear OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = 3.
OBJPACK-DOC_TYPE = 'RAW'.
append OBJPACK.
* Create Message Attachment
ATT_TYPE = 'PDF'.
describe table OBJBIN lines TAB_LINES.
read table OBJBIN index TAB_LINES.
* OBJPACK-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + strlen( OBJBIN ).
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = ATT_TYPE.
OBJPACK-OBJ_NAME = 'ATTACHMENT'.
OBJPACK-OBJ_DESCR = 'Payslip'.
append OBJPACK.
* Create receiver list refresh RECLIST.
clear RECLIST.
RECLIST-RECEIVER = itab-USRID_long.
translate RECLIST-RECEIVER to lower case.
RECLIST-REC_TYPE = 'U'.
append RECLIST.
* Send the document
*SO_NEW_DOCUMENT_ATT_SEND_API1
call function 'SO_DOCUMENT_SEND_API1'
exporting
DOCUMENT_DATA = DOCDATA
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
tables
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = pdf
CONTENTS_TXT = OBJTXT
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
RECEIVERS = RECLIST
exceptions
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
others = 8.
if SY-SUBRC NE 0.
ITAB-MTEXT = 'Message Not Sent to : '.
else.
ITAB-MTEXT = 'Message Sent to : '.
endif.
* else.
* ITAB-MTEXT = 'Message Not Sent to : '.
* endif.
else.
"SY-SUBRC Not = 0
ITAB-MTEXT = 'Payroll data not found : '.
endif.
"end of SY-SUBRC = 0.
modify ITAB.
endloop. "end loop at ITAB
sort ITAB by MTEXT PERNR.
loop at ITAB.
at new MTEXT.
uline.
write : / ITAB-MTEXT color 4 intensified on.
write : / 'Emp. Code' color 2 intensified on,
12 'Emp. Name' color 2 intensified on,
54 'Email ID' color 2 intensified on.
endat.
write : / ITAB-PERNR, 12 ITAB-ENAME, 54 ITAB-USRID_LONG.
endloop. -
HI Gurus,
I have a requirement like below desc, Is UDF required for this?!! or Can we manage with Node Functions?!!!
Source File: ( File )
a) PO_TYPE
b) Style1
c) Style2
Note: Style1 leads to Headernode and Style2 leads to ChildNode, Style1 and Style 2 are interconnected.
Target File: ( Idoc )
a) Header Node ( EHDRNDE)
b) Child NOde ( CHLDNDE)
And my question is.... I have to populate Header Node and Child Node in target side on certain conditions of the source file. they are;
I) Whenver a different style1 comes in file...I have to create a Headernode for that in target file. Style1 can contain number of Style2 nodes with the same node. like
Ex:
i) Style1 -
Style2a, Style2b, Style2c
ii) Style1 ....... Style2aa, Style2ab.
For this above requirement, I have to create corresponding target nodes for Header ( Style1 ) and as well as for Child ( Style2)
for ex1: it should be one Header node in target and 3 corresponding child nodes
for ex2 : It should be One Header Node and 2 child nodes
For this requirement...can we use node functions....if it is...could you please help me.
....Stallin
Edited by: stallin xavier on May 1, 2008 4:18 AMHi,
You can do it by using node function as well as UDF also.
1) If your sequence is sorted and always come in sorted order only e.g. 1st come only style1 node and child node and then come all nodes from style 2 then u can use node function.
2) for parent node use collpse context then remove context.
3) for child node 1st differntiat according to your condition and then use split by value(value change)
4) If occurance of style1 node and style2 node is not fixed then you don't have any option you have to write UDF.
I think this will help you.
Regards,
Rohit.
Reward points if helpful -
IDOC to FILE(xml) graphical mapping using node function createIf
Greetings All,
My Scenario is Idoc to File(XML)
Target Structure is
MO_MAT_LAN....................(0: unbound)
LAN_KEY.......................(0 :1)
DESCRIPTION.................(0 : 1)
Source MATMAS Idoc
E1MAKTM.........................(0 : 99)
SPRAS_ISO..................(0 :1)
MAKTX..........................(0 :1)
initially i had mapped E1MAKTM----->MO_MAT_LAN but i dont want target node MO_MAT_LAN to be created when the SPRAS_ISO is equal to EN
I have tried using node function createIf but the node is geting created only once although the input stucture is having occurance more than 5.
Can anyone please help me to achive this.
Many thanks,
RohitU have to use:-
SPRAS_ISO mak the context to E1MAKTM compare (Use equals) it with Constant function EN out put to be given to If without else and in then Give E1MAKTM and map out put of If node to MO_MAT_LAN.
chirag
Maybe you are looking for
-
Unable to upgrade server v 3.0
I am getting the error "You can't use this version of the application "Server" with this version of OS X. I had purchased and installed server version 2.2.2 on my mac mini. Am I required to purchase server version 3 to be able run on Mavericks?
-
Unspecified error if no violations
Hi, flex-pmd:report fails with this error if no violations are found: An error has occurred in Flex PMD Report report generation. There is no further info. It does not happen if there's any violation. I have tried both with and without failOnErro
-
Could anyone tell me how to create a preset that allows me to export a .wmv file from AME? I have Flip4Mac Studio Pro HD installed, but can't seem to figure out how to get it to work with my CC suite. Please advise.
-
Installing iPod on a new computer
Hi there, I've just got a new laptop and was wondering if I will need my iPod installation CD to make the iPod work on the new computer?
-
Hello, I want to view exceptions generated in MRP by multiple MRP controllers. Transaction MDLD - Print MRP LIst and Transaction MD45 show only for 1 MRP controller. Is there any report which can show me the MRP exceptions for multiple MRP controller