SAP SELECT_LFM2_ALL_FIELDS_IN Function Module for Select all fields from LFM2 according to ranges parameters









SELECT_LFM2_ALL_FIELDS_IN is a standard select lfm2 all fields in 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 all fields from LFM2 according to ranges 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 all fields in FM, simply by entering the name SELECT_LFM2_ALL_FIELDS_IN 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_ALL_FIELDS_IN 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_ALL_FIELDS_IN'"Select all fields from LFM2 according to ranges parameters
EXPORTING
* I_SELECT_TYPE = '0' "Kind of select : standard (0), distinct (3)
* I_REALLY_EXIST = "General flag
* I_BYPASS = "General flag

CHANGING
* DB_COUNT = "DB operations, number of table lines processed

TABLES
* R_LIFNR = "Range structure for selection of Account Number of Vendor
* R_EKORG = "Vendor Master Record: Purchasing Data
* R_LTSNR = "Range Table for Vendor Sub-Range
* R_WERKS = "Range table for the site
* R_SPERM = "Range structure for selection of Purch. block at purch. org
T_LFM2 = "Vendor Master Record: Purchasing Data

EXCEPTIONS
NOT_FOUND = 1 ERROR_IN_SELECT = 2
.



IMPORTING Parameters details for SELECT_LFM2_ALL_FIELDS_IN

I_SELECT_TYPE - Kind of select : standard (0), distinct (3)

Data type: C
Default: '0'
Optional: Yes
Call by Reference: Yes

I_REALLY_EXIST - General flag

Data type: FLAG
Optional: Yes
Call by Reference: Yes

I_BYPASS - General flag

Data type: FLAG
Optional: Yes
Call by Reference: Yes

CHANGING Parameters details for SELECT_LFM2_ALL_FIELDS_IN

DB_COUNT - DB operations, number of table lines processed

Data type: SY-DBCNT
Optional: Yes
Call by Reference: Yes

TABLES Parameters details for SELECT_LFM2_ALL_FIELDS_IN

R_LIFNR - Range structure for selection of Account Number of Vendor

Data type: LIFNR_RAN
Optional: Yes
Call by Reference: Yes

R_EKORG - Vendor Master Record: Purchasing Data

Data type: EKORG_RAN
Optional: Yes
Call by Reference: Yes

R_LTSNR - Range Table for Vendor Sub-Range

Data type: LTSNR_RAN
Optional: Yes
Call by Reference: Yes

R_WERKS - Range table for the site

Data type: WERKS_RAN
Optional: Yes
Call by Reference: Yes

R_SPERM - Range structure for selection of Purch. block at purch. org

Data type: SPERM_RAN
Optional: Yes
Call by Reference: Yes

T_LFM2 - Vendor Master Record: Purchasing Data

Data type: LFM2
Optional: No
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 select statement

Data type:
Optional: No
Call by Reference: Yes

Copy and paste ABAP code example for SELECT_LFM2_ALL_FIELDS_IN 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:
lt_r_lifnr  TYPE STANDARD TABLE OF LIFNR_RAN, "   
lv_db_count  TYPE SY-DBCNT, "   
lv_not_found  TYPE SY, "   
lv_i_select_type  TYPE C, "   '0'
lt_r_ekorg  TYPE STANDARD TABLE OF EKORG_RAN, "   
lv_i_really_exist  TYPE FLAG, "   
lv_error_in_select  TYPE FLAG, "   
lt_r_ltsnr  TYPE STANDARD TABLE OF LTSNR_RAN, "   
lv_i_bypass  TYPE FLAG, "   
lt_r_werks  TYPE STANDARD TABLE OF WERKS_RAN, "   
lt_r_sperm  TYPE STANDARD TABLE OF SPERM_RAN, "   
lt_t_lfm2  TYPE STANDARD TABLE OF LFM2. "   

  CALL FUNCTION 'SELECT_LFM2_ALL_FIELDS_IN'  "Select all fields from LFM2 according to ranges parameters
    EXPORTING
         I_SELECT_TYPE = lv_i_select_type
         I_REALLY_EXIST = lv_i_really_exist
         I_BYPASS = lv_i_bypass
    CHANGING
         DB_COUNT = lv_db_count
    TABLES
         R_LIFNR = lt_r_lifnr
         R_EKORG = lt_r_ekorg
         R_LTSNR = lt_r_ltsnr
         R_WERKS = lt_r_werks
         R_SPERM = lt_r_sperm
         T_LFM2 = lt_t_lfm2
    EXCEPTIONS
        NOT_FOUND = 1
        ERROR_IN_SELECT = 2
. " SELECT_LFM2_ALL_FIELDS_IN




ABAP code using 7.40 inline data declarations to call FM SELECT_LFM2_ALL_FIELDS_IN

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'.
 
 
 
 
 
 
 
 
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!