Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Maintaining it1007 programmatically

Former Member
0 Likes
524

I need to develop a program that takes in two position numbers and delimits the vacancy record for the first position and creates a vacancy record for the second position. I am trying to use the SAP standard functions RH_CUT_INFTY and RH_INSERT_INFTY respectively but I seem to keep getting errors when the functions try to run. Is there some reason I can't get these classes to work for it1007.

Here is the main parts of the code that I have tried:

CALL FUNCTION 'RH_READ_INFTY'

EXPORTING

plvar = '01'

otype = c_plans

objid = plans_filled

infty = c_1007

begda = effective_date

endda = effective_date

TABLES

innnn = l_p1007_old

EXCEPTIONS

all_infty_with_subty = 1

nothing_found = 2

no_objects = 3

wrong_condition = 4

wrong_parameters = 5

OTHERS = 6.

*Delimit 1007 table:

CALL FUNCTION 'RH_CUT_INFTY'

EXPORTING

gdate = effective_date

histo = ' '

vtask = 'B'

TABLES

innnn = l_p1007_old

EXCEPTIONS

error_during_cut = 1

no_authorization = 2

gdate_before_begda = 3

cut_of_timco_one = 4

corr_exit = 5

OTHERS = 6.

*Create Vacancy

ls_p1007-vacan = 'X'.

ls_p1007-begda = effective_date.

ls_p1007-status = '0'.

ls_p1007-objid = plans_vacan.

ls_p1007-otype = c_plans.

ls_p1007-plvar = '01'.

ls_p1007-istat = '1'.

ls_p1007-endda = '99991231'.

ls_p1007-infty = '1007'.

APPEND ls_p1007 TO l_p1007_new.

**Insert new record

CALL FUNCTION 'RH_INSERT_INFTY'

EXPORTING

fcode = 'INSE'

vtask = 'B'

TABLES

innnn = l_p1007_new

EXCEPTIONS

no_authorization = 1

error_during_insert = 2

repid_form_initial = 3

corr_exit = 4

begda_greater_endda = 5

OTHERS = 6.

1 REPLY 1
Read only

RaymondGiuseppi
Active Contributor
0 Likes
396

Look at OSS [Note 648608 - Infotype 1007: Function INSE not allowed|https://service.sap.com/sap/support/notes/648608]

Also, you use VTASK = 'B', Changes are buffered, so you have to call function module RH_UPDATE_DATABASE. (Look at function module documentation)

Regards