on 10-07-2018 6:31 AM
Hi,
I want to change a shipment via the bapi: 'BAPI_SHIPMENT_CHANGE'. I change without any problem the different information as aaa but when I try to change the status it shows me an error message.
when I have to change the STATUS_SHPMNT_START. it displays this error message:
Status cannot be set because status "planned" has not been set
shipment xxxxxx could not be changed by the BAPI
it shows me this message even if my goal is to activate the status planned.
when I have to change the STATUS_LOAD_END.it displays this error message:
Use Transaction ZSAPMSSY4
the code to change the STATUS_SHPMNT_START:
DATA: ls_header TYPE bapishipmentheader,
ls_headera TYPE bapishipmentheaderaction,
lt_return TYPE bapiret2_t.
ls_header-SHIPMENT_NUM = '0004000142'.
ls_header-STATUS_SHPMNT_START = 'X'.
ls_headera-STATUS_SHPMNT_START = 'C'.
CALL FUNCTION 'BAPI_SHIPMENT_CHANGE'
EXPORTING
headerdata = ls_header
headerdataaction = ls_headera
TABLES
return = lt_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = abap_true.
PERFORM display_messages tables lt_return.
the code to change the STATUS_LOAD_END:
DATA: ls_header TYPE bapishipmentheader,
ls_headera TYPE bapishipmentheaderaction,
lt_return TYPE bapiret2_t.
ls_header-SHIPMENT_NUM = '0004000142'.
ls_header-STATUS_LOAD_END = 'X'.
ls_headera-STATUS_LOAD_END = 'C'.
CALL FUNCTION 'BAPI_SHIPMENT_CHANGE'
EXPORTING
headerdata = ls_header
headerdataaction = ls_headera
TABLES
return = lt_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = abap_true.
PERFORM display_messages tables lt_return.
Best regards,
simone.milesi it's good I managed to solve the problem. I can not start the modfication via se38. but after activating the program the update goes on without any problem.
Thanks for your help 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
simone.milesi, I am very sorry I did not pay attention to your request.
when I click on '?' he shows me this screen (Message no IEQ127):
and when I do a breakpoint at message in debug. of the program, I find the condition that displays the error message (in the program : ZXREPU01 )
here are the values of the variables :
the problem comes from the execution of the update via SE38. but when I execute via an ALV transaction containing the shipment change code, it works very well without problem.
But I want to make the change via a program that runs after receiving an IDOC.and not via a transaction.
So how to make the change via program (non-transactional) possible ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And we end up with the first suggestion we gave you: check if there is any user exit, customer function or badi under the hood.
The answer is.. yes, since you found the include ZXREPU01 which sound so bad a customer function.
Check the calls stack in debug so you can identify the customer function and see if you can fix it with some kind of workaround (or ask to the one who developed it why it has been done).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
simone.milesi , when I put 'ZSAPMSSY4' in SE38 he shows me the error message 'Program ZSAPMSSY4 does not exist'. because it's a transaction.
but when I put 'SAPMSSY4' (the program of this transaction) he shows me this program :
* -------------------------------------------------------------------
* S A P M S S Y 4
* system routines for ABAP processing
*
* - Update Task -
* -------------------------------------------------------------------
program sapmssy4 message-id 02.
include tskhincl.
include <sys000>.
tables: vbparam, tfdir.
data: %_vb_calls type %_vb_calls occurs 50 with header line. "#EC *
parameters: vbkey_id type %_vbkey no-display,
enqkey type eqeusrvb no-display,
enqdone type c no-display.
perform local_update_task.
form local_update_task.
data: l_enqkey type eqeusrvb,
l_vbkey type %_vbkey,
l_enqdone type c length 1.
system-call state_limit set.
*
* get direct update task orders from memory and do the job
*
free %_vb_calls. "#EC *
import %_vb_calls from memory id vbkey_id. "#EC *
if sy-subrc eq 0.
* new imode: switch direct update task "on" again
set update task local.
* switch direct update task to "active"
call 'SET_SWITCH_UTASK_OFF' id 'STATE' field 'Y'.
perform %_updates_no_utask.
free %_vb_calls. "#EC *
free memory id vbkey_id.
commit work.
* switch direct update task to "inactive"
call 'SET_SWITCH_UTASK_OFF' id 'STATE' field 'N'.
* get enqueue key of local update task imode
call 'ThVBCall' id 'OPCODE' field get_vb_key
id 'VBKEY' field l_vbkey-vbkey "#EC *
id 'ENQKEY' field l_enqkey
id 'ENQDONE' field l_enqdone.
* release the locally acquired SAP locks
if l_enqdone is not initial.
call 'C_ENQUEUE'
id 'USER' field l_enqkey
id 'OPCODE' field '3'
id 'SYNCHRON' field 'X'.
endif.
* SAP locks inherited from dialog imode are released when
* returning to SAPMSSY0 by a following call to
* 'ThVBCall' id 'OPCODE' field reset_vb_enq_key
* id 'SYNC_DEQUEUE' field 'X'.
* Therefore there is no need to release them here.
endif.
system-call state_limit reset.
endform.
************************************************************************
* A R F C _ D E Q U E U E _ I N _ L O C A L _ U T A S K *
* *
************************************************************************
form arfc_dequeue_in_local_utask.
data: %_direct_utask_active type c. "#EC *
data: %_loc_enqkey type eqeusrvb, "#EC *
%_loc_enqdone type c, "#EC *
%_vbkey type vbdata-vbkey. "#EC *
* release "inherited" locks if in local update task
if enqdone = 'X'.
call 'GET_SWITCH_UTASK' id 'MODE' field 'A'
id 'STATE' field %_direct_utask_active.
if %_direct_utask_active = 'Y'.
call 'C_ENQUEUE'
id 'USER' field enqkey
id 'OPCODE' field '3'.
enqdone = ' '.
endif.
endif.
* release local locks if in local update task
call 'ThVBCall' id 'OPCODE' field get_vb_key
id 'VBKEY' field %_vbkey
id 'ENQKEY' field %_loc_enqkey
id 'ENQDONE' field %_loc_enqdone.
if %_loc_enqdone = 'X'.
call 'GET_SWITCH_UTASK' id 'MODE' field 'A'
id 'STATE' field %_direct_utask_active.
if %_direct_utask_active = 'Y'.
call 'C_ENQUEUE'
id 'USER' field %_loc_enqkey
id 'OPCODE' field '3'.
%_loc_enqdone = ' '. "#EC *
endif.
endif.
endform.
************************************************************************
* % _ U P D A T E S _ N O _ U T A S K *
* *
************************************************************************
form %_updates_no_utask. "#EC *
data: l_oncom like sy-oncom.
loop at %_vb_calls.
select single * from tfdir where funcname = %_vb_calls-func_name.
if sy-subrc eq 0.
l_oncom = sy-oncom.
sy-oncom = 'V'. "#EC *
perform (%_vb_calls-func_name) in program (tfdir-pname) using
%_vb_calls-daten_id.
sy-oncom = l_oncom. "#EC *
free memory id %_vb_calls-daten_id.
else.
message a400 with %_vb_calls-func_name.
endif.
endloop.
endform.
************************************************************************
* % _ U P D A T E _ T A S K *
* *
************************************************************************
form %_update_task. "#EC *
data: begin of vbkey,
timestamp like vbparam-vbkey,
id like vbdata-vbmodcnt,
end of vbkey.
vbkey-timestamp = vbparam-vbkey.
vbkey-id = vbparam-vbmodcnt.
tfdir-funcname = vbparam-vbfunc.
read table tfdir.
perform (vbparam-vbfunc) in program (tfdir-pname) using vbkey.
endform.
************************************************************************
* G E T _ U P D A T E _ K E Y *
* *
* deliver update key (called from CL_SYSTEM_TRANSACTION_STATE) *
************************************************************************
form get_update_key changing update_key like vbhdr-vbkey. "#EC CALLED
update_key = vbkey_id-vbkey.
endform.
And when I click on F8 to execute it, it will show me this error message : "Use transaction ZSAPMSSY4".
Well, the message is self explaining: you are setting the Loading End status but you cannot since you didn't set the planned one.
i do not remember if it's a standard behavior, something you can set by customizing or a total custom control ( iftah.peretz refers to the last popup which clearly speaks about a Z.. development so it's quite possible you have a BADI activated and implemented performing some controls).
You should check those things, the Z stuff as first step
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
simone.milesi , could you please see this problem ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey,
Could it be that you have some custom code that intervenes in the status flow (for more information go here)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.