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: 

No Filtering while using PNP DB

former_member187457
Active Contributor
0 Kudos

HI all,

I am using PNP DB to get the HR data...

I m giving the data range in the std selection screen ...

but it is not filtering the data on the basis of data range....

it is giving all the data which are present in the DB...

plz help me in trobleshooting the problemm....

thnx

Rohit

1 ACCEPTED SOLUTION

former_member181966
Active Contributor
0 Kudos

Can you post your code? So we can look and suggest you something .. hmmmm

 

Example 

In your prog attr : PNP 

REPORT  Ypnp.
tables:pernr.

infotypes:0001,
          0002.

START-OF-SELECTION.
*reading logical database PNP with pernr node

GET PERNR .


* Reading pa0001 using macro

  RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.

  IF PNP-SW-FOUND  = 1. " if found = 1, otheriwse '0'

    YOURTAB-FIELD = P0001-PERSK.

  ENDIF.


  RP_PROVIDE_FROM_LAST P0002 SPACE PN-BEGDA PN-ENDDA.

  IF PNP-SW-FOUND  = 1. " if found = 1, otheriwse '0'

    YOURTAB-FIELD1 = P0002-NACHN.

  ENDIF.

  APPEND YOURTAB .

END-OF-SELECTION.
Perform write_output.

^ Saquib

.

18 REPLIES 18

former_member187457
Active Contributor
0 Kudos

any expert ......

Former Member
0 Kudos

Hi,

Make sure that, Master Data field is empty or not in Attributes.

goto attributes, click on 'HR Report category'

now make sure that, 'Master Data (Infotype)' is empty or not.

If its value is : ______03, some data retrieval is not done.

hopefull, it will be helpfull to you.

Regards

Sai

0 Kudos

no man its still not working.....

0 Kudos

thnx experts for not repling.....

former_member181966
Active Contributor
0 Kudos

Can you post your code? So we can look and suggest you something .. hmmmm

 

Example 

In your prog attr : PNP 

REPORT  Ypnp.
tables:pernr.

infotypes:0001,
          0002.

START-OF-SELECTION.
*reading logical database PNP with pernr node

GET PERNR .


* Reading pa0001 using macro

  RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.

  IF PNP-SW-FOUND  = 1. " if found = 1, otheriwse '0'

    YOURTAB-FIELD = P0001-PERSK.

  ENDIF.


  RP_PROVIDE_FROM_LAST P0002 SPACE PN-BEGDA PN-ENDDA.

  IF PNP-SW-FOUND  = 1. " if found = 1, otheriwse '0'

    YOURTAB-FIELD1 = P0002-NACHN.

  ENDIF.

  APPEND YOURTAB .

END-OF-SELECTION.
Perform write_output.

^ Saquib

.

0 Kudos

Thnx for replying SK....

my code is like this...

INFOTYPES: 0000, "Action

0001,

0002, "Personal Data

0006, "Address

0008,

1001,

0105, "Communication

0041. "Date Specification

  • 9000.

*----


  • TABLES

*----


TABLES: "pernr, "Standard Selections for HR Master Dat

t510,

pa0000,

hrp1001.

TYPE-POOLS: slis.

-


-


......

..........

START-OF-SELECTION .

*Fetch Data from LDAP / Active Directory Server for reconcilation

PERFORM get_ldap_data.

*Get SAP HR data

rp_set_data_interval 'P0002' PN-BEGDA PN-endda.

rp-set-name-format.

GET pernr.

PERFORM get_sap_data.

rp_provide_from_last p0002 space PN-BEGDA pn-endda.

IF PNP-SW-FOUND = 1.

  • get last name

MOVE p0002-nachn TO g_nachn.

*get first name

MOVE p0002-vorna TO g_vorna.

endif.

....do the selection screen makes any differance....

i m using std one.....

plz suggest...

and amit Gupta ---i am passing the values as shown above....as it is...

Edited by: Rohit Kumar on Sep 17, 2008 6:26 PM

0 Kudos

Comment the following and try ..

*Get SAP HR data

rp_set_data_interval 'P0002' PN-BEGDA PN-endda.

Iu2019ve seen wired behavior with above macro in past .

Also Iu2019m assuming that you are selecting all of the data after Get pernr event.

Good luck !

^ Saquib

0 Kudos

>

> Thnx for replying SK....

> my code is like this...

>

> INFOTYPES: 0000, "Action

> 0001,

> 0002, "Personal Data

> 0006, "Address

> 0008,

> 1001,

> 0105, "Communication

> 0041. "Date Specification

> * 9000.

> *----


> * TABLES

> *----


> TABLES: "pernr, "Standard Selections for HR Master Dat

> t510,

> pa0000,

> hrp1001.

>

> TYPE-POOLS: slis.

> -


> -


......

> ..........

>

> START-OF-SELECTION .

> *Fetch Data from LDAP / Active Directory Server for reconcilation

> PERFORM get_ldap_data.

>

> *Get SAP HR data

> rp_set_data_interval 'P0002' PN-BEGDA PN-endda.

> rp-set-name-format.

>

> GET pernr.

> PERFORM get_sap_data.

>

> rp_provide_from_last p0002 space PN-BEGDA pn-endda.

> IF PNP-SW-FOUND = 1.

> * get last name

> MOVE p0002-nachn TO g_nachn.

> *get first name

> MOVE p0002-vorna TO g_vorna.

> endif.

>

> ....do the selection screen makes any differance....

>

> i m using std one.....

>

> plz suggest...

>

>

> and amit Gupta ---i am passing the values as shown above....as it is...

>

> Edited by: Rohit Kumar on Sep 17, 2008 6:26 PM

Hi Rohit

The code is working fine for me, could you please post the values of pn-begda and pn-endda and the data(key fields) returned by LDB into the internal table P0002 and let us know as why you think LDB is not restricting the data. Here is the code that i've tested


REPORT zytest.
INFOTYPES: 0000, " Actions
0001,            " Org Assignment
0002,            " Personal Data
0006,            " Address
0008,            " Basic Pay
1001,            " Relationships
0070,            " Court orders
0105,            " Communication
0041.            " Date Specification

*9000.
*---------------------------------------------------------------------

*TABLES
*---------------------------------------------------------------------
TABLES: pernr, "Standard Selections for HR Master Dat
t510,
pa0000,
hrp1001.

TYPE-POOLS: slis.

START-OF-SELECTION .
*Fetch Data from LDAP / Active Directory Server for reconcilation
*PERFORM get_ldap_data.

*Get SAP HR data
  rp_set_data_interval 'P0002' pn-begda pn-endda.
  rp-set-name-format.

GET pernr.
*PERFORM get_sap_data.

  rp_provide_from_last p0002 space pn-begda pn-endda.
  IF pnp-sw-found = 1.

*get last name
*MOVE p0002-nachn TO g_nachn.
**get first name
*MOVE p0002-vorna TO g_vorna.
  ENDIF.REPORT zytest.
INFOTYPES: 0000, " Actions
0001,            " Org Assignment
0002,            " Personal Data
0006,            " Address
0008,            " Basic Pay
1001,            " Relationships
0070,            " Court orders
0105,            " Communication
0041.            " Date Specification

*9000.
*---------------------------------------------------------------------

*TABLES
*---------------------------------------------------------------------
TABLES: pernr, "Standard Selections for HR Master Dat
t510,
pa0000,
hrp1001.

TYPE-POOLS: slis.

START-OF-SELECTION .
*Fetch Data from LDAP / Active Directory Server for reconcilation
*PERFORM get_ldap_data.

*Get SAP HR data
  rp_set_data_interval 'P0002' pn-begda pn-endda.
  rp-set-name-format.

GET pernr.
*PERFORM get_sap_data.

  rp_provide_from_last p0002 space pn-begda pn-endda.
  IF pnp-sw-found = 1.

*get last name
*MOVE p0002-nachn TO g_nachn.
**get first name
*MOVE p0002-vorna TO g_vorna.
  ENDIF.

0 Kudos

Hi Rajesh,,

the value in PN-BEGDA & PN-ENDDA...is the same which is i m entering in the selection screen...

0 Kudos

Hi SK,

i commented it but didnt work...

0 Kudos

>

> Hi Rajesh,,

>

> the value in PN-BEGDA & PN-ENDDA...is the same which is i m entering in the selection screen...

Hi Rohit,

Could you please post the values of pn-begda, pn-endda and the values of the key fields in the records returned by the LDB into the internal table P0002

0 Kudos

as shown while debugging...

the value which i have entered in selection screen :

PN-BEGDA 20080901

PN-endda 20080919

and in p0002:

PERNR INFTY SUBTY OBJPS SPRPS ENDDA BEGDA SEQNR AEDTM

00000010|0002 | | | |99991231|19670522| 000 |

00000010|0002 | | | |99991231|19670522| 000 | 20030

there is problem it is taking begda from begining....

plz suggest ....

0 Kudos

hi Rohit,

Retrieving the Data by 'Get Pernr' will not restrict the data.

The whole data for a pernr will be retrieved at the Get pernr event no matter of ur pn-begda and pn-endda.

if u want to filter the data u have to use the macro's.

0 Kudos

Iu2019d say perform the following checks.

~ Take employee # and run it for other period option

~ Look at employee data (all ITs you are accessing in your program one by one closely with open eyes, pay attention to dates u201C.

~ Run report and debug it and look data for every IT and make sure it is picking up all the records as period specified in report . Compare them with PA20/PA30 .

~ At last , see what you are getting in internal table .

~ If problem still exist , Comment any code before START-OF-SELECTION event .

~ Just use "Get Pernr" and write statement . Comment ALL ITs and just run it for one IT at a time .

Iu2019m sure , youu2019ll find what is really going wrong .

Good Luck !

^Saquib

0 Kudos

>

> as shown while debugging...

>

> the value which i have entered in selection screen :

> PN-BEGDA 20080901

> PN-endda 20080919

>

>

>

> and in p0002:

>

>

> PERNR INFTY SUBTY OBJPS SPRPS ENDDA BEGDA SEQNR AEDTM

>

> 00000010|0002 | | | |99991231|19670522| 000 |

> 00000010|0002 | | | |99991231|19670522| 000 | 20030

>

>

> there is problem it is taking begda from begining....

>

> plz suggest ....

Hi Rohit

The records returned by the LDB are absolutely fine, i don't see any issue with them, since the 2 records are valid in the date range given in the selection screen(pn-begda, pn-endda) the LDB returned those 2 records this is the expected behaviour of the system and the macro

rp_set_data_interval is working as it should be.

If you want to analyze the macro(rp_set_data_interval), delimit any of the 2 records returned by the LDB such that the enddate of the record is before pn-begda(20080901), now the LDB will not return the delimited record as the enddate of the record does not fall in the interval pn-begda, pn-endda.

@Krishna Kishore : I totally agree with you, here in the example provided by Rohit as we are using the macro rp_set_data_interval we expect that the LDB should limit the records returned to the date range given in the selection screen(pn-begda, pn-endda) instead of returning all the records of the pernr.

One more option to totally restrict the records returned by the LDB is to add "MODE N" in the Infotypes declaration

itself. Please, check the link below

http://help.sap.com/saphelp_47x200/helpdata/en/4f/d527fb575e11d189270000e8322f96/content.htm

Regards

Rajesh.

Former Member
0 Kudos

pass ur selection screen data like p_begda, p_endda to PN-BEGDA, PN-ENDDA before get pernr event.

It will restrict get pernr event from fetching all the data.

Former Member
0 Kudos

THIS CODE CAN BE USED TO RESTRICT GET PERNR EVENT TO LOOP ONLY FOR PERNR MENTIONED IN SELECT OPTIONS

TABLES: PERNR.

SELECT-OPTIONS: R_PERNR FOR PERNR-PERNR.

START-OF-SELECTION.

PNPPERNR = R_PERNR.

GET PERNR.

WRITE: / PERNR-PERNR.

END-OF-SELECTION.

0 Kudos

Hi Amit,

i tried that also...

i jst copied ur code and tried alone ....bt still there is problem...

i think ther must be some problem with sonfig...

plz suggest me...