• No results found

Importing Cluster T

In document HR350 (Page 177-183)

Importing Data with Buffer

Exercise 8: Importing Cluster T

Exercise Objectives

After completing this exercise, you will be able to:

• Import and display the texts stored in the cluster, TX, for the infotype, 0040

Business Example

All the components of the HR system have been implemented at your company, Caliber A Bicycle. The company wants to use the special features of report programming within Human Resources. The departments at your company require a report that gives you an overview of the resources loaned to employees. This information is stored in the Objects on Loan infotype.

Task:

Write a report that lists only the employees who have received objects on loan. The report will also print the explanations that are entered by the administrator in the text fields.

1. The created list should contain the following information for each employee: Personnel number

Name Start date End date Number

Type of object on loan Description of object on loan

Take the name of the employee from the PERNR-ENAME field. The object on loan corresponds to the subtype for the infotype, 0040. To determine the subtype text, which is the description of the object on loan, read the table, T591S, with the keys, infotype and subtype. Display only the first 20 characters of the employee name and the subtype text.

The include program, RPC1TX00, contains the key for the cluster, TX, which consists of the fields for the structure, PSKEY. The data object for the cluster is the table, PTEXT, with the lines, LINE. Process the

Continued on next page

Continued on next page

Unit 5: Cluster Database Tables in HR HR350

table, P0040, with the LOOP...ENDLOOP so that the unchanged start and end dates for the infotype records are in the header. If the field, P0040-

ITXEX, is not blank, an explanatory text, which is stored in the cluster, TX,

is entered for the infotype record. If this is the case, enter the key and import the cluster, TX. If the return code for the import is not zero, display an error message.

Continued on next page

Solution 8: Importing Cluster TX

Task:

Write a report that lists only the employees who have received objects on loan. The report will also print the explanations that are entered by the administrator in the text fields.

1. The created list should contain the following information for each employee: Personnel number

Name Start date

End date Number

Type of object on loan Description of object on loan

Take the name of the employee from the PERNR-ENAME field. The object on loan corresponds to the subtype for the infotype, 0040. To determine the subtype text, which is the description of the object on loan, read the table,

T591S, with the keys, infotype and subtype. Display only the first 20

characters of the employee name and the subtype text.

The include program, RPC1TX00, contains the key for the cluster, TX, which consists of the fields for the structure, PSKEY. The data object for the cluster is the table, PTEXT, with the lines, LINE. Process the table, P0040, with the LOOP...ENDLOOP so that the unchanged start and end dates for the infotype records are in the header. If the field, P0040-ITXEX, is not blank, an explanatory text, which is stored in the cluster, TX, is entered for the infotype record. If this is the case, enter the key and import the cluster, TX. If the return code for the import is not zero, display an error message. a) REPORT zpsol060. TABLES: pernr, pcl1, pcl2, t591s. "Subtype Table INFOTYPES: 0001, "Org.Assignment 0040. "ObjectsonLoa

INCLUDE: rpc1tx00. "Definition Cluster T

INCLUDE: rpppxd00. "Buffer-Definition (I

Continued on next page

08-01-2004 ©2003 SAP AG. All rights reserved. Continued on next page

Unit 5: Cluster Database Tables in HR HR350

DATA: BEGIN OF COMMON PART buffer. INCLUDE: rpppxd10.

DATA: END OF COMMON PART buffer. GET pernr.

rp_provide_from_last p0001 space pn-begda pn-endda. LOOP AT p0040 WHERE endda GE pn-begda

AND begda LE pn-endda. PERFORM read_t591s USING p0040-infty p0040-subty. PERFORM print_data. IF NOT p0040-itxex IS INITIAL. PERFORM read_cluster. PERFORM print_cluster. ENDIF. ENDLOOP. END-OF-SELECTION.

FORM READ_T591S

Read Subtype Texts

FORM read_t591s USING info_type sub_type. CHECK t591s-sprsl NE sy-langu

OR t591s-infty NE info_type OR t591s-subty NE sub_type. SELECT SINGLE * FROM t591s

WHERE sprsl = sy-langu AND infty = info_type AND subty = sub_type. ENDFORM.

FORM PRINT_DATA FORM print_data.

FORMAT INTENSIFIED ON. WRITE: / pernr-pernr, (20) p0001-ename, p0040-begda, p0040-endda, p0040- anzkl, p0040-leihg, (20) t591s-stext. FORMAT INTENSIFIED OFF.

ENDFORM.

* ---

* FORM READ_CLUSTER

Continued on next page

Continued on next page

££? 142

© 2003 SAP AG. All rights reserved. 08-01-2004

"Buffer-Definition (II)

* *

* --- * Read Cluster TX * --- FORM read_cluster. CLEAR tx-key. MOVE-CORRESPONDING p0040 TO tx-key. rp-imp-c1-tx IF sy-subrc NE 0

WRITE: / ’Cluster TX was deleted.’(001). ENDIF. ENDFORM. * --- * FORM PRINT_CLUSTER * --- FORM print_cluster. SKIP. LOOP AT ptext. WRITE: / ptext-line. ENDLOOP. SKIP. ENDFORM. *-- Subroutines INCLUDE: rpppxm00. "Buffer subroutines

Continued on next page

08-01-2004 © 2003 SAP AG. All rights reserved.

143 E^

Unit 5: Cluster Database Tables in HR HR350

Lesson Summary

You s h o u l d now be able to:

• Import/export data using macros • Import/export data using buffers

Continued on next page

Lesson: Payroll Results

In document HR350 (Page 177-183)

Related documents