How to Change Infotype Data Using Standard Classes and Methods

  • by Rehan Zaidi, Senior SAP Technical Consultant
  • March 11, 2016
SAP provides a number of standard classes (and methods) for updating records in infotypes. Learn the detailed steps required to create new records in an infotype, delete a record, and change fields of an already-existing infotype record.
Learning Objectives

Reading this article, you will learn:

  • The main classes and methods needed for programming infotype updates
  • The detailed steps for inserting new records in standard and custom infotypes
  • How to search and delete employee records in an infotype
  • How to change certain fields for an existing infotype record for employees
Key Concept

Casting allows you to carry out assignments between two reference variables. Once the assignment is successful, the destination variable points to the same object pointed to by the source reference variable. The special casting operator ?= is used when the static type of the source variable is more general than the type of the destination variable.

In addition to reading data from employee infotypes, developers often need to offer the option of updating data in standard and custom infotypes. A number of techniques exist for doing so. These include obsolete techniques such as using Batch Data Communication (BDC) sessions as well as function modules, such as HR_INFOTYPE_OPERATION, that are not released for custom use. A more elegant and recommended approach is to use the standard classes provided by SAP to meet such requirements. This can be easily used by SAP ERP HCM developers, so having knowledge of these classes is absolutely essential.

I start with a brief introduction of the standard classes and methods that SAP provides for changing infotype data in custom programs, and then discuss the detailed steps required to insert records in an infotype. Next, I explain how you can use the standard methods to delete a single infotype record. Finally, I show how to modify an existing record in an infotype. Throughout the article, I use infotype 0006 (Addresses) as my example.

In my previous HR Expert article about infotypes, “How to Read Infotype Data Using Standard Classes and Methods,” I covered how to read data and infotype texts for an employee infotype. In this second installment, I show you how to update data in infotypes. This includes creating, deleting, and modifying an existing record in an infotype.

Note
The primary audience for this article is SAP HR developers and users. I provide coding examples and necessary screenprints to illustrate my points. Readers can easily adapt the coding examples used in this article to suit their requirements.

Rehan Zaidi

Rehan Zaidi is a consultant for several international SAP clients (both on-site and remotely) on a wide range of SAP technical and functional requirements, and also provides writing and documentation services for their SAP- and ABAP-related products. He started working with SAP in 1999 and writing about his experiences in 2001. Rehan has written several articles for both SAP Professional Journal and HR Expert, and also has a number of popular SAP- and ABAP-related books to his credit.

See more by this author


Comments

No comments have been submitted on this article. 


Please log in to post a comment.

To learn more about subscription access to premium content, click here.