NO STANDARD PAGE HEADING LINE-SIZE 255.
INCLUDE bdcrecx1.
TYPES : BEGIN OF ty_upload,
pernr TYPE char10, " Person No.
begda TYPE char10, " Begin Date
endda TYPE char10, " End Date
subty TYPE char04, " Sub-Type
beguz TYPE char6, " Start Time
enduz TYPE char6, " End Time
stdaz TYPE char10, " No. of Hr
END OF ty_upload,
tt_upload TYPE STANDARD TABLE OF ty_upload.
DATA : t_upload TYPE STANDARD TABLE OF ty_upload INITIAL SIZE 0,
* T_ERROR TYPE STANDARD TABLE OF TY_UPLOAD INITIAL SIZE 0,
t_bdcdata TYPE STANDARD TABLE OF bdcdata INITIAL SIZE 0,
*Workarea Declerations
*Upload Data
w_upload TYPE ty_upload,
*BDC data
w_bdcdata TYPE bdcdata.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_flname TYPE ibipparms-path.
SELECTION-SCREEN END OF BLOCK b1.
INITIALIZATION.
*Clear Workareas
CLEAR : w_upload,
w_bdcdata.
REFRESH : t_upload,
t_bdcdata.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_flname.
* F4 help for the file path
PERFORM sub_get_f4help.
START-OF-SELECTION.
*Upload the data
PERFORM sub_upload_data.
*Populating the data
PERFORM sub_fill_bdcdata.
*&---------------------------------------------------------------------*
*& Form SUB_GET_F4HELP
*----------------------------------------------------------------------*
FORM sub_get_f4help .
CLEAR p_flname.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = sy-repid
dynpro_number = '1000'
field_name = ' '
IMPORTING
file_name = p_flname.
ENDFORM. " SUB_GET_F4HELP
*&---------------------------------------------------------------------*
*& Form SUB_UPLOAD_DATA
*----------------------------------------------------------------------*
FORM sub_upload_data .
DATA : l_flname TYPE string.
l_flname = p_flname.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_flname
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = t_upload .
ENDFORM. " SUB_UPLOAD_DATA
*&---------------------------------------------------------------------*
*& Form SUB_FILL_BDCDATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------*
FORM sub_fill_bdcdata .
CLEAR w_upload.
PERFORM open_group.
LOOP AT t_upload INTO w_upload.
REFRESH : t_bdcdata.
PERFORM bdc_dynpro USING 'SAPMP50A' '1000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=INS'.
PERFORM bdc_field USING 'RP50G-PERNR' w_upload-pernr.
PERFORM bdc_field USING 'RP50G-TIMR6' 'X'.
PERFORM bdc_field USING 'RP50G-BEGDA' w_upload-begda.
PERFORM bdc_field USING 'RP50G-ENDDA' w_upload-endda.
PERFORM bdc_field USING 'BDC_CURSOR' 'RP50G-SUBTY'.
PERFORM bdc_field USING 'RP50G-CHOIC' '2001'.
PERFORM bdc_field USING 'RP50G-SUBTY' w_upload-subty.
PERFORM bdc_dynpro USING 'MP200000' '2000'.
PERFORM bdc_field USING 'BDC_CURSOR' 'P2001-BEGDA'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'P2001-BEGDA' w_upload-begda.
PERFORM bdc_field USING 'P2001-ENDDA' w_upload-endda.
PERFORM bdc_field USING 'P2001-BEGUZ' w_upload-beguz.
PERFORM bdc_field USING 'P2001-ENDUZ' w_upload-enduz.
PERFORM bdc_dynpro USING 'MP200000' '2000'.
PERFORM bdc_field USING 'BDC_CURSOR' 'P2001-BEGDA'.
PERFORM bdc_field USING 'BDC_OKCODE' '=UPD'.
PERFORM bdc_field USING 'P2001-BEGDA' w_upload-begda.
PERFORM bdc_field USING 'P2001-ENDDA' w_upload-endda.
PERFORM bdc_field USING 'P2001-STDAZ' w_upload-stdaz.
PERFORM bdc_transaction USING 'PA30'. CLEAR w_upload.
ENDLOOP.
PERFORM close_group.
ENDFORM. " SUB_FILL_BDCDATA
ALSO READ:
- Upload Job & Position Relations Through PO03.
- BDC To Upload The OM Relations Through T-code PO13.
- Function Modules To Read Benefits Data In HR ABAP.
- Sample Code For Do Varying In HR ABAP.
- HR ABAP - BDC To Upload The OM Relations Through T-code PO13.
- HR ABAP - BDC Upload For The Org Unit Relationship Through T-Code PO10.
- HR ABAP - BDC For The Action Transfer Of Location.
No comments:
Post a Comment