CREATE/UPDATE Infotype Records
Hi,
Am using the following code to insert records into InfoType PA0001 ,its not creating a new record and giving this Dump ....Any suggestion or Examples on this Please ...
Dump :
The source field is too short.
In the running program "SAPLHRMM" a field should have been assigned to a field
symbol, which is shorter than the type of the field symbol.
This is not possible.
It is a statement of the form ASSIGN f TO <fs> CASTING...
or ASSIGN f TO <fs> with a field symbol that was created with the
STRUCTURE addition.
*******************my code *************************
""Local Interface:
*" IMPORTING
*" REFERENCE(EMPNO) TYPE PERSNO
DATA: RETURN LIKE BAPIRETURN1.
DATA: P0001 TYPE P0001.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = EMPNO
IMPORTING
RETURN = RETURN.
IF NOT RETURN IS INITIAL.
WRITE: / EMPNO, 'Enqueue failed'.
EXIT.
ENDIF.
DATA: WA_PA0001 TYPE PA0001.
SELECT SINGLE * FROM PA0001 INTO WA_PA0001
WHERE PERNR = EMPNO
AND ENDDA = '99991231'.
WA_PA0001-ENDDA = '20090422'.
*CHANGE THE EXISTING RECORD FROM PA0001.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0001'
NUMBER = EMPNO
SUBTYPE = WA_PA0001-SUBTY
OBJECTID =
LOCKINDICATOR =
VALIDITYEND = WA_PA0001-ENDDA
VALIDITYBEGIN = WA_PA0001-BEGDA
RECORDNUMBER = '01'
RECORD = WA_PA0001
OPERATION = 'INS'
TCLAS = 'A'
DIALOG_MODE = '0'
NOCOMMIT = '1'
VIEW_IDENTIFIER =
SECONDARY_RECORD =
IMPORTING
RETURN = RETURN
KEY =
IF return-id NE space.
WRITE: / EMPNO,
20 'Create was unsuccessful',
return-id,
return-message+0(40).
ELSE.
WRITE: / EMPNO,
20 'Create was successful',
return-id,
return-message+0(40).
ENDIF.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
NUMBER = EMPNO
IMPORTING
RETURN = RETURN
Thanks,
Kumar
Hi,
Correct this
Operation should be 'MOD'
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0001'
NUMBER = EMPNO
SUBTYPE = WA_PA0001-SUBTY
OBJECTID =
LOCKINDICATOR =
VALIDITYEND = WA_PA0001-ENDDA
VALIDITYBEGIN = WA_PA0001-BEGDA
RECORDNUMBER = '01'
RECORD = WA_PA0001
OPERATION = 'MOD' "Correct this
TCLAS = 'A'
DIALOG_MODE = '0'
NOCOMMIT = '1'
VIEW_IDENTIFIER =
SECONDARY_RECORD =
IMPORTING
RETURN = RETURN
KEY =
Regards
Krishna
Edited by: Krishna Gowrneni on Apr 22, 2009 6:21 PM
Edited by: Krishna Gowrneni on Apr 22, 2009 6:22 PM
Similar Messages
-
Problem in creating 0027 infotype record in background
Hi Experts,
I am facing the problem in creating 27(Costs distribution) infotype record in back ground.
Whenever there is a change in position of the employee or when we hire a new employee (Through PA40)
i have to ctreate 0027 infotype record in background.For that i am using IN_UPDATE method of BADI
HRPAD00INFTY.
Here i am getting 2 problems.
1. I am unable to get the latest positions that is assigned to the employee.
Through NEW_IM AGE structure we can get the latest position but if a person is assigned to multiple positions for the same period then i am getting only one position from NEW_IM AGE but not all.can any body help me?
2. I am calling HR_INFOTYPE_OPERATION FM to create the IT0027 record in background in the above method (IN_UPDATE). but it is not updating the PA0027 table. any idea?
Full points will be rewarded.
Regards,
Sai.I am sending a sample program , which is on infotype 0105 (communication). I hope that this program will help u out............
REPORT ZSAPHR_SAMP.
tables: pa0105.
infotypes: 0105.
DATA : I_RETURN TYPE BAPIRETURN1,
I_KEY TYPE BAPIPAKEY,
PERNR TYPE P0001-PERNR,
I_P0105 TYPE TABLE OF P0105 WITH HEADER LINE,
ENDDA TYPE P0105-ENDDA,
BEGDA TYPE P0105-BEGDA.
MOVE '00000010' TO PERNR.
BEGDA = SY-DATUM + 1.
ENDDA = SY-DATUM + 1.
i_p0105-pernr = PERNR.
i_p0105-infty = '0105'.
i_p0105-subty = '0002'.
i_p0105-endda = ENDDA.
i_p0105-begda = BEGDA.
I_P0105-USRTY = '0002'.
I_P0105-USRID = '[email protected]'.
APPEND i_p0105.
CALL FUNCTION 'DEQUEUE_ALL' .
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = PERNR.
IF SY-SUBRC = 0.
WRITE 'Employee Locked Successfully'.
ENDIF.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '0105'
NUMBER = PERNR
SUBTYPE = '0002'
VALIDITYEND = BEGDA
VALIDITYBEGIN = ENDDA
RECORD = i_p0105
OPERATION = 'INS'
TCLAS = 'A'
DIALOG_MODE = '0'
NOCOMMIT = 'X'
IMPORTING
RETURN = I_RETURN
KEY = I_KEY.
IF SY-SUBRC = 0.
WRITE : 'FM returns sy-subrc 0'.
ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING -
Creating an Infotype Record 0019 using HR_INFOTYPE_OPERATION
All,
I have written a little test application for this, my code is below, and there is something funny happening. For some reason when I run the program for the first time it creates the 0019 infotype but it doesn't add on the additional text. However if I run the program again, without doing anything else, the text does get updated.
It appears that I am missing a commit statement or something along those lines but I am not sure.
I would appreciate any help on getting this working
Many Thanks,
Colm
DATA t0019 TYPE TABLE OF p0019.
DATA w0019 TYPE p0019.
DATA in_pernr TYPE prelp-pernr.
in_pernr = '02000305'.
BREAK-POINT.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
* TCLAS = 'A'
pernr = in_pernr
infty = '0019'
begda = '18000101'
endda = '99991231'
* BYPASS_BUFFER = ' '
* LEGACY_MODE = ' '
* IMPORTING
* SUBRC =
TABLES
infty_tab = t0019
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
BREAK-POINT.
DATA in_infty TYPE prelp-infty VALUE 0019.
DATA in_subty TYPE p0001-subty VALUE 02.
DATA wa_return1 TYPE bapireturn1.
DATA wa_pakey TYPE bapipakey.
DATA wa_pskey TYPE pskey.
DATA l_pgmid TYPE old_prog.
DATA it_text TYPE hrpad_text_tab.
DATA wa_text TYPE hrpad_text.
wa_text = 'Line 1'.
APPEND wa_text TO it_text.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = in_pernr
IMPORTING
return = wa_return1.
IF NOT wa_return1 IS INITIAL.
*ERROR MESSAGE
ENDIF.
w0019-pernr = in_pernr.
w0019-subty = '02'.
w0019-infty = '0019'.
w0019-endda = '20081204'.
w0019-begda = '20081204'.
w0019-seqnr = '000'.
w0019-aedtm = sy-datum."CREATED DATE
w0019-uname = sy-uname.
w0019-itxex = 'X'.
w0019-tmart = '02'. "TASK TYPE
w0019-termn = '20081204'. "DATE OF TASK
w0019-mndat = '20081203'. "REMINDER DATE
w0019-tmjhr = '2008'. "DATE OF TASK YEAR
w0019-tmmon = '12'. "DATE OF TASK MONTH
w0019-tmtag = '04'. "DATE OF TASK DAY
w0019-mnjhr = '2008'. "REMINDER DATE YEAR
w0019-mnmon = '12'. "REMINDER DATE MONTH
w0019-mntag = '03'. "REMINDER DATE DAY
BREAK-POINT.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = '0019'
number = in_pernr
subtype = '02'
validityend = sy-datum
validitybegin = sy-datum
record = w0019
operation = 'INS'
IMPORTING
return = wa_return1
key = wa_pakey
EXCEPTIONS
OTHERS = 0.
IF NOT wa_return1 IS INITIAL.
*ERROR HANDLING
ELSE.
*SUCCESS
wa_pskey-pernr = wa_pakey-employeeno.
wa_pskey-infty = '0019'.
wa_pskey-subty = wa_pakey-subtype.
wa_pskey-objps = wa_pakey-objectid.
wa_pskey-sprps = wa_pakey-lockindic.
wa_pskey-endda = wa_pakey-validend.
wa_pskey-begda = wa_pakey-validbegin.
wa_pskey-seqnr = wa_pakey-recordnr.
l_pgmid = 'SAPFP50P'.
BREAK-POINT.
TRY.
CALL METHOD cl_hrpa_text_cluster=>update
EXPORTING
tclas = 'A'
pskey = wa_pskey
histo = 'X'
uname = sy-uname
aedtm = sy-datum
pgmid = l_pgmid
text_tab = it_text
no_auth_check = 'X'.
ENDTRY.
IF sy-subrc EQ 0.
*SUCCESS
ENDIF.
ENDIF.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
number = in_pernr
IMPORTING
return = wa_return1.
BREAK-POINT.[url]HR_INFOTYPE_OPERATION is not working in user exit ZXPADU02[url]
If you do this and then update the text using the update task it should work perfectly. -
Infotype record create, edit
Hi All,
Can anybody tell me the steps involved in creating, editing employee;'s own infotype records through WD ABAP view.
I have infotype (IT0057) record which need to be displayed, create, edit. We are also supposed to attach a custom workflow template with this application so that whenever employee updates, creates his own record - a workflow item will be triggered and sent to concern person for approval.
We have designed the customer workflow template for the same. Please tell me the steps to display, create, update infotype record through WD View.
Regards,
Anil KumarHi,
If you want to perform some additional logic on these buttons then the standard buttons on the ALV cannot be used.
You need to have your own buttons and provide coding or you can also use the Normal TABLE UI element.
At first i'm explaining the process for TABLE UI element.
First,
Design the context node in the component controller for that table of contents with the apt columns.
Map this node to the view1.
Now, In the view1,
Create the TABLE UI element and using CREATE BINDING option bind it to this node, while doing this
select the apt type of UI element for each column( I mean if there are any columns for Inputfield/drodpdown etc).
and also you can design the buttons ADD, EDIT,DELETE and implement the actions.
After designing this, try to display the data by reading that infottype and fill the context node by using
the BIND_TABLE of if_wd_context_node.
By default for the table, one row is selected(lead selection). If you want mutltiple ones then use the option
Leadselection(Multi).
The BAPI you specified is for the save/update the infotype.
Now you can start of with this information...Once this is done I can help you out..for further process.
Regards,
Lekha. -
Create PD Infotype link to Object USER
Dear Experts,
I have created a custom PD Infotype P9032, under Object "User'. But when i go to Expert Mode to create the infotype record, it screen brings me to "Su01" screen ie. create SAP user instead.
If i change the Object to "Organizational Unit" and create the infotype record, it shows me the correct custom infotype screen.
How do i link my custom PD infotype to Object User? ... i have done the necessary updating of table T777I.
Thanks so much,
ZulHi Dusan,
perhaps the following steps will help you.
1. calls se11
2. mark radiobutton in front of Data type
3. fill data type with HRI9003
4. goto menu [Utilities] and select [Environment Analysis]
This will display all objects i hope also the 3 missed. From there
you could mark it and delete it.
Hope this helps.
Regards
Bernd -
Hi friends,
Can you please give the details of class(not HR_INFOTYPE_OPERATION) for updating infotypes?
Thanks in advance,
AnuHi Anu,
If "Class " mentioned by you related to time constrins,
A time constraint indicates whether more than one infotype record may be available at one time. The following time constraint indicators are permissible:
1: An infotype record must be available at all times. This record may have no time gaps. You may not delete the record last stored on the database because all records of this infotype would otherwise be deleted.
2: Only one record may be available at one time, but time gaps are permitted.
3: Any number of records may be valid at one time, and time gaps are permitted.
Other possible time constraint indicators are as follows:
A: Only one record may ever exist for this infotype. It is valid from 01/01/1800 to 12/31/9999. Splitting is not permissible.
View V_T582B Infotypes Which are Created Automically controls whether the system automatically creates the infotype record for an employee hiring or an applicant data entry action.
Infotypes with time constraint A may not be deleted.
B: Only one record may ever exist for this infotype. It is valid from 01/01/1800 to 12/31/9999. Splitting is not permissible.
Infotypes with time constraint B may be deleted.
T: The time constraint varies depending on the subtype.
Z: Refers to time management infotypes. The time constraint for these infotypes depends on the time constraint class defined in view V_T554S_I Absence: General Control. Collision checks are defined in view V_T554Y Time Constraint Reaction. -
BAPI for updating infotype 0019 - Date Monitoring
Hi,
Does anyone know if there a BAPI for creating/updating infotype 0019 - Monitoring of Dates?
Many thanks,
PaulHi Paul,
1. HR_INFOTYPE_OPERATION
This is the FM (for all infotypes, even 0019)
2. If u want something like BAPI (RFC Enabled),
what u can do is that
create a new Z Fm,
and call the FM
HR_INFOTYPE_OPERATION
in this.
regards,
amit m. -
Background job to create/update vendors.
Hello,
We need to create/update vendor records for travel expenses reimbursement. So far we try to create it as background scheduled job for transaction PRAA, but in fact PRAA transaction only creates batch input session and donu2019t process it. In fact we end up with out updates for vendors.
Usual manual routine is:
Call PRAA to create batch input session for create/update vendor records from HR Master data.
Call SM35 to process creates batch input session.
We would like to avoid this manual routine and run it on background as scheduled job. Is it possible? How it possible to combine this 2 processes?
BR, Maijathe process can only be run in a two step process.
You could have a BASIS program that automatically processed all sessions in SM35 with a certain Batch name, this will remove the manual step, however someone will still need to monitor it, as there may be errors. -
Update info records - Validity period
Hi,
I am using the following FM to create / update info records.
ME_INITIALIZE_INFORECORD
ME_DIRECT_INPUT_INFORECORD
ME_POST_INFORECORD
I need to update the validity period aswell. It is not available in the above FM's.
Need to update DATBI and DATAB with new validity periods.
The table KONH, KONP and A017 get updated.
Could you please tell me how to update validity periods.
Thanks for the help!Hi,
Use FMs :
ME_DB_UPDATE_INFORECORDS Updating info records in database
ME_UPDATE_INFORECORD Update program for purchasing info record
ME_UPDATE_INFORECORD_COND Update price in info record during maintenance from condition transac
ME_UPDATE_INFORECORD_PD Update info records from purchasing documents
Regards,
Hemant -
Creating / Updating Custom Infotype Records
Hello everbody,
We implement alot of custom HR infotypes in our system, both PA & HRP.
For the past several we have been using BDC (Batch-Input) recorded functions in order to update / create the records in our infotypes.
We're currently facing an upcoming ECC upgrade , and I would like to lead a change that will eventually lead to us using generic SAP supplied functions.
I've researched a few functions that might do the trick:
RH_INSERT_INFTY:
This one is giving me an SY-SUBRC 2 error code - Insert error, I tried to select a current record and insert it as different objid but this doesnt work.
HR_INFOTYPE_OPERATION:
I've read of several people that recommended using this function, but it is not released by SAP and I couldnt get it to work as well.
BAPI_HRMASTER_SAVE_REPL_MULT:
This one seems to work for sap infotypes but I dont think it suits custom infotypes.
What is the "official" way of doing such operations?
thanks in advance,
Eli.Hello Dilak,
Im currently trying to insert a new infotype record of infotype HRP9226.
First I call function RH_GET_NEXT_NUMBER to get an objid.
then I fill an HRP9226 line.
after this i call the function:
call function 'RH_INSERT_INFTY'
exporting
FCODE = 'INSE'
vtask = 'S'
ORDER_FLG = 'X'
COMMIT_FLG = 'X'
AUTHY = ' '
PPPAR_IMP =
OLD_TABNR = ' '
REPID = ' '
FORM = ' '
KEEP_LUPD =
WORKF_ACTV = 'X'
tables
innnn = hrp9226_line
ILFCODE =
EXCEPTIONS
NO_AUTHORIZATION = 1
ERROR_DURING_INSERT = 2
REPID_FORM_INITIAL = 3
CORR_EXIT = 4
BEGDA_GREATER_ENDDA = 5
OTHERS = 6
I'm getting an "Error_During_Insert" and Im out of options regarding what I can possibly do. -
Creating / updating Custom infotype with different screen
Hi All,
I have created custom infotype having different screen for different subtype(1,2).
From Subtype 1, indotype is automatically updated as it is a standard program. But for subtype 2 i am using HR_INFOTYPE_OPERATION for updating the record which is ending with error, as employee which i am trying to update is already locked by me only through PA30. So this function module ends with Complex error. Please suggest how to update the infotype with subtype 2.
Thanking you..
Best regards
AkshayHi All,
I have created custom infotype having different screen for different subtype(1,2).
From Subtype 1, indotype is automatically updated as it is a standard program. But for subtype 2 i am using HR_INFOTYPE_OPERATION for updating the record which is ending with error, as employee which i am trying to update is already locked by me only through PA30. So this function module ends with Complex error. Please suggest how to update the infotype with subtype 2.
Thanking you..
Best regards
Akshay -
How to update multiple records in a table created in view (web dynpro)
Here is my coding......
*coding to get the district value
DATA lo_nd_district TYPE REF TO if_wd_context_node.
DATA lo_el_district TYPE REF TO if_wd_context_element.
DATA ls_district TYPE wd_this->element_district.
DATA lv_district_txt LIKE ls_district-district_txt.
navigate from <CONTEXT> to <DISTRICT> via lead selection
lo_nd_district = wd_context->get_child_node( name = wd_this->wdctx_district ).
get element via lead selection
lo_el_district = lo_nd_district->get_element( ).
get single attribute
lo_el_district->get_attribute(
EXPORTING
name = `DISTRICT_TXT`
IMPORTING
value = lv_district_txt ).
*coding to diplay records when clicking a button(Submit)
DATA lo_nd_table TYPE REF TO if_wd_context_node.
DATA lo_el_table TYPE REF TO if_wd_context_element.
DATA ls_table TYPE wd_this->element_table.
DATA lv_district LIKE ls_table-district.
navigate from <CONTEXT> to <TABLE> via lead selection
lo_nd_table = wd_context->get_child_node( name = wd_this->wdctx_table ).
get element via lead selection
lo_el_table = lo_nd_table->get_element( ).
get single attribute
lo_el_table->set_attribute(
EXPORTING
name = `DISTRICT`
" IMPORTING
value = lv_district_txt ).
The above coding updates only one record to that
table created in view.
If i enter 2nd district value means then the first record
in the table is overwritten.
So my need is the record should not be overwritten.
it(2nd record ) should be displayed after the 1st record.
Any one can help me and send the coding plz....instead of using set attribute you should use bind table method to display/update the records in table view.
step1 ) collect all the data in a local table
step2 ) and the bind that lacal table with your node
search1 = wd_context->get_child_node( name = `TABLE1` ).
search1->bind_table( lt_detail)
here lt_detail is your local table and TABLE1 is node which is bound with table ui element. -
Create Custom Infotype and handle Modification/Updation
Hi All,
I need to create a custom infotype and handle few checks while creating/updating the existing one.
I have gone through the existing threads and have figured out the creation part.
Could anyone tell me where i need to code the checks while creating/updating.
I tried editing the PBO/PAI of the Module pool program, but as its standard, is asking for access key. Do we need to code this in any userexit or implement BADI.
For example,
a) i need to check that only one instance of the infotype should be valid for an
employee at a time
b) This infotype should be created for only Employees and not contingent workers.
c) Few fields on the body section needs to be updated/modified.
Thanks and Regards
Manish.You can use the IN_UPDATE or AFTER_INPUT Methods of the BAdI HRPAD00INFTY to perform your validations.
Arya -
Hi All,
I am on MDM 5.5 sp6,and this weird thing happens everytime i run the "update all mapped fields" option in the import manager,it creates a new duplicate field with the updated value record.Is this a bug in sp6 or I guess i am going wrong somewhere.I want to update a particular field in the qualified table and i am using a import file which has values for qualified field on the main table and the values for the qualified table itself.
Any Help greatly appreciated
ThanksHi Aravind,
I am on MDM 5.5 sp6,and this weird thing happens everytime i run the "update all mapped fields" option in the import manager,it creates a new duplicate field with the updated value record.Is this a bug in sp6 or I guess i am going wrong somewhere.I want to update a particular field in the qualified table and i am using a import file which has values for qualified field on the main table and the values for the qualified table itself.
MDM should not behave in this way. I thing there is an issue with the Matching Field you have choosen.
I think you have choosen all the FIeld as the Matching Field ( Tab) while IMporting.
Hence any change in any value, creates another dupliacte record( which we do not want)
Please select any Field with unique values ( like the Material ID, Customer ID etc) which will ensure that the particular records are updated with the new Values coming in.
You will find the new value getting updated for the records which are already present. It will not create a duplicate record
Hope it helps.
*Please reward points if helpful
Thanks and Regards
Nitin Jain -
Update SO after creating missing condition record
Hi Gurus,
I was getting error message that missing MWST condition in Order, then I investigated and created missing condition record in VK11. Now I would like to update the Sales order and tried update tab on condition but invain.
Initially the document was created on 17.11.2008 and today condition record was created 18.11.2008.
Kindly help me in resolving this.
Thanks
BawaDear Bawa,
While creating Condition Record "MWST" in VK11/ 12;
What were the Dates maintained in Fields:
1. Valid From (try with back-date maintenance)
2. Valid To (Maintain as 31.12.9999)
Once done, try to Update with "G - Copy pricing elements unchanged and redetermine taxes", in Sales Order.
Best Regards,
Amit
Maybe you are looking for
-
All Day Events ( banner events ) will not show in iCal and Web Cal
I have iCal Server working for the most part. I am having issues with the Web Calendar not showing the all day events that are made in iCal on that group calendar. Non-All Day events show on both the iCal on the client computer and on the Web Calenda
-
Trying to understand the views for monitoring streams
Hi, All of the columns with a measurement of elapsed_time in the following views have NUMBER as the datatype. Can someone help with me with what the actual measurement is for these field as it's definatley no seconds or milliseconds: v$streams_captur
-
Sender file Adapter without Key field
my File structure will be as follows <HEADER> <DATA1> <DATA2> <DATA3> <HEADER> <ITEM> <ITEM1> <ITEM2> <ITEM3> <ITEM> WHERE i do have flat file will be as follows 10001,20081902,US 10,soda,1 30,soda,4 40,soda,5 10002,20081902,US 10,steel,1 30,steel,4
-
HT5299 which is my ethernet mac address when in a retina with adapter?
Hi, I need to get my ethernet mac address, but i have a macboock pro retina displays that only have wireless connection. I bought the gigabit ethernet adapter, but i need the mac address because the University system that will provide me the net conn
-
Scenarios in XI [Points guaranteed]
Hello all, I am new to XI. Can someone kindly give me a couple of scenarios to work upon and enhance my knowledge. Can you also tell me what is the time give actually in real time to generally perform a task assigned. Thanks in advance, Sriram