on 2021 Dec 29 4:26 PM
Hi Guys,
Is there any reference document on how to update TDELIVERY date in PDO header. I know we can use class /scdl/cl_sp_prd_out but not sure how..
Request clarification before answering.
Hi Akshay,
Use the method /SCDL/IF_SP1_ASPECT~UPDATE in the class /scdl/cl_sp_prd_out to update the dates in delivery header.
Step 1:-
Get the delivery header information using aspect "/SCDL/S_SP_A_HEAD_DATE", method /SCDL/IF_SP1_ASPECT~SELECT.
Declare INKEYS as /SCDL/T_SP_A_HEAD. Populate with delivery docid and doccat to get the date information.
Step 2:-
Update using the method /SCDL/IF_SP1_ASPECT~UPDATE with the data from above with your date type.
Call this method /SCDL/IF_SP1_TRANSACTION~SAVE to save the date information.
Finally, call commit work and do cleanup.
Regards
Sunil Mani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Sunil for the inputs..
I followed below approach..
DATA: ls_k_head TYPE /scdl/s_sp_k_head,
lt_k_head TYPE /scdl/t_sp_k_head,
ls_a_head_date TYPE /scdl/s_sp_a_head_date,
lt_a_head_date TYPE /scdl/t_sp_a_head_date,
lt_a_head_date_out TYPE /scdl/t_sp_a_head_date, "#EC NEEDED
lv_rejected TYPE abap_bool, "#EC NEEDED
ls_rcode TYPE /scmb/s_sp_return_code,
lt_rcode TYPE /scmb/t_sp_return_code.
DATA: lo_handler TYPE REF TO /scwm/cl_dlv_handler_adapter,
lo_sp_prd TYPE REF TO /scdl/cl_sp_prd_out.
* create SP ------------------------------------------------------------
CREATE OBJECT lo_sp_prd
EXPORTING
io_attribute_handler = lo_handler.
ls_k_head-docid = 'xxxxx'.
APPEND ls_k_head TO lt_k_head .
lo_sp_prd->lock(
EXPORTING inkeys = lt_k_head
aspect = /scdl/if_sp_c=>sc_asp_head
lockmode = /scdl/if_sp1_locking=>sc_exclusive_lock
IMPORTING rejected = lv_rejected
return_codes = lt_rcode ).
* Get complete aspect data ---------------------------------------------
lo_sp_prd->select_by_relation(
EXPORTING relation = /scdl/if_sp_c=>sc_rel_head_to_date
inrecords = lt_k_head
aspect = /scdl/if_sp_c=>sc_asp_head
IMPORTING outrecords = lt_a_head_date ).
LOOP AT lt_a_head_date ASSIGNING FIELD-SYMBOL(<lfs_head_date>).
<lfs_head_date>-tstfr = 'xxxxxx'.
<lfs_head_date>-tstto = 'xxxxxx'.
ENDLOOP.
lo_sp_prd->update(
EXPORTING aspect = /scdl/if_sp_c=>sc_asp_head_date
inrecords = lt_a_head_date
IMPORTING outrecords = lt_a_head_date_out
rejected = lv_rejected
return_codes = lt_rcode ).
IF lv_rejected IS NOT INITIAL AND
lt_rcode IS NOT INITIAL.
* Call Before Save of SP -----------------------------------------------
lo_sp_prd->before_save(
IMPORTING rejected = lv_rejected ).
lo_sp_prd->save(
* EXPORTING synchronously = synchronously
IMPORTING rejected = lv_rejected ).
IF sy-subrc = 0.
COMMIT WORK AND WAIT.
/scwm/cl_tm=>cleanup( ).
ENDIF.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 6 | |
| 5 | |
| 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.