Buenos días a continuación detallo el programa de carga masiva que tengo y el problema que tengo es el siguiente, este programa me lo armaron con el fin de cargar todas las fotografias de personal a los infotipos de Sap Hr el problema es que desde que lo tengo para ejecutarlo el programa no hace nada no carga ni una foto y no tira ningún reprte de error como para saber cual es el problema detallo a continuación el programa utilizado junto con el txt que utilizo para la carga masiva, el txt esta compuesto por 8 caracteres conformado por el número de legajo, un espacio separado por tabulación y la ruta en donde se encuentra el archivo de fotografía jpg.
Si podrían decirme cual es el error se los agradesco y si hay alguna otra forma de cargar masivamente favor de mostrarme muchas gracias.
Programa:
*&---------------------------------------------------------------------*
*& Report HR_CARGAFOTOMASIVA
*&
*&---------------------------------------------------------------------*
*& Fecha....: xx-xx-xxxx
*&
*&---------------------------------------------------------------------*
REPORT HR_CARGAFOTOMASIVA
*-----------------------------------------------------------------
* Variables
*-----------------------------------------------------------------
DATA: ws_input_file type string.
DATA: ws_pernr LIKE RP50G-PERNR.
DATA: ws_filename(255) TYPE C.
DATA: count TYPE EPSFILSIZ,
one_percent TYPE F,
progress TYPE I.
DATA: object_id TYPE saeobjid,
pos_count TYPE I.
DATA: text_progress(20) TYPE C.
*-----------------------------------------------------------------
* Structures
*-----------------------------------------------------------------
TYPES: BEGIN OF e_input_file,
ISTK(8) TYPE C, "IS
Filename(255) TYPE C, "Path and JPG file name
END OF e_input_file.
*-----------------------------------------------------------------
* Internal tables
*-----------------------------------------------------------------
* Store the information of input file
DATA: t_input_data TYPE e_input_file OCCURS 0 WITH HEADER LINE.
* ArchiveLink Document Table
DATA: outdoctab LIKE toadt OCCURS 0 WITH HEADER LINE.
*-----------------------------------------------------------------
* Screen selection
*-----------------------------------------------------------------
SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-001.
PARAMETERS: p_fileI TYPE rlgrap-filename OBLIGATORY DEFAULT
'C:\Carga_Inicial\PICTURE.TXT'.
* p_print AS CHECKBOX DEFAULT 'X'.
PARAMETERS: p_repos TYPE TOAV0-ARCHIV_ID OBLIGATORY
DEFAULT 'A2'.
PARAMETERS: p_date TYPE TOAV0-AR_DATE OBLIGATORY
DEFAULT sy-datum.
SELECTION-SCREEN END OF BLOCK 1.
*-----------------------------------------------------------------
* Events
*-----------------------------------------------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fileI.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = p_fileI
mask = ',*.txt.'
mode = 'O'
title = 'Upload File'(078)
IMPORTING
filename = p_fileI
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
*-----------------------------------------------------------------
* START-OF-SELECTION
*-----------------------------------------------------------------
START-OF-SELECTION.
ws_input_file = p_fileI.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = ws_input_file
has_field_separator = 'X' "file is TAB delimited
TABLES
DATA_TAB = t_input_data
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc NE 0.
WRITE: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
STOP.
ENDIF.
END-OF-SELECTION.
* Get the record count
DESCRIBE TABLE t_input_data LINES count.
one_percent = count / 100.
* Read the internal table
LOOP AT t_input_data.
pos_count = sy-tabix.
progress = pos_count / one_percent.
CLEAR ws_pernr.
MOVE t_input_data-Filename TO ws_filename.
MOVE t_input_data-ISTK TO ws_pernr.
* Get the personal number
* Select PerNr
* From PA0032
* into ws_pernr
* Where pnalt = t_input_data-ISTK.
* EndSelect.
IF ws_pernr IS NOT INITIAL OR ws_pernr <> '00000000'.
* Concatenate the personal number and the infotype
CONCATENATE ws_pernr '0002' INTO object_id.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Load the file into the repository
CALL FUNCTION 'ALINK_DOCUMENTS_CREATE_DIALOG'
EXPORTING
archiv_id = p_repos
document_class = 'JPG'
document_type = 'HRICOLFOTO'
filename = ws_filename
multiple = 'X'
TABLES
outdoctab = outdoctab
EXCEPTIONS
error_contentrepository = 1
error_archivelink_customizing = 2
canceled_by_user = 3
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
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 outdoctab.
* Link the file with the personal number
CALL FUNCTION 'ARCHIV_CONNECTION_INSERT'
EXPORTING
archiv_id = outdoctab-contrep_id
arc_doc_id = outdoctab-arc_doc_id
AR_DATE = p_date
ar_object = 'HRICOLFOTO'
MANDANT = sy-mandt
object_id = object_id
sap_object = 'PREL'
doc_type = 'JPG'
EXCEPTIONS
error_connectiontable = 1
OTHERS = 2.
* Write a report
* IF p_print = 'X'.
IF sy-subrc = 0.
WRITE: / pos_count,
AT 20 'OK',
AT 30 t_input_data-ISTK,
AT 40 ws_filename.
ELSE.
WRITE: / pos_count,
AT 20 'ERROR',
AT 30 t_input_data-ISTK,
AT 40 ws_filename.
ENDIF.
* ENDIF.
COMMIT WORK.
text_progress = progress.
CONDENSE text_progress.
CONCATENATE text_progress ' % ?????????' INTO text_progress.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = progress
text = text_progress.
ENDLOOP.
ELSE.
WRITE: / pos_count, AT 20 'X', AT 30 t_input_data-ISTK, AT 40
ws_filename.
ENDIF.
CLEAR ws_filename.
ENDLOOP.
Txt para importar las fotografías:
Nº leg: Ruta en donde se encuentra la fotografía:
--------------------------------------------------------------------------
00000598 C:\DocumentoRHSAP\Archivos\0598.jpg
00000603 C:\DocumentoRHSAP\Archivos\0603.jpg
00000608 C:\DocumentoRHSAP\Archivos\0608.jpg
00000715 C:\DocumentoRHSAP\Archivos\0715.jpg
00000856 C:\DocumentoRHSAP\Archivos\0856.jpg
00001007 C:\DocumentoRHSAP\Archivos\1007.jpg
00002004 C:\DocumentoRHSAP\Archivos\2004.jpg
Desde ya muchas gracias.
Saludos....
Si podrían decirme cual es el error se los agradesco y si hay alguna otra forma de cargar masivamente favor de mostrarme muchas gracias.
Programa:
*&---------------------------------------------------------------------*
*& Report HR_CARGAFOTOMASIVA
*&
*&---------------------------------------------------------------------*
*& Fecha....: xx-xx-xxxx
*&
*&---------------------------------------------------------------------*
REPORT HR_CARGAFOTOMASIVA
*-----------------------------------------------------------------
* Variables
*-----------------------------------------------------------------
DATA: ws_input_file type string.
DATA: ws_pernr LIKE RP50G-PERNR.
DATA: ws_filename(255) TYPE C.
DATA: count TYPE EPSFILSIZ,
one_percent TYPE F,
progress TYPE I.
DATA: object_id TYPE saeobjid,
pos_count TYPE I.
DATA: text_progress(20) TYPE C.
*-----------------------------------------------------------------
* Structures
*-----------------------------------------------------------------
TYPES: BEGIN OF e_input_file,
ISTK(8) TYPE C, "IS
Filename(255) TYPE C, "Path and JPG file name
END OF e_input_file.
*-----------------------------------------------------------------
* Internal tables
*-----------------------------------------------------------------
* Store the information of input file
DATA: t_input_data TYPE e_input_file OCCURS 0 WITH HEADER LINE.
* ArchiveLink Document Table
DATA: outdoctab LIKE toadt OCCURS 0 WITH HEADER LINE.
*-----------------------------------------------------------------
* Screen selection
*-----------------------------------------------------------------
SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-001.
PARAMETERS: p_fileI TYPE rlgrap-filename OBLIGATORY DEFAULT
'C:\Carga_Inicial\PICTURE.TXT'.
* p_print AS CHECKBOX DEFAULT 'X'.
PARAMETERS: p_repos TYPE TOAV0-ARCHIV_ID OBLIGATORY
DEFAULT 'A2'.
PARAMETERS: p_date TYPE TOAV0-AR_DATE OBLIGATORY
DEFAULT sy-datum.
SELECTION-SCREEN END OF BLOCK 1.
*-----------------------------------------------------------------
* Events
*-----------------------------------------------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fileI.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = p_fileI
mask = ',*.txt.'
mode = 'O'
title = 'Upload File'(078)
IMPORTING
filename = p_fileI
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
*-----------------------------------------------------------------
* START-OF-SELECTION
*-----------------------------------------------------------------
START-OF-SELECTION.
ws_input_file = p_fileI.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = ws_input_file
has_field_separator = 'X' "file is TAB delimited
TABLES
DATA_TAB = t_input_data
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc NE 0.
WRITE: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
STOP.
ENDIF.
END-OF-SELECTION.
* Get the record count
DESCRIBE TABLE t_input_data LINES count.
one_percent = count / 100.
* Read the internal table
LOOP AT t_input_data.
pos_count = sy-tabix.
progress = pos_count / one_percent.
CLEAR ws_pernr.
MOVE t_input_data-Filename TO ws_filename.
MOVE t_input_data-ISTK TO ws_pernr.
* Get the personal number
* Select PerNr
* From PA0032
* into ws_pernr
* Where pnalt = t_input_data-ISTK.
* EndSelect.
IF ws_pernr IS NOT INITIAL OR ws_pernr <> '00000000'.
* Concatenate the personal number and the infotype
CONCATENATE ws_pernr '0002' INTO object_id.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Load the file into the repository
CALL FUNCTION 'ALINK_DOCUMENTS_CREATE_DIALOG'
EXPORTING
archiv_id = p_repos
document_class = 'JPG'
document_type = 'HRICOLFOTO'
filename = ws_filename
multiple = 'X'
TABLES
outdoctab = outdoctab
EXCEPTIONS
error_contentrepository = 1
error_archivelink_customizing = 2
canceled_by_user = 3
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
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 outdoctab.
* Link the file with the personal number
CALL FUNCTION 'ARCHIV_CONNECTION_INSERT'
EXPORTING
archiv_id = outdoctab-contrep_id
arc_doc_id = outdoctab-arc_doc_id
AR_DATE = p_date
ar_object = 'HRICOLFOTO'
MANDANT = sy-mandt
object_id = object_id
sap_object = 'PREL'
doc_type = 'JPG'
EXCEPTIONS
error_connectiontable = 1
OTHERS = 2.
* Write a report
* IF p_print = 'X'.
IF sy-subrc = 0.
WRITE: / pos_count,
AT 20 'OK',
AT 30 t_input_data-ISTK,
AT 40 ws_filename.
ELSE.
WRITE: / pos_count,
AT 20 'ERROR',
AT 30 t_input_data-ISTK,
AT 40 ws_filename.
ENDIF.
* ENDIF.
COMMIT WORK.
text_progress = progress.
CONDENSE text_progress.
CONCATENATE text_progress ' % ?????????' INTO text_progress.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = progress
text = text_progress.
ENDLOOP.
ELSE.
WRITE: / pos_count, AT 20 'X', AT 30 t_input_data-ISTK, AT 40
ws_filename.
ENDIF.
CLEAR ws_filename.
ENDLOOP.
Txt para importar las fotografías:
Nº leg: Ruta en donde se encuentra la fotografía:
--------------------------------------------------------------------------
00000598 C:\DocumentoRHSAP\Archivos\0598.jpg
00000603 C:\DocumentoRHSAP\Archivos\0603.jpg
00000608 C:\DocumentoRHSAP\Archivos\0608.jpg
00000715 C:\DocumentoRHSAP\Archivos\0715.jpg
00000856 C:\DocumentoRHSAP\Archivos\0856.jpg
00001007 C:\DocumentoRHSAP\Archivos\1007.jpg
00002004 C:\DocumentoRHSAP\Archivos\2004.jpg
Desde ya muchas gracias.
Saludos....
Comentario