SAP Function Modules

HR_REORDER_FIELDS SAP Function module - Define the field sequence







HR_REORDER_FIELDS is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name HR_REORDER_FIELDS into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: HRNOA03
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM HR_REORDER_FIELDS - HR REORDER FIELDS





CALL FUNCTION 'HR_REORDER_FIELDS' "Define the field sequence
* EXPORTING
*   title =                     " sy-title      The title on the pop-up window
*   field_num = 1               " i             The number of fields to be displayed
*   disp_only =                 " c             The flag indicating whether updating is allowed
  TABLES
    fieldtabin =                "               Input data table
    resulttab =                 "               Result table
    headertab =                 " treemhhdr     The header table
  EXCEPTIONS
    INVALID_COLUMN_NUM = 1      "               The given column number is not valid
    FEW_COLUMN_NUM = 2          "               The input table do not have enough columns
    NOT_ENOUGH_COL_OUTPUT = 3   "               The output table should have more than 2 fields
    NOT_ENOUGH_HEADER = 4       "               Not enough entries in header table
    ERROR_ASSIGN_FIELD = 5      "               Error happens when assigning to fields in input table
    .  "  HR_REORDER_FIELDS

ABAP code example for Function Module HR_REORDER_FIELDS





The ABAP code below is a full code listing to execute function module HR_REORDER_FIELDS including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
it_fieldtabin  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_fieldtabin  LIKE LINE OF it_fieldtabin ,
it_resulttab  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_resulttab  LIKE LINE OF it_resulttab ,
it_headertab  TYPE STANDARD TABLE OF TREEMHHDR,"TABLES PARAM
wa_headertab  LIKE LINE OF it_headertab .

DATA(ld_title) = 'some text here'.
DATA(ld_field_num) = 'some text here'.
DATA(ld_disp_only) = 'some text here'.

"populate fields of struture and append to itab
append wa_fieldtabin to it_fieldtabin.

"populate fields of struture and append to itab
append wa_resulttab to it_resulttab.

"populate fields of struture and append to itab
append wa_headertab to it_headertab. . CALL FUNCTION 'HR_REORDER_FIELDS' * EXPORTING * title = ld_title * field_num = ld_field_num * disp_only = ld_disp_only TABLES fieldtabin = it_fieldtabin resulttab = it_resulttab headertab = it_headertab EXCEPTIONS INVALID_COLUMN_NUM = 1 FEW_COLUMN_NUM = 2 NOT_ENOUGH_COL_OUTPUT = 3 NOT_ENOUGH_HEADER = 4 ERROR_ASSIGN_FIELD = 5 . " HR_REORDER_FIELDS
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_title  TYPE SY-TITLE ,
it_fieldtabin  TYPE STANDARD TABLE OF STRING ,
wa_fieldtabin  LIKE LINE OF it_fieldtabin,
ld_field_num  TYPE I ,
it_resulttab  TYPE STANDARD TABLE OF STRING ,
wa_resulttab  LIKE LINE OF it_resulttab,
ld_disp_only  TYPE C ,
it_headertab  TYPE STANDARD TABLE OF TREEMHHDR ,
wa_headertab  LIKE LINE OF it_headertab.

ld_title = 'some text here'.

"populate fields of struture and append to itab
append wa_fieldtabin to it_fieldtabin.
ld_field_num = 'some text here'.

"populate fields of struture and append to itab
append wa_resulttab to it_resulttab.
ld_disp_only = 'some text here'.

"populate fields of struture and append to itab
append wa_headertab to it_headertab.

SAP Documentation for FM HR_REORDER_FIELDS


This function module is used to re-define the sequence of entries in a data table. User will be able to see a pop-up window showing all the ...See here for full SAP fm documentation

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name HR_REORDER_FIELDS or its description.