cancel
Showing results for 
Search instead for 
Did you mean: 

How can I modify an infotype in ABAP using the new infotype framework?

jensupetersen
Participant
0 Kudos

Hello everyone,

I am running a report which (among others) does two things:

  • Update an infotype of employees
  • Launch a processes and forms workflow

For updating the infotype I am using FM HR_INFOTYPE_OPERATION.  Launching the P&F workflow comprises the method CL_HRASR00_PROCESS_EXECUTE=>IF_HRASR00_PROCESS_EXECUTE~INITIALIZE_FORM.

The problem is that these two things apparently require different infotype frameworks as described in note 493894. If the new infotype framework is active, HR_INFOTYPE_OPERATION dumps in method CL_HRPA_INFOTYPE_FACTORY=>SET_CONTEXT with exception "cx_hrpa_violated_precondition" (If you take a look at that method you will instantly see where the exception is being triggered. I see no way of preventing SET_CONTEXT being called, as FM HR_INFOTYPE_OPERATION does it on its own.)

If the old infotype framework is active, CL_HRASR00_PROCESS_EXECUTE=>IF_HRASR00_PROCESS_EXECUTE~INITIALIZE_FORM will dump in method CL_HRPA_MASTERDATA_FACTORY=>GET_BUSINESS_LOGIC with the same exception "cx_hrpa_violated_precondition". Again, one glance at the method will show you where the dump occurs.

See also note 1796396 to better understand my problem.

Since I need to start that P&F workflow, I understand that I need to find a way to change an infotype which uses the new infotype framework. But how? What is the alternative to FM HR_INFOTYPE_OPERATION? (If you answer with e.g. a method, please include enough information on its usage so I can figure out how to modify an infotype with it.)

Thank you in advance,

Jens

Accepted Solutions (1)

Accepted Solutions (1)

stuart_campbell
Active Contributor
0 Kudos

Hi Jens

There might be a way to update an infotype using New infotype framework in a similar way as you required but generally SAP provides (and only supports) specific tools and transactions to update infotypes like PA30 etc rather than by custom reports or free FM execution as you require in this case - you might take a look at transaction PUIT_UI - this transaction emulates the new infotype framework - therefore you may be able to isolate from this what is used to update infotypes in NITF

Worth noting in relation to your scenario the "HCM process and forms" product can both update infotypes (using new infotype framework) and use workflow - this would seem like the best approach to me

In general its recommended to use either the new infotype framework or old infotype framework not both - while it might be possible to use both in the same system but certainly there are no guarantees using it in the same session or step

Best wishes

Stuart


jensupetersen
Participant
0 Kudos

I think it all comes down to the question how to use the class CL_HRPA_INFOTYPE_0019 (seeing that it is infotype 19 that I would like to change). Unfortunately that class is far from being self-explanatory, and I fail to find any documentation. Only a few of its methods are already being used in existing code, too.

My biggest problem with that class is that its method CONVERT_CONTAINER_TO_PNNNN is protected so I see no way to actually get infotype payload data out of it (or into it for that matter).

stuart_campbell
Active Contributor
0 Kudos

Hi Jens

Its my understanding too that the old ITF the function module you mentioned is also marked as "not released" for use - although clearly the way around that is easier (depending on requirements) than in the new ITF

Worth noting that SAP has built a MSS application around infotype 0019 called "Reminder of Dates" - maybe this suit your needs or will reveal more

Best wishes

Stuart

jensupetersen
Participant

Hi Stuart,

it is true that this FM does not have the formal status "released". Unlike the average internal FM which is not supposed to be used by the public, however, HR_INFOTYPE_OPERATION has a detailed online documentation by SAP themselves, and as far as I know, it is the de-facto-standard when you ask anywhere how to modify an infotype from ABAP.

That being said, I embrace any alternative methods as long as they work and are easy enough to implement. I mean, what are we talking about here after all? Altering a single value in a table! Theoretically a simple UPDATE command could do it, although I agree that you should not modify SAP standard tables directly. But an interface to doing such a change should not be too hard to wield (otherwise we end up in the old discussion whether OO code is really better than old procedural code. When in conventional programming calling a simple FM with the data for the required change will do, I should not need to set up a complex web of objects and data references just to be able to achieve the same thing.)

That being said, I managed to solve my problem by re-using P&F code that our consultants implemented and that does it. Basically it uses interface IF_HRPA_MASTERDATA_BL and classes CL_HRPA_MASTERDATA_FACTORY and CL_HRPA_INFOTYPE_CONTAINER. Two classes, one interface and lots of data objects to set up just to replace one FM... horrible IMHO. I cannot even claim to completely have understood the coding (I probably could if I tried hard enough, but I will not get my work done if I invest hours on every single field I modify), but copy&paste with a few adjustments worked well enough.

Thank you for your support!

Answers (0)