Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

REPORT  zhrupload_2010.

*----------------------------------------------------------------------*
* Created by       : Venkat Appikonda
* Created on       : 02/04/2009

* Sap version     : ECC6
* Description      : Upload pgoram for Personnel data

*----------------------------------------------------------------------*

TABLES:pernr.

TYPES: BEGIN OF ty_data,
       data(300) TYPE c,
       END   OF ty_data.

TYPES: BEGIN OF ty_pernr,
       pernr TYPE char8,
       subty TYPE char4,
       begda TYPE char8,
       endda TYPE char8,
       aedtm TYPE char8,
       uname TYPE char12,
       stdaz TYPE char9,
       lgart TYPE char4,
       END   OF ty_pernr.

TYPES: BEGIN OF ty_proposed_values.
        INCLUDE STRUCTURE pprop.
TYPES: END OF ty_proposed_values.

TYPES: BEGIN OF ty_modified_keys.
        INCLUDE STRUCTURE pskey.
TYPES: END OF ty_modified_keys.

DATA: it_data              TYPE TABLE OF ty_data            WITH HEADER LINE,
      it_pernr             TYPE TABLE OF ty_pernr           WITH HEADER LINE,
      it_proposed_values   TYPE TABLE OF ty_proposed_values WITH HEADER LINE,
      it_modified_keys     TYPE TABLE OF ty_modified_keys   WITH HEADER LINE,
      wa_fval              LIKE pprop-fval,
      wa_bapiret           LIKE bapireturn,
      wa_bapiret1          LIKE bapireturn1.

PARAMETERS: p_file  TYPE ibipparms-path .

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  PERFORM f4_file_name.

START-OF-SELECTION.
  DATA: l_string TYPE string.

  l_string = p_file.

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename = l_string
    TABLES
      data_tab = it_data.

END-OF-SELECTION.

  LOOP AT it_data .
    SPLIT  it_data AT ','  INTO
           it_pernr-pernr
           it_pernr-subty
           it_pernr-begda
           it_pernr-endda
           it_pernr-aedtm
           it_pernr-uname
           it_pernr-stdaz
           it_pernr-lgart.

    it_pernr-aedtm = sy-datum.
    it_pernr-uname = sy-uname.
    APPEND it_pernr.
  ENDLOOP.

  LOOP AT it_pernr.

    it_proposed_values-infty = '2010'.
    it_proposed_values-fname = 'P2010-PERNR'.
    it_proposed_values-fval  = it_pernr-pernr.
    it_proposed_values-seqnr = '01'.
    APPEND it_proposed_values.

    it_proposed_values-infty = '2010'.
    it_proposed_values-fname = 'SUBTY'.
    it_proposed_values-fval  = it_pernr-subty.
    it_proposed_values-seqnr = '01'.
    APPEND it_proposed_values.

    it_proposed_values-infty = '2010'.
    it_proposed_values-fname = 'P2010-BEGDA'.
    it_proposed_values-fval  = it_pernr-begda.
    it_proposed_values-seqnr = '01'.
    APPEND it_proposed_values.

    it_proposed_values-infty = '2010'.
    it_proposed_values-fname = 'P2010-ENDDA'.
    it_proposed_values-fval  = it_pernr-endda.
    it_proposed_values-seqnr = '01'.
    APPEND it_proposed_values.

    it_proposed_values-infty = '2010'.
    it_proposed_values-fname = 'P2010-AEDTM'.
    it_proposed_values-fval  = it_pernr-aedtm.
    it_proposed_values-seqnr = '01'   .
    APPEND it_proposed_values.

    it_proposed_values-infty = '2010'.
    it_proposed_values-fname = 'P2010-UNAME'.
    it_proposed_values-fval  = it_pernr-uname.
    it_proposed_values-seqnr = '01'.
    APPEND it_proposed_values.

    it_proposed_values-infty = '2010'.
    it_proposed_values-fname = 'P2010-STDAZ'.
    it_proposed_values-fval  = it_pernr-stdaz.
    it_proposed_values-seqnr = '01'   .
    APPEND it_proposed_values.

    it_proposed_values-infty = '2010'.
    it_proposed_values-fname = 'P2010-LGART'.
    it_proposed_values-fval  = it_pernr-lgart.
    it_proposed_values-seqnr = '01'.
    APPEND it_proposed_values.

    DATA: l_pernr  LIKE  pspar-pernr.

    l_pernr = it_pernr-pernr.

    CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'
      EXPORTING
        pernr              = l_pernr
        actio              = 'INS'
        tclas              = 'A'
        begda              = sy-datum
        endda              = '99991231'
        dialog_mode        = '0'
        no_existence_check = 'X'
      IMPORTING
        return             = wa_bapiret
        return1            = wa_bapiret1
      TABLES
        proposed_values    = it_proposed_values
        modified_keys      = it_modified_keys.

  ENDLOOP.
*&---------------------------------------------------------------------*
*&      Form  F4_FILE_NAME
*----------------------------------------------------------------------*
FORM f4_file_name .

*-- F4 functionality for file name on Presentation Server
  DATA: l_file TYPE ibipparms-path.

  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      program_name  = syst-cprog
      dynpro_number = syst-dynnr
      field_name    = 'P_FILE'
    IMPORTING
      file_name     =  p_file.

*  p_file = l_file.

ENDFORM.                    " F4_FILE_NAME

please find the text format file.

00000301,10EH,20100101,20100101,,,8,10EH

  • No labels