SAP Function Modules

UPSCU_CONSTRUCTOR SAP Function module







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

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


Pattern for FM UPSCU_CONSTRUCTOR - UPSCU CONSTRUCTOR





CALL FUNCTION 'UPSCU_CONSTRUCTOR' "
  EXPORTING
    im_packagename =            " api_upshdr-upsnam  ALE Distribution Packet: Name
    im_owner =                  " api_upshdr-owner  ALE Distribution Packet : Owner
    im_partner =                " api_upshdr-logsys  ALE Distribution Packet : Partner
    im_direction =              " api_upshdr-direct  ALE Distribution Packet: Distribution Direction
*   im_editmode = KUPS_DISPLAY  " ups_editmode  Processing type
*   flg_error_if_not_exist = KUPS_TRUE  " xfeld  Error Message if Unit Does Not Exist
*   flg_error_if_exist = KUPS_TRUE  " xfeld     Error Message if Unit Already Exists
*   flg_appl_log = KUPS_FALSE   " xfeld         Write application log
*   flg_msg_collect = KUPS_FALSE  " xfeld       Collect messages
*   flg_itm_dscrpt = KUPS_FALSE  " xfeld
*   flg_itm_idoc = KUPS_FALSE   " xfeld
*   flg_dialog = KUPS_FALSE     " xfeld         Call in Dialog
*   im_handle =                 " balloghndl    Application Log: Log Handle
*   im_trustlevel_check = 0     " i
*   im_trustlevel_log = 0       " i
  IMPORTING
    ex_instid =                 " ups_instid    ALE Distribution Packet: ID for Instantiation
* TABLES
*   ex_messages =               " tupsbapiret2  Accumulated messages
  EXCEPTIONS
    FAILING_INSTANCE = 1        "               Object instance of packet could not be created
    UNITY_NOT_EXISTS = 2        "               Distribution unit is not available
    UNITY_EXISTS = 3            "               Distribution Packet Already Exists
    NO_AUTHORITY = 4            "               No Authorization
    DISPLAY_ONLY = 5            "
    ERROR = 6                   "               Unclassified error
    .  "  UPSCU_CONSTRUCTOR

ABAP code example for Function Module UPSCU_CONSTRUCTOR





The ABAP code below is a full code listing to execute function module UPSCU_CONSTRUCTOR 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_ex_instid  TYPE UPS_INSTID ,
it_ex_messages  TYPE STANDARD TABLE OF TUPSBAPIRET2,"TABLES PARAM
wa_ex_messages  LIKE LINE OF it_ex_messages .


DATA(ld_im_packagename) = some text here

DATA(ld_im_owner) = some text here

DATA(ld_im_partner) = some text here

DATA(ld_im_direction) = some text here
DATA(ld_im_editmode) = 'Check type of data required'.
DATA(ld_flg_error_if_not_exist) = 'Check type of data required'.
DATA(ld_flg_error_if_exist) = 'Check type of data required'.
DATA(ld_flg_appl_log) = 'Check type of data required'.
DATA(ld_flg_msg_collect) = 'Check type of data required'.
DATA(ld_flg_itm_dscrpt) = 'Check type of data required'.
DATA(ld_flg_itm_idoc) = 'Check type of data required'.
DATA(ld_flg_dialog) = 'Check type of data required'.
DATA(ld_im_handle) = 'Check type of data required'.
DATA(ld_im_trustlevel_check) = 'Check type of data required'.
DATA(ld_im_trustlevel_log) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_ex_messages to it_ex_messages. . CALL FUNCTION 'UPSCU_CONSTRUCTOR' EXPORTING im_packagename = ld_im_packagename im_owner = ld_im_owner im_partner = ld_im_partner im_direction = ld_im_direction * im_editmode = ld_im_editmode * flg_error_if_not_exist = ld_flg_error_if_not_exist * flg_error_if_exist = ld_flg_error_if_exist * flg_appl_log = ld_flg_appl_log * flg_msg_collect = ld_flg_msg_collect * flg_itm_dscrpt = ld_flg_itm_dscrpt * flg_itm_idoc = ld_flg_itm_idoc * flg_dialog = ld_flg_dialog * im_handle = ld_im_handle * im_trustlevel_check = ld_im_trustlevel_check * im_trustlevel_log = ld_im_trustlevel_log IMPORTING ex_instid = ld_ex_instid * TABLES * ex_messages = it_ex_messages EXCEPTIONS FAILING_INSTANCE = 1 UNITY_NOT_EXISTS = 2 UNITY_EXISTS = 3 NO_AUTHORITY = 4 DISPLAY_ONLY = 5 ERROR = 6 . " UPSCU_CONSTRUCTOR
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 ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "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_ex_instid  TYPE UPS_INSTID ,
ld_im_packagename  TYPE API_UPSHDR-UPSNAM ,
it_ex_messages  TYPE STANDARD TABLE OF TUPSBAPIRET2 ,
wa_ex_messages  LIKE LINE OF it_ex_messages,
ld_im_owner  TYPE API_UPSHDR-OWNER ,
ld_im_partner  TYPE API_UPSHDR-LOGSYS ,
ld_im_direction  TYPE API_UPSHDR-DIRECT ,
ld_im_editmode  TYPE UPS_EDITMODE ,
ld_flg_error_if_not_exist  TYPE XFELD ,
ld_flg_error_if_exist  TYPE XFELD ,
ld_flg_appl_log  TYPE XFELD ,
ld_flg_msg_collect  TYPE XFELD ,
ld_flg_itm_dscrpt  TYPE XFELD ,
ld_flg_itm_idoc  TYPE XFELD ,
ld_flg_dialog  TYPE XFELD ,
ld_im_handle  TYPE BALLOGHNDL ,
ld_im_trustlevel_check  TYPE I ,
ld_im_trustlevel_log  TYPE I .


ld_im_packagename = some text here

"populate fields of struture and append to itab
append wa_ex_messages to it_ex_messages.

ld_im_owner = some text here

ld_im_partner = some text here

ld_im_direction = some text here
ld_im_editmode = 'Check type of data required'.
ld_flg_error_if_not_exist = 'Check type of data required'.
ld_flg_error_if_exist = 'Check type of data required'.
ld_flg_appl_log = 'Check type of data required'.
ld_flg_msg_collect = 'Check type of data required'.
ld_flg_itm_dscrpt = 'Check type of data required'.
ld_flg_itm_idoc = 'Check type of data required'.
ld_flg_dialog = 'Check type of data required'.
ld_im_handle = 'Check type of data required'.
ld_im_trustlevel_check = 'Check type of data required'.
ld_im_trustlevel_log = '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 UPSCU_CONSTRUCTOR or its description.