SAP Function Modules

UPSCU_PACKAGE_CREATE SAP Function module







UPSCU_PACKAGE_CREATE 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_PACKAGE_CREATE 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_PACKAGE_CREATE - UPSCU PACKAGE CREATE





CALL FUNCTION 'UPSCU_PACKAGE_CREATE' "
  EXPORTING
    im_instid =                 " ups_instid    ALE Distribution Packet: ID for Instantiation
    imt_apiitm =                " api_tupsitm
*   imt_apisrc =                " api_tupssrc
*   imt_apipre =                " api_tupspre   ALE Distribution Packet: Predecessor (Input Structure)
*   flg_commit_and_wait = KUPS_TRUE  " xfeld    Send COMMIT AND WAIT
*   flg_appl_log = KUPS_FALSE   " xfeld         Write application log
*   flg_docnum_update = KUPS_FALSE  " xfeld     Identify object IDocs
*   flg_serial_update = KUPS_FALSE  " xfeld
*   flg_lock_package = KUPS_FALSE  " xfeld      Lock packet against changes
*   flg_msg_collect = KUPS_FALSE  " xfeld       Collect accumulated messages
*   im_handle =                 " balloghndl    Application Log: Log Handle
*   flg_set_upssts_new = KUPS_FALSE  " xfeld    Set packet status to 'new'
*   im_vrgng = KUPS_VRGNG_EDIT  " tj01-vrgng    Business Transaction
* TABLES
*   ex_messages =               " tupsbapiret2  Accumulated messages
  CHANGING
    ch_apihdr =                 " api_upshdr    ALE Distribution Packet: Header Data (Input Structure)
  EXCEPTIONS
    FAILING_INSTANCE = 1        "
    CURRENT_EXISTS = 2          "               There is still a packet in the unit that can be changed
    ERROR = 3                   "               Unspecified Error
    WRONG_INSTANCE = 4          "               Packet key does not fit current instance
    NO_CHANGE = 5               "               Packet has been opened for display only
    PACKAGE_EXISTS = 6          "               Package already exists
    NO_AUTHORITY = 7            "               No Authorization
    .  "  UPSCU_PACKAGE_CREATE

ABAP code example for Function Module UPSCU_PACKAGE_CREATE





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

DATA(ld_ch_apihdr) = 'Check type of data required'.
DATA(ld_im_instid) = 'Check type of data required'.
DATA(ld_imt_apiitm) = 'Check type of data required'.
DATA(ld_imt_apisrc) = 'Check type of data required'.
DATA(ld_imt_apipre) = 'Check type of data required'.
DATA(ld_flg_commit_and_wait) = 'Check type of data required'.
DATA(ld_flg_appl_log) = 'Check type of data required'.
DATA(ld_flg_docnum_update) = 'Check type of data required'.
DATA(ld_flg_serial_update) = 'Check type of data required'.
DATA(ld_flg_lock_package) = 'Check type of data required'.
DATA(ld_flg_msg_collect) = 'Check type of data required'.
DATA(ld_im_handle) = 'Check type of data required'.
DATA(ld_flg_set_upssts_new) = 'Check type of data required'.

SELECT single VRGNG
FROM TJ01
INTO @DATA(ld_im_vrgng).


"populate fields of struture and append to itab
append wa_ex_messages to it_ex_messages. . CALL FUNCTION 'UPSCU_PACKAGE_CREATE' EXPORTING im_instid = ld_im_instid imt_apiitm = ld_imt_apiitm * imt_apisrc = ld_imt_apisrc * imt_apipre = ld_imt_apipre * flg_commit_and_wait = ld_flg_commit_and_wait * flg_appl_log = ld_flg_appl_log * flg_docnum_update = ld_flg_docnum_update * flg_serial_update = ld_flg_serial_update * flg_lock_package = ld_flg_lock_package * flg_msg_collect = ld_flg_msg_collect * im_handle = ld_im_handle * flg_set_upssts_new = ld_flg_set_upssts_new * im_vrgng = ld_im_vrgng * TABLES * ex_messages = it_ex_messages CHANGING ch_apihdr = ld_ch_apihdr EXCEPTIONS FAILING_INSTANCE = 1 CURRENT_EXISTS = 2 ERROR = 3 WRONG_INSTANCE = 4 NO_CHANGE = 5 PACKAGE_EXISTS = 6 NO_AUTHORITY = 7 . " UPSCU_PACKAGE_CREATE
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 ELSEIF SY-SUBRC EQ 7. "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_ch_apihdr  TYPE API_UPSHDR ,
ld_im_instid  TYPE UPS_INSTID ,
it_ex_messages  TYPE STANDARD TABLE OF TUPSBAPIRET2 ,
wa_ex_messages  LIKE LINE OF it_ex_messages,
ld_imt_apiitm  TYPE API_TUPSITM ,
ld_imt_apisrc  TYPE API_TUPSSRC ,
ld_imt_apipre  TYPE API_TUPSPRE ,
ld_flg_commit_and_wait  TYPE XFELD ,
ld_flg_appl_log  TYPE XFELD ,
ld_flg_docnum_update  TYPE XFELD ,
ld_flg_serial_update  TYPE XFELD ,
ld_flg_lock_package  TYPE XFELD ,
ld_flg_msg_collect  TYPE XFELD ,
ld_im_handle  TYPE BALLOGHNDL ,
ld_flg_set_upssts_new  TYPE XFELD ,
ld_im_vrgng  TYPE TJ01-VRGNG .

ld_ch_apihdr = 'Check type of data required'.
ld_im_instid = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_ex_messages to it_ex_messages.
ld_imt_apiitm = 'Check type of data required'.
ld_imt_apisrc = 'Check type of data required'.
ld_imt_apipre = 'Check type of data required'.
ld_flg_commit_and_wait = 'Check type of data required'.
ld_flg_appl_log = 'Check type of data required'.
ld_flg_docnum_update = 'Check type of data required'.
ld_flg_serial_update = 'Check type of data required'.
ld_flg_lock_package = 'Check type of data required'.
ld_flg_msg_collect = 'Check type of data required'.
ld_im_handle = 'Check type of data required'.
ld_flg_set_upssts_new = 'Check type of data required'.

SELECT single VRGNG
FROM TJ01
INTO ld_im_vrgng.

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