Doubt IN Pa0001 Table

hi all
I have created one HR report. In that report contain empno. field, i want to get cost center (KOSTL) from PA0001 table based on empno. But in Pa0001 has more than one record for particular employee. I want to get latest record. how can i get cost center?

please     use this  code  and see in the debug  mode 
the     table will have only the latest record  of the employee .
****1  method ****Selecting the latest infotype record
rp_provide_from_last p0001 space pn-begda pn-endda.
(or) 
*****2  mothod ***Loop around data from more than one infotype
PROVIDE BEGDA ENDDA STAT2 MASSN MASSG FROM P0000
        PERNR PERSK BTRTL SACHZ FROM P0001
BETWEEN PN-BEGDA AND PN-ENDDA
  WHERE P0000-BEGDA < sy-datum AND
        P0000-ENDDA > sy-datum AND
        P0001-BEGDA < sy-datum  AND
        P0001-ENDDA > sy-datum.
(or)
****3method *Loop around infotype data (similar to select/endselect).
PROVIDE * from p0001 between pn-begda and pn-endda.
ENDPROVIDE.
reward points  if it is usefull
Girish

Similar Messages

  • Doubts about Temporary Table.

    Hi,
    I am using Temporary Table.
    But the insert command takes too much time compare to insert in Normal table.
    One more doubt about Temporary Table is:
    Suppose there are two different users. They connect and first insert rows of their use .Now they go for select.
    Does select of one user goes to check the rows of second user also or the temporary table treats 2 users data as inserted in 2 different tables?
    Help!!!

    Nested structure (not deep - deep means their a string or a table as a component)
    TYPES: BEGIN OF tp_header_type,
             BEGIN OF d,
               empresa TYPE ...
               num_docsap TYPE ...
            END OF d,
            awkey TYPE ...
          END OF tp_header_type.
    matt

  • Updating ORGEH in PA0001 table

    Hi,
    I have to insert a new record in PA0001 table with a new ORGEH for a given PLANS. I tried using HR_INFOTYPE_OPERATION function module to insert the record. A new record in getting inserted in the table but the ORGEH remains the same as the old record. Please let me know if there are any FM or BAPI to insert a new record in PA0001 table with new ORGEH value.
    Thanks ,
    Suvarna R

    Hi
    Try following methods one at a time -
    1. Check the relationship date between the organizational unit & the position. It will only reflect in PA0001 table if the relationship date is in current period.
    2. Also, if this desn't works, check if the PLOGI-ORGA switch in T77S0 table is set to 'X'
    3. You will need to run the RHINTE30 batch program provided by SAP to update org. assignment infotype. Also, do not forget to process the batch session through SM35.
    Regards,
    Rupesh
    Edited by: rumhat on Mar 9, 2011 6:59 AM

  • How do I secure PA0001 table by Personal Area

    Hi All,
    How do I secure PA0001 table by Personal Area?
    Usually Personal Area is defined by the data element PERSA, but in case of PA0001 table it is using WERKS. usually WERKS is a data element for Plant which is used in many other auth objects.
    Can anyone please tell me if there is any way to secure PA0001 table by Personal Area?

    If I understand correctly, you are having a custom report created which picks up data from PA0001 table and you want the report to pick up only certain entries from the table which is pertaining to a personnel area that the user is authorized to.
    In that case, you can have a auth check included in the custom report on P_ORGIN (or P_ORGINCON) along with S_TABU_DIS, so that PERSA that your user is authorized is picked up and only those are passed as input to PA0001 to fetch relevant data. Or if user has a option to specify PERSA in selection screen of your report, auth check is made first on P_ORGIN to check if user has authorization to that PERSA or not and then fetch data from the table accordingly.
    Thanks
    Sandipan

  • Doubt in read table statement.

    hi friends
    i have a doubt in read statement
    please suggest me which one i can use.
    i have one master table
    with fields like
    contract contract line wbs
    500060    10                XXX
    500070     10               XXX
    and the transaction table has
    500060     10             01              01              01
    500060      10            02              02              02
    500070       10            01              01             01
    500070       10            02              02              02
    what i am doing is like
    loop at master table into wamastertable
    read table tranintertab into tranintertab1 with key contract=wamastertable-contract                                                                               
    contractline = wamastertable-contractline.
    endloop.
    As my read query satifies multiple lines of transaction internal table i am in a posistion to do this
    but if i do like the above it is giving error that tranintertab1 is not the line type of tranintertab
    please provide me ur valuable suggestions.

    >
    janagar sundaramoorthy Nadar wrote:
    >
    contract contract line wbs
    > 500060    10                XXX
    > 500070     10               XXX
    > and the transaction table has
    > 500060     10          01              01              01
    > 500060     10          02              02              02
    > 500070     10          01              01             01
    > 500070     10          02              02              02
    >
    >
    loop at master table into wamastertable
    > read table tranintertab into tranintertab1 with key contract=wamastertable-contract
    >                                                                                contractline = wamastertable-contractline.
    > endloop.
    >
    Try it like this..........
    loop at tranintertab into tranintertab1.
    read table master table into wamastertable with key
                                                                           contract = tranintertab1-contract
                                                                      contractline = tranintertab1-contractline.
    endloop.
    Regards,
    Suneel G

  • Doubt in Drop Table statement

    Hi,
    what will happen(internally), when we use DROP TABLE <table name>?
    Could you please elaborate for the above?
    Version : Oracle 9.2
    For example:
    If we use DML statements. It ll record the changes in redo log/archive log.
    My doubt is...
    i use DROP TABLE <table name>;
    What operation takes place?
    Will it record the changes in redo log/archive log file?
    Thanks in advance

    Hi,
    You can start 10046 trace and see what all happens when you fire a drop table command.
    Different Version and different functionalities would do additional task.
    eg: Database with recyclebin on would perform different task when compared to the database with recyeclebin off.
    They all would fire set of recursive SQL which would insert/update/delete the data dicitionary objects.
    Since drop table command would internally fire these dmls, hence would get logged into the redo log too.
    Regards
    Anurag

  • Doubt in DUAL TABLE

    Hi,
    below is one query
    SQL> select * from dual;
    D
    XNow from the below Query I came to know that there is one field in the dual table DUMMY which is having VARCHAR2(1)
    SQL> desc dual;
    Name                                                  Null?    Type
    DUMMY                                                          VARCHAR2(1)now my doubt is when I run the below query how it is displaying text more than 1 character
    SQL> select 'how are you' from dual;
    'HOWAREYOU'
    how are youplease explain
    thanks in advance.

    Hi,
    What you are SELECTing here nas no relation to any column in the table.
    There's nothing special about the dual table regarding literals. Try
    SELECT  'Hello'
    FROM    scott.dept;Notice that scott.dept does not have any 5-character columns, yet a query on scott.dept is producing a 5-character column.
    When you query a table, you don't have to SELECT all of the columns in the table. In fact, you don't have to SELECT any of the columns in the table, as you demonstrated.
    The query you posted, like the query above, does not refer to any columns in its base table; it's not surprising that the output doesn't resemble any column in the base table. In the case of the query above, which is based on a table that has 3 columns, the one column that we are SELECTing can't have the characteristics of all 3 columns in the table. Which column do you think the output should resemble, and why? 'Hello' is the first column of output; does that mean it has to resemble the first column in the table, which happens to be defined as NUMBER (2)? 'Hello' is also the last column of output; does that mean it has to resemble the last column of the table? 'Hello' is directly in the center of the output; does that mean it has to resemble the column that happens to be in the middle of the table? Of course not!
    Once agian, it is perfectly legal, and sometimes extremely useful, to have columns in a result set that have no connection at all to any column in the table.

  • Doubts in the tables

    Hi All,
    i have a doubt in the following tables.The tables are
    TEBP_ADR_ADD
    TEBP_ADR_SHIP_TO
    Doubt is
    1) What is the purpose of this two tables and relationsip between  
         them.
    2) I found that some address number that are not available in the
         Address master table for Business partner BUT020 and ADRC,so the address no in the above table are related to Business partner.
    3) from where ie..which tcode or program these tables where populated.
    4) is it necessary to update the corresponding Business partner data in the  table TEBP_ADR_SHIP_TO when we do any changes in the table TEBP_ADR_ADD.
    Thanks in advance..

    Hi Joe,
    TEBP_ADR_ADD
    Supplementary Table for TEBP_ADR_SHIP_TO
    You can use T-Code BP to maintain data to view the info in the above table. For this you have to maintain multiple addresses.
    Cheers.
    ...Reward if useful.

  • Need HR BAPI to change PA0001 table

    HI all,
    I want to update ZEMP_STATUS, ZREPORT_TO and ZLEVEL_OF_RESP fields of table pa0001. CAn anyone suggest me,which BAPI will help me to update the table.
    Thank you.
    Swati.

    Hi swai,
    1. this is the full coding.
    2. just copy paste in new program.
    3. U can change the pernr and amount values as per requirement.
    4.
    Report abc.
    Data
    DATA : P0001 LIKE P0001.
    DATA : RETURN LIKE BAPIRETURN1.
    DATA : KEY LIKE BAPIPAKEY.
    DATA : RETURNE LIKE BAPIRETURN1 .
    Values (Change as per Requirement)
    P0015-PERNR = '1'.
    P0015-BEGDA = '2061101'.
    P0015-ENDDA = '2061101'.
    *----- First Enqu
    CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
    EXPORTING
    NUMBER = p0001-pernr
    IMPORTING
    RETURN = RETURNE.
    Update
    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
    EXPORTING
    INFTY = '001'
    NUMBER = P0001-PERNR
    SUBTYPE = P0001-SUBTY
    OBJECTID = P0001-OBJPS
    LOCKINDICATOR = P0001-SPRPS
    VALIDITYEND = P0001-ENDDA
    VALIDITYBEGIN = P0001-BEGDA
    RECORDNUMBER = P0001-SEQNR
    RECORD = P0001
    OPERATION = 'INS'
    TCLAS = 'A'
    DIALOG_MODE = '0'
    IMPORTING
    RETURN = RETURN
    KEY = KEY.
    IF RETURN IS NOT INITIAL.
    WRITE :/ 'Error Occurred'.
    ENDIF.
    Dequeue
    CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
    EXPORTING
    NUMBER = P0001-PERNR
    regards,
    amit m.

  • 11i to R12 Upgrade- Doubt in XLA tables

    Hi All,
         I am migrating the 11i AP reports to R12..
         In the below query I have commented the obselete and changed 11i columns & tables , but I wasnt able to find the alternate column in WHERE clause for 2 columns in xla_ae_lines and 1 in xla_ae_headers.
         I have marked the ones for which I didn't find the alternate column in red
    SELECT  c.check_id,
            to_char(c.check_number) check_num ,
            i.invoice_id,
            i.invoice_num,
            c.amount,
            ael.accounted_dr accounted_dr,
            ael.entered_dr entered_dr,
            &p_flexdata4 c_flexdata4,
            aeh.accounting_date check_date,
            c.doc_sequence_value voucher_number,
            --ael.ae_line_type_code acct_line_type,
            ael.accounting_class_code acct_line_type,
            l3.displayed_field acct_line_type_name,
            ael.code_combination_id code_combination_id,
            ael.description comments ,
            v.segment1 vendor_num,
            v.vendor_name vendor_name,
            vs.vendor_site_code third_party_sub_name,
            c.check_date trx_date ,
            c.check_number trx_number_n,
            c.bank_account_name bank_account_name,
            abb.bank_name,
            aba.bank_account_num
    FROM 
          --ap_bank_accounts_all aba,
          --ap_bank_branches abb,
          ce_bank_accounts aba,
          ce_bank_branches_v abb,
          ap_invoice_distributions_all d,
          ap_invoices_all i,
          ap_invoice_payments_all p,
          ap_checks_all c,
          --ap_accounting_events_all ae,
          --ap_ae_headers_all aeh,
          --ap_ae_lines_all ael,
          xla_events ae,
          xla_ae_headers aeh,
          xla_ae_lines ael,
          xla_transaction_entities xte,
          ce_statement_lines sl,
          --ce_statement_headers_all sh,
          ce_statement_headers sh,
          ce_statement_reconcils_all csr,
          --po_vendor_sites_all vs,
          --po_vendors v,
          --ap_tax_codes AT,
          ap_supplier_sites_all vs,
          ap_suppliers v,
          zx_lines zl,
          rcv_shipment_headers rsh,
          po_releases_all pr,
          po_headers_all ph,
          po_distributions_all pd,
          rcv_transactions rct,
          gl_je_categories jc,
          gl_daily_conversion_types glct,
          fnd_document_sequences fd,
          fnd_document_sequences fd2,
          ap_lookup_codes l1,
          ap_lookup_codes l2 ,
          ap_lookup_codes l3 ,
          ap_lookup_codes l4 ,
          ap_lookup_codes l5 ,
          ap_lookup_codes l6,
          ap_lookup_codes l7,
          ap_lookup_codes l8 ,
          ap_lookup_codes l9 ,
          ap_lookup_codes l10 ,
          ap_lookup_codes l11 ,
          ap_lookup_codes l12,
          ap_lookup_codes l13,
          gl_code_combinations gcc1
    WHERE c.bank_account_id =aba.bank_account_id
          --AND aba.bank_branch_id =abb.bank_branch_id
          AND aba.bank_branch_id =abb.branch_party_id
          AND ael.code_combination_id =gcc1.code_combination_id(+)
          AND l1.lookup_code = c.payment_method_lookup_code
          AND l1.lookup_type = 'PAYMENT METHOD'
          AND l2.lookup_code(+) = d.line_type_lookup_code
          AND l2.lookup_type(+) = 'INVOICE DISTRIBUTION TYPE'
          --AND l3.lookup_code = ael.ae_line_type_code
          AND l3.lookup_code = ael.accounting_class_code
          AND l3.lookup_type = 'AE LINE TYPE'
          --AND l4.lookup_code = aeh.gl_transfer_flag
          AND l4.lookup_code = aeh.gl_transfer_status_code
          AND l4.lookup_type = 'POSTING STATUS'
          AND l5.lookup_code = ae.event_type_code
          AND l5.lookup_type = 'EVENT TYPE'
    --AND l6.lookup_code(+) = aeh.accounting_error_code
          AND l6.lookup_type(+) = 'ACCOUNTING ERROR TYPE'
    --AND l7.lookup_code(+) = ael.accounting_error_code
          AND l7.lookup_type(+) = 'ACCOUNTING ERROR TYPE'
          AND l8.lookup_code = 'Payments'
          AND l8.lookup_type = 'POSTING CATEGORY'
    --AND l9.lookup_code(+) = ael.gl_transfer_error_code
          AND l9.lookup_type(+) = 'POSTING EXCEPTIONS'
          AND l10.lookup_code = 'EVENT'
          AND l10.lookup_type = 'VIEW_ACCOUNTING'
          AND l11.lookup_code = 'LINE'
          AND l11.lookup_type = 'VIEW_ACCOUNTING'
          AND l12.lookup_code = 'APPLIED_TO'
          AND l12.lookup_type = 'VIEW_ACCOUNTING'
          AND l13.lookup_code = 'BANK_STATEMENT'
          AND l13.lookup_type = 'VIEW_ACCOUNTING'
          --AND AT.tax_id(+) = ael.tax_code_id
          AND i.invoice_id = zl.trx_id(+)
          AND zl.entity_code = 'AP_INVOICES'
          --AND jc.je_category_name = aeh.ae_category
          AND jc.je_category_name = aeh.je_category_name
          AND rsh.shipment_header_id = rct.shipment_header_id
          AND d.rcv_transaction_id = rct.transaction_id
          AND pr.po_release_id(+) = pd.po_release_id
          AND ph.po_header_id(+) = pd.po_header_id
          AND pd.po_distribution_id(+) = d.po_distribution_id
          AND ael.currency_conversion_type = glct.conversion_type(+)
          AND c.doc_sequence_id = fd.doc_sequence_id
          AND sh.doc_sequence_id = fd2.doc_sequence_id
          --AND ael.third_party_sub_id = vs.vendor_site_id
          --AND ael.third_party_id = v.vendor_id
          AND ael.party_site_id = vs.vendor_site_id
          AND ael.party_id = v.vendor_id
          AND i.invoice_id(+) = p.invoice_id
          --AND c.check_id = ae.source_id
          --AND ae.source_table = 'AP_CHECKS'
          --AND ae.accounting_event_id = aeh.accounting_event_id
          --AND aeh.ae_header_id = ael.ae_header_id
          AND i.invoice_id = xte.source_id_int_1
          AND xte.entity_code = 'AP_CHECKS'
          AND aeh.ae_header_id = ael.ae_header_id
          AND aeh.application_id = ael.application_id
          AND aeh.event_id=ae.event_id
          AND aeh.application_id = ae.application_id
          AND ae.entity_id=xte.entity_id
          AND ae.application_id = xte.application_id
          AND sl.statement_header_id = sh.statement_header_id(+)
          AND csr.statement_line_id = sl.statement_line_id(+)
          AND c.check_id = csr.reference_id(+)
          AND csr.reference_type = 'PAYMENT'
          AND csr.current_record_flag(+) = 'Y'
          AND decode(ael.source_table,'AP_INVOICE_PAYMENTS', ael.source_id,NULL) = p.invoice_payment_id(+)
          AND decode(ael.source_table,'AP_INVOICE_DISTRIBUTIONS', ael.source_id,NULL) = d.invoice_distribution_id(+)
          AND ael.accounted_dr IS NOT NULL
          AND (v.segment1 = :p_vendor_code
          OR :p_vendor_code IS NULL)
          AND (v.vendor_name = :p_vendor_name
          OR :p_vendor_name IS NULL)
          AND (abb.bank_name = :p_bank_name
          OR :p_bank_name IS NULL)
          AND (c.currency_code = :p_currency
          OR :p_currency IS NULL)
          AND (c.doc_sequence_value = :p_doc_sequence_value
          OR :p_doc_sequence_value IS NULL)
          AND (i.pay_group_lookup_code = :p_paygroup
          OR :p_paygroup IS NULL)
          AND ( c.check_date IS NULL
          OR trunc(c.check_date) = nvl(:p_payment_date, trunc(c.check_date)))
    Thanks and Regards,
    Madonna

    Hi Cheryl,
         Thank you for the reply..
         It would be nice if you could illustrate with a sample code..
    Thanks and Regards,
    Madonna

  • SOME DOUBTS IN SETUP TABLES

    HI,
    TO ALL BW GURUS,
    I WANT TO KNOW THE ARCHITECTURE OF SETUP TABLES.
    WHAT IS THE MAIN DIFF'S BETWEEN NORMAL TABLES AND POOLED AND CLUSTERED TABLES.
    2.
    WHAT IS PSEUDODELTA.
    WHERE IT IS USED AND WHAT IS THE PURPOSE OF THIS DELTA.
    THANKS
    ANAND.

    Hi,
    check the beow link for table types:
    http://help.sap.com/saphelp_47x200/helpdata/en/81/415d363640933fe10000009b38f839/frameset.htm
    regards,
    raju

  • Small doubt(about pivot table)

    while creating a report i am getting error in Table view,if i create a same report in pivot view it is working fine in pivot view.
    after this i want to add this view to the compound view then i will have to delete the table view from the compound view .but while adding the pivot view to the compound view it is throwing error because by default compound view has only table view and tital view.it is not allowing me to add pivot view to the compound view.
    can anyone suggest me is there any other way i can add the pivot view to compoud view i want to view the title view and pivot view only in the compond view.(here the problem is i am unable to add pivot view to the compound view because error in the table view)

    Actually i placed couple of column in the excluded. now its working fine. i just want to know how can i add pivot tabler to the compound view at this situation

  • Doubt In internal table using in GUI download

    Hi,
    how to get the field lable of all the fields in the internal table... when i download it to xls file... while downloading it i want to pass the field lable first and then its value.
    eg. in mara table .
    MATERIAL NO.
    p-101
    points will be rewarded for correct answer.

    hi,
    Actually i'm downloading the data from mara table to excel file i.e from mara -> internal table-> excel file.
    In this i'm gettng all the values in excel file but i don't kno what those values exactly ment for , so i want the fields lable to be passed first.
    But i don't kno how to get the field lables into the internal atble and then how to pass that value to the excel file.
    Thanks.
    Arunprasad.P

  • Doubt in internal table

    Hi,
    I have internal table with 5 records. I want to separate out the last record in the internal table.
    For ex : itab contains,
                 12,
                 10,
                 15,
                 09,
                 13 .  i need the last record '13' only. how to fetch the last record from the internal table, i no need the other records.
    point will be sure.
    Gowri

    Hi,
    try this simle code:
    DATA: BEGIN OF ITAB OCCURS 0,
            N2(2) TYPE N,
          END   OF ITAB.
    DATA: LINE_ITAB LIKE SY-TABIX.
    START-OF-SELECTION.
      ITAB-N2 = '12'. APPEND ITAB.
      ITAB-N2 = '10'. APPEND ITAB.
      ITAB-N2 = '15'. APPEND ITAB.
      ITAB-N2 = '09'. APPEND ITAB.
      ITAB-N2 = '13'. APPEND ITAB.
      CLEAR: ITAB.
      DESCRIBE TABLE ITAB LINES LINE_ITAB.
      READ TABLE ITAB INDEX LINE_ITAB.
      WRITE: / ITAB-N2.
    Regards, Dieter

  • Doubt in internal table record count

    Hi,
    i have an internal table with 5 fields. Last field is flag. In my internal table lot many records are there. i want to count only the records with flag 'E'. How to count the total records with 'E'.
    Mohana

    Try like this,
    Data: c type i.
    Loop at itab into wa.
    if wa-flag = 'E'.
    c = c + 1.
    endif.
    Endloop.
    Write:/ 'Total records', c.
    OR
    LOOP AT itab WHERE flag = 'E'.
      c = c + 1.
    ENDLOOP.
    Edited by: Sap Fan on Apr 3, 2009 5:21 PM

Maybe you are looking for