cancel
Showing results for 
Search instead for 
Did you mean: 

Create OM Info type 1002 programatically (for Position object)

Former Member
0 Kudos

Scenario: I am doing a BDC to Create OM Position. Subtypes for Info type 1002 (Description) are free text controls that I beleive can't be recorded using the Transaction recording tool.

So Is my understanding correct that the subtypes for Info type 1002 can't be populated in BDC while creating other OM info types for Position?

Is there anyway that i can programatically create/update IT1002 subtypes for an existing position?

Hint: The data in these sub types are stored in tables HRP1002 & HRT1002 and the class CL_GUI_TEXTEDIT (methods SET_TEXT_AS_R3TABLE, GET_TEXT_AS_R3TABLE) seems to be doing some trick. I am not sure how can i get hold of the Text control instance to upload data though. Itu2019s different from what I have done for SD/MM modules where I used Object/Object key, etc with the FM CREATE_TEXT to populate free text for objects like Sales order, Purchase order, etc.

Any ideas will be greatly appreciated.

Thanks,

Saurabh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

I have data in internal table to Create a position Object (IT 1000) along with infotypes 1001 (relationships), IT 1002 (Descriptions), IT 1008, IT 1007, couple of other stabdard info tyoes, and a custom Info type.

Thanks,

Saurabh

Former Member
0 Kudos

Saurabh,

1. Create position object ID(IT1000) using FM RH_OBJECT_CREATE...

2. Using the generated Object ID generate relation(IT1001) using FM

RH_RELATION_MAINTAIN..

Use the FM RH_RELATION_MAINTAIN in this way,

LOOP AT T_MAINTAIN INTO WA_MAINTAIN.

WA_MAINTAIN-FCODE = 'INSE'.

WA_MAINTAIN-PLVAR = '01'.

WA_MAINTAIN-ISTAT = '1'.

*Relate account to project

IF WA_MAINTAIN-OTYPE = 'O' AND WA_MAINTAIN-SCLAS = 'O'.

WA_MAINTAIN-RSIGN = 'B'.

WA_MAINTAIN-RELAT = '002'.

*Relate position to project

ELSEIF WA_MAINTAIN-OTYPE = 'O' AND WA_MAINTAIN-SCLAS = 'S'.

WA_MAINTAIN-RSIGN = 'B'.

WA_MAINTAIN-RELAT = '003'.

*Relate job to position

ELSEIF WA_MAINTAIN-OTYPE = 'S' AND WA_MAINTAIN-SCLAS = 'C'.

WA_MAINTAIN-RSIGN = 'B'.

WA_MAINTAIN-RELAT = '007'.

*Relate employee to position

ELSEIF WA_MAINTAIN-OTYPE = 'S' AND WA_MAINTAIN-SCLAS = 'P'.

WA_MAINTAIN-RSIGN = 'A'.

WA_MAINTAIN-RELAT = '008'.

ENDIF.

WA_MAINTAIN-ENDDA = '99991231'.

*FM to create relationship

CALL FUNCTION 'RH_RELATION_MAINTAIN'

EXPORTING

ACT_FCODE = WA_MAINTAIN-FCODE

ACT_PLVAR = WA_MAINTAIN-PLVAR

ACT_OTYPE = WA_MAINTAIN-OTYPE

ACT_OBJID = WA_MAINTAIN-OBJID

ACT_ISTAT = WA_MAINTAIN-ISTAT

ACT_RSIGN = WA_MAINTAIN-RSIGN

ACT_RELAT = WA_MAINTAIN-RELAT

ACT_SCLAS = WA_MAINTAIN-SCLAS

ACT_SOBID = WA_MAINTAIN-SOBID

ACT_BEGDA = WA_MAINTAIN-BEGDA

ACT_ENDDA = WA_MAINTAIN-ENDDA

ACT_PROZT = WA_MAINTAIN-PROZT

EXCEPTIONS

MAINTAINANCE_FAILED = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

  • WRITE : WA_INPUT-OBJID.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

COMMIT WORK.

ENDLOOP.

3. Using FM RH_OBJECT_DESCRIPTION_WRITE create Description(IT1002).

4.For further infotype i m not sure of FM....you can try BDC for those things...

Answers (4)

Answers (4)

Former Member
0 Kudos

Thanks to all for responding.

Shrinivas: I tried the parameter id 'PON' and unfortunately that does not bring me any results.

Thyagu & Shivakumar: I am looking to create at least 9 diff. infotypes and the function modules 'RH_OBJECT_CREATE' and 'HR_INFOTYPE_OPERATION' won't allow me to create all those before I prepare to update texts. Please let me know if you know of any FM that will let me create multiple OM infotypes and return Object ID as a result that I canuse later to create text infotype 1002.

Thanks once again,

Saurabh

Former Member
0 Kudos

Saurabh,

U r trying to create new infotypes or uploading in the existing one..?

If you are trying to create 9 different infotypes...there is no possibility to update with any standard FM or class...in this case the best way to do is to proceed with BDC...

According to me,In these kind of scenarios there is no option of using particular FM...

could u post the actuall requirement u got,so that i can help u?

Former Member
0 Kudos

Hi Sourabh,

First you update/create the record using HR_INFOTYPE_OPERATION with out the text fields.

With this function module all the database fields are updated.

This function module returns the key structure for the record created/updated.

Using that key structure, call the method UPDATE of the class CL_HRPA_TEXT_CLUSTER.

Its very simple process, but follow the steps one by one.

As direct text updation is not possible using the FM, this is the only way to update the comment lines.

so first create the record, then update the texts for the same record.

Its a two step process.

Thanks & Regards,

Shiva vs.

Former Member
0 Kudos

Srinivas,

Thanks for your response - It works. However, what I don't know is how to capture position Id after the 'Call Transaction' statement is issued from the program. I want to retrieve the position id created by the 'Call Transaction PP03...' in the same program and then use the positon id to create IT 1002 using the FM you proposed.

Unfortunately Position ID does not have a Parameter ID.

Thanks,

Saurabh

former_member31961
Contributor
0 Kudos

Hi Saurabh,

You can use the parameter id 'PON' to get the position number. Hence if you can use following command

get parameter id 'PON' field v_objid.

Although the field PM0D1-SEARK doesnt have the parameter id, if you try to debug the standard program you will come to know it uses the parameter id 'PON' to get the object id's. hence you also can use this to get the position id.

Regards,

Shrinivas

Former Member
0 Kudos

Saurabh,

Instead of going for an BDC..u can use FM 'RH_OBJECT_CREATE'

Use that FM this way,

CALL FUNCTION 'RH_OBJECT_CREATE'

EXPORTING

LANGU = SY-LANGU

PLVAR = '01'

OTYPE = 'S'

SHORT = V_NEWPROJECT

STEXT = V_PROJECTDESC

BEGDA = V_DATE

ENDDA = '99991231'

IMPORTING

OBJID = W_OBJID

EXCEPTIONS

TEXT_REQUIRED = 1

INVALID_OTYPE = 2

INVALID_DATE = 3

ERROR_DURING_INSERT = 4

ERROR_EXT_NUMBER = 5

UNDEFINED = 6

OTHERS = 7.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Here W_OBJID is the Object ID generated....

Use that Object ID in the FM ''RH_OBJECT_DESCRIPTION_WRITE...to enter the text...

Hope this one wil do...

Regards,

Thyagu

Edited by: Thyagu on Sep 30, 2008 10:27 AM

former_member31961
Contributor
0 Kudos

Hi,

Use FM ''RH_OBJECT_DESCRIPTION_WRITE" to create the description record.

Regards,

Shrinivas