on 03-10-2011 2:14 AM
Hi all, I would like to know how to do the context binding for infotype. I know binding with table and it works well. But I have tried the HR infotype and it failed.
Regards,
YC
Hi YC,
it's been a long time since I've replied to any forum posts, but the title of yours just called out to me...
Firstly - are you trying to just display the infotype data? Or are you doing an update?
In either case you should have a look at the decoupled infotype framework. This framework has been built to allow developers a way to access infotype data in a consistent manner that allows for a decoupling of the business logic associated with infotypes and the display logic.
Each infotype may well have a "conversion class" associated - and may even have different business logic which could depend on the country that the person is from - this could even do things like read an associated secondary infotype that is specific to that country... It's not just select * from PAnnnn
One advantage of abstracting yourself this far is that you can then use standard logic and configuration to change which fields are display only, required, etc. (that said even SAP don't yet properly implement the whole logic in their ESS implementation (as of EhP4, interested to see what EhP5 holds). At the very least - when you read the data use the newer class based methods.
To read PA data use the class CL_HRPA_MASTERDATA_FACTORY to get yourself an instance of IF_HRPA_READ_INFOTYPE (if you want to just read the data). Then use the methods of that interface to get access to your data - and then map the structures into your context.
Personally, I've never mapped a straight infotype into a context - I can't understand why you'd want to. Contexts should be about data that you are going to use to display to your user, or control the views of data that your user sees. There are many fields in a standard infotype structure that the user does not care about - or in many cases shouldn't even see.
Rather - build your own structure and use this for the context. Within your assistance class (or another helper class) retrieve the infotype data using the classes/methods above and then just populate the structure with the bits you need.
There are other methods for reading/updating OM/PD data and yet more for time based data (although that is horrible code).
Good luck - and given the small number of posts against your name - Welcome to SDN!
Cheers,
Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
To read data from an infotype for example pa0001
DATA lt_0001 type TABLE OF p0001.
DATA ls_0001 type p0001.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
TCLAS = 'A'
pernr = '10339'
infty = '0001'
BEGDA = sy-datum
ENDDA = sy-datum
tables
infty_tab = lt_0001
EXCEPTIONS
INFTY_NOT_FOUND = 1
OTHERS = 2 .
To bind the output to a table ui element create a node
<Node_Name> of cardinality (0..n or 1..n) with dictionary Structure p0001 and bind the node to the datasource property of table UI element.
If we create a internal table of type pa0001, then data in the infortype will not be fetched correctly using the hr_read_infotype.
Always create internal table using the structure type of the Infotype (eg: For pa0001, its corresponding structure is p0001).
Regards,
Bala Baskaran.S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI ,
Try using the structures P0000,P0001 etc for infotypes.
For table structures, set the cardinality accordingly.
Thanks,
Aditya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.