Skip to Content
0
Sep 26, 2018 at 08:58 AM

Problem updating shipment stages with BAPI_SHIPMENT_CHANGE

2116 Views

Hi experts,

I need to update shipment's stages, in tab Execution End date and time.

For this issue I'm using bapi BAPI_SHIPMENT_CHANGE like this:

gv_shp_hdr-shipment_num = l_vttk-tknum.
gv_hdract-shipment_num = 'X'.
gv_hdract-status_shpmnt_end = 'C'.
gv_shp_hdr-status_shpmnt_end = 'X'.

SELECT *
FROM vttp
INTO TABLE li_vttp
WHERE tknum = p_tknum
AND vbeln = p_vbeln.

* Searching shipment's stages (
REFRESH: li_vtts.
SELECT *
FROM vtts
INTO TABLE li_vtts
WHERE tknum = p_tknum.

LOOP AT li_vttp.
SELECT *
FROM vtsp
APPENDING TABLE li_vtsp
WHERE tknum = p_tknum
AND tpnum = li_vttp-tpnum.

LOOP AT li_vtsp.
l_st_dline-stage_seq = li_vtsp-tsnum.
l_st_dline-time_type = 'STLENADT'.
l_st_dline-time_stamp_utc = l_time_utc..
l_st_dline-time_zone = sy-zonlo.
APPEND l_st_dline TO it_stagedeadline.
l_st_act-stage_seq = 'C'.
l_st_act-time_type = 'C'.
l_st_act-time_stamp_utc = 'C'.
l_st_act-time_zone = 'C'.
APPEND l_st_act TO it_stagedeadlineaction.
READ TABLE li_vtts WITH KEY tsnum = li_vtsp-tsnum.
IF sy-subrc = 0.
l_st_data-stage_cat = li_vtts-tstyp.
l_st_data-org_addr = li_vtts-adrna.
l_st_data-org_point = li_vtts-knota.
l_st_data-org_shipp_dpmnt = li_vtts-vstel.
l_st_data-org_plant = li_vtts-werka.
l_st_data-org_cust = li_vtts-kunna.
l_st_data-org_suppl = li_vtts-lifna.
ENDIF.
l_st_data-stage_seq = li_vtsp-tsnum.
APPEND l_st_data TO it_stagedata.
l_st_data_act-stage_cat = 'C'.
l_st_data_act-stage_seq = 'X'.
APPEND l_st_data_act TO it_stagedataaction.
ENDLOOP.

ENDLOOP.

[....]

CALL FUNCTION 'BAPI_SHIPMENT_CHANGE'
EXPORTING
headerdata = gv_shp_hdr
headerdataaction = gv_hdract
TABLES
* headerdeadline = it_shp_hdr_dline
* headerdeadlineaction = it_hdr_dline_action
* ITEMDATA =
* ITEMDATAACTION =
stagedata = it_stagedata
stagedataaction = it_stagedataaction
stagedeadline = it_stagedeadline
stagedeadlineaction = it_stagedeadlineaction
return = it_logfile.

I have a dump in include LV56I_BAPIF03, form FILL_STG_DATA_CHANGE at this point:

LOOP AT it_stg_dline_action INTO ls_stg_dline_action
WHERE stage_seq = is_stg-stage_seq
AND time_type = gc_chg_delete.

At this moment IT_STG_DLINE_ACTION is like this:

but SAP is triing to find something within this internal table with IS_STG-STAGE_SEG = '0001' (field which is Numc4).

So I get this dump:

Unable to interpret "C" as a number.

I know C is not a number, but IT_STG_DLINE_ACTION-STAGE_SEQ type allows only A/C/D.

I don't know how to solve this problem. Any suggestion?

Thanks in advance!

Maria

Attachments

nfmvx.png (62.9 kB)
hb716.png (6.3 kB)