SAP Function Modules

WB2_CHANGE_ITEM_MATNR SAP Function module - Trading Contract: Change Material







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

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


Pattern for FM WB2_CHANGE_ITEM_MATNR - WB2 CHANGE ITEM MATNR





CALL FUNCTION 'WB2_CHANGE_ITEM_MATNR' "Trading Contract: Change Material
  EXPORTING
    i_komwbhk =                 " komwbhk       Trading Contract: Communication Structure Header Data
    i_komwbhi =                 " komwbhi       Trading Contract: Communication Structure, Item Data
    i_komwbhi_old =             " komwbhi       Trading Contract: Communication Structure, Item Data
    i_t180 =                    " t180          Screen Sequence Control: Transaction Default Values
    i_komwbhd =                 " komwbhd       Trading Contract: Communication Structure, Commercial Data
*   i_delete_pricing = 'X'      " c
*   i_online =                  " c
  IMPORTING
    e_komwbhi =                 " komwbhi       Trading Contract: Communication Structure, Item Data
    e_komwbhi_old =             " komwbhi       Trading Contract: Communication Structure, Item Data
    e_komwbhd =                 " komwbhd       Trading Contract: Communication Structure, Commercial Data
  TABLES
    t_komwbhi =                 " komwbhi       Trading Contract: Communication Structure, Item Data
    t_komwbhp =                 " komwbhp       Trading Contract: Communication Structure, Partner Assignmt
    t_komwbhd =                 " komwbhd       Trading Contract: Communication Structure, Commercial Data
*   t_error_message =           " wb2_error     Trading Contract: Error Handling
  EXCEPTIONS
    CHANGE_ERROR = 1            "
    MATERIAL_ERROR = 2          "
    NO_CHANGE_POSSIBLE = 3      "
    CHECK_ERROR = 4             "
    .  "  WB2_CHANGE_ITEM_MATNR

ABAP code example for Function Module WB2_CHANGE_ITEM_MATNR





The ABAP code below is a full code listing to execute function module WB2_CHANGE_ITEM_MATNR 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_e_komwbhi  TYPE KOMWBHI ,
ld_e_komwbhi_old  TYPE KOMWBHI ,
ld_e_komwbhd  TYPE KOMWBHD ,
it_t_komwbhi  TYPE STANDARD TABLE OF KOMWBHI,"TABLES PARAM
wa_t_komwbhi  LIKE LINE OF it_t_komwbhi ,
it_t_komwbhp  TYPE STANDARD TABLE OF KOMWBHP,"TABLES PARAM
wa_t_komwbhp  LIKE LINE OF it_t_komwbhp ,
it_t_komwbhd  TYPE STANDARD TABLE OF KOMWBHD,"TABLES PARAM
wa_t_komwbhd  LIKE LINE OF it_t_komwbhd ,
it_t_error_message  TYPE STANDARD TABLE OF WB2_ERROR,"TABLES PARAM
wa_t_error_message  LIKE LINE OF it_t_error_message .

DATA(ld_i_komwbhk) = 'Check type of data required'.
DATA(ld_i_komwbhi) = 'Check type of data required'.
DATA(ld_i_komwbhi_old) = 'Check type of data required'.
DATA(ld_i_t180) = 'Check type of data required'.
DATA(ld_i_komwbhd) = 'Check type of data required'.
DATA(ld_i_delete_pricing) = 'Check type of data required'.
DATA(ld_i_online) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_t_komwbhi to it_t_komwbhi.

"populate fields of struture and append to itab
append wa_t_komwbhp to it_t_komwbhp.

"populate fields of struture and append to itab
append wa_t_komwbhd to it_t_komwbhd.

"populate fields of struture and append to itab
append wa_t_error_message to it_t_error_message. . CALL FUNCTION 'WB2_CHANGE_ITEM_MATNR' EXPORTING i_komwbhk = ld_i_komwbhk i_komwbhi = ld_i_komwbhi i_komwbhi_old = ld_i_komwbhi_old i_t180 = ld_i_t180 i_komwbhd = ld_i_komwbhd * i_delete_pricing = ld_i_delete_pricing * i_online = ld_i_online IMPORTING e_komwbhi = ld_e_komwbhi e_komwbhi_old = ld_e_komwbhi_old e_komwbhd = ld_e_komwbhd TABLES t_komwbhi = it_t_komwbhi t_komwbhp = it_t_komwbhp t_komwbhd = it_t_komwbhd * t_error_message = it_t_error_message EXCEPTIONS CHANGE_ERROR = 1 MATERIAL_ERROR = 2 NO_CHANGE_POSSIBLE = 3 CHECK_ERROR = 4 . " WB2_CHANGE_ITEM_MATNR
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 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_e_komwbhi  TYPE KOMWBHI ,
ld_i_komwbhk  TYPE KOMWBHK ,
it_t_komwbhi  TYPE STANDARD TABLE OF KOMWBHI ,
wa_t_komwbhi  LIKE LINE OF it_t_komwbhi,
ld_e_komwbhi_old  TYPE KOMWBHI ,
ld_i_komwbhi  TYPE KOMWBHI ,
it_t_komwbhp  TYPE STANDARD TABLE OF KOMWBHP ,
wa_t_komwbhp  LIKE LINE OF it_t_komwbhp,
ld_e_komwbhd  TYPE KOMWBHD ,
ld_i_komwbhi_old  TYPE KOMWBHI ,
it_t_komwbhd  TYPE STANDARD TABLE OF KOMWBHD ,
wa_t_komwbhd  LIKE LINE OF it_t_komwbhd,
ld_i_t180  TYPE T180 ,
it_t_error_message  TYPE STANDARD TABLE OF WB2_ERROR ,
wa_t_error_message  LIKE LINE OF it_t_error_message,
ld_i_komwbhd  TYPE KOMWBHD ,
ld_i_delete_pricing  TYPE C ,
ld_i_online  TYPE C .

ld_i_komwbhk = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_t_komwbhi to it_t_komwbhi.
ld_i_komwbhi = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_t_komwbhp to it_t_komwbhp.
ld_i_komwbhi_old = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_t_komwbhd to it_t_komwbhd.
ld_i_t180 = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_t_error_message to it_t_error_message.
ld_i_komwbhd = 'Check type of data required'.
ld_i_delete_pricing = 'Check type of data required'.
ld_i_online = 'Check type of data required'.

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