on 08-25-2015 7:13 PM
Hi,
I'm developing a program which including many steps ,and one of them is to cancel picking for the relevant delivery(/SCWM/CANCPICK).
I'm looking for a function module or class-method which could implement the same function as tcode /SCWM/CANCPICK.
Does anyone has idea about this ? Thank you very much.
Hi!
Try to use class /SCWM/CL_CANCPICK_SP with Execute method
BR, Alex.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anoop
Below is a working sample test code i had written for my own requirements. Maybe it may help you out too. Haven't built in any strong validation, just make sure that you input a valid HU on the selection screen.
{code}
*&---------------------------------------------------------------------*
*& Report ZTEMP
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ztemp.
* Local Data
DATA: gx_cancpick TYPE REF TO /scwm/cl_cancpick_sp,
gt_hu_keys TYPE STANDARD TABLE OF /scwm/s_aspk_hu_cancpick,
gs_hu_key TYPE /scwm/s_aspk_hu_cancpick,
gv_rejected TYPE boole_d,
gs_inparam TYPE /scwm/s_sp_q_cancpick,
gs_val_def TYPE /scmb/s_default_values_det,
gt_val_defs TYPE /scmb/t_default_values_det,
gx_attr_hndler TYPE REF TO /scmb/cl_attribute_handler,
gx_msg_hndler TYPE REF TO /scmb/cl_message_handler.
PARAMETERS: pa_huidt TYPE /scwm/de_huident.
START-OF-SELECTION.
CLEAR: gs_val_def.
gs_val_def-v_fieldname = 'LGNUM'.
gs_val_def-v_mandatory = abap_true.
gs_val_def-v_memoryid = '/SCWM/LGN'.
gs_val_def-v_checkbox = abap_false.
gs_val_def-v_no_dropdown = abap_true.
APPEND gs_val_def TO gt_val_defs.
CLEAR: gs_val_def.
gs_val_def-v_fieldname = 'CDHU'.
gs_val_def-v_mandatory = abap_false.
gs_val_def-v_memoryid = '/SCWM/CDHU'.
gs_val_def-v_checkbox = abap_true.
gs_val_def-v_no_dropdown = abap_true.
APPEND gs_val_def TO gt_val_defs.
/scmb/cl_ees_defaults=>init( iv_identifier = '/SCWM/CANCPICK'
iv_values_structure = '/SCWM/S_SP_DEFAULT_CANCPICK'
iv_extended = abap_true
it_values_definition = gt_val_defs ).
CREATE OBJECT gx_attr_hndler.
CREATE OBJECT gx_msg_hndler.
CREATE OBJECT gx_cancpick
EXPORTING
io_attribute_handler = gx_attr_hndler
io_message_handler = gx_msg_hndler.
CLEAR: gs_inparam.
gs_inparam-huident = pa_huidt.
CLEAR: gs_hu_key.
SELECT SINGLE guid_hu
INTO gs_hu_key-guid_hu
FROM /scwm/huhdr
WHERE huident EQ pa_huidt.
APPEND gs_hu_key TO gt_hu_keys.
gx_cancpick->/scmb/if_sp_transaction~cleanup( /scmb/if_sp_transaction=>sc_cleanup_end ).
gx_cancpick->/scmb/if_sp_query~execute( EXPORTING inparam = gs_inparam
query = /scwm/if_sp_cancpick_c=>sc_qry_cancpick_hu ).
gx_cancpick->/scmb/if_sp_action~execute( EXPORTING aspect = /scwm/if_sp_cancpick_c=>sc_asp_hu
inkeys = gt_hu_keys
action = /scwm/if_sp_cancpick_c=>sc_act_unassign_stock ).
gx_cancpick->/scmb/if_sp_transaction~save( EXPORTING synchronously = abap_false
IMPORTING rejected = gv_rejected ).
CASE gv_rejected.
WHEN abap_false.
COMMIT WORK AND WAIT.
gx_cancpick->/scmb/if_sp_transaction~cleanup( /scmb/if_sp_transaction=>sc_cleanup_commit ).
WHEN abap_true.
ROLLBACK WORK.
gx_cancpick->/scmb/if_sp_transaction~cleanup( /scmb/if_sp_transaction=>sc_cleanup_commit ).
WHEN OTHERS.
ENDCASE.
{code}
Hi Anoop,
Please check Mathew's example, my logic is also like that. And just one thing need your attention, if there's HU for the outbound delivery order, then use the logic of Mathew, if there's no HU for the ODO, then you need to set 'ASPECT' to '/SCWM/A_SP_ITEM' ,and then pass another table with 'DOCID&ITEMID&DOCAT' to Parameter 'INKEYS', i forgot the exact table type for this. you can check it.
if you want to get the exact message happened in this process, you can debug ,and you will find it is to call FM 'STOCK_CHANGE' finally, from this FM, you can get the details from the returned message table. Before this FM call ,it also has some validation logic, you can debug to find it.
Is it possible to create a program to read an excel document, and for each line and run /SCWM/DCONS and update Details2.. in a massive way?
See the fiigure of the screen, for eac Id Type (E, M 😞
I tried to create a batch input program in SM35, and doesnt work.
Is it possible to have a way that automatically update massively this info?
Thanks,
João (barbosa.pereira08@gmail.com)
User | Count |
---|---|
9 | |
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.