on 2005 Apr 06 4:03 PM
Hi,
I have created one ABAP mapping class with the method IF_MAPPING~EXECUTE.I tried to test the mapping program in a report by passing the source(XML document as a string).The call to the mapping method is done as follows:
CALL METHOD CLASS1=>IF_MAPPING~EXECUTE
EXPORTING
source = sxml
IMPORTING
result = sxml1.
When I try to activate the above call, I get an error message which says that You can only use class=>method with static methods.This is happening in SAP WAS6.20.I understand that ABAP mapping can be tested in dynamic calls only in XI.
So the only option left is to test the ABAP mapping in Integration repository Design -Interface mapping.When I include ABAP mapping class in the interface mapping and run the whole scenario,I get error message in SXMB_MONI.
Is there an easy way out to test the ABAP mapping than including it in the Interface mapping?If you have some ideas,please inform.
Thanks in advance,
S.Banukumar
Bonjour,
To test ABAP mapping in XI use the transaction SXI_MAPPING_TEST after creating a little scenario in the directory.
Regards,
Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I guess if you want to do the ABAP you have to do the create object before like this example: obj type ref to your-class.
data: obj type ref to zcl_abap_mapping_test.
data: source type xstring,
result type xstring.
data: param type ref to IF_MAPPING_PARAM,
trace type ref to IF_MAPPING_trace.
create object obj.
try.
CALL METHOD obj->IF_MAPPING~EXECUTE
EXPORTING
SOURCE = source
PARAM = param
TRACE = trace
IMPORTING
RESULT = result.
CATCH CX_MAPPING_FAULT .
ENDTRY.
Cheers
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks Stefan.When I try to code in the same way as you told,the error thrown is Formal parameter Result is not
a exporting parameter,but it is a return parameter from the method call.
Let us try what Chris has told.I like to ask one question.Did you have an oppurtunity to see the XSLT Development tool provided by SAP?It has a XSLT tester provided to test with Source file(XML) as an input.Is there a similar tool provided for ABAP mapping in SAP?
Thanks,
S.Banukumar
Hello,
Yes, with the transaction SXI_MAPPING_TEST after creating a small scenario (one receiver determination, one receiver interface and one receiver agreement) you can upload your XML file and test the ABAP mapping.
In the result you can see, your source file, your dest file and all the log.
Regards,
Chris
Hi Chris,
I have configured a simple scenario with one receiver determination,one receiver interface etc.I have done the ABAP mapping and the input document is as follows.
<?xml version="1.0" encoding="UTF-8" ?>
<ns0:BookingOrders xmlns:ns0="http://sap.com/test/ABAPMapping">
<Order>
<BookingCode>2KY34R</BookingCode>
<Passenger>
<Name>Smith</Name>
<Address>123 Main street</Address>
</Passenger>
<Flight>
<Date>04042004</Date>
<AirlineID>SX</AirlineID>
<FlightNumber>21</FlightNumber>
<From>ZRH</From>
<To>FRA</To>
</Flight>
</Order>
</ns0:BookingOrders>
The output xml document expected after the execution of ABAP mapping is:
<?xml version="1.0" ?>
<MsgOut>
<BookingCode>2KY34R</BookingCode>
</MsgOut>
When I test the ABAP mapping with the transaction
SXI_MAPPING_TEST I get the success message.But the output document is same as the input document.
In the trace it says No mapping configured.What could be the possible reason for the ABAP mapping not getting invoked.
Thanks,
S.Banukumar
Check in the Directory if in your interface determination you put correct information.
The sender service : SENDER
The sender interface : BookingOrders corresponding interface.
The sender namespace : http://sap.com/test/ABAPMapping
The receiver service : RECEIVER
Under Configured Inbound Interfaces, you can find :
The Inbound interface : MsgOut corresponding interface.
Interface mapping : BookingOrders2MsgOut that use your ABAP Mapping.
I am not sure the Receiver determination is necessary.
Then if it's OK, check that you put exactly the same information in transaction SXI_MAPPING_TEST :
Sender Service : SENDER
Sender Interface Namespace : http://sap.com/test/ABAPMapping
Sender Interface Name : BookingOrders corresponding interface.
Receiver Service : RECEIVER
Receiver Interface Namespace : namespace where you define your MsgOut Interface.
Receiver Interface Name : MsgOut corresponding interface.
Regards,
Chris
Hi Chris,
Thanks a lot.I have corrected the name space as ns instead of ns0.I have done the Design and Directory setting as suggested by you.Now I am getting the following error when I try to test my scenario in
SXI_MAPPING_TEST.
<?xml version="1.0" encoding="utf-8" ?>
- <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
- <asx:values>
<ERROR href="#o97" />
</asx:values>
- <asx:heap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:dic="http://www.sap.com/abapxml/types/dictionary">
- <cls:CX_XMS_SYSERR_MAPPING id="o97">
- <CX_ROOT>
<TEXTID>579DFEE1FC5AF24F9C83617A696DC539</TEXTID>
<PREVIOUS />
<KERNEL_ERRID />
- <INTERNAL_SOURCE_POS>
<PROGID>160</PROGID>
<CONTID>650</CONTID>
</INTERNAL_SOURCE_POS>
</CX_ROOT>
<CX_STATIC_CHECK />
- <CX_XMS_SYSTEM_ERROR>
<ID>APPLICATION_PROGRAM_ERROR</ID>
<P1>$TMP.BOOKINGTOMSG</P1>
<P2>R3_ABAP</P2>
<P3>UNCAUGHT_EXCEPTION</P3>
<P4 />
<INFO />
<CATEGORY />
What could be possible reason for the exception?Do I need to give the name space for the ABAP mapping name when I include it in the Interface mapping?
Thanks,
S.Banukumar
Hello,
No you dn't need to add the ABAP namespace in the repository when you call it in the interface mapping.
I don't know if I can help you. I never test SAP example.
But you can put some trace to see if there is a problem in the program.
For exmaple replace "iparser->parse( )." by this :
if iparser->parse( ) ne 0.
if iparser->num_errors( ) ne 0.
count = iparser->num_errors( ).
l_trace = 'Parse errors have occured:'.
index = 0.
while index < count.
parseError = iparser->get_error( index = index ).
str = parseError->get_line( ).
CONCATENATE l_trace 'line:' str INTO l_trace SEPARATED BY SPACE.
str = parseError->get_column( ).
CONCATENATE l_trace 'column:' str INTO l_trace SEPARATED BY
SPACE.
str = parseError->get_reason( ).
CONCATENATE l_trace str INTO l_trace SEPARATED BY SPACE.
index = index + 1.
endwhile.
trace->trace( level = '2' message = l_trace ).
raise exception type CX_MAPPING_FAULT.
endif.
endif.
Regards,
Chris
Hi Chris,
Thanks for the input.My real requirement is to extract a XML document which is hidden as a string in the response document from a web service call.I thought of writing ABAP Mapping which will extract the hidden XML document and deliver it to the caller as a XML document.
To get familiar with ABAP mapping,I started with SAP example.
I need two points to be clarified.
1.Can ABAP mapping support the execution of ABAP code which does some string manipulations?Or Does it support only parsing the input stream and mapping it to the result structure?
2.How is the performance of ABAP mapping in real time scenario?Does it have any complaints.
Please share your experience if you have used ABAP mapping already.
Thanks,
S.Banukumar
1. Yes with ABAP mapping you can do anything that you can do in ABAPOO. In my case I call Function module and it works.
2. All the test I do, satisfy me concerning the performance with ABAP Mapping. I am not sure but I think performance is equivalent to ABAP Function module or RFC Call.
Regards,
Chris
Hi Chris,
Thanks a lot.As you have used the ABAP mapping for writing some ABAP code,one more question to you.
1.The Source and Result parameters of the ABAP mapping method are of type XSTRING.I believe it is a hexadecimal string.How did you manage to convert the XSTRING into String or other data type.
Thanks,
S.Banukumar
Sorry, I never need to do it. But you can use DOM to navigate in your XML representing by the input XSTRING.
This is a link very useful for ABAP Mapping :
http://help.sap.com/saphelp_nw04/helpdata/en/86/8280ba12d511d5991b00508b6b8b11/frameset.htm
Regards,
Chris
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.