SAP Function Modules

LC_GET_COMPANIES SAP Function module







LC_GET_COMPANIES 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 LC_GET_COMPANIES into the relevant SAP transaction such as SE37 or SE80.

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


Pattern for FM LC_GET_COMPANIES - LC GET COMPANIES





CALL FUNCTION 'LC_GET_COMPANIES' "
  EXPORTING
    rvers =                     " t858-rvers
    ryear =                     " t852g-ryear
    rsubd =                     " t852g-rsubd
  TABLES
    comptab =                   " lccomptab
  EXCEPTIONS
    INVALID_VERSION = 1         "
    .  "  LC_GET_COMPANIES

ABAP code example for Function Module LC_GET_COMPANIES





The ABAP code below is a full code listing to execute function module LC_GET_COMPANIES 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_comptab  TYPE STANDARD TABLE OF LCCOMPTAB,"TABLES PARAM
wa_comptab  LIKE LINE OF it_comptab .


SELECT single RVERS
FROM T858
INTO @DATA(ld_rvers).


SELECT single RYEAR
FROM T852G
INTO @DATA(ld_ryear).


SELECT single RSUBD
FROM T852G
INTO @DATA(ld_rsubd).


"populate fields of struture and append to itab
append wa_comptab to it_comptab. . CALL FUNCTION 'LC_GET_COMPANIES' EXPORTING rvers = ld_rvers ryear = ld_ryear rsubd = ld_rsubd TABLES comptab = it_comptab EXCEPTIONS INVALID_VERSION = 1 . " LC_GET_COMPANIES
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "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_rvers  TYPE T858-RVERS ,
it_comptab  TYPE STANDARD TABLE OF LCCOMPTAB ,
wa_comptab  LIKE LINE OF it_comptab,
ld_ryear  TYPE T852G-RYEAR ,
ld_rsubd  TYPE T852G-RSUBD .


SELECT single RVERS
FROM T858
INTO ld_rvers.


"populate fields of struture and append to itab
append wa_comptab to it_comptab.

SELECT single RYEAR
FROM T852G
INTO ld_ryear.


SELECT single RSUBD
FROM T852G
INTO ld_rsubd.

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 LC_GET_COMPANIES or its description.