Form level Pre-population

Include /FLMHR/FORM_PREPOP

Form level pre-population is activated by adding the include program /FLM/FORM_PREPOP to the form-level user-exit.

 

Configuration table /FLMHR/PRE_CNTRL

The configuration table for form-level pre-population enables the addition of a number of custom functions to fill form fields.

 

Entries with a customer code but no form type will be executed for ALL form types.

Additionaly Form Type, Version and Status can be added to control form-level pre-population more granularly.

By default, pre-population is only run at Initial status, unless extra pre-population statuses are configured in the standard FLM configuration table.

Multiple Steps can be added, and a setting can be added to control whether the function is run for initial pre-population, check cycles or both.

The table controls what function modules will be run and the order in which they will be run.

You can also specify an optional RFC Destination to read from other SAP systems or call the pre-pop using a "Super User".

Where you do not want to modify individual user authorisations you can create a service user with full HR Access and provide the logon details as part of a new FLMHR destination created via transaction SM59, requested via your SAP Basis team.

Adding this FLMHR destination will ensure that infotypes and areas of the Org structure not normally avaialable to the curent user can still be read.

In additonal this include will look for form specific entries within the FLM project variables with the FPRE_<fieldname> tag and load the value into the relevant form field.

Note that the default values passed in via the project variables are updated AFTER the pre-population functions have run so will OVERWRITE any previously derived values.

There are some pre-delivered function modules:

/FLMHR/PRE_GLOBAL

This function should always be included.  It performs two functions:

(1) It pre-populates the folowing generic form fields:

o   TXT_INITIATOR (employee name read from infotype 0002)

o   TXT_INITIATOR_PER (employee number determined from infotype 0105)

o   DT_REQUEST DATE (current system date)

o   TXT_MOLGA (country grouping of user logged in)

o   TXT_MOLGA_CURRENCY (currency of company code linked to country grouping)

o   TXT_IM_DOCUMENT (passed via URL parameter FLMIMDocument)

 

(2) It triggers the item-level pre-population routines.

 

/FLMHR_PRE_AR_PERSAREA

This pre-populates an array of Personnel Area and Personnel SubArea into field 'AR_PERSAREA'.

This is used to control cascading drop-down fields on the form.

 

/FLMHR/PRE_AR_EMPGROUP

This pre-populates an array of Employee Group and Employee Subgroup into field 'AR_EMPGROUP'.

This is used to control cascading drop-down fields on the form.

 

Customer-defined Form-level prepopulation functions

Customers can use form-level pre-population functions to add logic to pre-populate fields that cannot be directly read from an infotype using the field-level control table.

This could be used, for example, to fill other arrays.

The functions are used to APPEND data fields for pre-population to the export table e_data. 

Note that the work area "l_data" must be cleared and only the name, value and optionally height fields should be filled.

The "l_data-height" variable can be set if you wish to populate fields on repeating rows where a height value of 1 fills the first row on the form.

In this example, fields 'TXT_SUPER_ID" and 'TXT_SUPER_NAME' are filled.  Note the table i_data contains data already pre-populated using the previously called functions (but not default values passed via FLM project variables).

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
FUNCTION z_flm_pre_sample
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(I_DATA) TYPE  /FLM/XML_TAB_T
*"     VALUE(I_CCODE) TYPE  /FLM/CUST_CODE
*"     VALUE(I_FTYPE) TYPE  /FLM/FTYPE_CODE
*"     VALUE(I_USER) TYPE  UNAME DEFAULT SY-UNAME
*"     VALUE(I_DOC) TYPE  TEXT40
*"  EXPORTING
*"     VALUE(E_DATA) TYPE  /FLM/XML_TAB_T
*"----------------------------------------------------------------------
*
  DATA: l_sobid         TYPE sobid,
        l_super_pos     TYPE sobid,
        lt_leading_pos  TYPE TABLE OF hrobject,
        l_leading_pos   TYPE hrobject,
        l_data          TYPE /flm/xml_tab,
        l_vorna         TYPE pad_vorna,
        l_nachn         TYPE pad_nachn,
        l_super_name    TYPE string.

*
* Read the Org Unit from the form data.
*
  READ TABLE i_data INTO l_data WITH KEY name = 'TXT_ORGU_ID'.
  l_sobid = l_data-value.
*
* Find leading position for Org Unit
*
  CALL FUNCTION 'RH_GET_LEADING_POSITION'
    EXPORTING
      plvar             = '01'
      otype             = 'O'
      sobid             = l_sobid
    TABLES
      leading_pos       = lt_leading_pos
    EXCEPTIONS
      no_lead_pos_found = 1
      OTHERS            = 2.
*
  IF sy-subrc EQ '0'.
*
* Should be only 1 leading position
*
    LOOP AT lt_leading_pos INTO l_leading_pos.
      l_super_pos = l_leading_pos-objid.
    ENDLOOP.

    SELECT sobid FROM  hrp1001 INTO l_sobid UP TO 1 ROWS
           WHERE  otype  = 'S'
           AND    objid  = l_super_pos
           AND    plvar  = '01'
           AND    rsign  = 'A'
           AND    relat  = '008'
           AND    istat  = '1'
           AND    begda  LE sy-datum
           AND    endda  GE sy-datum
           AND    sclas  EQ 'P'.
    ENDSELECT.
*
    CLEAR l_data.
    l_data-name = 'TXT_SUPER_ID'.
    l_data-value = l_sobid.
    APPEND l_data TO e_data.
*
    SELECT SINGLE vorna FROM pa0002 INTO l_vorna
        WHERE pernr = l_sobid
        AND begda LE sy-datlo
        AND endda GE sy-datlo.
*
    SELECT SINGLE nachn FROM pa0002 INTO l_nachn
        WHERE pernr = l_sobid
        AND begda LE sy-datlo
        AND endda GE sy-datlo.
*
    CONCATENATE l_vorna l_nachn INTO l_super_name SEPARATED BY space.
*
    CLEAR l_data.
    l_data-name = 'TXT_SUPER_NAME'.
    l_data-value = l_super_name.
    APPEND l_data TO e_data.

  ENDIF.


ENDFUNCTION.