IF_HRPA_INFTY_BL~INSERT or IF_HRPA_INFTY_BL~MODIFY CL_HRPA_INFOTYPE_0185_IN
Hello,
Can anyone provide me source code to INSERT/MODIFY records in IT0185 using methods IF_HRPA_INFTY_BLINSERT or IF_HRPA_INFTY_BLMODIFY of class CL_HRPA_INFOTYPE_0185_IN.
Note: I don't want to go for BDC through PA30 as well as HR_INFTY_OPERATIONS. I have to use above mentioned methods.
Thanks in advance!
Hello Vishal,
Below code will help you.
LOOP AT t_insert INTO w_insert.
w_pernr = w_insert-ownnum.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = w_pernr
infty = c_infty "'0105'
TABLES
infty_tab = t_0105
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
READ TABLE t_0105 INTO w_0105 WITH KEY pernr = w_insert-ownnum"#EC *
subty = c_subu.
IF sy-subrc = 0.
MOVE w_0105 TO w_p0105.
w_p0105-usrid = w_insert-lanid.
CLEAR w_0105.
ELSE.
w_p0105-pernr = w_pernr.
w_p0105-usrid = w_insert-lanid.
w_p0105-begda = sy-datum.
w_fnr = 'X'.
ENDIF.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = w_pernr.
w_p0105-pernr = w_pernr.
IF w_fnr = 'X'.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = c_infty "'0105'
number = w_p0105-pernr
subtype = c_subu "'0001'
validityend = w_p0105-endda
validitybegin = w_p0105-begda
record = w_p0105
operation = c_oprn "'INS'
tclas = 'A'
dialog_mode = '0'
IMPORTING
return = w_return.
ELSE.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = c_infty "'0105'
number = w_p0105-pernr
subtype = c_subu "'0001'
validityend = w_p0105-endda
validitybegin = w_p0105-begda
record = w_p0105
operation = 'MOD' "'MOD'
tclas = 'A'
dialog_mode = '0'
IMPORTING
return = w_return.
ENDIF.
CLEAR w_fnr.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
number = w_pernr.
Endloop.
Hope it helps.
Thanks,
Jayant
Search SDN before posting.
Similar Messages
-
Robohelp 10 - Inserting a Last modified date in a topic - how can it be achieved?
Hi there,
this is my first post, so apologies if I am in the wrong place...
I would like to insert a "last modified" date in my topics, but can't figure out how to do this! The Date field inserts today's date whenever the topic is opened, and so doesn't reflect the timeframes of changes accurately.
I'd appreciate any help on this.
Thank you
CarolineHi there
When you insert the field, look at the options.
See that option for auto updating? Try clearing it and the field shouldn't auto-populate.
But note that now the onus is on the help author to ensure they perform the update if they want the date to finally match the current date.
Cheers... Rick -
Can Multi-Table Insert KM be modified for updates ?
Hi All,
I am doing a POC on MTI KM.
I would like to know if it is possible to modify/customize the MTI KM for updating the rows as well.
Thanks & Regards,
PrernaYes you can . Refer my post on this
http://bhabaniranjan.com/ikm-oracle-multitable-insert-with-filters/
http://bhabaniranjan.com/router-transformation-in-odi/
Thanks. -
Database Updation and Insertion using Modify Statement
Hi All,
I am using Modify statment for data insertion and updation
MODIFY zmpit_ven_bgg_rg FROM TABLE t_ven_bgg .
But I am getting error
The type of the database table and work area (or internal table) "T_VEN_BGG" are not compatible.
I have defined my internal table of below type :
TYPES : BEGIN OF ty_ven_bgg,
mandt TYPE mandt,
lifnr TYPE lfa1-lifnr,
bgg TYPE zmpit_ven_bgg_rg-matkl,
ind TYPE zmpit_ven_bgg_rg-active_ind,
created_by TYPE zmpit_ven_bgg_rg-created_by,
created_on TYPE zmpit_ven_bgg_rg-created_on,
last_changed_by TYPE zmpit_ven_bgg_rg-last_changed_by,
last_changed_on TYPE zmpit_ven_bgg_rg-last_changed_on,
remarks TYPE zmpit_ven_bgg_rg-remarks,
ind1(1) TYPE c,
END OF ty_ven_bgg.
Here, ind1 is not field of the table.
I have added a new field Remarks in the table and thus i included it in the Internal table also.
Above Modify statement was working fine without Remarks field. I am not able to understand the error
as work area is also of type ty_ven_bgg.
Please suggest some solution.
Regards,
NibhaHi,
Though you have creaated one more internal tsble without the indc field, but you can do it using the same intrenal table by simply using
1. MOVE-CORRESPONDING <internal table> to <ztable>.
2.MODIFY <ztable>.
will solve your problem
Secondly declare the internal table using DATA after structure has been declared using TYPES.
This is better approach to follow.
Pooja -
Authorised to User Fro MODIFY,VIEW and INSERT
Hi,
i want to authenticate my application .How can i give RIGHTS to User ,How can i authorised to User for MODIFY,VIEW and INSERT.
How can i implement this.
Thanks
Edited by: 805629 on Jan 26, 2011 11:10 PMHi,
Create authorization scheme for MODIFY, VIEW and INSERT.
For MODIFY and INSERT edit button and select Authorization Scheme.
For VIEW on Edit Application properties go to security tab and select Authorization Scheme for VIEW.
Sample PL/SQL code for authorization(It will return boolen):
Scheme Type: PL/SQL Function Returning Boolean
Code:
Declare
v_ret number;
Begin
v_ret := AUTH_PKG.can_update(:APP_USER,:APP_PAGE_ID);
IF V_RET =1 THEN
RETURN true;
ELSE
RETURN false;
END IF;
End;
Regards,
Kartik Patel
http://patelkartik.blogspot.com/
http://apex.oracle.com/pls/apex/f?p=9904351712:1 -
How to insert record inside the internal table in below code
Hi all,
My requirement is to find the sub-total and need to insert in between the internal table.
You can see the output ....where I want the sub-total F2 when 1 & 2 combindely , 3 , 4& 5 combindely .Please check it and let me know is it possible
when i am using modification it is not creating extra row inside the table instead it is modifying one row and putting the total there.
For ex: the origianl output is
F1 F2 F3
A 1 1
B 1 1
F 2 1
D 3 1
E 4 1
C 5 1
We want to display all the total of f2 of 1-2 , 3 , 4-5
so expcected output is
F1 F2 F3
A 1 1
B 1 1
F 2 1
* 3 ->This is the sub-total of 1& 2 of f2
D 3 1
* 1 ->this is the sub-total of 3
E 4 1
C 5 1
* 2 -> this is the sub-total of 4 & 5
= space
But coming output is
A 1 1
B 1 1
* 3 -> it is modifying the F row and inserting the total .Total is comong correct but is shoule insert instead of modifying the record!!
* 1
E 4 1
* 2
Please help how to insert the row total at the end of the chage of field
Please find the below code ..Due to space problem i am attaching below
SasHere is the solution ....i Got the answer Thanks for your helping hands friends
REPORT YTEST_MODIFY.
DATA: BEGIN OF ITAB OCCURS 1,
TOT TYPE C,
F1 TYPE C,
F2 TYPE C,
F3 TYPE I ,
END OF ITAB.
DATA: BEGIN OF JTAB OCCURS 1,
F1 TYPE C,
F2 TYPE C,
F3 TYPE I ,
END OF JTAB.
START-OF-SELECTION.
ITAB-F1 = 'A'.
ITAB-F2 = 1.
ITAB-F3 = 1.
APPEND ITAB.
ITAB-F1 = 'B'.
ITAB-F2 = 1.
ITAB-F3 = 1.
APPEND ITAB.
ITAB-F1 = 'C'.
ITAB-F2 = 5.
ITAB-F3 = 1.
APPEND ITAB.
ITAB-F1 = 'D'.
ITAB-F2 = 3.
ITAB-F3 = 1.
APPEND ITAB.
ITAB-F1 = 'E'.
ITAB-F2 = 4.
ITAB-F3 = 1.
APPEND ITAB.
ITAB-F1 = 'F'.
ITAB-F2 = 2.
ITAB-F3 = 1.
APPEND ITAB.
SORT ITAB BY F2.
LOOP AT ITAB.
WRITE:/1 ITAB-F1 ,
8 ITAB-F2 ,
10 ITAB-F3 .
ENDLOOP.
LOOP AT ITAB.
IF ITAB-F2 = 1 OR ITAB-F2 = 2.
ITAB-TOT = 1.
MODIFY ITAB.
ELSEIF ITAB-F2 = 3.
ITAB-TOT = 3.
MODIFY ITAB.
ELSEIF ITAB-F2 = 4 OR ITAB-F2 = 5.
ITAB-TOT = 4.
MODIFY ITAB.
ENDIF.
ENDLOOP.
SKIP 2.
SORT ITAB BY TOT.
DATA : L_SUM(2) TYPE C,
L_ROW(2) TYPE C.
LOOP AT ITAB.
MOVE-CORRESPONDING ITAB TO JTAB.
APPEND JTAB.
L_SUM = L_SUM + ITAB-F3 .
AT END OF TOT.
CLEAR JTAB.
JTAB-F3 = L_SUM .
APPEND JTAB.
CLEAR L_SUM.
ENDAT.
ENDLOOP.
LOOP AT JTAB.
WRITE:/1 JTAB-F1 ,
8 JTAB-F2 ,
10 JTAB-F3 .
ENDLOOP.
* DATA: a TYPE i , b .
* LOOP AT itab.
* IF b = 0.
* a = a + itab-f3.
* ENDIF.
* AT END OF tot.
* MOVE space TO itab-f1.
* MOVE space TO itab-f2.
* MOVE a TO itab-f3.
* MODIFY itab .
* CLEAR a.
* b = 1.
* ENDAT.
* b = 0.
* ENDLOOP.
* LOOP AT itab.
* MOVE-CORRESPONDING itab TO jtab.
* APPEND jtab.
* ENDLOOP.
* ULINE.
* LOOP AT jtab.
* WRITE: / jtab-f1 , jtab-f2 , jtab-f3.
* ENDLOOP. -
INSERT works for only last record of the Internal table ...??
I am trying to insert data from an internal table JTAB to a Databse Table
in CRM. The name of the databse table in CRM is CRMD_PARTNER
For this i first declared an internal table JTAB with same structure as that of
the databse table CRMD_PARTNER
DATA: BEGIN OF JTAB OCCURS 0,
INCLUDE STRUCTURE CRMD_PARTNER,
END OF JTAB.
Then I filled my JTAB with the required entries. For filling the JTAB i am
getting data from couple of other tables and filling the internal table JTAB
loop at ktab.
here i am filling values in JTAB and then i say APPEND JTAB.
endloop.
Till here every thing works well and my internal table JTAB has all values that
I need to insert to the CRMD_PARTNER table. Also my JTAB has vales for all primary key fields.
Now I write a condition like below.
if not jtab[] inital.
MODIFY CRMD_PARTNER from TABLE JTAB.
COMMIT WORK.
endif.
Here comes the problem...once this code is executed and once program totally executes...
i always see that only last record in JTAB is being inserted to the databse table CRMD_PARTNER.
When i check in the debugger ..i see that the loop is being executed only once
and the SY-TABIX of JTAB is being always set to the length of JTAB and
that is why only last record is being inseretd to the table CRMD_PARTNER.
Now what should i do ..to insert all records of JTAB to CRMD_PARTNER table?
is there a way i can restet the SY-TABIX and make the modify statement work for all records of JTAB?
Finally i hardcoded the values in JTAB then i dont have any problem and all records of JTAB are being
inserted into the database table.
only if i am dynamically fetching the values into JTAB(by Putting in loop..endloop statements and
pushing values to JTAB and APPENDING JTAB ) i have a problem .
in this case also my JTAB is being correctly filled with values ..but when i try to
insert theses values to CRMD_PARTNER with MODIFY stmt ..only always last record is being inserted.
i tried with INSERT instead of MODIFY and i am getting runtime error.
kindly pease help.
Regards,
Jessica Samyes a@s i am really struggling from last 3 days.
I actually want to create a sales order in CRM and want to
assign ship to party for each line item in a sales order in CRM
for that i used the standard bapi BAPI_BUSPROCESSND_CREATEMULTI and i am able
to create an order successfully, but i see that the ship toparty
that i give at header is being copied to each line item.
but this is not what is expected.
So finally i tracked in which table the ship to party gets stored in each line item
and then tried to insert the records directly into databse. and it worked
but only if i am hardcoding..but not when i am dynamically fecthing the values into JTAB for insertion,
Can yoy help ..if you have any idea why insert/modify is processing only last record?
any help will be highly appreciated.
Regards,
Jessica Sam -
Hello experts,
we have and requirement where we have to insert/delete or modify specific clock in/out posts from infotype 2011. Looking trough this forum I was not able to find how to delete or modify specific events from SAP correctly.
We are able to insert new record via FM : HR_INFOTYPE_OPERATION with ease, but can not use the same function module to either delete or modify the same record.
I was able to find FM: HR_TMW_DB_UPDATE_TEVENT and tried it in combination with HR_TMW_DB_READ_TEVENT, with out any succes.
My question is: in what way must the tables be filled for deletion or modification, for FM HR_TMW_DB_UPDATE_TEVENT to work?
With testing deleting a record, function explicitly demands taht all four tables are set
del_teven = t_teven_del
ins_teven = t_teven_ind
del_teven_more = t_teven_more_del
ins_teven_more = t_teven_more_ins
, but still the record is not deleted form table TEVEN.
Thank you in advance for any given anwsers,
MatevžHello Rajesh,
the code goes:
* get original data:
CALL FUNCTION 'HR_TMW_DB_READ_TEVENT'
EXPORTING
pernr = iv_pernr
fromdate = iv_begda
todate = iv_endda
IMPORTING
result = result_tmw.
* get next seq. nr.:
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = lv_ragne
object = lv_object
IMPORTING
NUMBER = lv_number
EXCEPTIONS
INTERVAL_NOT_FOUND = 1
NUMBER_RANGE_NOT_INTERN = 2
OBJECT_NOT_FOUND = 3
QUANTITY_IS_0 = 4
QUANTITY_IS_NOT_1 = 5
INTERVAL_OVERFLOW = 6
BUFFER_OVERFLOW = 7
OTHERS = 8.
LOOP AT result_tmw INTO s_result_tmw.
s_teven = s_result_tmw-teven.
IF s_teven-ldate = iv_ldate AND s_teven-ltime = iv_ltime AND s_teven-satza = iv_satza.
"set TEVEN_DEL tables for reading
APPEND s_teven TO t_teven_del.
APPEND s_teven_more TO t_teven_more_del.
"set status for change to TEVEN_INS tables
s_teven-pdsnr = lv_number.
s_teven-ldate = iv_ldate.
s_teven-ltime = iv_ltime.
s_teven-satza = iv_satza.
APPEND s_teven TO t_teven_ins.
MOVE-CORRESPONDING s_teven TO s_teven_more.
APPEND s_teven_more TO t_teven_more_ins.
EXIT.
ENDIF.
ENDLOOP.
* execute deletion of current record:
CALL FUNCTION 'HR_TMW_DB_UPDATE_TEVENT'
TABLES
del_teven = t_teven_del
ins_teven = t_teven_ins
del_teven_more = t_teven_more_del
ins_teven_more = t_teven_more_ins
EXCEPTIONS
insert_failed = 1
update_failed = 2
OTHERS = 3.
COMMIT WORK.
Now I am using the following code, that is working:
* get original data:
CALL FUNCTION 'HR_TMW_DB_READ_TEVENT'
EXPORTING
pernr = iv_pernr
fromdate = iv_begda
todate = iv_endda
IMPORTING
result = result_tmw.
********************************************************************** modification
* CODE : MODIFY CLOCK IN/OUT
IF iv_operation = 'MOD'.
LOOP AT result_tmw INTO s_result_tmw.
s_teven = s_result_tmw-teven.
IF s_teven-ldate = iv_ldate AND s_teven-ltime = iv_ltime AND s_teven-satza = iv_satza.
"set TEVEN_DEL tables for reading
APPEND s_teven TO t_teven_del.
APPEND s_teven_more TO t_teven_more_del.
"set status for change to TEVEN_INS tables
APPEND s_teven TO t_teven_ins.
MOVE-CORRESPONDING s_teven TO s_teven_more.
APPEND s_teven_more TO t_teven_more_ins.
EXIT.
ENDIF.
ENDLOOP.
* execute deletion of current record:
CALL FUNCTION 'HR_TMW_DB_UPDATE_TEVENT'
TABLES
del_teven = t_teven_del
ins_teven = t_teven_ins
del_teven_more = t_teven_more_del
ins_teven_more = t_teven_more_ins
EXCEPTIONS
insert_failed = 1
update_failed = 2
OTHERS = 3.
COMMIT WORK.
* insert new (updated) record of clock registration:
s_p2011-pernr = iv_pernr.
s_p2011-infty = '2011'.
s_p2011-ldate = iv_ldate_new.
s_p2011-ltime = iv_ltime_new.
s_p2011-erdat = sy-datum.
s_p2011-ertim = sy-uzeit.
s_p2011-satza = iv_satza_new.
s_p2011-origf = 'E'.
s_p2011-begda = iv_ldate.
s_p2011-endda = iv_ldate.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '2011'
number = iv_pernr
* SUBTYPE =
* OBJECTID =
* LOCKINDICATOR =
validityend = iv_begda
validitybegin = iv_endda
recordnumber = f_recordnumber
record = s_p2011
operation = 'INS'
tclas = 'A'
dialog_mode = '0'
* NOCOMMIT =
* VIEW_IDENTIFIER =
* SECONDARY_RECORD =
IMPORTING
return = fm_return
key = personaldatakey.
COMMIT WORK.
ENDIF.
Kind regards,
Matevž -
System getting hanged whilst using Insert into table select * from table
I have a peculiar problem.
I am using the below statements:
Query 1:
insert into table ppms.erin_out@ppms_dblink select * from erin_out;
Query 2:
insert into table ppms.erin_out@ppms_dblink values(23,'dffgg',12',dfdfdgg,dfdfdg);
I am in 'interfaces' schema (testing server) and executing above statements. We have testing server and development server, both are identical, i.e one is clone of the other.
ppms_dblink is created in interfaces schema. ppms_dblink points to different database server which has two schemas 'clarity' and 'ppms'. ppms_dblink is create through authentication details of clarity schema.
erin_out table is created on ppms schema on the same dababase server pointed by ppms_dblink.
Question is :
TOAD hangs while running query 1.
Query 2 is working perfectly.
As I have pl/sql script which is using query 1. I want to know why query 1 is creating problem.
If I use query 2 in my pl/sql query then it may create performance issue as i have to use cursor then.
On clarity schema, I have insert, update, select, modify rights on ppms.erin_out.
I have tried same queries from another database server.
That is I tried queries from 'interfaces' schema of development server ( clone of the testing server ). Its working perfectly.
Message was edited by:
user484158Dhanchik:
The table from which I select rows, to insert into table on dblink, is having only one record. It may contatin maximum 100 rows at a time because I am scheduling the procedure through daemon process. Anyway transaction is not more than 100 records. I am trying with just 1 record for testing.
So 1) Problem is not about the cost, TOAD is getting hanged ( to insert 1 record, cost does not mean much)
2) there is no large amount of data, so no question of deteriorated performance
Aron Tunzi:
I think that should not be problem, because I am able to insert a record through query 2.
Warren Tolentino :
I am testing with 1 record only. Its not performance issue.
Message was edited by:
रचित -
Hi,
I have 2 tables. In 1st one, I insert a record, and a PRE-INSERT based trigger modify value of columns CODE. I then need to insert a record in my 2nd table with the value insert in TABLE1.CODE (FK/PK). I tried to use returning clause like this :
PROCEDURE CONVERTIR_DOCVENTE(PCODE IN CHAR) IS
VCODE TABLE1.CODE%TYPE;
BEGIN
INSERT INTO TABLE1 ... RETURNING CODE INTO VCODE;
INSERT INTO TABLE2 VALUES(VCODE);
END;
It does not work (ORA-00933: SQL command not properly ended at line 4)
any idea ?
nullTABLE1 : CODE CHAR(10) PK,DESIG VARCHAR2(100)
TABLE2 : CODE CHAR(10) PK,TABLE1_CODE CHAR(10) FK,DESIG VARCHAR2(100)
Both have a sequence on CODE
I need to insert in TABLE1 'My master record' and in TABLE2 'Child record 1' and 'Child record 2'.
When I insert 'My master record' in TABLE 1 (INSERT into TABLE1(DESIG) values('My master record')), a trigger query my sequence and fetch CODE column. When I then insert 'Child record 1' and 'Child record 2', I need to know the value inserted in TABLE1.CODE to insert it in TABLE2.TABLE1_CODE (INSERT into TABLE2(TABLE1_CODE,DESIG) values(??????,'Child record X')). That's why I need to use RETURNING clause in the first INSERT order.
But it doesn't works (ORA-00933: SQL command not properly ended at line 4)
Note : All my orders are in a stored procedure.
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Riaz Shahid ([email protected]):
Hi!
Would u clearifiy ur point please so that i can advise you. Feel free to mail me.
Regards
<HR></BLOCKQUOTE>
null -
PP CS6 - Loud buzzing during playback after modifying timeline
Hi all,
I've been searching and searching for solutions to my problem, and while I found a few results that seemed to be similar, none of them describe my problem.
While working on a project and changing/inserting/deleting/otherwise modifying clips on the timeline, initiation of playback brings with it a very loud buzzing noise in the right channel of my headphones. This sound only lasts about 0.1s, but is incredibly loud and piercing. It does not happen every time I change something and then play back, and I am not sure what could be the cause of the problem.
My specs:
iMac 27-inch, Late 2012, 2.9 GHz Intel Core i5, 16GB 1600MHz DDR3, NVIDIA GeForce GTX 660M 512MB, OS X 10.8.4
Adobe Creative Suite Production Premium CS6
I should mention that previously I was having problems with Premiere Pro CS6 crashing when performing certain activies such as clicking an item in the menu bar or playing back the timeline. However, these problems were solved by performing a reinstallation and cleaning out any cache-like area I could find on my Mac.I realize this post is quite a few months old, but I am having the same problem as well. But I'm on CC now. Me and 3 other guys in our office have this problem as well and it's extremely frustrating. I have 32 gb ram installed on my mac. It looks like I have the same specs as thedboydguy's computer as well. I will do some edits, click on the timeline to move my cursor and this extremely loud buzz sound fills my headphones for like .1 seconds. I have sensitive ears and this is very hard to take. If anyone has found a solution to this, it would help me very much. I have installed many updates over the past few months and they still haven't fixed it.
-
Hi All,
Could anybody guide me where to locate the SQL Insert statement and modify the statement in a typical form based on a table.
Regards
AmitTrigger option sounds better. So I will go with that. Thank you so much for the solution.
Another thing buzzing me around is about the session user. I have another field called "ChangedBy" which will be the current user who has logged in to the system. How to get the identity of the session user so that ultimately I will store that in the relative field in the dataabase.
Regards
Amit -
Calling custom Infotype method from Webdynpro Abap
Hi Experts,
I am working on an application where i need to call a method of a custom defined infotype.
I have done this -->
1. Create a custom infotype 9111
2. SAP creates a class of that infotype ZCL_HRPA_INFOTYPE_9111
3. Inside this method there are few inherited method which provide me functionality of insert , update , delete
i want to call methods IF_HRPA_INFTY_BL~MODIFY,
IF_HRPA_INFTY_BL~INSERT
However when i call these method from webdynpro abap this method does not work.
where as when i try to insert an entry using PA30 transaction it works.
Does anyone know why does this happen and what is the solution?
Regards,
Ashish ShahHi Ashish,
You need to create method inside your assistance class, the class your webdynpro component talks to.
Within the methods of Assistance class you will have to create instance of ZCL_HRPA_INFOTYPE_9111 and call its method IF_HRPA_INFTY_BL~INSERT passing the data.
Cheers
Prashant -
Calling custom Infotype method from ABAP report
Hi Experts,
I am working on an application where i need to call a method of a custom defined infotype.
I have done this -->
1. Create a custom infotype 9111
2. SAP creates a class of that infotype ZCL_HRPA_INFOTYPE_9111
3. Inside this method there are few inherited method which provide me functionality of insert , update , delete
i want to call methods IF_HRPA_INFTY_BL~MODIFY,
IF_HRPA_INFTY_BL~INSERT
However when i call these method from abap report this method does not work.
where as when i try to insert an entry using PA30 transaction it works.
Does anyone know why does this happen and what is the solution?
Regards,
Ashish ShahHi,
This is the code we are using. Just calling the read and modify methods of the check class. Very simple actually .. we just want once update/insert to work but it does not.
<CODE>
REPORT ZTESTRAD_WD.
FIELD-SYMBOLS <p9106> TYPE p9106.
DATA : infty_container_tab TYPE hrpad_infty_container_tab ,
message_list TYPE REF TO cl_hrpa_message_list,
w_ok type boole_d ,
ref_class TYPE REF TO ZCL_HRPA_INFOTYPE_9106,
container TYPE REF TO if_hrpa_infty_container,
it9106_container TYPE REF TO cl_hrpa_infotype_container,
p9106_ref TYPE REF TO data,
busilog type ref to if_hrpa_masterdata_bl.
CREATE OBJECT message_list.
TRY.
CREATE OBJECT ref_class
EXPORTING
tclas = 'A'
infty = '9106'.
CATCH cx_hrpa_violated_assertion .
write :/ 'Error during initialization'.
ENDTRY.
call method cl_hrpa_masterdata_bl=>get_instance
importing
masterdata_bl = busilog.
TRY.
CALL METHOD ref_class->IF_HRPA_INFTY_BL~read
EXPORTING
tclas = 'A'
pernr = 'XXXXXXXX'
infty = '9106'
begda = sy-datum
endda = sy-datum
no_auth_check = abap_true
message_handler = message_list
IMPORTING
container_tab = infty_container_tab
is_ok = w_ok.
CATCH cx_hrpa_violated_assertion .
WRITE :/ 'Infotype could not be read'.
ENDTRY.
*" Fill the local structure with container data:
loop at infty_container_tab into container.
it9106_container ?= container.
TRY.
CALL METHOD it9106_container->primary_record_ref
IMPORTING
pnnnn_ref = p9106_ref.
CATCH cx_hrpa_violated_assertion .
ENDTRY.
ASSIGN p9106_ref->* to <p9106>.
write :/ <p9106> .
endloop.
*" Just change some field values of the record
<p9106>-C1name2 = 'Test name'.
<p9106>-C2name2 = 'Test name 2 3 4'.
data : return TYPE BAPIRETURN1,
return1 TYPE BAPIRETURN1.
*CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = <p9106>-pernr
IMPORTING
RETURN = return1
*PERFORM do_nothing(sapfp50p).
The container itself is modified
container ?= it9106_container->modify_primary_record( <p9106> ).
CREATE OBJECT message_list.
the invocation - errors are always fatal !!!
DATA : lx_exception TYPE REF TO cx_root,
update_mode type HRPAD_UPDATE_MODE,
massn type massn,
massg type massg.
TRY.
CALL METHOD ref_class->IF_HRPA_INFTY_BL~MODIFY(
EXPORTING
old_container = it9106_container
massn = massn
massg = massg
update_mode = update_mode
no_auth_check = 'X'
message_handler = message_list
IMPORTING
is_ok = w_ok
CHANGING
container = container
CATCH cx_hrpa_violated_assertion INTO lx_exception.
RAISE EXCEPTION TYPE cx_wd_no_handler
EXPORTING previous = lx_exception.
ENDTRY.
</CODE>
I have also tried by instantiating the cl_hrpa_masterdata_bl and then calling the methods on that object...... makes no difference.
I used this link to proceed with the modifications:
http://help.sap.com/saphelp_erp2005/helpdata/en/43/21d2254bba2bebe10000000a1553f7/frameset.htm
The funny thing is that the WHOLE logic executes without any error messages or dumps or anything. I have now debugged almost every line of code that these methods call. PA30 works just fine. HR_INFOTYPE_OPERATION does not .. that's a whole differnt story. -
Calling method of a custom infotype from ABAP
Hi Experts,
I am working on an application where i need to call a method of a custom defined infotype.
I have done this -->
1. Create a custom infotype 9111
2. SAP creates a class of that infotype ZCL_HRPA_INFOTYPE_9111
3. Inside this method there are few inherited method which provide me functionality of insert , update , delete
i want to call methods IF_HRPA_INFTY_BL~MODIFY,
IF_HRPA_INFTY_BL~INSERT
However when i call these method from abap report this method does not work.
where as when i try to insert an entry using PA30 transaction it works.
Does anyone know why does this happen and what is the solution?
Regards,
Ashish ShahHad the same problem (probably copied from the same program). The answer is that you need to commit the work at the end using something like
* Commit
CALL METHOD busilog->flush
EXPORTING
no_commit = space.
Here is an example of my code for IT0002 which works.
*& Report Z_TEST2
REPORT z_test2.
DATA: a_masterdata_bl TYPE REF TO if_hrpa_masterdata_bl,
p0002 TYPE p0002,
lo_0002 TYPE REF TO cl_hrpa_infotype_0002,
ls_p0002_ref TYPE REF TO data,
container_tab TYPE hrpad_infty_container_tab,
container TYPE REF TO if_hrpa_infty_container,
message_handler TYPE REF TO cl_hrpa_message_list,
infotype_logic TYPE REF TO if_hrpa_infty_bl,
update_mode TYPE hrpad_update_mode VALUE 'XXX',
lt_0002_container TYPE REF TO cl_hrpa_infotype_container,
key TYPE pskey,
l_is_ok TYPE boole_d.
FIELD-SYMBOLS <p0002> TYPE p0002.
* get business logic from masterdata factory
CALL METHOD cl_hrpa_masterdata_factory=>get_business_logic
IMPORTING
business_logic = a_masterdata_bl.
* CATCH cx_hrpa_violated_assertion .
*ENDTRY.
*TRY.
CALL METHOD a_masterdata_bl->read
EXPORTING
tclas = 'A'
pernr = '508'
infty = '0002'
begda = sy-datum
endda = sy-datum
no_auth_check = 'X'
message_handler = message_handler
IMPORTING
container_tab = container_tab
is_ok = l_is_ok
* CATCH cx_hrpa_violated_assertion .
*ENDTRY.
READ TABLE container_tab INTO container INDEX 1.
lt_0002_container ?= container.
TRY.
CALL METHOD lt_0002_container->primary_record_ref
IMPORTING
pnnnn_ref = ls_p0002_ref.
CATCH cx_hrpa_violated_assertion.
ENDTRY.
ASSIGN ls_p0002_ref->* TO <p0002>.
MOVE-CORRESPONDING <p0002> TO key.
break stantric.
<p0002>-vorna = 'Rick'.
container ?= lt_0002_container->modify_primary_record( <p0002> ).
TRY.
CREATE OBJECT lo_0002
EXPORTING
tclas = 'A'
infty = '0002'.
CATCH cx_hrpa_violated_assertion .
ENDTRY.
CREATE OBJECT message_handler.
TRY.
CALL METHOD lo_0002->get_specific_bl
EXPORTING
versionid = '01'
tclas = 'A'
pskey = key
IMPORTING
infotype_logic = infotype_logic.
CATCH cx_hrpa_violated_assertion .
ENDTRY.
TRY.
CALL METHOD infotype_logic->modify
EXPORTING
old_container = lt_0002_container
massn = space
massg = space
update_mode = update_mode
no_auth_check = 'X'
message_handler = message_handler
IMPORTING
is_ok = l_is_ok
CHANGING
container = container.
CATCH cx_hrpa_violated_assertion .
ENDTRY.
* Commit
CALL METHOD a_masterdata_bl->flush
EXPORTING
no_commit = space.
Maybe you are looking for
-
Report on open sales order ,total sales
Hello Gurus I am developing a report line item wise of sales order in which i need to get Suppose a sales order is created on 01.12.2009 for 1000 quantity billed quantity in december 600 billed quantity in january 200 1) total sales done against
-
How to restore header and dock to Mail on MacMini?
When using Mail I have to scroll to tippy top of page to get header to show. I have to Quit Mail in order to get Dock to show so I can go online. This is a recent development. Why? How to restore?
-
Warning by NAC when a new Pcs connecte to the network
Hi All, I have a NAC is configured to authenticate users through the NAC by local BD and just use vlan mapping mac-address filter list. I would like to control new Pcs connection to the network ; when a new mac-address -- PC ,laptop or any other ma
-
I have Firefox 3.6.12. In the last couple of days I have been having problems cosing tabs. I click on the cross on the tab but nothing happens. It only happens occasionaly on 1 tab. I can close other tabs in the session without a problem. It is not s
-
Business rules not showing up in Planning
hi guys, we qare in the development stage. i logged in to planning application and could not see the business rules in the tools .could some one help me out on this....very urgent