0% found this document useful (0 votes)
114 views5 pages

Conversion Program For 168 Infotype - SAP HR ABAP

This document describes a program for converting data between different systems. It defines parameters for selecting the input and output files, the conversion cycle, and the server. It creates an object to handle the conversion, which includes uploading the input file, validating the data, creating transactions using BDC or BAPI, and downloading the output files. Forms are included to select the input filenames and modify the selection screen based on the server choices.

Uploaded by

Naha Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views5 pages

Conversion Program For 168 Infotype - SAP HR ABAP

This document describes a program for converting data between different systems. It defines parameters for selecting the input and output files, the conversion cycle, and the server. It creates an object to handle the conversion, which includes uploading the input file, validating the data, creating transactions using BDC or BAPI, and downloading the output files. Forms are included to select the input filenames and modify the selection screen based on the server choices.

Uploaded by

Naha Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

ZCHR_CONVERSIONS_0168.

TXT
REPORT zchr_conversions_0168 NO STANDARD PAGE HEADING LINE-SIZE 132.
DATA: cl_conversion TYPE REF TO zchr_conversions_0168.
*&---------------------------------------------------------------------*
*& SELECTION PAPAMETERS
*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK file WITH FRAME TITLE text-010.
PARAMETERS:p_pcfile TYPE text200 MODIF ID pc .
PARAMETERS:p_apfile TYPE text200 MODIF ID ap.
PARAMETERS:p_test
AS CHECKBOX.
SELECTION-SCREEN END

OF BLOCK file.

SELECTION-SCREEN BEGIN OF BLOCK fileloc WITH FRAME TITLE text-020.


PARAMETERS:p_pc
RADIOBUTTON GROUP rd DEFAULT 'X' USER-COMMAND ucom,
p_app
RADIOBUTTON GROUP rd.
SELECTION-SCREEN END
OF BLOCK fileloc.
SELECTION-SCREEN BEGIN OF BLOCK cycle WITH FRAME TITLE text-060.
PARAMETERS:p_cycl type c LENGTH 10 OBLIGATORY DEFAULT 'HCM1'.
PARAMETERS: p_path type c LENGTH 10 OBLIGATORY DEFAULT 'DE1400'.
SELECTION-SCREEN END
OF BLOCK cycle.
AT SELECTION-SCREEN OUTPUT.
PERFORM modify_screen.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_pcfile.
PERFORM get_filename CHANGING p_pcfile.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_apfile.
PERFORM get_filename_ap CHANGING p_apfile.
*
START-OF-SELECTION.
*---------------initialize the cl_conversion class.
IF p_app = 'X'.
p_pcfile = p_apfile.
ENDIF.

CREATE OBJECT cl_conversion


EXPORTING
filename = p_pcfile
pserver = p_pc
aserver = p_app
datum
= sy-datum
test
= p_test.
Page 1

ZCHR_CONVERSIONS_0168.TXT
cl_conversion->gv_cycle_name = p_cycl.
cl_conversion->gv_client = p_path.
*-----------------Upload input file
CALL METHOD cl_conversion->upload_file( ).
*------------------Process input file & Data Validation.
CALL METHOD cl_conversion->processconversion.
*------------------Create Transaction using BDC.
CALL METHOD cl_conversion->load_infotype_bdc.

*------------------Create Transaction using BAPI.


* CALL METHOD CL_CONVERSION->HR_LOAD_INFOTYPE_BAPI.
*--------------------Download files to application server.
CALL METHOD cl_conversion->download_files( ).
*-----------------------Display Additional Error Report.
* CALL METHOD CL_CONVERSION->DISPLAY_ERROR_REPORT( ).
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*&
Form GET_FILENAME
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM get_filename CHANGING p_file.
DATA:lt_files
TYPE filetable,
ls_file
TYPE file_table,
lv_title
TYPE string,
lv_subrc
TYPE i,
lv_usr_act TYPE i,
lv_def_file TYPE string,
lv_filter
TYPE string.
lv_title = text-001.
lv_filter = '|All Files (*.*)|*.*.'(007).
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title
= lv_title
default_filename
= lv_def_file
file_filter
= lv_filter
Page 2

ZCHR_CONVERSIONS_0168.TXT
CHANGING
file_table
= lt_files
rc
= lv_subrc
user_action
= lv_usr_act
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error
= 2
error_no_gui
= 3
not_supported_by_gui
= 4
OTHERS
= 5.
IF sy-subrc EQ 0 AND
lv_usr_act <> cl_gui_frontend_services=>action_cancel.
LOOP AT lt_files INTO ls_file.
MOVE ls_file-filename TO lv_def_file.
MOVE lv_def_file
TO p_file.
EXIT.
ENDLOOP.
ENDIF.
ENDFORM.

" get_filename

*&---------------------------------------------------------------------*
*&
Form modify_screen
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM modify_screen .
LOOP AT SCREEN.
IF p_pc EQ 'X' AND screen-group1 EQ 'AP'.
screen-input = 0.
screen-invisible = '1'.
MODIFY SCREEN.
ENDIF.
IF p_app EQ 'X' AND screen-group1 EQ 'PC'.
screen-input = 0.
screen-invisible = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDFORM.
" MODIFY_SCREEN
*&---------------------------------------------------------------------*
*&
Form GET_FILENAME_AP
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
*
<--P_P_APFILE text
*----------------------------------------------------------------------*
Page 3

ZCHR_CONVERSIONS_0168.TXT
FORM get_filename_ap CHANGING p_apfile.
DATA : lv_path TYPE dxfields-longpath,
lv_path1 TYPE dxfields-longpath,
lv_path2 TYPE dsvasdocid,
lv_filename TYPE dsvasdocid.
CONCATENATE '\usr\sap\CONV_SHARE\' p_path '\CHR403' into lv_path1.

*
*
*
*
*

CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'


EXPORTING
i_location_flag = 'A'
i_server
= ' '
i_path
= lv_path1"'\usr\sap\CONV_SHARE\CHR403'
filemask
= '*.*'
fileoperation
= 'R'
IMPORTING
O_LOCATION_FLAG =
O_SERVER
=
o_path
= lv_path
ABEND_FLAG
=
EXCEPTIONS
rfc_error
= 1
error_with_gui = 2
OTHERS
= 3.
IF sy-subrc EQ 0.
WRITE lv_path TO p_apfile.
ENDIF.

ENDFORM.

" GET_FILENAME_AP

**Text Symbols
**------------**
**001 Please select your file 23 23
**006 Initial Hire Conversions 24 27
**007 |All Files (*.*)|*.*. 21 24
**010 File Location 13 13
**020 Server Selection 16 16
**030 Assignment Number 17 17
**040 Select Active, Retiree Or Temnination employees conversion
**050 Retire employees conversion 27 27
**
**Selection-texts
**--------------------**P_ACTIV
Active employees conversion
**P_APFILE App. Server File Name & Path
**P_APP Application Server
Page 4

58

100

ZCHR_CONVERSIONS_0168.TXT
**P_JOB Assignment Number
**P_MASSG
Reason for Action
**P_PC Personal Desk top
**P_PCFILE Desk top File Name & Path
**P_st1 subtype 1
**p_st5 subtype 5
**p_emg emergency contacts

Page 5

You might also like