FM To get managers name in HR-ABAP
Hi Experts,
The scenario is this, we have two Org units A and B, the orgunit B comes under A.
I have orgunit B's number, with that I want to find its managers name.
If that org unit B doesn't have any manager, then it should automatically give us the manager name of orgunit A.
Please let me know are there any Function module to do this.
Thanks in Advance,
Nivash.
HI try to use this.....
DATA : v_objid LIKE hrp1001-objid,
v_sobid LIKE hrp1001-sobid,
v_pernr LIKE pa0001-pernr,
v_first LIKE pa0002-nachn,
v_last LIKE pa0002-vorna,
v_name LIKE pa0002-nachn,
v_date type datum.
*To fetch Selection Screen Date.
v_date = pn-begda.
refresh it_hrp1001.
SELECT begda objid subty sobid FROM hrp1001
INTO corresponding fields of table it_hrp1001
WHERE objid = p0001-plans
AND subty = 'A002'
AND begda LE v_date.
if not it_hrp1001[] is INITIAL.
SORT it_hrp1001 BY begda DESCENDING .
LOOP AT it_hrp1001 INTO wa_hrp1001.
v_objid = wa_hrp1001-objid.
ON CHANGE OF v_objid.
v_sobid = wa_hrp1001-sobid.
ENDON.
CLEAR : wa_hrp1001,v_objid.
ENDLOOP.
*Concatinating First Name And Last Name
SELECT single pernr FROM pa0001
INTO v_pernr
WHERE plans = v_sobid.
SELECT single vorna nachn FROM pa0002
INTO (v_first, v_last)
WHERE pernr = v_pernr.
CONCATENATE v_first v_last INTO g_mname SEPARATED BY space.
clear: v_objid,
v_sobid,
v_pernr,
v_first,
v_last,
wa_hrp1001.
endif.
Thanks
Rahul
Similar Messages
-
Getting the name of the program or the FM called from security audit log
Dears,
Is there a way to get the name of the ABAP program called through transaction SE38, or the FM called through transaction SE37, from the security audit log ?
What is available is only : RSABAPPROGRAM for transaction SE38, and RSFUNCTIONBUILDER for transaction SE37
Thanks.
RedaI had always assumed this log to be in the SUBMIT statement, but never used it.
If I remember correctly this is recorded it the runtime submit, so it should be there.
Perhaps it is only in selected reports? I will check in my system.
Please compare with sm20n and run the report from sa38. The submits are different in sa38 etc compared to se38.
The FM will only be recorded it it has a destination extention in the source system which is mostly remote. Local fm calls are not recorded for sure.
Cheers,
Julius
Edited by: Julius Bussche on Jul 26, 2011 11:32 PM -
Table Name where the ABAP program names get stored
Can any 1 tell me the table name where the ABAP programs get stored
try TRDIR,TRDIRT,TADIR
regards
shiba dutta -
How to get the name of a Data Element of a generic Table!
Hi guys!
In my function i have the following import paramenter
i_outtab type standard table
now i import a table and i want to get the dataelement of the fields.
is there a way to do this??Hello Thomas
Perhaps the following sample report may be useful for you.
*& Report ZUS_SDN_RTTI_STRUCT_COMPONENTS
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1145711"></a>
*& Thread: How to get the name of a Data Element of a generic Table!
REPORT zus_sdn_rtti_struct_components.
TYPE-POOLS: abap.
TYPES: BEGIN OF ty_s_outtab.
TYPES: bukrs TYPE bukrs.
TYPES: kunnr TYPE kunnr.
TYPES: END OF ty_s_outtab.
DATA: gdo_data TYPE REF TO data.
DATA: gs_outtab TYPE ty_s_outtab.
DATA: go_typedescr TYPE REF TO cl_abap_typedescr,
go_structdescr TYPE REF TO cl_abap_structdescr,
go_datadescr type ref to cl_abap_datadescr.
DATA: gs_comp TYPE abap_compdescr,
gd_dtel type string,
gt_dfies type ddfields.
FIELD-SYMBOLS:
<gs_struct> TYPE ANY.
START-OF-SELECTION.
BREAK-POINT.
GET REFERENCE OF gs_outtab INTO gdo_data.
ASSIGN gdo_data->* TO <gs_struct>.
go_typedescr = cl_abap_typedescr=>describe_by_data( <gs_struct> ).
go_structdescr ?= go_typedescr.
BREAK-POINT.
LOOP AT go_structdescr->components INTO gs_comp.
go_datadescr = GO_STRUCTDESCR->GET_COMPONENT_TYPE( gs_comp-name ).
gd_dtel = go_datadescr->get_relative_name( ).
write: / syst-tabix, 'Data element =', gd_dtel.
ENDLOOP.
END-OF-SELECTION.
Regards
Uwe -
How to get Manager name of a particular BP/User from territory management
Hi Guys,
I want to retrieve the Manager name of a particular BP/User from territory management. The manager might be in any territory hierarchy level above the user.
Please guide.
Regards,
ShailiHi Shailip,
Basically Territory hierarchy is customized based on client's business, from your reply if i understood properly i think your territory has 3 levels and
First level : District
Second level: Area
Third level: Branch
when an employee at third level is passed, you need employees assigned to area and district levelwhich are above Branch(in your case managers)
Solution: Example
First level : District - territory length(2 char)
Second level: Area - - territory length(4 char)
Third level: Branch- territory length(4 char)
1. Read the territory hierarchy(which is customized to meet clients requirement) using function module
CRM_TERRMAN_TERRLEVEL_READ ehich gives territory levels with territory length and territory offset
2. pass employee(business partner number) to FM CRM_TERRMAN_TERR_EMP_DETERMINE and get the branch path id.
3. Based on territory length for above levels drill down to Area's path id and District's path id and pass those path id's to
FM CRM_TERRMAN_EMPLOYEE_DETERMINE to get managers.
Hope this helps.
Thanks,
Priyanka -
WAD: How-to get query name and pass to URL
Hi,
The task: In a BI 7.0 web template - get the technical query name and use that to open a URL in the format http://<MYURL>&DOCUMENTATION=<QUERYNAME>. So:
1) User clicks an icon
2) Get technical name of query
3) Open the documentation for that query using a URL
How can this be done? Do I have to use the Custom Extension web item and implement a new class using the interface IF_BICS_CONS_WEBITEM_CUST_EXIT? If so, do you have an example of how this can be done? OR even better is there an easier way to accomplish this?
Thanks in advance,
JacobHi Daniel,
you could get the query name in ABAP code, also. Here is a snippet from the execute method. The Query name should be in l_sx_view at the end.
best regards
Arne
TYPE-POOLS:
rrx1.
DATA:
l_string TYPE string,
l_xml TYPE string,
l_xml_xstring TYPE xstring,
l_sx_view TYPE rrx1_sx_view,
* Line Feed, CR
c_lf TYPE string,
l_h_lf(2) TYPE x VALUE '0D0A',
l_r_conv TYPE REF TO cl_abap_conv_in_ce.
* Get the line feed and carriage return for unicode
l_r_conv = cl_abap_conv_in_ce=>create( input = l_h_lf ).
l_r_conv->read( IMPORTING data = c_lf ).
DATA:
l_t_data_providers TYPE cl_bics_cons_webitem_util=>tn_t_data_provider,
l_s_data_providers TYPE cl_bics_cons_webitem_util=>tn_s_data_provider,
l_r_variable_container TYPE REF TO if_ixml_node.
CLEAR e_xml.
TRY.
* All data passed to the webitem exit is hold in I_XML using XML.
* The XML is UTF-8 encoded. You can convert the UTF-8 xstring
* to a simple ABAP string by calling the following method:
* ==================================================================
CALL METHOD cl_bics_cons_webitem_util=>utf8_xstring_2_string
EXPORTING
i_utf8_xstring = i_xml
RECEIVING
r_string = l_xml.
* The XML includes sections about the used data provider and about the
* variable container. The following method parses the XML and
* provides the IF_IXML_NODE instances for data providers and for the
* variable container.
* ==================================================================
CALL METHOD cl_bics_cons_webitem_util=>parse_xml
EXPORTING
i_xml = i_xml
IMPORTING
e_t_data_providers = l_t_data_providers
e_r_variable_container = l_r_variable_container.
* 01 Get name of first Data Provider
READ TABLE l_t_data_providers INDEX 1 INTO l_s_data_providers.
CALL TRANSFORMATION bics_cons_webitem_filter_by_dp
PARAMETERS dataprovider = l_s_data_providers-name
SOURCE XML i_xml
RESULT XML l_xml_xstring.
CALL METHOD cl_bics_cons_state_converter=>convert_xml
EXPORTING
i_xml = l_xml_xstring
IMPORTING
e_sx_view = l_sx_view. -
How to get he names of all the local drives that are present in hdd
Hi ABAP Experts,
I want to get the names of all the local drives that are present in hdd on local system using
ABAP. Is this technically possible. If so how.
Thanks & Regards,
Aexandr CiunchikHi Alexandr,
My workaround.
REPORT zztest.
DATA : len TYPE i,
off TYPE i,
directory TYPE string,
result(1).
len = STRLEN( sy-abcde ).
DO len TIMES.
off = sy-index - 1.
CONCATENATE sy-abcde+off(1) ':' INTO directory.
CONDENSE directory NO-GAPS.
CALL METHOD cl_gui_frontend_services=>directory_exist
EXPORTING
directory = directory
RECEIVING
result = result
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
not_supported_by_gui = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF result EQ 'X'.
WRITE : / 'Drive : ',
directory.
ENDIF.
ENDDO.
Regards,
AS -
GET FILE NAME C:\temp\ADIBO.txt
Hi,
How to get file name?
I used Get_File_NAME, but I'am getting an error.
lv_lfilename is not the type LOGICAL_FILENAME
C:\temp\ADIBO.txt
I need to get ADIBO ??
tnh, Adibo..:)
I am using this code to download file and after that I need to get FILE_NAME:
DATA: lv_lfilename TYPE string.
PARAMETERS:
pa_lfile TYPE zlocalfile
DEFAULT 'C:temp'.
CONCATENATE pa_lfile ''INTO lv_lfilename.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lv_lfilename
filetype = 'ASC'
TABLES
data_tab = it_billit_down.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.Hii..
You have to Maintain the Logical filenames and their Physical Paths in Tcode FILE.
Then create a program like this..
REPORT ZSEL_FILES1.
DATA : V_LOGFILE TYPE STRING.
DATA :V_PHYFILE TYPE STRING.
DATA : ITAB TYPE TABLE OF SCARR.
START-OF-SELECTION.
SELECT * FROM SCARR INTO TABLE ITAB.
**To get the Physical file based on the Logical file names - Maintained in Tcode FILE
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
CLIENT = SY-MANDT
LOGICAL_FILENAME = VlOGFILE
OPERATING_SYSTEM = SY-OPSYS
PARAMETER_1 = ' '
PARAMETER_2 = ' '
PARAMETER_3 = ' '
USE_PRESENTATION_SERVER = ' '
WITH_FILE_EXTENSION = ' '
USE_BUFFER = ' '
ELEMINATE_BLANKS = 'X'
IMPORTING
EMERGENCY_FLAG =
FILE_FORMAT =
FILE_NAME = V_PHYFILE
EXCEPTIONS
FILE_NOT_FOUND = 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.
**To download the file to PC.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = V_PHYFILE
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = ITAB
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
<b>reward if helpful</b> -
HP ePrint from excel add-in: Error while getting driver name for printer
Trying to use add-in for ePrint from excel/word I get, "error while getting driver name for printer \\...HP DesignJet 800PS 42 by HP," with an option to select "OK" and that same message repeats with each printer in our network, and then it doesn't allow me to print using the add-in. However, I can print normally to HP Go Web, open up Print and Share, then print it from there. This happens with excel and word. I have Office Suite 2007.
Hello modameister,
Sorry you are having issues with this printer and the ePrint add-on. There are a couple of questions I would like you to answer please.
1. What operating system are you using? (XP,VISTA,7,MAC OS X)
2. What and how much data are you trying to print?
3. Have you tried to copy and paste the data into a different application or tried using the snip it tool?
4. Are you receiving any .dll errors (mscms.dll)
Thanks
If I have solved your issue, please feel free to provide kudos and make sure you mark this thread as solution provided!
Although I work for HP, my posts and replies are my own opinion and not those of HP. -
Cisco Unity 7: Voice mail cann't get the name or Number phone of the caller
Hi,
I have installed Cisco Unity Messaging Unified version 7 and integrated with Exchange 2010.
I have two scenario, and I want to know if are normal or not:
1. If the 2 IP phones are subscribed with Cisco Unity: the first IP phone call the other IP phone and let a voice mail. When the second IP phone check his message vocal it can get the name of the caller or his number phone (the message is: You have One message from XXXX) and he get e-mail as objet: Voice Mail from XXXX.
2. If one IP phone is not subscriber with cisco unity call other Ip phone subscribed with cisco unity and let him a voice mail. The second IP phone when check his message vocal it can’t get the name of the caller or his number phone: The message is: You have one voice mail xxxx; without indicate from!! and he get a e-mail as object: Voice mail from Unknown.
Please, I want to know if the second scenario is normal ? if not, who to resolve this problem? I want that he indicate the number of caller same he isn't subscriber with cisco unity?
Thanks a lot,
Best regards,
Omar YUNSISo for the 2nd scenerio you would want to check what your Message Subjects were set to. For Unity 7 open Web SA, click Configuration and then Message Subjects. Make sure that the Outside Caller Message has %CALLERID% in it somewhere. The value %CALLERNAME% will return unknown if we do not receive a name from the PSTN.
Try setting the Outside Caller Message to:
%U% %P% Voice Message from %CALLERID%
and that should get you your desired results.
The default Message subject is:
%U% %P% Voice Message from %CALLERNAME% (%CALLERID%). So with that it would say Voice Message fom Unknown (xxxx) if it was not able to determine the name of the user which is usually normal from a PSTN call.
Just to note, the From address is always going to say from Unity Messaging System, it will only be the subject that has the extension in it.
Bryan -
Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group. Through this memberof class I am trying to find full qualified name(DN) of my group.
code I have used:
//specify the LDAP search filter
String searchFilter = "(&(objectClass=user)(CN=Username))";
//Specify the Base for the search
String searchBase = "";
Also I have used,
String searchFilter = "(&(objectClass=user)(CN=Username))";
//Specify the Base for the search
String searchBase = "ou=ibmgroups,o=ibm.com";
But in both cases I am getting value for Total groups as 0.
Code Reference:
* memberof.java
* December 2004
* Sample JNDI application to determine what groups a user belongs to
import java.util.Hashtable;
import javax.naming.*;
import javax.naming.ldap.*;
import javax.naming.directory.*;
public class memberof {
public static void main (String[] args) {
Hashtable env = new Hashtable();
String adminName = "CN=Administrator,CN=Users,DC=ANTIPODES,DC=COM";
String adminPassword = "XXXXXXX";
String ldapURL = "ldap://mydc.antipodes.com:389";
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
//set security credentials, note using simple cleartext authentication
env.put(Context.SECURITY_AUTHENTICATION,"simple");
env.put(Context.SECURITY_PRINCIPAL,adminName);
env.put(Context.SECURITY_CREDENTIALS,adminPassword);
//connect to my domain controller
env.put(Context.PROVIDER_URL,ldapURL);
try {
//Create the initial directory context
LdapContext ctx = new InitialLdapContext(env,null);
//Create the search controls
SearchControls searchCtls = new SearchControls();
//Specify the search scope
searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
//specify the LDAP search filter
String searchFilter = "(&(objectClass=user)(CN=Andrew Anderson))";
//Specify the Base for the search
String searchBase = "DC=antipodes,DC=com";
//initialize counter to total the group members
int totalResults = 0;
//Specify the attributes to return
String returnedAtts[]={"memberOf"};
searchCtls.setReturningAttributes(returnedAtts);
//Search for objects using the filter
NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
//Loop through the search results
while (answer.hasMoreElements()) {
SearchResult sr = (SearchResult)answer.next();
System.out.println(">>>" + sr.getName());
//Print out the groups
Attributes attrs = sr.getAttributes();
if (attrs != null) {
try {
for (NamingEnumeration ae = attrs.getAll();ae.hasMore();) {
Attribute attr = (Attribute)ae.next();
System.out.println("Attribute: " + attr.getID());
for (NamingEnumeration e = attr.getAll();e.hasMore();totalResults++) {
System.out.println(" " + totalResults + ". " + e.next());
catch (NamingException e) {
System.err.println("Problem listing membership: " + e);
System.out.println("Total groups: " + totalResults);
ctx.close();
catch (NamingException e) {
System.err.println("Problem searching directory: " + e);
Any help will be highly appreciated.Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group. Through this memberof class I am trying to find full qualified name(DN) of my group.
code I have used:
//specify the LDAP search filter
String searchFilter = "(&(objectClass=user)(CN=Username))";
//Specify the Base for the search
String searchBase = "";
Also I have used,
String searchFilter = "(&(objectClass=user)(CN=Username))";
//Specify the Base for the search
String searchBase = "ou=ibmgroups,o=ibm.com";
But in both cases I am getting value for Total groups as 0.
Code Reference:
* memberof.java
* December 2004
* Sample JNDI application to determine what groups a user belongs to
import java.util.Hashtable;
import javax.naming.*;
import javax.naming.ldap.*;
import javax.naming.directory.*;
public class memberof {
public static void main (String[] args) {
Hashtable env = new Hashtable();
String adminName = "CN=Administrator,CN=Users,DC=ANTIPODES,DC=COM";
String adminPassword = "XXXXXXX";
String ldapURL = "ldap://mydc.antipodes.com:389";
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
//set security credentials, note using simple cleartext authentication
env.put(Context.SECURITY_AUTHENTICATION,"simple");
env.put(Context.SECURITY_PRINCIPAL,adminName);
env.put(Context.SECURITY_CREDENTIALS,adminPassword);
//connect to my domain controller
env.put(Context.PROVIDER_URL,ldapURL);
try {
//Create the initial directory context
LdapContext ctx = new InitialLdapContext(env,null);
//Create the search controls
SearchControls searchCtls = new SearchControls();
//Specify the search scope
searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
//specify the LDAP search filter
String searchFilter = "(&(objectClass=user)(CN=Andrew Anderson))";
//Specify the Base for the search
String searchBase = "DC=antipodes,DC=com";
//initialize counter to total the group members
int totalResults = 0;
//Specify the attributes to return
String returnedAtts[]={"memberOf"};
searchCtls.setReturningAttributes(returnedAtts);
//Search for objects using the filter
NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
//Loop through the search results
while (answer.hasMoreElements()) {
SearchResult sr = (SearchResult)answer.next();
System.out.println(">>>" + sr.getName());
//Print out the groups
Attributes attrs = sr.getAttributes();
if (attrs != null) {
try {
for (NamingEnumeration ae = attrs.getAll();ae.hasMore();) {
Attribute attr = (Attribute)ae.next();
System.out.println("Attribute: " + attr.getID());
for (NamingEnumeration e = attr.getAll();e.hasMore();totalResults++) {
System.out.println(" " + totalResults + ". " + e.next());
catch (NamingException e) {
System.err.println("Problem listing membership: " + e);
System.out.println("Total groups: " + totalResults);
ctx.close();
catch (NamingException e) {
System.err.println("Problem searching directory: " + e);
Any help will be highly appreciated. -
I have done extensive programming with the SQL Toolkit with LabVIEW versions through 6.1. My customer now wants to upgrade to Windows 7, so I am trying to upgrade to LabVIEW 2009 (my latest purchased version) using the Database Connectivity Toolkit, and the SQL Toolkit Compatibility vis. Everything seemed to be going okay with the higher level SQL operations, but I ran into trouble with the Get Column Name.vi.
The pictures below show the problem. The original SQL Toolkit connected the Prepare SQL.vi with the Get Column Name.vi with a cluster of two references, one for connection, and one for sql. The new compatibility vis have a class conflict in the wire because the Prepare SQL.vi contains a cluster with connection, and command references, but the Get Column Name.vi expects a cluster with connection and recordset references.
How do I resolve this conflict?
Thank You.
DanI've never worked with the old version of the toolkit, so I don't know how it did things, but looking inside the SQL prep VI, it only generates a command, and the the column name VI wants a recordset. I'm not super familiar with all the internals of ADO, but my understanding is that is standard - you only have the columns after you execute the command and get the recordset back. What you can apparently do here is insert the Execute Prepared SQL VI in the middle and that will return what you need.
I'm not sure why it worked before. Maybe the execute was hidden inside the prep VI or maybe you can get the column names out of the command object before execution. In general, I would recommend considering switching to the newer VIs.
Try to take over the world! -
Any Function module or BAPIs are available to get scheme name for the inter
I have internal order no value in table AUFK-AUFNR , and the internal order corresponding Scheme value is available in IMPR-PRNAM . Now I want to inner join both the tables to extract the data , but there is no common field . Is there any Function module or BAPIs are available to get scheme name for the internal orders?
look at DB-VIEW "V_IVP_OR".
Regards,
Laurent -
How to get the name and value of an attribute on a node/element that is not a child
Hello,
Can someone shed some wisdom on how I can compare 2 xml nodes for differences.
My main challenge is I need to use the attributes/values of 'ProductDescription' and 'Features' as 'key' to identify the same node in
another doc with the same layout, but different content.
I am having trouble getting the name of the attribute on the node, 'ProductDescription' and 'Features'. I can only seem to get the node names, but not the attributes on the node. I need the name, because it can be different from doc to doc, so
I can't hardcode this.
Can someone please help with how to retrieve an attribute name/value on a node that is not a child. Here's an example of what
my xml looks like:
DECLARE
@myDoc1 xml
,@mydoc2 xml
DECLARE
@ProdID int
SET @myDoc1 ='<ProductDescription ProductID="1" ProductName="Road Bike">
<Features featureID = "1" featureName = "body">
<Warranty>1 year parts and labor</Warranty>
<Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
</Features>
<features featureID = "2" featureName = "seat">
<Warranty>1 year parts and labor</Warranty>
<Maintenance>2 year parts and labor extended maintenance is available</Maintenance>
</Features>
</ProductDescription>
SET @myDoc2 ='<ProductDescription ProductID="1" ProductName="Road Bike">
<Features featureID = "1" featureName = "body">
<Warranty>2 year parts and labor</Warranty>
<Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
</Features>
<features featureID = "2" featureName = "wheel">
<Warranty>1 year parts and labor</Warranty>
<Maintenance>2 year parts and labor extended maintenance is available</Maintenance>
</Features>
</ProductDescription>
I need to compare the attributes of 'ProductDescription' and 'Features' from @mydoc1 against @mydoc2 to see if they are the same based on those 2 nodes first. If they are, then i want to show the difference in the child elements.
This will eventually be an outer join to give me the differences betw the 2 docs based on those key values (node attributes).
I used node('//*') for the path, and value('local-name(../.)', 'varchar(50)') as element
,value('.[not(@xsi:nil = "true")]','VARCHAR(255)') AS new_value
...etc...
but that only gives me the node names, and the child elements. It does not give me back the attribute names and values from the node itself.
Thanks in advance for your help.
ceeAre you looking for something like this:
DECLARE @myDoc1 xml
SET @myDoc1 ='<ProductDescription ProductID="1" ProductName="Road Bike">
<Features featureID = "1" featureName = "body">
<Warranty>1 year parts and labor</Warranty>
<Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
</Features>
<Features featureID = "2" featureName = "seat">
<Warranty>1 year parts and labor</Warranty>
<Maintenance>2 year parts and labor extended maintenance is available</Maintenance>
</Features>
</ProductDescription>'
SELECT T.c.value('local-name(.)', 'nvarchar(50)') AS name,
T.c.value('.', 'nvarchar(50)') AS value
FROM @myDoc1.nodes('ProductDescription/@*') AS T(c)
Erland Sommarskog, SQL Server MVP, [email protected] -
after I burn the files to dvd and load to view the name does not appear. How do I get the name listed to appear on the burn disk instead of the file number?
Naming the Photo - or giving it a title - is not the same as naming file.
How are you burning to dvd? With iPhoto? If so then the Title will be available in any app that understands basic metadata.
If you want the title available in the Finder - which does not understand photo metadata - then you'll need to export the file
File -> Export
In the resulting dialogue you'll see a heading for 'File Name'. Choose 'Use Title' from the drop down.
Regards
TD
Maybe you are looking for
-
How to handle parked message in BPM?
Hi, I have a scenario that buyer as R3 send PO(same PO number) change idoc multiple times into bpm without receiving PO change confirmation(from seller, non R3) yet, I have a loop in bpm to handle this case, the loop checks the condition whether conf
-
Copy and paste don't work in MIAW
I have a field member in an MIAW and even though the field editable is TRUE and I can select text or type text at the cursor, I can't copy and paste within the field. Shouldn't I be able to? Craig Wollman Lingo Specialist Word of Mouth Productions 21
-
Workflow triggered. but workitem missing
Hi , Following is my problem Workflow is triggered. when displayed workitem from SWI1 , the dialogue workitem status is ready in user's inbox. But the user is unable to see the workitems in his inbox. Please Note: The workitem has been farwarded to
-
Keeping latest entries when syncing iCal and iPhone
Hello, Is there a way I can *keep my latest entries* on iCal (be them on my iPhone or MacBook Pro) rather choosing one device's entries to replace the others? Thank you, Nando. Message was edited by: Icenando
-
Hi I recently downloaded the cs5 trial after using cs4 for a while but all of the fonts now appear blurry when i type but if i open a document made in cs4 the fonts are fine. Any help?