Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the Delivery Document Number from the Associative type/Type group

yarnagula_sudhir
Active Participant
0 Kudos

Hi,

As I'm working on Idoc custom segments/Enhancement.

The following is the FM Exit, respective Associative Type/Type Group and Select Query that i'm using.

SELECT SINGLE VBELN LIFNR ZZASNNO ZZINVOIVE_NO ZZREASON FROM LIKP INTO LS_LIKP WHERE VBELN = likp-VBELN.


But whenever i'm getting the data from the Tcode, i'm not getting the delivery document number in my WHERE condition.

Kindly suggest me what will be the WHERE condition and its corresponding syntax.



With Regards,

Sudhir.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Sudhir,

Please elaborate on which IDOC and message type you are working on and the IDOC is used in which process. Also the customer exit details that is being used.

Regards,

Aashika

8 REPLIES 8

Former Member
0 Kudos

Hi Sudhir,

Please elaborate on which IDOC and message type you are working on and the IDOC is used in which process. Also the customer exit details that is being used.

Regards,

Aashika

0 Kudos

Hi,

Idoc Details:

Message Type: DESADV

Basic Type: DELVRY03

Outbound Process Code: DELV

Output Type: OPOD

Function Module - IDOC_OUTPUT_DELVRY

Customer Exit - customer-function '002'

FM Exit name - EXIT_SAPLV56K_002

Include -   zxtrku02

Kindly let me know the select query where condition syntax, from which i should get delivery document number.

With Regards,

Sudhir.

0 Kudos

Hi Sudhir,

Please try to get delivery number using below logic:

field-symbols: <lx_edidd> type edidd.

data: wa_e1edl20 type E1EDL20.

READ TABLE int_edidd assigning <lx_edidd> WITH KEY segnam = 'E1EDL20'.

IF <lx_edidd> IS ASSIGNED. 

wa_e1edl20 = <lx_edidd>-sdata.

ENDIF. 



The delivery number will be wa_e1edl20-vbeln, which can be used in where clause.


Regards,

Aashika

0 Kudos

Hi Aashika,

You are Awesome in SAP. Thank you so much. You have cleared two doubts of mine.

One is exact FM Exit and the other one is getting the delivery document number.

Thanks a lot again.

With Regards,

Sudhir.

0 Kudos

Hi,

Find the piece of code below as per my requirement regarding Idoc Zsegments and fields.

Its working fine.

*Getting the Delivery Document Number and assigning it to the Where Clause

FIELD-SYMBOLS: <FS_EDIDD> TYPE EDIDD.

READ TABLE IDOC_DATA ASSIGNING <FS_EDIDD> WITH KEY SEGNAM = 'E1EDL20'.

IF <FS_EDIDD> IS ASSIGNED.

   LS_E1EDL20 = <FS_EDIDD>-SDATA.      "Delivery Document Number

ENDIF.

*1*Fetching the respective fields for IDoc: Delivery header

SELECT SINGLE VBELN LIFNR ZZASNNO ZZINVOIVE_NO ZZREASON FROM LIKP INTO LS_LIKP WHERE VBELN = LS_E1EDL20-VBELN.

CHECK SY-SUBRC = 0.

*1****************************************Delivery header******************************1

READ TABLE IDOC_DATA INTO ls_edidd WITH KEY segnam = 'E1EDL20'.   "Custom Segment Position

CHECK SY-SUBRC = 0.

lv_tabix = sy-tabix + 1.

CONCATENATE LS_LIKP-ZZASNNO+0(20) LS_LIKP-ZZINVOIVE_NO+0(10) LS_LIKP-ZZREASON+0(20) INTO lv_sdata1.

ls_edidd-sdata = lv_sdata1.

ls_edidd-segnam = co_E1EDL20.

INSERT ls_edidd INTO IDOC_DATA INDEX lv_tabix.

CHECK sy-subrc = 0.

CLEAR: LS_LIKP,

        lv_sdata1,

        ls_edidd.


Doubt: As Respective "Include -   zxtrku02" is triggering multiple times and so my "segment E1EDL20"/Zsegment ZE1EDL20.


How to restrict my standard segment E1EDL20 and its custom segment ZE1EDL20 from triggering mutiple times.

Kindly let me know ASAP.


With Regards,

Sudhir.

0 Kudos

Hi Sudhir,

This exit will trigger for all the segments. In the exit you will see a importing parameter 'SEGMENT_NAME'.

Put the entire logic of yours when the segment name is E1EDL20. This will make it run only once.

Hopefully this will hep you.

Regards,

Aashika

0 Kudos

Can you elaborate more. Where should i change my code. 

My requirement is use to get all the standard segments and my custom segment should trigger once.

But where ever i'm adding Zsegments, its triggering multiple times.

Kindly let me know ASAP.

With Regards,

Sudhir.

rajkumarnarasimman
Active Contributor
0 Kudos

Hi Sudhir,

As per my understanding from the above discussion, I found that, you are not able to retrieve the value Document number(VBELN). I hope in such case, we can fetch the value using screen name inside the exit using the below code. Change the code as per the screen element name.


FIELD-SYMBOLS <FS_POSNR> LIKE /DBM/VBAP-POSNR. "Position Number

"Screen Name

CONSTANTS: LV_ITEM_NO TYPE CHAR40 VALUE '(/DBM/SAPLORDER_UI)/DBM/S_POS-POSNR'.     "Item Number

"Assign the Item number value

ASSIGN (LV_ITEM_NO) TO <FS_POSNR>.

"Check whether Postion number is available

IF <FS_POSNR> IS ASSIGNED.

   L_POSNR = <FS_POSNR>.     "Postion Number

ENDIF.

Hope it helps to you.

Regards

Rajkumar Narasimman