SAP SELECT_LFM2_SPECIAL_FIELDS_FOR Function Module for Select special fields from LFM2 for given parameters
SELECT_LFM2_SPECIAL_FIELDS_FOR is a standard select lfm2 special fields for SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Select special fields from LFM2 for given parameters processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for select lfm2 special fields for FM, simply by entering the name SELECT_LFM2_SPECIAL_FIELDS_FOR into the relevant SAP transaction such as SE37 or SE38.
Function Group: SEL_LFM2
Program Name: SAPLSEL_LFM2
Main Program: SAPLSEL_LFM2
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function SELECT_LFM2_SPECIAL_FIELDS_FOR pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'SELECT_LFM2_SPECIAL_FIELDS_FOR'"Select special fields from LFM2 for given parameters.
EXPORTING
* I_SELECT_TYPE = '0' "Kind of select : standard (0), single (1), for update (2), distinct (3)
* I_REALLY_EXIST = "General flag
* I_BYPASS = "General flag
* IS_LIFNR = "General flag
* I_LIFNR = "Account number of vendor or creditor
* IS_EKORG = "General flag
* I_EKORG = "Purchasing organization
* IS_LTSNR = "General flag
* I_LTSNR = "Vendor sub-range
* IS_WERKS = "General flag
* I_WERKS = "Plant
CHANGING
* DB_COUNT = "DB operations, number of table lines processed
TABLES
T_LFM2_FIELDNAME = "Field Name
T_LFM2 = "Vendor Master Record: Purchasing Data
* T_WHERE_CLAUSE_IN = "Line for WHERE clauses (dynamic selections)
EXCEPTIONS
NOT_FOUND = 1 ERROR_IN_SELECT = 2
IMPORTING Parameters details for SELECT_LFM2_SPECIAL_FIELDS_FOR
I_SELECT_TYPE - Kind of select : standard (0), single (1), for update (2), distinct (3)
Data type: CDefault: '0'
Optional: Yes
Call by Reference: Yes
I_REALLY_EXIST - General flag
Data type: FLAGOptional: Yes
Call by Reference: Yes
I_BYPASS - General flag
Data type: FLAGOptional: Yes
Call by Reference: Yes
IS_LIFNR - General flag
Data type: FLAGOptional: Yes
Call by Reference: Yes
I_LIFNR - Account number of vendor or creditor
Data type: LFM2-LIFNROptional: Yes
Call by Reference: Yes
IS_EKORG - General flag
Data type: FLAGOptional: Yes
Call by Reference: Yes
I_EKORG - Purchasing organization
Data type: LFM2-EKORGOptional: Yes
Call by Reference: Yes
IS_LTSNR - General flag
Data type: FLAGOptional: Yes
Call by Reference: Yes
I_LTSNR - Vendor sub-range
Data type: LFM2-LTSNROptional: Yes
Call by Reference: Yes
IS_WERKS - General flag
Data type: FLAGOptional: Yes
Call by Reference: Yes
I_WERKS - Plant
Data type: LFM2-WERKSOptional: Yes
Call by Reference: Yes
CHANGING Parameters details for SELECT_LFM2_SPECIAL_FIELDS_FOR
DB_COUNT - DB operations, number of table lines processed
Data type: SY-DBCNTOptional: Yes
Call by Reference: Yes
TABLES Parameters details for SELECT_LFM2_SPECIAL_FIELDS_FOR
T_LFM2_FIELDNAME - Field Name
Data type: FIELDNAMESOptional: No
Call by Reference: Yes
T_LFM2 - Vendor Master Record: Purchasing Data
Data type: LFM2Optional: No
Call by Reference: Yes
T_WHERE_CLAUSE_IN - Line for WHERE clauses (dynamic selections)
Data type: RSDSWHEREOptional: Yes
Call by Reference: Yes
EXCEPTIONS details
NOT_FOUND - No record found for given parameters
Data type:Optional: No
Call by Reference: Yes
ERROR_IN_SELECT - Incorrect field to search given to select statement
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for SELECT_LFM2_SPECIAL_FIELDS_FOR Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than 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 newer method of declaring data variables on the fly. 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), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_db_count | TYPE SY-DBCNT, " | |||
| lv_not_found | TYPE SY, " | |||
| lv_i_select_type | TYPE C, " '0' | |||
| lt_t_lfm2_fieldname | TYPE STANDARD TABLE OF FIELDNAMES, " | |||
| lv_i_really_exist | TYPE FLAG, " | |||
| lv_i_bypass | TYPE FLAG, " | |||
| lt_t_lfm2 | TYPE STANDARD TABLE OF LFM2, " | |||
| lv_is_lifnr | TYPE FLAG, " | |||
| lv_error_in_select | TYPE FLAG, " | |||
| lv_i_lifnr | TYPE LFM2-LIFNR, " | |||
| lt_t_where_clause_in | TYPE STANDARD TABLE OF RSDSWHERE, " | |||
| lv_is_ekorg | TYPE FLAG, " | |||
| lv_i_ekorg | TYPE LFM2-EKORG, " | |||
| lv_is_ltsnr | TYPE FLAG, " | |||
| lv_i_ltsnr | TYPE LFM2-LTSNR, " | |||
| lv_is_werks | TYPE FLAG, " | |||
| lv_i_werks | TYPE LFM2-WERKS. " |
|   CALL FUNCTION 'SELECT_LFM2_SPECIAL_FIELDS_FOR' "Select special fields from LFM2 for given parameters |
| EXPORTING | ||
| I_SELECT_TYPE | = lv_i_select_type | |
| I_REALLY_EXIST | = lv_i_really_exist | |
| I_BYPASS | = lv_i_bypass | |
| IS_LIFNR | = lv_is_lifnr | |
| I_LIFNR | = lv_i_lifnr | |
| IS_EKORG | = lv_is_ekorg | |
| I_EKORG | = lv_i_ekorg | |
| IS_LTSNR | = lv_is_ltsnr | |
| I_LTSNR | = lv_i_ltsnr | |
| IS_WERKS | = lv_is_werks | |
| I_WERKS | = lv_i_werks | |
| CHANGING | ||
| DB_COUNT | = lv_db_count | |
| TABLES | ||
| T_LFM2_FIELDNAME | = lt_t_lfm2_fieldname | |
| T_LFM2 | = lt_t_lfm2 | |
| T_WHERE_CLAUSE_IN | = lt_t_where_clause_in | |
| EXCEPTIONS | ||
| NOT_FOUND = 1 | ||
| ERROR_IN_SELECT = 2 | ||
| . " SELECT_LFM2_SPECIAL_FIELDS_FOR | ||
ABAP code using 7.40 inline data declarations to call FM SELECT_LFM2_SPECIAL_FIELDS_FOR
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single DBCNT FROM SY INTO @DATA(ld_db_count). | ||||
| DATA(ld_i_select_type) | = '0'. | |||
| "SELECT single LIFNR FROM LFM2 INTO @DATA(ld_i_lifnr). | ||||
| "SELECT single EKORG FROM LFM2 INTO @DATA(ld_i_ekorg). | ||||
| "SELECT single LTSNR FROM LFM2 INTO @DATA(ld_i_ltsnr). | ||||
| "SELECT single WERKS FROM LFM2 INTO @DATA(ld_i_werks). | ||||
Search for further information about these or an SAP related objects