cancel
Showing results for 
Search instead for 
Did you mean: 

ASN Cancellation using IDOC_INPUT_DESADV1

Former Member
0 Kudos

Dear All,

I’ve implemented the enhancement V55K0004 to delete the inbound deliveries when an ASN is performed on SNC by Vendor. It is working until the deletion, but always is creating a new inbound delivery number.

Before:

After:

The reference number continues the same, but a new delivery number is created.

Bellow you can see my code:

We are using the FM IDOC_INPUT_DESADV1 (DESADV. DELS – Inbound Processing).

Include: ZXTRKU12

TYPES: BEGIN OF ty_likp,

                vbeln TYPE vbeln,

       END OF ty_likp.

DATA: gs_likp TYPE ty_likp ,

      gt_likp TYPE TABLE OF ty_likp .

DATA: it_likp TYPE STANDARD TABLE OF ty_likp.

DATA: ls_e1edl18 TYPE e1edl18 ,

      ls_e1edl20            TYPE e1edl20 ,

      ls_e1adrm1            TYPE e1adrm1 .

FIELD-SYMBOLS:

               <ls_edidd>   TYPE edidd ,

               <ls_e1edl20> TYPE e1edl20 .

** Precisa preencher com o número da delivery para executar o

** cancelamento da ASN que saiu do sistema SNC.

READ TABLE idoc_data ASSIGNING <ls_edidd> WITH KEY segnam = 'E1EDL18'.

CHECK sy-subrc = 0.

ls_e1edl18 = <ls_edidd>-sdata.

CHECK ls_e1edl18-qualf = 'DEL'.

IF <ls_edidd> IS ASSIGNED .

  UNASSIGN <ls_edidd> .

ENDIF .

READ TABLE idoc_data ASSIGNING <ls_edidd> WITH KEY segnam = 'E1ADRM1' .

ls_e1adrm1  = <ls_edidd>-sdata .

** Pega o IDoc header com LIFEX e PARID

IF <ls_edidd> IS ASSIGNED .

  UNASSIGN <ls_edidd> .

ENDIF .

READ TABLE idoc_data ASSIGNING <ls_edidd> WITH KEY segnam = 'E1EDL20'.

IF sy-subrc = 0.

  ls_e1edl20 = <ls_edidd>-sdata.

** Pega o número da inbound delivery que venho na estrutura do IDoc.

  REFRESH gt_likp[] .

  SELECT vbeln

    FROM likp

    INTO TABLE gt_likp

    WHERE lifex = ls_e1edl20-lifex

      AND lifnr = ls_e1adrm1-partner_id .

*          lifnr = ls_e1edl20-parid.

  LOOP AT gt_likp INTO gs_likp .

** Remove todas as inbound deliveries armazenadas conforme tabela

**interna gs_likp.

*    IF sy-subrc = 0.

    DELETE FROM lips

      WHERE vbeln = gs_likp.

    COMMIT WORK.

    DELETE FROM likp

      WHERE vbeln = gs_likp.

    COMMIT WORK.

    DELETE FROM ekes

      WHERE vbeln = gs_likp.

    COMMIT WORK.

*    ENDIF.

*  ENDSELECT.

  ENDLOOP .

ENDIF.

Is there any problem with my code? Has anyone already implemented a solution for this issue?

Thanks.

Alberto.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

For deletion you also need to do a change in PI, and chance the DDN when action code =03 map it to idoc WHSCON.DELVRY03 istead of the default IDoc, because the default idoc even with action code 03 will create another Inbound delivery.


Former Member
0 Kudos

I understood this point, but in case of the vendor creates an ASN from SNC and transfer this creation to ECC using this message type, it’ll generate an error "Field VBELN empty” because the FM IDOC_INPUT_DELVRY requires an inbound delivery number to be processed. At this moment I don’t have this number because I hope the system to create it via IDoc. This is the reason for me to use the Message type DESADV (FM IDOC_INPUT_DESADV1) instead of WHSCON.

Tks.

0 Kudos

Hi, Alberto, I had met this issue before and solved it by following step:

Firstly, use Content-base routing in interface determination to mapping 'DespatchedDeliveryNotification_Out' to 'WHSCON' when actioncode is '03';

Secondly, maintain IDoc inbound message type 'WHSCON' with process code 'DELV';

Thirdly, implement enhancement 'V55K0005' to get the inbound delivery number before 'WHSCON' IDoc process.