Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to access PCL1 for travel management data

Former Member
0 Kudos

Hi,

does anybody know how I can access data which are stored in the cluster table PCL1? I already know that the RELID I need is 'TE'. I would prefer a function module but I'm thankful for every hint. I'm new to ABAP HR development.

Regards,

Martin

10 REPLIES 10

former_member31961
Contributor
0 Kudos

Hi,

You need to use macro rp-imp-c1-te to import the data from PCL1/TE cluster.

Check the BAPI/FM 'BAPI_TRIP_GET_DETAILS' which gets the trip/travel expense details (This inturn uses the macro rp-imp-c1-te to read the PCL1 cluster, you can check that code to implement the same macro in our program )

Regards,

Shrinivas

0 Kudos

Hi Shrinivas,

thanks for your reply. It already helps. But I still cannot figure out how I have to access the cluster-table. I also found a [code sample on SDN: |https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/37a26120-0c01-0010-a994-a92ad880c26c] but I'm also not sure how I have to use it and where I have to add my code. I would like to access the table PCL1 within a function module.

Can maybe somebody explain the code mentioned in the PDF?

Regards and thanks in advance!

Martin

0 Kudos

Hi,

when you pass key's for PCL1/TE cluster as follows (i.e te-key-pernr etc) and then call macro rp-imp-c1-te, your trip informations (Receipt data Tables - exbel,beleg

Deduction table - abzug,

Trip Info table -zweck ) will automatically get populated from PCL1 cluster, then you can use this internal tables in your function module.

(You need to include some include modules (where macro & exbel, beleg tables are defined) in your FM, check the above BAPI for that )

te-key-pernr = l_perio-pernr.

te-key-reinr = l_perio-reinr.

te-key-perio = l_perio-perio.

te-key-pdvrs = l_perio-pdvrs.

rp-imp-c1-te.

once you execute above macro, tables exbel,beleg,zweck,vsch etc gets automatically filled.

Hope this helps,

Shrinivas

0 Kudos

Hi Shrinivas,

now it worked, thanks for your help!

Regards,

Martin

Edited by: fischerman on Feb 19, 2008 6:52 PM

0 Kudos

Hi Shrinivas,

as I already mentioned, I figured out how to call the macro and access PCL1. But now I tried to read the results in the internal table BELEG. Unfortunately it didn't work. The internal table where I want to store the data is initial after a loop on BELEG. I know that there are data with this pernr and reinr because I tested it with report RPCLSTTE.

Below you can find my code, maybe you can see a mistake.

data: 
       itab_vpfps           like table of ptk22,
       wa_vpfps             like line of itab_vpfps,
       itab_ziel            like table of ptk05,
       wa_ziel              like line of itab_ziel,
       itab_konti           like table of ptk17,
       wa_konti             like line of itab_konti,
       itab_beleg           like table of ptk03,
       wa_beleg             like line of itab_beleg.

include rprstr00.    "internal structures for TE-Transparent-Tables
include rpc1te00.    "PCL1-Data Travel Exp. DDIC Cluster TE
include mp56tt99.    "PCL1 Data User-table USER

include rpc2cd09. "Cluster CD data definition
include rpc2ca00. "Cluster CA Data-Definition
include rpppxd00. "Data Definition buffer PCL1/PCL2 Buffer
include rpppxd10. "Common part buffer PCL1/PCL2
include rpc2rx09.

data: l_perio like t_perio.

te-key-pernr = '1007'. "pernr.
te-key-reinr = '1001145'."l_perio-reinr.

rp-imp-c1-te.

loop at beleg into wa_beleg.
 append wa_beleg to itab_beleg.
endloop.

Thanks in advance and regards,

Martin

0 Kudos

Hi again,

I finally found the problem: I didn't have any results in BELEG because the TE-KEY was not filled completely.

The TE-KEY consists of the following fields:

te-key-pernr for personnel number

te-key-reinr for trip number

te-key-perio for number of trip period

te-key-pdvrs for sequential number of period

That's defined in structure ptp00.

Is there a way to select data without values for te-key-perio and te-key-pdvrs with a joker search or something like that?

Regards,

Martin

0 Kudos

I already found the solution: I have to read the data from table PTRV_PERIO first.

0 Kudos

Hi

Great to know you found the solution :).

Please close the thread (Reward Points if my reply was helpful )

Regards,

Shrinivas

0 Kudos

I really would like to give you the reward points but it seems I can't give you the points, because I forget to mark my first post as a question.

srijram1
Advisor
Advisor
0 Kudos

Hi Guys,

I am accessing the data from PCL1 cluster too, but would like to access this within a method and while doing so it does not permit using the 'RP-IMP-CL-TE' macro or the import statement itself in its present format. Infact even the internal tables itself needs to be declared in the OO fashion without the header line.

That being said, I tried doing an import in the following fashion.

IMPORT gte_version TO ote_version

         statu    TO lt_statu

         beleg   TO lt_beleg

         exbel   TO lt_exbel

         abzug  TO lt_abzug

         ziel      TO lt_ziel

         zweck  TO lt_zweck

         konti    TO lt_konti

         vsch    TO lt_vsch

         kmver  TO lt_kmver

         paufa  TO  lt_paufa

         uebpa TO  lt_uebpa

         beler   TO lt_beler

         vpfps  TO lt_vpfps

         vpfpa  TO lt_vpfpa

         rot       TO lt_rot

         ruw     TO lt_ruw

         aend   TO lt_aend

         kostr   TO lt_kostr

         kostz  TO lt_kostz

         kostb  TO lt_kostb

         kostk  TO lt_kostk

         v0split TO lt_v0split

         editor  TO lt_editor

         user    TO lt_user

FROM   DATABASE pcl1(te) ID

gs_key ACCEPTING PADDING ACCEPTING TRUNCATION.

where gte_version / ote_version are of type work area and remaining from STATU through USER are internal tables without a work area. Although this design checks for syntax successfully, creates an exception error (An exception with the type CX_SY_IMPORT_MISMATCH_ERROR occurred, but was neither handled locally, nor declared in a RAISING clause) during program execution.

Can you guys through some light on what could be the problem here?

Thanks and regards,

Srikanth