Hi gurus, The query is why the user is able to make changes once the PR is in closed status ?
User is expecting to get the delete indicator and closed indicator to be checked for the PR
created 45 days.
There is custom program and BAPI_REQUISITION_DELETE is used to delete and close the items.
The following is the code ::
data lv_date1 type datum.
data lv_date2 type datum.
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = sy-datum
days = '46'
months = '00'
signum = '-'
years = '00'
importing
calc_date = lv_date1.
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = sy-datum
days = '00'
months = '06'
signum = '-'
years = '00'
importing
calc_date = lv_date2.
if lv_date1 is not initial.
select banfn, bnfpo from eban
into table @DATA(lt_eban)
where badat le @LV_date1
and frgkz IN ('C', 'D')
and loekz NE 'X'.
endif.
* if lv_date2 is not initial.
* select banfn, bnfpo from eban
* appending table @LT_eban
* where badat le @LV_date2
* and frgkz = 'A'
* and statu = 'N'.
* endif.
if lt_eban is not initial.
data lt_items type table of bapieband.
data ls_items type bapieband.
data(lt_head) = lt_eban[].
data lt_ret type table of bapireturn.
data ls_log type zmm_pr_del_log.
sort lt_head by banfn.
delete adjacent duplicates from lt_head comparing all fields.
loop at lt_head into data(ls_head).
refresh lt_items[].
refresh lt_ret[].
loop at lt_eban into data(ls_eban) where banfn = ls_head-banfn.
ls_items-preq_item = ls_eban-bnfpo.
ls_items-delete_ind = 'X'.
ls_items-closed = 'X'. "PASHA 17/10/2024
append ls_items to lt_items.
clear ls_items.
endloop.
call function 'BAPI_REQUISITION_DELETE'
exporting
number = ls_head-banfn
tables
requisition_items_to_delete = lt_items
return = lt_ret.
read table lt_ret into data(ls_ret) with key type = 'E'.
if sy-subrc = 0.
ls_log-banfn = ls_head-banfn.
loop at lt_items into ls_items.
ls_log-bnfpo = ls_items-preq_item.
ls_log-message = ls_ret-message.
ls_log-zdate = sy-datum.
ls_log-uzeit = sy-uzeit.
ls_log-uname = sy-uname.
ls_log-status = 'E'.
modify zmm_pr_del_log from ls_log.
endloop.
clear ls_log.
else.
ls_log-banfn = ls_head-banfn.
loop at lt_items into ls_items.
ls_log-bnfpo = ls_items-preq_item.
ls_log-message = ls_ret-message.
ls_log-zdate = sy-datum.
ls_log-uzeit = sy-uzeit.
ls_log-uname = sy-uname.
ls_log-status = 'S'.
modify zmm_pr_del_log from ls_log.
endloop.
clear ls_log.
endif.
endloop.
endif.I have observed two scenarios at me52n once this code gets executed.
for EBAN-ESTKG (PRODUCTION ORDER(F)) it is giving me the expected result which is not editable after
running the above code.
However ,
For all other scenarios other than production order it is going in editable mode after running through the same above code like below
Strange thing is that in the first scenario closed is not ticked but it was non editable , in the second one closed is ticked but i can able to undelete and make changes.
My question is why it is working fine in PRODUCTION ORDER case but not in other cases though
the code is same.
The requirement is once the code is executed it should be non editable for all documents based on the select query in the code.
Is it that needs to be fixed from functional end or is it SAP's glitch as it is making
item number editable after the PR is closed.
Thank in advance for your replies
Request clarification before answering.
Hello,
Thank you very much for your question and sorry for the late reply.
Can you please check whether the following information (GenAI was used to help generate this content) solves your issue?
The behavior you are experiencing with the Purchase Requisition (PR) being editable even after being marked as closed can be attributed to the standard system design and the specific conditions under which the PRs are processed.
In the case of PRs related to production orders, the system might have additional checks or settings that prevent editing once the PR is marked as closed. This could be due to specific configurations or business rules that apply to production-related documents.
For other types of PRs, even if the ‘closed’ indicator is set, the system might allow editing due to different configurations or lack of specific restrictions that apply to production orders. This behavior is consistent with the standard SAP system design where certain fields or indicators might not prevent editing unless explicitly configured.
Kind regards,
Henrike
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.