ABAP HR - How to insert payroll results using fm PYXX_WRITE_PAYROLL_RESULT

Hi,
I have a scenario where I want to read cluster information (PCL2 RX) from system A and insert it into system B. Both systems are SAP ECC 6.0. Employee master data already exists on target system, but no payroll results yet, so this is an insert and not an update.
I am using fm PYXX_READ_PAYROLL_RESULT (I also tried with HRCM_PAYROLL_RESULTS_GET) to read the data and then calling a RFC on system B where I use fm PYXX_WRITE_PAYROLL_RESULT to write the payroll results into database. Is this fm only to use in case of update, or it should also work when inserting new lines on the cluster? Because I always get a sy-subrc=0 but nothing is created on the db. Is there any other way to this? Do you have any code samples?
Many thanks,
Miguel

HI Miguel:
I have succe add of new payroll records, the following reference code:
*& Report  ZTEST_BJARNE8
REPORT  ztest_bjarne8.
TABLES:pcl1,pcl2.
INCLUDE rpc2cd00.           "Cluster CD data definition
INCLUDE rpc2ca00.           "Cluster CA Data-Definition
INCLUDE pc2rxcn0.           "Cluster CN data definition
INCLUDE rpc2rx00.           "Cluster RX data definition internat. part
DATA: refvar_curr TYPE REF TO data.
DATA: refvar_prev TYPE REF TO data.
DATA: refvar_cumul TYPE REF TO data.
DATA: t52relid_header TYPE t52relid.
FIELD-SYMBOLS: <payresult_current>.
DATA: employee_number LIKE pc200-pernr,
      client           LIKE sy-mandt,
      globalmolga      TYPE T500L-MOLGA,
      cluster_id       LIKE t500l-relid,
      isocode          LIKE t500l-intca.
DATA: rgdir_entry LIKE pc261.
CALL FUNCTION 'HR_PCLX_INIT_BUFFER'.
employee_number = '81000463'.
CLEAR:rgdir.REFRESH rgdir[].
CALL FUNCTION 'CU_READ_RGDIR_NEW'
  EXPORTING
    persnr                = employee_number
    check_read_authority  = space
    imp_client            = client
  TABLES
    in_rgdir              = rgdir
  EXCEPTIONS
    no_record_found       = 1
    import_mismatch_error = 2
    no_read_authority     = 3
    OTHERS                = 4.
LOOP AT rgdir.
ENDLOOP.
cluster_id = 'CN'.
SELECT SINGLE * FROM t52relid INTO t52relid_header
                       WHERE relid = cluster_id.
CREATE DATA refvar_curr TYPE (t52relid_header-typename).
ASSIGN refvar_curr->* TO <payresult_current>.
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
  EXPORTING
    clusterid                    = cluster_id
    employeenumber               = employee_number
    sequencenumber               = rgdir-seqnr
    check_read_authority         = space"false "already done
    filter_cumulations           = space
  CHANGING
    payroll_result               = <payresult_current>
  EXCEPTIONS
    illegal_isocode_or_clusterid = 1
    error_generating_import      = 2
    import_mismatch_error        = 3
    subpool_dir_full             = 4
    no_read_authority            = 5
    no_record_found              = 6
    versions_do_not_match        = 7
    OTHERS                       = 8.
IF NOT <payresult_current> IS INITIAL.
  "TODO changed RT data......
  "Add new month payresult
   rgdir-seqnr = rgdir-seqnr + 1.
  CALL FUNCTION 'PYXX_WRITE_PAYROLL_RESULT'
    EXPORTING
      clusterid                          = cluster_id
      employeenumber                     = employee_number
      sequencenumber                     = rgdir-seqnr
      payroll_result                     = <payresult_current>
      CLIENT                             =
   EXCEPTIONS
     illegal_isocode_or_clusterid       = 1
     error_generating_export            = 2
     export_error                       = 3
     subpool_dir_full                   = 4
     no_update_authority                = 5
     incomplete_result_imported         = 6
     OTHERS                             = 7
  IF sy-subrc <> 0.
  ENDIF.
  APPEND rgdir.
   globalmolga = '28'.
   client = '200'.
  CALL FUNCTION 'CU_WRITE_RGDIR_NEW'
    EXPORTING
      persnr              = employee_number
      molga               = globalmolga
      imp_client          = client
    TABLES
      rgdir               = rgdir
    EXCEPTIONS
      no_update_authority = 1
      OTHERS              = 2.
  CALL FUNCTION 'HR_FLUSH_BUFFER_UPDATE_PCLX'
    EXPORTING
      test                = space
    EXCEPTIONS
      insert_error        = 1
      no_update_authority = 2
      OTHERS              = 3.
  IF sy-subrc <> 0.
    "MESSAGE e062.
  ENDIF.
ENDIF.
"INCLUDE  rpc2cd09.
*& INCLUDE
INCLUDE rpppxd00.           "Data definition buffer PCL1/PCL2
INCLUDE rpppxd10.           "Common part buffer PCL1/PCL2
INCLUDE rpppxm00.           "Buffer handling routine

Similar Messages

  • How to find payroll results using includes

    hi all,
          I have a requirement to get the payroll results of number of data clusters using includes not by using function modules.
    I know by using function modules.
          How to find out the exact include for given data cluster. If there is any path please let me know.
    thanks & regards,
        sekhar.

    Hi,
    You can define macros in the program and call depending on the cluster you need.
    For Eg  for B2 cluster,
    rp-imp-c2-b2.
    before calling macros,
    You should fill the key
    move pernr  to b2-key-pernr.
      move year         to b2-key-pabrj.
      move period       to b2-key-pabrp.
      move '1'          to b2-key-cltyp.
    rp-imp-c2-b2.
    For payroll
    RP-IMP-C2-RU
    Regards,
    Manoj.

  • Reading Payroll Results using PNPCE

    Hi All,
    As far as reading infotypes/master data is concerned, I am comfortable using "PNPCE" instead of logical database "PNP".
    Can any one tell me how can I read payroll results using "PNPCE". Since Get payroll event is not available in pnpce.

    Hi khalid,
    1. U want the remuneration (monthly salary )
    2. U won't get it DIRECTLY from any table.
    (Its stored in cluster format)
    3. Use this logic and FM.
    DATA: myseqnr LIKE hrpy_rgdir-seqnr.
    DATA : mypy TYPE payin_result.
    DATA : myrt LIKE TABLE OF pc207 WITH HEADER LINE.
    SELECT SINGLE seqnr FROM hrpy_rgdir
    INTO myseqnr
    WHERE pernr = mypernr
    AND fpper = '200409'
    AND srtza = 'A'.
    IF sy-subrc = 0.
    CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
    EXPORTING
    clusterid = 'IN'
    employeenumber = mypernr
    sequencenumber = myseqnr
    CHANGING
    payroll_result = mypy
    EXCEPTIONS
    illegal_isocode_or_clusterid = 1
    error_generating_import = 2
    import_mismatch_error = 3
    subpool_dir_full = 4
    no_read_authority = 5
    no_record_found = 6
    versions_do_not_match = 7
    error_reading_archive = 8
    error_reading_relid = 9
    OTHERS = 10.
    myrt[] = mypy-inter-rt.
    READ TABLE myrt WITH KEY lgart = '1899'.
    4. the internal table myrt
    will contain what u require.
    regards,
    amit m.

  • Looping payroll results using pnpce ldb

    hii experts,
    Can anybody tell me how can v loop payroll results using pnpce ldb..plz provide me the syntax...or any reference report
    program.

    Hi First Using Get peras event read the RGDIR results as below
    CALL FUNCTION 'CU_READ_RGDIR'
        EXPORTING
          persnr          = p_pernr
        IMPORTING
          molga           = p_molga
        TABLES
          in_rgdir        = p_rgdir
        EXCEPTIONS
          no_record_found = 1
          OTHERS          = 2.
    Get the Cluster ID based on the molga value of the employee using T5001 table
    Then Based on the RGDIR results loop retrive the payroll results below
        LOOP AT gt_rgdir INTO wa_rgdir WHERE fpbeg LE wa_dates-endda AND fpend GE wa_dates-endda
                            AND srtza EQ c_a
                            AND payty EQ c_space.
      CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
            EXPORTING
              clusterid                    = wa_t500l-relid
              employeenumber               = pernr-pernr
              sequencenumber               = wa_rgdir-seqnr
              read_only_international      = 'X'
            CHANGING
              payroll_result               = gt_result
            EXCEPTIONS
              illegal_isocode_or_clusterid = 1
              error_generating_import      = 2
              import_mismatch_error        = 3
              subpool_dir_full             = 4
              no_read_authority            = 5
              no_record_found              = 6
              versions_do_not_match        = 7
              error_reading_archive        = 8
              error_reading_relid          = 9
              OTHERS                       = 10.

  • How to import payroll result from 3rd party system to SAP

    Hi Experts,
    May i know how to import payroll result from legacy system / 3rd party payroll system into SAP.
    i need to import the payroll result from Jan - April (from 3rd party payroll system) and system go live on May. I using payroll malaysia.
    Thanks.

    check this link
    http://help.sap.com/saphelp_40b/helpdata/en/91/80e9087834d111a4620060b03c3b0e/content.htm

  • How to insert the data using matrix

    Hi
      All how to insert the data using matrix feild
      plz help me
       thanks
        Loy

    Hi Loy,
    The best way to fill an entire matrix is to use a DBDatasource, here is some sample code:
    Dim oForm As SAPbouiCOM.Form
    oForm = SBO_App.Forms.Item("YourFormTypeID")
            '1. Add a DBDataSource to the form
            oForm.DataSources.DBDataSources.Add("OUSR")
            Dim oColumnDBS As SAPbouiCOM.Column
            Dim oColumnUDS As SAPbouiCOM.Column
            Dim i As Integer
            Dim GenEdt As SAPbouiCOM.EditText
            Dim oMatrix As SAPbouiCOM.Matrix
            Dim oColumns As SAPbouiCOM.Columns
            Dim oDBDataSource As SAPbouiCOM.DBDataSource
            oMatrix = oForm.Items.Item("7").Specific
            oColumns = oMatrix.Columns
            '2. DBDataSource: Binding a field / alias of the table to a column
            oColumnDBS = oColumns.Item("V_1")
            oColumnDBS.DataBind.SetBound(True, "OUSR", "U_NAME")
            '3. getting the data sources bound to the form
            oDBDataSource = oForm.DataSources.DBDataSources.Item("OUSR")
            oMatrix.Clear()
            ' Querying the DB Data source
            oDBDataSource.Query()
            ' Adding the data to the matrix
            oMatrix.LoadFromDataSource()
    When you want to fill a specific field use :
    GenEdt = oMatrix.Columns.Item("V_2").Cells.Item(1).Specific
                    GenEdt.String = "Hello"

  • How to track payroll results if payroll runs twice in day.

    Hi ALL,
       How can i see all  payroll results if payroll runs more than once in a day. i.e if program runs on 31.10.2008 at 9.00 AM and the same day program runs at 8.00PM .i have to find both results. please give me any table or program form whihc we can find the No.of time that program was run in the one day.
    thank You
    Ram

    >
    Asam Ramakrishna wrote:
    > Hi ALL,
    >
    >    How can i see all  payroll results if payroll runs more than once in a day. i.e if program runs on 31.10.2008 at 9.00 AM and the same day program runs at 8.00PM .i have to find both results. please give me any table or program form whihc we can find the No.of time that program was run in the one day.
    >
    > thank You
    > Ram
    The payroll results directory of an employee can be found in the database table HRPY_RGDIR, alternatively you
    can also use the FM CD_READ_RGDIR or the macro RP-IMP-C2-CD to fetch the payroll results directory for an employee

  • How to insert a number using ADO or OLEDB by oracle provider

    I create a talbe .
    Create Table A
    (id number(7));
    I use ADO to access the table a;
    _ConnectionPtr pConn=NULL;
    pConn.CreateInstance(__uuidof(Connection));
    _RecordsetPtr pRst=NULL;
    pRst.CreateInstance(__uuidof(Recordset));
    pConn->Provider="OraOLEDB.Oracle.1";
    try
         pConn->Open("","ISVISION","ISVISION",NULL);
         pRst->CursorLocation=adUseClient;
         pRst->Open("A",pConn.GetInterfacePtr(),adOpenStatic,adLockOptimistic,adCmdTable);
         pRst->AddNew();
         pRst->Fields->Item[0L]->Value=100L;
    //It raise a exception,why?
    //If I convert the datetype of "ID" to CHAR(7)
    //and pRst->Fields->Item[0L]->Value=L"100",it is ok.
         pRst->Update();
         pRst->Close();
         pConn->Close();
    catch (_com_error& e)
         MessageBox(e.Description(),"error",MB_OK|MB_ICONWARNING);
         return ;
    if (pConn)
    pConn.Release();
    if (pRst)
    pRst.Release();
    I create a table A。
    create table A
         ID number(7)
    Now ,I use OLE DB to access the table A;
    struct CIsA
         CIsA()
              memset(this, 0, sizeof(*this));
    public:
         DB_NUMERIC m_ID;
         BEGIN_COLUMN_MAP(CIsA)
              COLUMN_ENTRY_PS(1, 7, 0, m_ID)
         END_COLUMN_MAP()
    DEFINE_COMMAND(CIsA, _T("SELECT ID FROM A"))
    CDataSource DataSource;
    HRESULT hrt=DataSource.Open(_T("OraOLEDB.Oracle.1"),NULL,_T("ISVISION"),_T("ISVISION"));
    CSession Session;
    hrt=Session.Open(DataSource);
    CDBPropSet propset(DBPROPSET_ROWSET);
    propset.AddProperty(DBPROP_IRowsetChange, true);
    propset.AddProperty(DBPROP_UPDATABILITY,
         DBPROPVAL_UP_INSERT | DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_DELETE);
    CCommand<CAccessor<CIsA> > Command;
    Command.Open(Session,NULL,&propset);
    tcscpy((TCHAR*)Command.mID.val,_T("1245"));
    Command.m_ID.sign=1;
    hrt=Command.Insert();//It is wrong,why?
    Command.Close();
    Session.Close();
    DataSource.Close();
    In Fact,the two problems is the same. The key of problem is how to insert a number into oracle.
    help me! thank you.

    hi
    create a table something like this.
    create table image(
    Image_Id number(5),
    Image    blob);create a form with the same table and use the following code.
    when-button-pressed trigger.
    read_image_file('c:\image_name.jpg' , 'jpg' , 'image.image');if its correct/helpful please mark it thanks.
    sarah

  • How to obtain aggregate results using ODBC?

    How do I obtain results of an aggreate functions like SUM etc? I have an MFC application that uses CRecordset. Following is the code snip:
    CDatabase db1;
    o1 db; // class that is a sub class of CRecordset and makes a connection to the Oracle
    // database
    try
    BOOL bUseCursorLib = FALSE;
    db1.Open(_T( "globaldb" ), FALSE, FALSE, _T( "ODBC;UID=scott;PWD=tiger" ),FALSE);
    catch(CDBException* e)
    TRACE0(e->m_strError + "\n");
    AfxMessageBox("Error... "+e->m_strError);          
    e->Delete();
    if( db1.IsOpen() )
    db1.Close();     
    CString strCmd = "select sum(ordernumber) from orders";
    try
    db1.ExecuteSQL( strCmd );
    catch(CDBException *e)
    AfxMessageBox("Error here: "+e->m_strError);
    CString t;
    t.Format("Sum=%ld",db.m_sum_ORDERNUMBER);
    AfxMessageBox(t);
    I always get zero displayed as the sum. I am going wrong somewhere for sure. I am not able to figure out.

    This ought to work. Can you verify that you have the latest ODBC driver and that you have the proper version of the MDAC installed?
    Justin

  • How to clear Payroll results in Bulk???

    Hi Folks,
    Could all the payroll results of one personnel numbers be removed one stretch????
    (Instead of pu01)
    regards,
    Santhosh

    RPUAUD00 HR Report to list all logged changes in infotype data for an employee. Uses the PCL4 Audit Cluster.
    RPUAUDDL HR Report to delete audit data from the PCL4 Audit Cluster
    RPUDELPN Delete all info for an employee number, including cluster data and infotypes
    RPUP1D00 View/Delete records from PCL1 Cluster
    RPUP2D00 View/Delete records from PCL2 Cluster
    RPUP3D00 View/Delete records from PCL3 Cluster
    RPUP4D00 View/Delete records from PCL4 Cluster

  • How to insert variable value using select statement - Oracle function

    Hi,
    I have a function which inserts record on basis of some condition
    INSERT INTO Case
    Case_ID,
    Case_Status,
    Closure_Code,
    Closure_Date
    SELECT newCaseID,
    caseStatus,
    Closure_Code,
    Closure_Date,
    FROM Case
    WHERE Case_ID = caseID
    Now i want new casestatus value in place of select statement caseStatus value. I have a variable m_caseStatus and i want to use the value of this variable in above select statement.
    how can i use this.
    thanks

    Hi,
    I have a function which inserts record on basis of some condition
    INSERT INTO Case
    Case_ID,
    Case_Status,
    Closure_Code,
    Closure_Date
    SELECT newCaseID,
    caseStatus,
    Closure_Code,
    Closure_Date,
    FROM Case
    WHERE Case_ID = caseID
    Now i want new casestatus value in place of select statement caseStatus value. I have a variable m_caseStatus and i want to use the value of this variable in above select statement.
    how can i use this. Do not select Case_Status from inner select, so null will be inserted then after inserting it update the case status with m_caseStatus.
    Regards.

  • How to insert the records using sql query

    hi,
    i insert the record uisng sql query and DOTNET programme successfully and increase the doc num .ubut when i try to  add record using SAP B1 the old Doc no show.It means its not consider the docnums which are not inserted by sql query.
    how can i solve this problem?
    Regards,
    M.Thippa Reddy

    You are not support use Insert / Update / Delete on SAP Databases directly.
    SAP will not support any database, which is inconsistent, due to SQL-Queries, which modify datasets or the datastructure of the SAP Business One Database. This includes any update-, delete- or drop-statements executed via SQL-Server Tools or via the the query interface of SAP Business One
    Check SAP Note: 896891 Support Scope for SAP Business One - DB Integrity
    [https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/smb_searchnotes/display.htm?note_langu=E&note_numm=896891]

  • How to insert delay without using loops, and how can I use variable to store data in labview

    Hi all,
    I am new to Labview and I realized that quite often I am in condition to require a delay beween two functions or elements.. how can we insert a delay in such cases?
    I know how to use delays in a loop. but don't know how to inser some time delay between two elements.
    I have one more question, I know its a bad practice to post 2 questions in 1 thread.
    How can I use a temporary variable to store data, So far I am storing it in an indicator by making it invisible in front panel and making local variable of that indicator, is it the right way to do it ?
    Thanks in advance.

    Generally, LV doesn't have variables in the same sense that most languages do. You can use indicators to perform the same function as variables, but as Adnan pointed out, you run the risk of having race condition and it creates data copies, which is a problem if you have a lot of data. In most cases, you should use wires to perform the function of variables, which is to store data and make it available to the different functions in your code. Instead of thinking about variables, you need to think about data (something like "I have the data coming out of this function. Where does it need to go?").
    Try to take over the world!

  • How to get sequence result using httpservice

    I send 2 httpservice requests to server: requestA and
    requestB in sequence, but sometime I get the response of responseB
    first. How can I get the sequence result, response from A and then
    response from B.

    use AsyncToken - assign it to your HTTPService like so....
    var tok:AsyncToken = myservice.send(params)
    tok.requestName = "myRequest"
    Then in your resultHandler test for the token
    if(event.token['requestName']=='myRequest'){
    do something with the event.result
    }

  • How to get fixed results using JPA

    Hi
    I have a table with lot of rows, when I querry, it is taking a lot of time and I am displaying that many rows in UI in single table. So it is not scaling well.
    SO I am planing to show x number of row in on page. So for that to achieve, how do I querry the db (derby) using JPA to get first 25 rows, next 25 rows...
    I appricate any help
    thanks

    i think you can have a serial number column in your table and you keep track of that serial number. I mean pass it to your method along with the size of page. Lets say if the number starts from 0 then you can calculate the first page using starting number + page size, if your page size is 25 then you will get 0+25 =25 and you can use the result to query from database like;
    select * from myTable where rowNo<=25
    You can store this number (Now 25) in user's session and pass it to the method.

Maybe you are looking for

  • Automatic Row Processing BUG?

    Unfortunately it turns out that one can not create report with form through the wizard if the target table has a primary key that should be updatable. Is that true? I have a table with only 2 columns 1-code of some type, 2-description. Column 1 is pr

  • Want to manipulate the ref cursor

    Hi, iam having a procedure whiuch returns a ref cursor as a output parameter having 20 columns. i had to manipulate only 2 columns in that ref cursor output in another calling procedure. iam getting an error when iam fetching the ref cursor result in

  • Fb01 bdc

    hi all,       I'm facing problem while entering multiple lineitem for fb01 transaction. i can finish my debt either with two lineitem or with 100 lineitem also. but i'm getting screen error from 2nd lieitem onwards while uploading data from my excel.

  • Online Interactive Form

    Hi All , I m doing the online interactive form project using Adobe Reader . In My NWDS I have A 6.0 version . So If Anyone can tell  me how to upgrade it to 7.0 or above .

  • What do I do when Adobe Flash needs to be updated but Safari won't let me??

    I have an iPhone 3g and every site I go on that has any kind of content that needs flash I cant view. I go through the Adobe site via the Apple.com all the way to the down load part, click install and then I get a prompt that Safari won't allow the i