Application Development and Automation 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: 
Read only

IDOC segment problem !

Former Member
0 Likes
1,609

Can we have feilds from different tables in one segment ?

Or a segment must have the fields from one particular table only ?

14 REPLIES 14
Read only

Former Member
0 Likes
1,571

Can we have feilds from different tables in one segment ?

Or a segment must have the fields from one particular table only ?

yes we can have fields from different tables.

Read only

0 Likes
1,571

in my IDOC outbound program only those segments are populated which contain fields from same table...reast of tham not fully populated....What is the problen ?

Shal i send my code ?

Read only

0 Likes
1,571

If it is Outbound then you should take care of the design part. and fill the data accordingly.

I guess you are selecting the data from one table. if you want the data in other fields then you need to use another select or join then populate it.

are you doing it through program. or any standard one.

if it is so you find a exit and populate the rest of the fields

Read only

0 Likes
1,571

It is a report program.When i run it IDOC is generated but

it is not showing all the fields of one segment..

Suppose in one segment there are two fields from two tables

its showing only that field which contains data.it is not even showing the other field !!

Read only

0 Likes
1,571

Can you show me how you are populating the data into segements.

there you are doing some mistake

Read only

0 Likes
1,571

Hi

In IDOC when ever there is NO data in particular field in segment you can't see those fields also.

in otherwords

in IDOC you can see fields only with values in side ...

to check this in debug mode try to force some values into those fileds .then you can see those fields also..

Read only

0 Likes
1,571

When you view an IDoc using WE02/WE05 and view the segment data. Only the fields that are populated will appear.

Read only

0 Likes
1,571

Hey thanks to co-operate.This is my code. ALL the BEZEI values are not comming,support type values are not comming,

Take your time and seld me back reply.

Thanks

REPORT Z_CREDITMEMO_OUTBOUND MESSAGE-ID ZJOY .

SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-BL1

NO INTERVALS.

PARAMETERS: S_VBELN LIKE LIKPUK-VBELN.

PARAMETERS: P_MESTYP LIKE EDMSG-MSGTYP OBLIGATORY.

PARAMETERS: P_LOGSYS LIKE TBDLST-LOGSYS.

*PERFORM ARE_YOU_SURE.

SELECTION-SCREEN END OF BLOCK BL1.

*INTERNAL TABLE FOR ITEM DATA

ranges: r_matkl for vbap-matkl.

r_matkl-sign = 'I'.

r_matkl-option = 'BT'.

r_matkl-low = '000000300'.

r_matkl-high = '000000399'.

append r_matkl.

DATA: BEGIN OF I_ITEM OCCURS 0,

VBELN LIKE VBAP-VBELN,

POSNR LIKE VBAP-POSNR,

MATNR LIKE VBAP-MATNR,

VKAUS LIKE VBAP-VKAUS,

SPART LIKE VBAP-SPART,

NETWR LIKE VBAP-NETWR,

WAERK LIKE VBAP-WAERK,

KWMENG LIKE VBAP-KWMENG,

KONDM LIKE VBAP-KONDM,

MVGR1 LIKE VBAP-MVGR1,

MVGR2 LIKE VBAP-MVGR2,

MVGR3 LIKE VBAP-MVGR3,

MVGR4 LIKE VBAP-MVGR4,

MVGR5 LIKE VBAP-MVGR5,

KONDA LIKE VBKD-KONDA,

BSTDK LIKE VBKD-BSTDK,

BSTDK_E LIKE VBKD-BSTDK_E,

KDKG2 LIKE VBKD-KDKG2,

BEZEI1 LIKE TVLVT-BEZEI,

BEZEI2 LIKE TVM1T-BEZEI,

BEZEI3 LIKE TVM2T-BEZEI,

BEZEI4 LIKE TVM3T-BEZEI,

BEZEI5 LIKE TVM4T-BEZEI,

BEZEI6 LIKE TVM5T-BEZEI,

VTEXT1 LIKE V_T178-VTEXT,

VTEXT2 LIKE V_T188-VTEXT,

VTEXT3 LIKE TVKGGT-VTEXT,

END OF I_ITEM.

*Declaring constants

DATA:

*SEGMENT NAMES

C_SALES_ORDER_NUMBER LIKE EDIDD-SEGNAM VALUE 'Z1SONUMBER',

C_MATERIAL_DETAILS LIKE EDIDD-SEGNAM VALUE 'Z1MATERIAL',

C_PRODUCT_LINE LIKE EDIDD-SEGNAM VALUE 'Z1MVGR1',

C_PRODUCT_NAME LIKE EDIDD-SEGNAM VALUE 'Z1MVGR2',

C_PRODUCT_VERSION_DETAILS LIKE EDIDD-SEGNAM VALUE 'Z1MVGR3',

C_PRODUCT_PLATFORM_DETAILS LIKE EDIDD-SEGNAM VALUE 'Z1MVGR4',

C_PRODUCT_APPSERVER_DETAILS LIKE EDIDD-SEGNAM VALUE 'Z1MVGR5',

C_COMPILER_CODE LIKE EDIDD-SEGNAM VALUE 'Z1KONDM',

C_LANGUAGE_CODE LIKE EDIDD-SEGNAM VALUE 'Z1KONDA',

C_RUNTIME_BANDCODE LIKE EDIDD-SEGNAM VALUE 'Z1VKAUS',

C_SUPPORT LIKE EDIDD-SEGNAM VALUE 'Z1SUPPORT',

C_AMOUNT LIKE EDIDD-SEGNAM VALUE 'Z1AMOUNT'.

DATA :

C_CREDIT_IDOITY LIKE EDIDC-IDOCTP VALUE 'ZIPGI_IDOC_TYPE'.

*data declaration

*..................................................................

*idoc control record

data : control_record_out like edidc.

*other data declaration

DATA:W_SALES_ORDER LIKE Z1SONUMBER.

DATA:W_MATERIAL LIKE Z1MATERIAL.

DATA:W_MVGR1 LIKE Z1MVGR1.

DATA:W_MVGR2 LIKE Z1MVGR2.

DATA:W_MVGR3 LIKE Z1MVGR3.

DATA:W_MVGR4 LIKE Z1MVGR4.

DATA:W_MVGR5 LIKE Z1MVGR5.

DATA:W_KONDM LIKE Z1KONDM.

DATA:W_KONDA LIKE Z1KONDA.

DATA:W_VKAUS LIKE Z1VKAUS.

DATA:W_SUPPORT LIKE Z1SUPPORT.

DATA:W_AMOUNT LIKE Z1AMOUNT.

*DECLARE TABLES

TABLES : VBAP,VBKD,TVM1T,TVM2T,TVM3T,TVM4T,TVM5T,TVLVT,T178T,T188T,

TVKGGT.

*CREATING INTERNAL TABLES FOR THE DATABASE TABLES

DATA:

INT_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE,

IT_COMM_IDOCS LIKE EDIDC OCCURS 0 WITH HEADER LINE,

IT_VBAP LIKE VBAP OCCURS 0 WITH HEADER LINE,

IT_VBKD LIKE VBKD OCCURS 0 WITH HEADER LINE,

IT_TVM1T LIKE TVM1T OCCURS 0 WITH HEADER LINE,

IT_TVM2T LIKE TVM2T OCCURS 0 WITH HEADER LINE,

IT_TVM3T LIKE TVM3T OCCURS 0 WITH HEADER LINE,

IT_TVM4T LIKE TVM4T OCCURS 0 WITH HEADER LINE,

IT_TVM5T LIKE TVM5T OCCURS 0 WITH HEADER LINE,

IT_TVLVT LIKE TVLVT OCCURS 0 WITH HEADER LINE,

IT_T178T LIKE T178T OCCURS 0 WITH HEADER LINE,

IT_TVKGGT LIKE TVKGGT OCCURS 0 WITH HEADER LINE,

IT_T188T LIKE T188T OCCURS 0 WITH HEADER LINE.

  • SELECT APPLICATION DATA

*POPULATING THE ITEM DATA

break-point.

SELECT

VBAP~VBELN

VBAP~POSNR

VBAP~MATNR

VBAP~VKAUS

VBAP~SPART

VBAP~NETWR

VBAP~WAERK

VBAP~KWMENG

VBAP~KONDM

VBAP~MVGR1

VBAP~MVGR2

VBAP~MVGR3

VBAP~MVGR4

VBAP~MVGR5

FROM VBAP

INTO CORRESPONDING FIELDS OF TABLE I_ITEM

WHERE VBAP~VBELN EQ S_VBELN

and vbap~matkl NOT IN r_matkl.

LOOP AT I_ITEM.

data: ITEMWORKAREA like line of I_ITEM.

BREAK-POINT.

select single

KONDA

BSTDK

BSTDK_E

KDKG2

FROM VBKD INTO corresponding fields of ITEMWORKAREA

WHERE vbkd~vbeln eq I_item-vbeln

AND vbkd~posnr EQ '000'.

select single

KONDA

BSTDK

BSTDK_E

KDKG2

FROM VBKD INTO corresponding fields of ITEMWORKAREA

WHERE vbkd~vbeln eq I_item-vbeln

AND vbkd~posnr EQ I_item-posnr.

select single

bezei

FROM tvm1t

INTO ITEMWORKAREA-BEZEI2

WHERE spras EQ sy-langu

AND mvgr1 EQ I_ITEM-mvgr1.

select single

bezei

FROM tvm2t

INTO ITEMWORKAREA-BEZEI3

WHERE spras EQ sy-langu

AND mvgr2 EQ I_ITEM-mvgr2.

select single

bezei

FROM tvm3t

INTO ITEMWORKAREA-BEZEI4

WHERE spras EQ sy-langu

AND mvgr3 EQ I_ITEM-mvgr3.

select single

bezei

FROM tvm4t

INTO ITEMWORKAREA-BEZEI5

WHERE spras EQ sy-langu

AND mvgr4 EQ I_ITEM-mvgr4.

select single

bezei

FROM tvm5t

INTO ITEMWORKAREA-BEZEI6

WHERE spras EQ sy-langu

AND mvgr5 EQ I_ITEM-mvgr5.

SELECT SINGLE

VTEXT

FROM T178T

INTO ITEMWORKAREA-VTEXT1

WHERE SPRAS EQ SY-LANGU

AND KONDM EQ I_ITEM-KONDM.

SELECT SINGLE

VTEXT

FROM T188T

INTO ITEMWORKAREA-VTEXT2

WHERE SPRAS EQ SY-LANGU

AND KONDA EQ ITEMWORKAREA-KONDA.

SELECT SINGLE

bezei

FROM TVLVT

INTO ITEMWORKAREA-BEZEI1

WHERE ABRVW = I_ITEM-VKAUS.

SELECT SINGLE

vtext

FROM TVKGGT

INTO ITEMWORKAREA-VTEXT3

WHERE KDKGR = ITEMWORKAREA-kdkg2.

ITEMWORKAREA-VBELN = I_ITEM-VBELN.

ITEMWORKAREA-POSNR = I_ITEM-POSNR.

ITEMWORKAREA-MATNR = I_ITEM-MATNR.

ITEMWORKAREA-VKAUS = I_ITEM-VKAUS.

ITEMWORKAREA-SPART = I_ITEM-SPART.

ITEMWORKAREA-NETWR = I_ITEM-NETWR.

ITEMWORKAREA-WAERK = I_ITEM-WAERK.

ITEMWORKAREA-KWMENG = I_ITEM-KWMENG.

ITEMWORKAREA-KONDM = I_ITEM-KONDM.

ITEMWORKAREA-MVGR1 = I_ITEM-MVGR1.

ITEMWORKAREA-MVGR2 = I_ITEM-MVGR2.

ITEMWORKAREA-MVGR3 = I_ITEM-MVGR3.

ITEMWORKAREA-MVGR4 = I_ITEM-MVGR4.

ITEMWORKAREA-MVGR5 = I_ITEM-MVGR5.

modify I_ITEM from ITEMWORKAREA.

CLEAR ITEMWORKAREA.

ENDLOOP.

  • Fill the control record Information.

control_record_out-MESTYP = P_MESTYP.

control_record_out-IDOCTP = C_CREDIT_IDOITY.

control_record_out-RCVPRT = 'LS'.

control_record_out-RCVPRN = P_LOGSYS.

  • FILL THE DATA RECORD

W_SALES_ORDER-VBELN = I_ITEM-VBELN.

INT_EDIDD-SEGNAM = C_SALES_ORDER_NUMBER.

INT_EDIDD-SDATA = W_SALES_ORDER-VBELN.

APPEND INT_EDIDD.

W_MATERIAL-MATNR = I_ITEM-MATNR.

W_MATERIAL-SPART = I_ITEM-SPART.

INT_EDIDD-SEGNAM = C_MATERIAL_DETAILS.

INT_EDIDD-SDATA = W_MATERIAL.

APPEND INT_EDIDD.

W_MVGR1-MVGR1 = I_ITEM-MVGR1.

W_MVGR1-BEZEI = I_ITEM-BEZEI2.

INT_EDIDD-SEGNAM = C_PRODUCT_LINE.

INT_EDIDD-SDATA = W_MVGR1.

APPEND INT_EDIDD.

W_MVGR2-MVGR2 = I_ITEM-MVGR2.

W_MVGR2-BEZEI = I_ITEM-BEZEI3.

INT_EDIDD-SEGNAM = C_PRODUCT_NAME.

INT_EDIDD-SDATA = W_MVGR2.

APPEND INT_EDIDD.

W_MVGR3-MVGR3 = I_ITEM-MVGR3.

W_MVGR3-BEZEI = I_ITEM-BEZEI4.

INT_EDIDD-SEGNAM = C_PRODUCT_VERSION_DETAILS.

INT_EDIDD-SDATA = W_MVGR3-MVGR3.

APPEND INT_EDIDD.

W_MVGR4-MVGR4 = I_ITEM-MVGR4.

W_MVGR4-BEZEI = I_ITEM-BEZEI5.

INT_EDIDD-SEGNAM = C_PRODUCT_PLATFORM_DETAILS .

INT_EDIDD-SDATA = W_MVGR4.

APPEND INT_EDIDD.

W_MVGR5-MVGR5 = I_ITEM-MVGR5.

W_MVGR5-BEZEI = I_ITEM-BEZEI6.

INT_EDIDD-SEGNAM = C_PRODUCT_APPSERVER_DETAILS.

INT_EDIDD-SDATA = W_MVGR5.

APPEND INT_EDIDD.

W_KONDA-KONDA = I_ITEM-KONDA.

W_KONDA-VTEXT = I_ITEM-VTEXT1.

INT_EDIDD-SEGNAM = C_COMPILER_CODE.

INT_EDIDD-SDATA = W_KONDA.

APPEND INT_EDIDD.

W_KONDM-KONDM = I_ITEM-KONDM.

W_KONDM-VTEXT = I_ITEM-VTEXT2.

INT_EDIDD-SEGNAM = C_LANGUAGE_CODE.

INT_EDIDD-SDATA = W_KONDM.

APPEND INT_EDIDD.

W_VKAUS-VKAUS = I_ITEM-VKAUS.

W_VKAUS-BEZEI = I_ITEM-BEZEI1.

INT_EDIDD-SEGNAM = C_RUNTIME_BANDCODE .

INT_EDIDD-SDATA = W_VKAUS.

APPEND INT_EDIDD.

W_SUPPORT-BSTDK = I_ITEM-BSTDK.

W_SUPPORT-BSTDK_E = I_ITEM-BSTDK_E.

W_SUPPORT-KDKG2 = I_ITEM-KDKG2.

W_SUPPORT-VTEXT = I_ITEM-VTEXT3.

INT_EDIDD-SEGNAM = C_SUPPORT.

INT_EDIDD-SDATA = W_SUPPORT.

APPEND INT_EDIDD.

W_AMOUNT-NETWR = I_ITEM-NETWR.

W_AMOUNT-KWMENG = I_ITEM-KWMENG.

W_AMOUNT-WAERK = I_ITEM-WAERK.

INT_EDIDD-SEGNAM = C_AMOUNT.

INT_EDIDD-SDATA = W_AMOUNT.

APPEND INT_EDIDD.

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

EXPORTING

MASTER_IDOC_CONTROL = CONTROL_RECORD_OUT

  • OBJ_TYPE = ''

  • CHNUM = ''

TABLES

COMMUNICATION_IDOC_CONTROL = IT_COMM_IDOCS

MASTER_IDOC_DATA = INT_EDIDD

EXCEPTIONS

ERROR_IN_IDOC_CONTROL = 1

ERROR_WRITING_IDOC_STATUS = 2

ERROR_IN_IDOC_DATA = 3

SENDING_LOGICAL_SYSTEM_UNKNOWN = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

MESSAGE E002 WITH I_ITEM-vbeln.

ELSE.

LOOP AT it_comm_idocs.

WRITE: / 'IDOC GENERATED',IT_COMM_IDOCS-DOCNUM.

ENDLOOP.

COMMIT WORK.

ENDIF.

Read only

0 Likes
1,571

Have you ran you program in debug to ensure that the relevant fields are populated on the IDoc. Remeber my post above states that displaying IDoc data in WE02/05 will only show populated fields.

Read only

0 Likes
1,571

Hey thanks Martin ..i debugged that code those fields which are not comming are not actually populated....

So there is some error in the populating part...

Please can you check it and send me back ?

Read only

0 Likes
1,571

You would need to debug the SQL yourself as I would not be able to see why data is not being read.

I have planted the seed, put some water on it and make your knowlege grow.

Read only

0 Likes
1,571

Hey yash any update on this !

Read only

0 Likes
1,571

So, you cannot debug the code and resolve it yourself.

I will not longer provide any more help on this matter.

Read only

0 Likes
1,571

Hey I solved it...

There will be a loop at......end loop missing...

  • FILL THE DATA RECORD

+loop at i_item.+

W_SALES_ORDER-VBELN = I_ITEM-VBELN.

INT_EDIDD-SEGNAM = C_SALES_ORDER_NUMBER.

INT_EDIDD-SDATA = W_SALES_ORDER-VBELN.

APPEND INT_EDIDD.

W_MATERIAL-MATNR = I_ITEM-MATNR.

W_MATERIAL-SPART = I_ITEM-SPART.

INT_EDIDD-SEGNAM = C_MATERIAL_DETAILS.

INT_EDIDD-SDATA = W_MATERIAL.

APPEND INT_EDIDD.

W_MVGR1-MVGR1 = I_ITEM-MVGR1.

W_MVGR1-BEZEI = I_ITEM-BEZEI2.

INT_EDIDD-SEGNAM = C_PRODUCT_LINE.

INT_EDIDD-SDATA = W_MVGR1.

APPEND INT_EDIDD.

W_MVGR2-MVGR2 = I_ITEM-MVGR2.

W_MVGR2-BEZEI = I_ITEM-BEZEI3.

INT_EDIDD-SEGNAM = C_PRODUCT_NAME.

INT_EDIDD-SDATA = W_MVGR2.

APPEND INT_EDIDD.

W_MVGR3-MVGR3 = I_ITEM-MVGR3.

W_MVGR3-BEZEI = I_ITEM-BEZEI4.

INT_EDIDD-SEGNAM = C_PRODUCT_VERSION_DETAILS.

INT_EDIDD-SDATA = W_MVGR3-MVGR3.

APPEND INT_EDIDD.

W_MVGR4-MVGR4 = I_ITEM-MVGR4.

W_MVGR4-BEZEI = I_ITEM-BEZEI5.

INT_EDIDD-SEGNAM = C_PRODUCT_PLATFORM_DETAILS .

INT_EDIDD-SDATA = W_MVGR4.

APPEND INT_EDIDD.

W_MVGR5-MVGR5 = I_ITEM-MVGR5.

W_MVGR5-BEZEI = I_ITEM-BEZEI6.

INT_EDIDD-SEGNAM = C_PRODUCT_APPSERVER_DETAILS.

INT_EDIDD-SDATA = W_MVGR5.

APPEND INT_EDIDD.

W_KONDA-KONDA = I_ITEM-KONDA.

W_KONDA-VTEXT = I_ITEM-VTEXT1.

INT_EDIDD-SEGNAM = C_LANGUAGE_CODE .

INT_EDIDD-SDATA = W_KONDA.

APPEND INT_EDIDD.

W_KONDM-KONDM = I_ITEM-KONDM.

W_KONDM-VTEXT = I_ITEM-VTEXT2.

INT_EDIDD-SEGNAM = C_COMPILER_CODE.

INT_EDIDD-SDATA = W_KONDM.

APPEND INT_EDIDD.

W_VKAUS-VKAUS = I_ITEM-VKAUS.

W_VKAUS-BEZEI = I_ITEM-BEZEI1.

INT_EDIDD-SEGNAM = C_RUNTIME_BANDCODE .

INT_EDIDD-SDATA = W_VKAUS.

APPEND INT_EDIDD.

W_SUPPORT-BSTDK = I_ITEM-BSTDK.

W_SUPPORT-BSTDK_E = I_ITEM-BSTDK_E.

W_SUPPORT-KDKG2 = I_ITEM-KDKG2.

W_SUPPORT-VTEXT = I_ITEM-VTEXT3.

INT_EDIDD-SEGNAM = C_SUPPORT.

INT_EDIDD-SDATA = W_SUPPORT.

APPEND INT_EDIDD.

W_AMOUNT-NETWR = I_ITEM-NETWR.

W_AMOUNT-KWMENG = I_ITEM-KWMENG.

W_AMOUNT-WAERK = I_ITEM-WAERK.

INT_EDIDD-SEGNAM = C_AMOUNT.

INT_EDIDD-SDATA = W_AMOUNT.

APPEND INT_EDIDD.

endloop.