on 01-05-2010 12:41 AM
Hi, i am dealing with a problem and i am trying to resolve this.
I want to use REGISTER_DEVICE API, the parameter is XML_SOURCE and i dont know what should i send. Do i have to send the xml's path on my computer or somewhere else? This XML_SOURCE shoudl be in Hexadecimal? I have the XML's file but i dont know what to do whis this file.
I hope somebody can help me because its getting me crazy.
Regards,
Nicolas Eliaschev.
Hi,
Can you please try pasting this code, that i have created with the same information that you have provided:
data: str type string.
data: str1(100).
data: str2(100).
data: str3(100).
data: str4(100).
data: str5(100).
data: str6(100).
data: str7(100).
data: str8(100).
data: str9(100).
data: xstr1 type xstring.
str1 = '<?xml version="1.0" encoding="utf-8"?><asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0\"><asx:values><registration><param name="PHYSICAL_ID" value="'.
str2 = '68F24C2FF4EBFF6C649C84174BE68FBA'.
str3 = '" />'.
str4 = '<param name="RGSTRATN_CNF_ID" value="'.
str5 = '000C29DEFEEE02DDA6E69FA499A3D0EE'.
str6 = '" /><param name="NAME" value="'.
str7 = 'NICO'.
str8 = '" /><param name="LOGIN_NAMEu201D value=" '.
str9 = 'PISUPER </registration></asx:values></asx:abap>'.
CONCATENATE str1 str2 str3 str4 str5 str6 str7 str8 str9 INTO str.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = str
* MIMETYPE = ' '
* ENCODING =
IMPORTING
buffer = xstr1
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc = 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
data: device_id type SMMW_GUID.
data: s_mmw_xstring_data type S_MMW_XSTRING_DATA.
data: registered type BOOLEAN.
CALL FUNCTION 'REGISTER_DEVICE'
EXPORTING
xml_source = xstr1
IMPORTING
device_id = device_id
ev_x_xmldoc = s_mmw_xstring_data
registered = registered
EXCEPTIONS
registration_error = 1
error_others = 2
reg_clnt_server_config_differ = 3
OTHERS = 4.
I hope this would help you. please respond so for further clarifications.
Thanks & regards
Shweta Soni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, i try with your code and it isnt working.
First of all, in this code you declare str1 with 100, and later you write more than 100 characters.
Besides that, i change that to 200 and it isnt workign either.
All i got is this:
3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D38223F3E3C6173783A616261702020786D6C6E733A6173783D22687474703A2F2F7777772E7361702E636F6D2F61626170786D6C222076657273696F6E3D22312E305C223E3C6173783A76616C7565733E3C726567697374726174696F6E3E3C706172616D206E616D653D22504859534943414C5F4944222076616C75653D22363846323443324646344542464636433634394338343137344245363846424122202F3E3C706172616D206E616D653D22524753545241544E5F434E465F4944222076616C75653D223030304332394445464545453032444441364536
Translated to Text is:
<?xml version="1.0" encoding="utf-8"?><asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0\"><asx:values><registration><param name="PHYSICAL_ID" value="68F24C2FF4EBFF6C649C84174BE68FBA" /><param name="RGSTRATN_CNF_ID" value="000C29DEFEEE02DDA6E6
so as you can see, there is something wrong
I will try to resolve this, probably is something easy but i cant find out how to do anyway.
Thanks and Regards
Nicolas Eliaschev
Hi to all!
The problem is finally solved! But no fully solved :S
I get a response, the ev_x_xmldoc is giving me an xml, but the device_id is empty
I need it of course, so im working on how to get this parameter!
Thanks to all for the replys
Regards,
Nicolas Eliaschev
PS: The problem was the xml, not the xstring.
Hi Nicolas Eliaschev,
Sample code for Register Device
str1 = '<?xml version="1.0" encoding="utf-8"?><asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0\"><asx:values><registration><param name="PHYSICAL_ID" value="'.
str2 = physical_id.
str3 = '" />'.
str4 = '<param name="RGSTRATN_CNF_ID" value="'.
str5 = str_res.
str6 = '" /><param name="NAME" value="'.
str7 = device_name.
str8 = '" /><param name="DEVICE_TYPE" value="LAPTOP" />'.
str9 = '<param name="CLIENT_FRAMEWORK_TYPE" value="JSC" /><param name="CLIENT_FRAMEWORK_VERSION" value="710400"/></registration></asx:values></asx:abap>'.
CONCATENATE str1 str2 str3 str4 str5 str6 str7 str8 str9 INTO str.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = str
* MIMETYPE = ' '
* ENCODING =
IMPORTING
buffer = xstr1
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR: smmw_guid, s_mmw_xstring_data, registered.
CALL FUNCTION 'REGISTER_DEVICE'
EXPORTING
xml_source = xstr1
IMPORTING
device_id = device_id
ev_x_xmldoc = s_mmw_xstring_data
registered = registered
EXCEPTIONS
registration_error = 1
error_others = 2
reg_clnt_server_config_differ = 3
OTHERS = 4.
Regards,
Lakshman Balanagu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, i am trying with this source code, the length of the string is 255 top, so when i try to concatenate my string get truncated into this:
<?xml version="1.0" encoding="utf-8"?><asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0\<asx:values><registration><param name="PHYSICAL_ID" value="68F24C2FF4EBFF6C649C84174BE68FBA" /><param name="RGSTRATN_CNF_ID" value="000C29DEFEEE02DDA6E69FA
and i need to concatenate everything no just the first 255 characters.
How can i solve this?
Thanks
data: str type string.
data: str1(100).
data: str2(100).
data: str3(100).
data: str4(100).
data: str5(100).
data: xstr1 type xstring.
str1 = '<?xml version="1.0" encoding="utf-8"?><asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0\">'.
str2 = '<asx:values><registration><param name="PHYSICAL_ID" value="68F24C2FF4EBFF6C649C84174BE68FBA" />'.
str3 = '<param name="RGSTRATN_CNF_ID" value="000C29DEFEEE02DDA6E69FA499A3D0EE" />'.
str4 = '<param name="NAME" value="NICO" /><param name="LOGIN_NAME" value="PISUPER" />'.
str5 = '</registration></asx:values></asx:abap>'.
break pisuper.
CONCATENATE str1 str2 str3 str4 str5 INTO str .
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = str
* MIMETYPE = ' '
* ENCODING =
IMPORTING
buffer = xstr1
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*CLEAR: smmw_guid, s_mmw_xstring_data, registered.
data: device_id type SMMW_GUID.
data: s_mmw_xstring_data type S_MMW_XSTRING_DATA.
data: registered type BOOLEAN.
*" VALUE(DEVICE_ID) TYPE SMMW_GUID
*" VALUE(EV_X_XMLDOC) TYPE S_MMW_XSTRING_DATA
*" VALUE(REGISTERED) TYPE BOOLEAN
CALL FUNCTION 'REGISTER_DEVICE'
EXPORTING
xml_source = xstr1
IMPORTING
device_id = device_id
ev_x_xmldoc = s_mmw_xstring_data
registered = registered
EXCEPTIONS
registration_error = 1
error_others = 2
reg_clnt_server_config_differ = 3
OTHERS = 4.
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I believe you are mistaken.
If you are looking at this in the debugger, in the 'Fast Display' view mode, yes it displays only til 'FA'.
If you change the view mode set to 'Tabular', you will see all the 384 characters.
Atleast thats what I saw when I pasted the identical code into a report and ran it.
Edited by: Arjun Shankar on Jan 5, 2010 3:06 PM
Probably there is something wrong in my code. I change it to find out what is the problem.
I have xstr13 which i concatenate xstr10 & xstr11 & xstr12. I should be like this:
3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D38223F3E3C6173783A6162617020786D6C6E733A6173783D22687474703A2F2F7777772E7361702E636F6D2F61626170786D6C222076657273696F6E3D22312E305C3C6173783A76616C7565733E3C726567697374726174696F6E3E3C706172616D206E616D653D22504859534943414C5F4944222076616C75653D22363846323443324646344542464636433634394338343137344245363846424122202F3E3C706172616D206E616D653D22524753545241544E5F434E465F4944222076616C75653D22303030433239444546454545303244444136453639464134393941334430454522202F3E3C706172616D206E616D653D224E414D45222076616C75653D224E49434F22202F3E3C706172616D206E616D653D224C4F47494E5F4E414D45222076616C75653D225049535550455222202F3E3C2F726567697374726174696F6E3E3C2F6173783A76616C7565733E3C2F6173783A616261703E (768 characters)
But i get this:
3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D38223F3E3C6173783A6162617020786D6C6E733A6173783D22687474703A2F2F7777772E7361702E636F6D2F61626170786D6C222076657273696F6E3D22312E305C3C6173783A76616C7565733E3C726567697374726174696F6E3E3C706172616D206E616D653D22504859534943414C5F4944222076616C75653D22363846323443324646344542464636433634394338343137344245363846424122202F3E3C706172616D206E616D653D22524753545241544E5F434E465F4944222076616C75653D223030304332394445464545453032444441364536394641 (510 characters)
510 characters are 255 which is the max length of a xstring, so i cant do it longer than the max value.
If you make a report with this you will see that i am right.
I hope somebody can helkp me
Regards
Nicolas Eliaschev
*&---------------------------------------------------------------------*
*& Report ZTEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZTESTNICO.
data: str type string,
stra type string,
strb type string.
data: str1(100).
data: str2(100).
data: str3(100).
data: str4(100).
data: str5(100).
data: xstr10 type xstring,
xstr11 type xstring,
xstr12 type xstring,
xstr13 type xstring.
str1 = '<?xml version="1.0" encoding="utf-8"?><asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0\">'.
str2 = '<asx:values><registration><param name="PHYSICAL_ID" value="68F24C2FF4EBFF6C649C84174BE68FBA" />'.
str3 = '<param name="RGSTRATN_CNF_ID" value="000C29DEFEEE02DDA6E69FA499A3D0EE" />'.
str4 = '<param name="NAME" value="NICO" /><param name="LOGIN_NAME" value="PISUPER" />'.
str5 = '</registration></asx:values></asx:abap>'.
break pisuper.
CONCATENATE str1 str2 INTO str .
concatenate str3 str4 into stra.
strb = str5.
****************************************************
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = str
* MIMETYPE = ' '
* ENCODING =
IMPORTING
buffer = xstr10
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = stra
* MIMETYPE = ' '
* ENCODING =
IMPORTING
buffer = xstr11
EXCEPTIONS
failed = 1
OTHERS = 2.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = strb
* MIMETYPE = ' '
* ENCODING =
IMPORTING
buffer = xstr13
EXCEPTIONS
failed = 1
OTHERS = 2.
concatenate xstr10 xstr11 xstr13 into xstr12 in byte mode.
*CLEAR: smmw_guid, s_mmw_xstring_data, registered.
data: device_id type SMMW_GUID.
data: s_mmw_xstring_data type S_MMW_XSTRING_DATA.
data: registered type BOOLEAN.
*" VALUE(DEVICE_ID) TYPE SMMW_GUID
*" VALUE(EV_X_XMLDOC) TYPE S_MMW_XSTRING_DATA
*" VALUE(REGISTERED) TYPE BOOLEAN
CALL FUNCTION 'REGISTER_DEVICE'
EXPORTING
xml_source = xstr12
IMPORTING
device_id = device_id
ev_x_xmldoc = s_mmw_xstring_data
registered = registered
EXCEPTIONS
registration_error = 1
error_others = 2
reg_clnt_server_config_differ = 3
OTHERS = 4.
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Probably there is something wrong in my code. I change it to find out what is the problem. I have xstr13 which i concatenate xstr10 & xstr11 & xstr12. I should be like this:
3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D38223F3E3C6173783A6162617020786D6C6E733A6173783D22687474703A2F2F777777
2E7361702E636F6D2F61626170786D6C222076657273696F6E3D22312E305C3C6173783A76616C7565733E3C726567697374726174696F6E3E3C706172616D206E616D653D
22504859534943414C5F4944222076616C75653D22363846323443324646344542464636433634394338343137344245363846424122202F3E3C706172616D206E616D653D2
2524753545241544E5F434E465F4944222076616C75653D22303030433239444546454545303244444136453639464134393941334430454522202F3E3C706172616D206E616
D653D224E414D45222076616C75653D224E49434F22202F3E3C706172616D206E616D653D224C4F47494E5F4E414D45222076616C75653D225049535550455222202F3E3C2
F726567697374726174696F6E3E3C2F6173783A76616C7565733E3C2F6173783A616261703E (768 characters)
But i get this:
3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D38223F3E3C6173783A6162617020786D6C6E733A6173783D22687474703A2F2F777777
2E7361702E636F6D2F61626170786D6C222076657273696F6E3D22312E305C3C6173783A76616C7565733E3C726567697374726174696F6E3E3C706172616D206E616D653D
22504859534943414C5F4944222076616C75653D22363846323443324646344542464636433634394338343137344245363846424122202F3E3C706172616D206E616D653D2
2524753545241544E5F434E465F4944222076616C75653D223030304332394445464545453032444441364536394641 (510 characters)
510 characters are 255 which is the max length of a xstring, so i cant do it longer than the max value. If you make a report with this you will see that i am right.
I hope somebody can help me
Regards
Nicolas Eliaschev
*&---------------------------------------------------------------------*
*& Report ZTEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZTESTNICO.
data: str type string,
stra type string,
strb type string.
data: str1(100).
data: str2(100).
data: str3(100).
data: str4(100).
data: str5(100).
data: xstr10 type xstring,
xstr11 type xstring,
xstr12 type xstring,
xstr13 type xstring.
str1 = '<?xml version="1.0" encoding="utf-8"?><asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0\">'.
str2 = '<asx:values><registration><param name="PHYSICAL_ID" value="68F24C2FF4EBFF6C649C84174BE68FBA" />'.
str3 = '<param name="RGSTRATN_CNF_ID" value="000C29DEFEEE02DDA6E69FA499A3D0EE" />'.
str4 = '<param name="NAME" value="NICO" /><param name="LOGIN_NAME" value="PISUPER" />'.
str5 = '</registration></asx:values></asx:abap>'.
break pisuper.
CONCATENATE str1 str2 INTO str .
concatenate str3 str4 into stra.
strb = str5.
****************************************************
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = str
* MIMETYPE = ' '
* ENCODING =
IMPORTING
buffer = xstr10
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = stra
* MIMETYPE = ' '
* ENCODING =
IMPORTING
buffer = xstr11
EXCEPTIONS
failed = 1
OTHERS = 2.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = strb
* MIMETYPE = ' '
* ENCODING =
IMPORTING
buffer = xstr12
EXCEPTIONS
failed = 1
OTHERS = 2.
concatenate xstr10 xstr11 xstr12 into xstr13 in byte mode.
*CLEAR: smmw_guid, s_mmw_xstring_data, registered.
data: device_id type SMMW_GUID.
data: s_mmw_xstring_data type S_MMW_XSTRING_DATA.
data: registered type BOOLEAN.
*" VALUE(DEVICE_ID) TYPE SMMW_GUID
*" VALUE(EV_X_XMLDOC) TYPE S_MMW_XSTRING_DATA
*" VALUE(REGISTERED) TYPE BOOLEAN
CALL FUNCTION 'REGISTER_DEVICE'
EXPORTING
xml_source = xstr13
IMPORTING
device_id = device_id
ev_x_xmldoc = s_mmw_xstring_data
registered = registered
EXCEPTIONS
registration_error = 1
error_others = 2
reg_clnt_server_config_differ = 3
OTHERS = 4.
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Hi
just for clarification, you can find a sample XML string here:
[http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30e033a0-73ef-2b10-b291-b653c3b48385?quicklink=index&overridelayout=true]. (Page 19 in the article)
Thanks & Regards
Shweta Soni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
In REGISTER_DEVICE API, the parameter is XML_SOURCE refers to the XML String . The API expects a string of type "XSTRING" for which you can use the API - "ECATT_CONV_STRING_TO_XSTRING" . This API would convert the STRING to XSTRING, which can be further passed to the REGISTER_DEVICE API.
For further details you can visit the following thread:
Thanks & Regards
Shweta Soni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.