on 09-18-2008 10:51 AM
I'm not able to upload data from excel sheet to infotypes,
can any one please give me the soln
Guru,
Try to upload from excel using FM
'TEXT_CONVERT_XLS_TO_SAP
If u r using a BDC...upload infotypes using FM
HR_INFOTYPE_OPERATION...
before using this FM...lock the employee using FM
BAPI_EMPLOYEE_ENQUEUE
After using HR_INFOTYPE_OPERATION...unlock the employee using FM
BAPI_EMPLOYEE_DEQUEUE
For example...if u want to upload infotype 45....
DATA : WA_P0045 TYPE P0045.
DATA : IT_TYPE TYPE TRUXS_T_TEXT_DATA.
*T_0045 is the flat file
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR = 'X'
I_LINE_HEADER = 'X'
I_TAB_RAW_DATA = IT_TYPE
I_FILENAME = P_FPATH
TABLES
I_TAB_CONVERTED_DATA = T_0045
EXCEPTIONS
CONVERSION_FAILED = 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.
LOOP AT T_0045 INTO WA_0045.
MOVE-CORRESPONDING WA_0045 TO WA_P0045.
*lock employee
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
NUMBER = WA_P0045-PERNR
IMPORTING
RETURN = RETURN.
WA_P0045-INFTY = C_INF0045.
*upload data into infty 45
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = WA_P0045-INFTY
NUMBER = WA_P0045-PERNR
RECORD = WA_P0045
OPERATION = 'INS'
IMPORTING
RETURN = RETURN
KEY = KEY.
*unlock employee
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
NUMBER = WA_P0045-PERNR
IMPORTING
RETURN = RETURN.
ENDLOOP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use the below FM to upload the data from EXCEL to internal table. then use that internal table to update your infotype.
call function 'TEXT_CONVERT_XLS_TO_SAP'
exporting
i_field_seperator =
i_line_header = 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = fp_file
tables
i_tab_converted_data = it_datatab[] "ACTUAL DATA
exceptions
conversion_failed = 1
others = 2.
Hope it solves your issue.
Regards
Sunil Kondoju
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for which infotype
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.