Question:
Hello,
I've got the attributes to identify an specific object, but I have no object-key. How can I get the object-key using the attributes?
Thanks
Ben
Answer:
Could you please elaborate a bit more on your question, because with this info not a lot of people are able to help you.
From what I understand:
You think you have enough info to be able to identify a business object and probably want to use that BO. Either for testing.analysing problems, or for structural usage in a not yet built workflow.
For example finding out the object-key of BO EMPLOYEET
You only have partially the attribute PersonalData, this is basically BO PERSDATA. from this business object you only have the lastname.
Wht you then do is open PERSDATA in SWO1, position the cursor on the attribute LastName and then click on the button Program(CTRL+SHIFT+F3).
you'll then see the following:
GET_TABLE_PROPERTY PA0002.
DATA SUBRC LIKE SY-SUBRC.
* Fill TABLES PA0002 to enable Object Manager Access to Table Properties
PERFORM SELECT_TABLE_PA0002 USING SUBRC.
IF SUBRC NE 0.
EXIT_OBJECT_NOT_FOUND.
ENDIF.
END_PROPERTY.
Double click on perform SELECT_TABL_PA0002, you'll see that the perform uses a function which reads infotype 2 with key EMPLOYEENUBER (this is what you are lokking for). Further research will reveal that lastname is stored in table pa0002. If you then start se16 with pa0002 fill in the last name in field NACHN you have the employeenumber.
OR! you doubleclicked on the attribute lastname, there you find out that it has an abapdictionary reference for pa0002-nachn. Either way you also can find out what the employeenumber is.
Fill this in in BO EMPLOYEET and presto.
Regards, Rob Dielemans