SAP Function Modules

COM_PRODUCT_GETLIST2 SAP Function module







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

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


Pattern for FM COM_PRODUCT_GETLIST2 - COM PRODUCT GETLIST2





CALL FUNCTION 'COM_PRODUCT_GETLIST2' "
* EXPORTING
*   iv_max_rows = 250           " bapimaxrow
*   it_product_type_range =     " comt_product_type_range_tab
*   it_product_id_range =       " comt_product_id_range_tab
*   it_prshtext_range =         " comt_prshtext_range_tab
*   iv_langu = SY-LANGU         " spras
*   it_product_config_range =   " comt_product_config_range_tab
*   it_competitor_range =       " comt_product_compet_range_tab
*   it_batch_dedic_range =      " comt_pr_batch_dedic_range_tab
*   it_logsys_range =           " comt_product_logsys_range_tab
*   it_category_range =         " comt_pr_category_range_tab
*   it_hierarchy_range =        " comt_hierarchy_id_range_tab
*   it_category_guid_range =    " comt_category_guid_range_tab
*   iv_category_subtree = SPACE  " comt_boolean  Logical Variable
*   iv_read_locked_too = SPACE  " comt_boolean  Logical Variable
*   iv_format_output = 'X'      " comt_boolean  Logical Variable
*   ir_scenario =               " cl_com_prsearchscenario_base
  IMPORTING
    et_product =                " comt_product_selection_tab
  EXCEPTIONS
    NOT_FOUND = 1               "
    WRONG_CALL = 2              "
    .  "  COM_PRODUCT_GETLIST2

ABAP code example for Function Module COM_PRODUCT_GETLIST2





The ABAP code below is a full code listing to execute function module COM_PRODUCT_GETLIST2 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:
ld_et_product  TYPE COMT_PRODUCT_SELECTION_TAB .

DATA(ld_iv_max_rows) = 'Check type of data required'.
DATA(ld_it_product_type_range) = 'Check type of data required'.
DATA(ld_it_product_id_range) = 'Check type of data required'.
DATA(ld_it_prshtext_range) = 'Check type of data required'.
DATA(ld_iv_langu) = 'Check type of data required'.
DATA(ld_it_product_config_range) = 'Check type of data required'.
DATA(ld_it_competitor_range) = 'Check type of data required'.
DATA(ld_it_batch_dedic_range) = 'Check type of data required'.
DATA(ld_it_logsys_range) = 'some text here'.
DATA(ld_it_category_range) = 'some text here'.
DATA(ld_it_hierarchy_range) = 'some text here'.
DATA(ld_it_category_guid_range) = 'some text here'.
DATA(ld_iv_category_subtree) = 'some text here'.
DATA(ld_iv_read_locked_too) = 'some text here'.
DATA(ld_iv_format_output) = 'some text here'.
DATA(ld_ir_scenario) = 'some text here'. . CALL FUNCTION 'COM_PRODUCT_GETLIST2' * EXPORTING * iv_max_rows = ld_iv_max_rows * it_product_type_range = ld_it_product_type_range * it_product_id_range = ld_it_product_id_range * it_prshtext_range = ld_it_prshtext_range * iv_langu = ld_iv_langu * it_product_config_range = ld_it_product_config_range * it_competitor_range = ld_it_competitor_range * it_batch_dedic_range = ld_it_batch_dedic_range * it_logsys_range = ld_it_logsys_range * it_category_range = ld_it_category_range * it_hierarchy_range = ld_it_hierarchy_range * it_category_guid_range = ld_it_category_guid_range * iv_category_subtree = ld_iv_category_subtree * iv_read_locked_too = ld_iv_read_locked_too * iv_format_output = ld_iv_format_output * ir_scenario = ld_ir_scenario IMPORTING et_product = ld_et_product EXCEPTIONS NOT_FOUND = 1 WRONG_CALL = 2 . " COM_PRODUCT_GETLIST2
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 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_et_product  TYPE COMT_PRODUCT_SELECTION_TAB ,
ld_iv_max_rows  TYPE BAPIMAXROW ,
ld_it_product_type_range  TYPE COMT_PRODUCT_TYPE_RANGE_TAB ,
ld_it_product_id_range  TYPE COMT_PRODUCT_ID_RANGE_TAB ,
ld_it_prshtext_range  TYPE COMT_PRSHTEXT_RANGE_TAB ,
ld_iv_langu  TYPE SPRAS ,
ld_it_product_config_range  TYPE COMT_PRODUCT_CONFIG_RANGE_TAB ,
ld_it_competitor_range  TYPE COMT_PRODUCT_COMPET_RANGE_TAB ,
ld_it_batch_dedic_range  TYPE COMT_PR_BATCH_DEDIC_RANGE_TAB ,
ld_it_logsys_range  TYPE COMT_PRODUCT_LOGSYS_RANGE_TAB ,
ld_it_category_range  TYPE COMT_PR_CATEGORY_RANGE_TAB ,
ld_it_hierarchy_range  TYPE COMT_HIERARCHY_ID_RANGE_TAB ,
ld_it_category_guid_range  TYPE COMT_CATEGORY_GUID_RANGE_TAB ,
ld_iv_category_subtree  TYPE COMT_BOOLEAN ,
ld_iv_read_locked_too  TYPE COMT_BOOLEAN ,
ld_iv_format_output  TYPE COMT_BOOLEAN ,
ld_ir_scenario  TYPE CL_COM_PRSEARCHSCENARIO_BASE .

ld_iv_max_rows = 'some text here'.
ld_it_product_type_range = 'some text here'.
ld_it_product_id_range = 'some text here'.
ld_it_prshtext_range = 'some text here'.
ld_iv_langu = 'some text here'.
ld_it_product_config_range = 'some text here'.
ld_it_competitor_range = 'some text here'.
ld_it_batch_dedic_range = 'some text here'.
ld_it_logsys_range = 'some text here'.
ld_it_category_range = 'some text here'.
ld_it_hierarchy_range = 'some text here'.
ld_it_category_guid_range = 'some text here'.
ld_iv_category_subtree = 'some text here'.
ld_iv_read_locked_too = 'some text here'.
ld_iv_format_output = 'some text here'.
ld_ir_scenario = 'some text here'.

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