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 call Function Module in Selection Screen

Former Member
0 Kudos

Hi All,

I have developed one HR Report (Qualification Overview Report: To display all active employees and their Qualifications along with their Proficiency).

Already it has 3 selection fields on selection screen and now I want one more field on selection screen like Qualification Id.

But when the end user press F4 it should display the Popup which comes in TCode: PA30 at the time of Creating Qualification.

I have debugged the Standard Code and searched the Function Module: 'RH_OBJID_REQUEST' which shows Popup which I wanted to show at Selection screen for newly added field.

So I have to define new field like 'Qualification Id' and want to attach above Function Module so that it will cater my requirement.

If anybody has worked on this type of requirement then please let me know.

Thanks,

Jay.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

- Read some documentation on [AT SELECTION-SCREEN - selscreen_event|http://help.sap.com/abapdocu_70/en/ABAPAT_SELECTION-SCREEN_EVENTS.htm#&ABAP_ALTERNATIVE_7@7@] for event [ON VALUE-REQUEST FOR|http://help.sap.com/abapdocu_70/en/ABAPAT_SELECTION-SCREEN_EVENTS.htm#&ABAP_ALTERNATIVE_7@7@] (ore press F1)

- Perform a search for where-used on FM RH_OBJID_REQUEST (you will find may methods and FM with F4 in the name) - you will get many samples this way.

Regards,

Raymond

15 REPLIES 15

raymond_giuseppi
Active Contributor
0 Kudos

- Read some documentation on [AT SELECTION-SCREEN - selscreen_event|http://help.sap.com/abapdocu_70/en/ABAPAT_SELECTION-SCREEN_EVENTS.htm#&ABAP_ALTERNATIVE_7@7@] for event [ON VALUE-REQUEST FOR|http://help.sap.com/abapdocu_70/en/ABAPAT_SELECTION-SCREEN_EVENTS.htm#&ABAP_ALTERNATIVE_7@7@] (ore press F1)

- Perform a search for where-used on FM RH_OBJID_REQUEST (you will find may methods and FM with F4 in the name) - you will get many samples this way.

Regards,

Raymond

0 Kudos

Hi Raymond,

Thanks for your quick reply.

But I want to know that how can we call Function Module on selection screen, i.e. my requirement is to show a popup when I press F4 button on selection screen for that particular field and at that time the FM 'RH_OBJID_REQUEST' should call and show pop up over there.

So pls tell me how to use/call FM at selection screen?

Thanks,

Jay.

0 Kudos

Did you use the link provided in the first part of my answer, it is the answer ^^


AT SELECTION-SCREEN ON VALUE-REQUEST FOR fieldname.
* fill parameters
...
* Call FM
  CALL FUNCTION 'RH_OBJID_REQUEST'
    EXPORTING
* ...
* fill fieldname value
* ...

Regards,

Raymond

0 Kudos

Hi Raymond,

Thanks a lot, you solved my problem.

Now just tell me one simple thing that how to pass all those entries in selection screen field?

Thanks,

Jay.

0 Kudos

Hi jaykrishna007,

Sure you read the documentation suggested by Giuseppe.

Which part is it you do not understand.

And what do you want to say "pass all those entries in selection screen field"? You can not pass more than one entry to one selection-screen field.

For value-request, the system uses a certain search sequence to find the adequate module. Check the relevant documentation.

Regards,

Clemens

0 Kudos

Not "All those entries", but use one of the returned parameter sel_* (object, otype or object) and move the required subfield to you selection field. If FM documentation is too hard to understand, try to enter in debug mode on transaction PA30 (or use tools like SE30 to analyze an execution)

Regards,

Raymond

0 Kudos

Hi Raymond,

Yes, I came to know that how to use FM, and it returns the Table 'SEL_OBJECTS', even I stored it in an Internal Table, and my question is how to pass all those selected qualification Ids into that Parameter.

and 1 more imp thing is, can we pass many values to selection screen field which User has selected from that Popup screen.(which comes after executing the Function Module)

Thanks,

Jay.

0 Kudos

AFAIK in a AT SELECTION-SCREEN ON VALUE-REQUEST FOR even on a SELECT-OPTIONS you can only return one value (use parameter SEL_OBJECT and not table SEL_OBJECTS)

If you want to select multiple values in one F4, you have to find or develop a search help using the called FM (*). Attach the search help to the field via [MATCHCODE OBJECT search_help|http://help.sap.com/abapdocu_70/en/ABAPPARAMETERS_VALUE.htm#&ABAP_ADDITION_3@3@], then user will be able to select multiple values via F4.

Regards,

Raymond

(*) Read [search help exit|http://help.sap.com/saphelp_nw73/helpdata/en/cf/21ee52446011d189700000e8322d00/frameset.htm], create a structure with the required fields (parameters and fields to display), create a FM/FG for search help exit, use FM F4IF_SHLP_EXIT_EXAMPLE as as sample for the FM, add the call to RH_OBJID_REQUEST after IF CALLCONTROL-STEP = 'SELECT'. use the FM beginning with F4UT to fill/update the required internal.tables then desactivate the display step.

0 Kudos

Hi Raymond,

Thanks a lot.

I really highly appreciate you for your complete solution and help to know better about selection screen in detailed.

Regards,

Jay.

0 Kudos

Hi Raymond,

I have written following code:

      • s_quali is used in selection screen for Qualification Id.

SELECT-OPTIONS : s_quali FOR hrp1000-objid NO INTERVALS.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_quali-low.

CALL FUNCTION 'RH_OBJID_REQUEST'

EXPORTING

plvar = '01'

otype = 'Q'

seark = '*'

seark_begda = '18000101'

seark_endda = '99991231'

set_mode = 'X'

TABLES

sel_objects = git_objects.

LOOP AT git_objects INTO wa_objects. " Logic is to fill up the Selection screen field

s_quali-low = wa_objects-objid.

APPEND s_quali TO s_quali.

CLEAR : s_quali, wa_objects.

ENDLOOP.

Now problem is that, its not populating all values in selection screen which I select from Popup screen (Choose Qualification).

I checked that the first value in the internal Table is over written by second records in the internal table

For e.g.: If I select 001,002,003,004 from Popup screen then I am able to see only 002,003,004 in the Multiple selection view of that field though it is available in the internal table s_quali (because I am filling up the table using Loop-Endloop)

Please advise me how to overcome this issue. (How to fill up selection screen)

Thanks,

Jay.

0 Kudos

I suppose that after your call, s_quali-low is '004', so it will erase currently displayed value (which should be '001') - header line overwrites first record ?

Regards,

Raymond

0 Kudos

Raymond,

Its not like that... its over writting first record with second record..

E.g. Internal Table has records (001,002,003,004,005) after selecting from popup screen and when I go back to selection screen it will not display first record at selection screen field, but if click Multiple Selection (Arrow) it will show records like (002,003,004,005), means 1st record is over written by second record i.e. 1st row deleted and rest all entries shifted to up.

To overcome this issue I used

SUBMIT zrhr_quali_update VIA SELECTION-SCREEN WITH s_quali IN s_quali.

by using this my selection screen problem comes 2 end but its clearing all other values of fields on the selection screen.

Thanks,

Jay.

0 Kudos

You could try RS_SELECTIONSCREEN_READ to read current values, add new values, and then use RS_SELECTIONSCREEN_UPDATE to update screen.

Regards,

Raymond

Former Member
0 Kudos

One issue came while filling up the data in selection screen.

Former Member
0 Kudos

thanks