Application Development and Automation 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: 
Read only

Program flow skipping get pernr statement

former_member420959
Participant
0 Likes
5,658

Hello all,

I am new to HR abap coding and had to see a program written for dubai and now i have to make changes to india.

in the code it is as

START-OF-SELECTION.

   REFRESH : it_zhr_tbl_006[].

   SELECT * FROM zhr_tbl_006 INTO TABLE it_zhr_tbl_006.

   IF NOT it_zhr_tbl_006[] IS INITIAL.

     SELECT * FROM t512t INTO TABLE it_t512t

     FOR ALL ENTRIES IN it_zhr_tbl_006[]

     WHERE sprsl EQ sy-langu AND

           molga EQ 40 AND

           lgart  EQ it_zhr_tbl_006-lgart.

   ENDIF.

   DATA : s_period TYPE char10.

   SELECT * FROM zhr_tbl_002 INTO TABLE it_para.

GET pernr.

   rp_provide_from_last p0008 space sy-datum sy-datum.

the program flow is coming till the select above get pernr and skipping all other and going to end of selection.

Can you tell me what changes i have to make??

I changes molga and and user group paramaters in user profiles as 40 also.

Please help.

Ujwal

23 REPLIES 23
Read only

Former Member
0 Likes
4,099

hi Ujwal,

For GET, there is no syntax that matches - GET pernr.

In order to get the value that you want, we first create a node for the table and then access its fields as shown in the example below.

REPORT demo_get.

NODES: spfli, sflight, sbook.

DATA: weight       TYPE p LENGTH 8 DECIMALS 4,
      total_weight TYPE p LENGTH 8 DECIMALS 4.

INITIALIZATION.
  carrid-sign = 'I'.
  carrid-option = 'EQ'.
  carrid-low = 'AA'.
  carrid-high = 'LH'.
  APPEND carrid TO carrid.

START-OF-SELECTION.
  WRITE 'Luggage weight of flights'.

GET spfli FIELDS carrid connid cityfrom cityto.
  SKIP.
  ULINE.
  WRITE: / 'Carrid:', spfli-carrid,
           'Connid:', spfli-connid,
         / 'From:  ', spfli-cityfrom,
           'To:    ', spfli-cityto.


Let me know if this helps.

Uk

Read only

0 Likes
4,099

Try writing this way:

REPORT zreport.

INFOTYPES: 0001.

TABLES: pernr.

START-OF-SELECTION.

GET PERNR.

PROVIDE * FROM P0001 BETWEEN PN-BEGDA AND PN-ENDDA.

WRITE:/ P0001-PERNR,

P0001-STELL,

P0001-BEGDA.

ENDPROVIDE.

Read only

Former Member
0 Likes
4,099

Hi Ujwal,

do you want to enhance an existing program or do you write a new program?

GET penrnr needs a logical database like PNP in the programs attributes.

Please check the attributes of your program.

You can display the Logical Database in SE36.

Regards,

Klaus

Read only

0 Likes
4,099

hi klaus,

There is an existing program for molga 99(Dubai) and now in need to copy the program and change according to India Molga = 40.

Yes i have used PNP in the attributes. I know all those but dont know why the program flow is not going till get pernr and jumping directly to end of selection.

Ujwal.

Read only

0 Likes
4,099

Hi Ujwal,

this normally always will happen, if no data matching the Logical Database select options on your selection screen  will be found.

Regards,

Klaus

Read only

0 Likes
4,099

Hi Ujwal,

I created a short test program with logical database PNP in the attributes:

REPORT  ztestpnp.

NODES: pernr.

START-OF-SELECTION.

GET pernr.

BREAK-POINT.

END-OF-SELECTION.

It works fine without any input on the selection screen. Please check it in your system.

Regards,

Klaus

Read only

0 Likes
4,099

hi klaus.

\thanks for your reply.

Can you tell me how can i cross check this??

i am using following infotypes in my program. is it anything related to this.

INFOTYPES : 0000, 0001, 0002, 0008, 0041, 2006,0014,0009.

Ujwal

Read only

0 Likes
4,099

Hi Ujwal,

I think the issue might also be caused using macro rp_provide_from_last p0008.

Maybe this doesn't work okay for India. Try the macrö's code without using the macro, for macros can't be processed in debugging mode.

Regards,

Klaus

Read only

0 Likes
4,099

hi klaus,

the

rp_provide_from_last p0008. statement is after get pernr right? but the flow is not going till get pernr also.

and aslo i checked the data for infotype 0008 and its available.

Thanks

Read only

RaymondGiuseppi
Active Contributor
0 Likes
4,099

If you don't trigger the GET there may be no record you are allowed to see So logical database program SAPDBPNP does not execute any PUT pernr.

(no record or records you are not allowed, HR loves authorization-checks)

Some hints :

  • Look via SU53 for authorization-check failed.
  • Check (development system ?) via SE16/SE16N if there are records if there is no authorization failure.
  • Also, you could also test your selection via SE36 on logical database, the test option allows this. (if SE36 give same result than you report, there is no problem, else...)

Regards,

Raymond

Read only

0 Likes
4,099

hi raymond,

i check su53 after running my program it says "The last authorization check was successful".

Ujwal

Read only

0 Likes
4,099

And do you see some data when testing the LDB with SE36 ?

Regards,

Raymond

Read only

0 Likes
4,099

yes i am getting a record for the employee given.

hover i modified the pnp selection screen with Z report category.

My screen looks like below. its program for settlement form for resigned or terminated employees.

Read only

0 Likes
4,099

Can you try to put a break point in the PUT PERNR (end of include DBPNPF03 of SAPDBPNP)

Regards,

Raymond

Read only

0 Likes
4,099

hi raymond,

  i put break at the point you mentioned but its not triggering.

 

Ujwal

Read only

Former Member
0 Likes
4,099

Hi,

you should give the user id executing this logic correct user parameters like molga.

Kind regards, Rob Dielemans

Read only

0 Likes
4,099

hi rob,

the molga value is given correctly as 40 in the user parameters

Read only

Sudhakargadde
Participant
0 Likes
4,099

hi ujwal,

for every LDB program their is start-of-selection and End-of-selection in between GET PERNR is their right. your statements are below

GET pernr.

   rp_provide_from_last p0008 space sy-datum sy-datum.

put a break point in macro above mentioned and check. put in macro don't forget OK.

Thanks and Regards

Sudhakar

Read only

0 Likes
4,099

break-point in a macro, how did you perform ?

Read only

0 Likes
4,099

Hi Raymond,

Oh sorry Raymond, you are correct.

put a break point in any executable statement not in a macro, but put the break point after Get pernr and before End-of-selection.

Thanks and Regards

Sudhakar

Read only

0 Likes
4,099

hi sudhakar,

yes ,put break point after get pernr statement on the macro and in end-of selection.

the break on marcro is not triggered but in end-of selection it does.

Ujwal

Read only

0 Likes
4,099

Hi Ujwal,

you can't debug a macro. Therefore use the ABAP command

BREAK-POINT.

after GET PERNR

to see if it can be reached.

Regards,

Klaus

Read only

Former Member
0 Likes
4,099

Hi Ujwal,

This happens when no records have been selected in the logical database.

Make sure that personnel number and payroll area matches, that there are valid records for the input criteria given. If its still not working you could try the option below. 

Use logical database PNPCE instead of PNP.  In the attributes, change logical database from PNP to PNPCE.

Program will have few changes.

TABLES: pernr,
            pa0008.


NODES: peras.

DATA : s_period TYPE char10.

START-OF-SELECTION.

   REFRESH : it_zhr_tbl_006[].

   SELECT * FROM zhr_tbl_006 INTO TABLE it_zhr_tbl_006.

   IF NOT it_zhr_tbl_006[] IS INITIAL.

     SELECT * FROM t512t INTO TABLE it_t512t

     FOR ALL ENTRIES IN it_zhr_tbl_006[]

     WHERE sprsl EQ sy-langu AND

           molga EQ 40 AND

           lgart  EQ it_zhr_tbl_006-lgart.

   ENDIF.

   SELECT * FROM zhr_tbl_002 INTO TABLE it_para.


* Calling the PERAS event in the PNPCE LDB to retrieve specified infotype values
GET peras.

   sort p0008 by begda . " You need to sort infotype before using the following macro.

   rp_provide_from_last p0008 space sy-datum sy-datum.