on 07-31-2014 8:15 AM
Hi,
I am using FM /sapapo/ts_dm_lock_unlock to lock and unlock planning area.
When I am executing my program in forground it is working properly but in background by this FM planning area is not being lock/unlock
Can you please help on same FM in background.
Code written is as below
INCLUDE /sapapo/ts_constants_iobjnm.
" Declarations
TABLES :/SAPAPO/TSPAPLOB, " Planning Area - Plng Object Struct. (Key Fig)
/SAPAPO/TSVERSIO. " Planning Versions for Planning Area
" Selection Screen Design
SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-B01.
SELECTION-SCREEN SKIP.
PARAMETERS :s_parea TYPE /SAPAPO/DM_PAREA_LOCK-PAREA OBLIGATORY, planning area
s_pvers TYPE /SAPAPO/VRSIOID OBLIGATORY, planning version
s_lock as CHECKBOX. Lock /unlock
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK BL1.
" Declarations
TYPES: BEGIN OF st_parea,
pareaid TYPE /SAPAPO/TS_PAREAID, " Planning area
keyfigure TYPE rsiobjnm, " Key figure
END OF st_parea,
BEGIN OF st_pver,
pareaid TYPE /SAPAPO/TS_PAREAID, " Planning area
VRSIOID TYPE /SAPAPO/VRSIOID, " Planning version
END OF st_pver.
DATA: it_parea TYPE STANDARD TABLE OF st_parea, " Internal table
it_pver TYPE STANDARD TABLE OF st_pver,
wa_parea TYPE st_parea, " Work area
wa_pver TYPE st_pver.
DATA :lt_selection TYPE /sapapo/ts_iobj_selection_tab,
ls_selection TYPE /sapapo/ts_iobj_selection,
lS_LOCK_STR TYPE /SAPAPO/TS_LC_LOCK_STR,
iv_lock TYPE as4flag.
*DATA : version TYPE /sapapo/iobjnm VALUE '000'.
" selecting values
SELECT pareaid vrsioid
FROM /SAPAPO/TSVERSIO
INTO TABLE it_pver
WHERE pareaid eq s_parea
AND vrsioid eq s_pvers.
IF sy-subrc = 0.
LOOP AT it_pver INTO wa_pver.
ls_selection-iobjnm = gs_c_iobjnm-version.
ls_selection-sign = 'I'.
ls_selection-option = 'EQ'.
ls_selection-low = wa_pver-vrsioid.
APPEND ls_selection TO lt_selection.
ENDLOOP.
ENDIF.
" If locking is selected
IF s_lock = 'X'.
CALL FUNCTION '/SAPAPO/TS_DM_LOCK_UNLOCK'
EXPORTING
iv_pareaid = s_parea
iv_vrsioid = s_pvers
iv_lock = 'X'
* IMPORTING
* EV_USER =
* ES_LOCK_STR =
changing
ct_selection = lt_selection
EXCEPTIONS
ERROR = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
write: 3 s_parea ,15 ' Entered planning area has been locked'.
ENDIF.
" If unlocking
ELSEIF s_lock = ' '.
iv_lock = ' ' .
CALL FUNCTION '/SAPAPO/TS_DM_LOCK_UNLOCK'
EXPORTING
iv_pareaid = s_parea
iv_vrsioid = s_pvers
iv_lock = ' '
* IMPORTING
* EV_USER =
* ES_LOCK_STR = ls_lock_str
changing
ct_selection = lt_selection
EXCEPTIONS
ERROR = 1
OTHERS = 2
.
iv_lock = ' ' .
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
write: 3 s_parea ,15 ' Entered planning area has been unlocked'.
ENDIF.
ENDIF.
Hi,
I hv the same requirement and using the FM to lock/unlock the PA. Do you have problem only at the time of unlocking or both? Since your comments are old, let me know if you have overcome the issue or figured out some other technique.
I hv observed the unlock being an issue. I am trying figure it out.
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.