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: 

HR-How to use dynamic selection fields in prog ..?

Former Member
0 Kudos

Hii

I have written a prog to select data pertaining to details of all employees who belong to a particular country . For this i have provided a dynamic selection field for selecting country (through Selection View).But when i am getting all the records for all countries.

How to use the dynamic selection fields in program or they behave in the same way as the standard selection given by the LDB .As if we enter a value in the std screen then the GET event acts accordingly .

Ajitabh Pradhan

11 REPLIES 11

Former Member
0 Kudos

send us the code plz

0 Kudos

TABLES : pernr.

INFOTYPES : 0002,0006.

GET pernr.

provide * from p0006 between pn-begda and pn-endda.

WRITE:/ pernr-pernr, sy-vline,

p0006-land1,sy-vline.

endprovide.

In this prog i have created a selection View with the country code field . Now i want only those employees which have that country in there address.

0 Kudos

why don't you do, before the write :

select-option : so_land for pa0006-land1.

check p0006-land1 in so_land.

so you display only the one in your select-option

0 Kudos

Hi Ajitabh,

The dynamic selections you entered are taken into account when the report is executed. There is no need to put an explict check in the program for the LAND1 field.The report will pick up only addresses of the LAND1 value you entered in your selection view on the screen.

Regards,

Suresh Datti

0 Kudos

> Hi Ajitabh,

>

> The dynamic selections you entered are taken into

> account when the report is executed. There is no need

> to put an explict check in the program for the LAND1

> field.The report will pick up only addresses of the

> LAND1 value you entered in your selection view on the

> screen.

>

> Regards,

>

> Suresh Datti

Hi,

I'm not sure about what u say!

I would mean SAP has to do something about this in pNP

fo me this is not the case!

Use CHECK statement

0 Kudos

Hi,

I stand by my earlier statement.. there is ABSOLUTELY no need to put an explicit CHECK when using the Dynamic Selections. I am on 47 ext 2 and it works perfect for me.

Regards,

Suresh Datti

0 Kudos

Help on provide

1. PROVIDE { FIELDS {*|{compi}}

FROM itabj INTO waj VALID flagj

BOUNDS intlim1j AND intlim2j

[WHERE log_expj] }

BETWEEN extlim1 AND extlim2

[INCLUDING GAPS].

Why don't u use where clause on field LAND1 of infotype 6

0 Kudos

Hi suresh

well the code i had earlier written is not working correctly , Can u give me a sample code to print the name of all employees who belong to a particular country .

The main concern here is that 0006 infotype has many subypes so my code prints all the countries for an employee .i.e if his permanent address is in india and some other address is in Qatar then it prints both the entries here and not a single entry for Qatar .

Please Help .

Ajitabh Pradhan

0 Kudos

Hi Ajitabh,

First off, is the Dynamic Selection working? If so, try the following code.. I am assuming, you only want to look at Permanent Address.


tables: pernr.
infotypes: 0001,0006.

start-of-selection.

get pernr.
  rp-provide-from-last p0001 space pn-begda pn-endda.
  check pnp-sw-found eq 1.
  rp-provide-from-last p0006 1 pn-begda pn-endda.
  check pnp-sw-found eq 1.
  write:/ pernr-pernr,p0001-ename,p0006-land1.

end-of-selection.

Regards,

Suresh Datti

0 Kudos

Hii Suresh

Well the code u had send is not giving the desired result .

The Report is also showing the records of Infotype 0006 subtype 1 which do not have the country specified in the Dynamic selection though other subtypes have the specified country.The PERNRS its displaying has a the country For Eg 'QA' (Qatar)(Specified in the dyanmic Selection) but for other subtypes that is for 2 or 3 not for subtype 1.

Hope u r getting my point

Ajitabh Pradhan

0 Kudos

Hi Ajitabh,

Here is what I found out.. Dynamic Selections work only for subty 1 on the Address Infotype (0006).. You have to put an explicit check for the other subtypes..

Regards,

Suresh Datti