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

Populate IDOC data for outbound message type

Former Member
0 Likes
2,539

Hi friends,

I am creating a FM to populate the Idoc data for message type. i am using the DEBMAS05 as basic type and ZDEBAV as message type. I'm having nearly 20 segments to be filled. I am very much confused regarding the declaration part. So can anyone of the experts tell me what to write in the declaration part.

Thanks in advance

Santosh L.G

Hi friends,

I am creating a FM to populate the Idoc data for message type. i am using the DEBMAS05 as basic type and ZDEBAV as message type. I'm having nearly 20 segments to be filled. I am very much confused regarding the declaration part. So can anyone of the experts tell me what to write in the declaration part.

Thanks in advance

Santosh L.G

7 REPLIES 7
Read only

former_member582701
Contributor
0 Likes
1,533

I don't understand you need but i go to try.

You need create an internal table like your segment. You fill all your fields you need and append to field sdata of idoc (idoc_data like edidd).

Note: if you are using extended idocs from standard idocs you need do it into an user exit

Read only

0 Likes
1,533

Hi Manel,

Thanks for ur inputs. Can u plz send me some examples on how to populate the data into segments and again populate the same into the sdata of table EDIDD. And lastly append the data into output parameter of FM . It will be more helpfull for me if you send me asap.

Thanks in advance

Santosh L.G

Read only

former_member187255
Active Contributor
0 Likes
1,533

Santosh,

You can declare in the exit <b>EXIT_SAPLVV01_001</b> .. include name is <b>ZXVSVU01</b>

You can declare as... for example...

data: I_E1LFA1M like E1LFA1M,

I_E1LFB1M like E1LFB1M,

I_E1LFM1M like E1LFM1M.

constants: C_E1LFA1M(7) type C value 'E1LFA1M'.

case SEGMENT_NAME.

when C_E1LFA1M.

-write ur code and fill the segments..---

endcase.

Regards.

Read only

Former Member
0 Likes
1,533

Hi Santosh,

You can use FM MASTERIDOC_CREATE_DEBMAS as a reference on how to populate segment data.

Regads,

Ferry Lianto

Read only

Former Member
0 Likes
1,533

For the declaration you need to define a workarea for each of the segments of the debmas you need to fill like this:


data: wa_E1KNA1M like E1KNA1M,
        wa_E1KNA11 like E1KNA11....

Then the data of the IDOC is allways in a sdata, so you only need to make a case like this:


case idoc-segname .
when 'E1KNA1M'.
wa_E1KNA1M = idoc-sdata.
when 'E1KNA11'.
wa_E1KNA11 = idoc-sdata.
endcase.

And then you can acces each of the fields of the segment by it's name:


if wa_e1kna1m-KUNNR = ...

etc

Read only

0 Likes
1,533

Hi Ruben,

Thanks for ur inputs. Can u plz send me some examples on how to populate the data into segments and again populate the same into the sdata of table EDIDD. And lastly append the data into output parameter. It will be more helpfull for me if you send me asap.

Thanks in advance

Santosh L.G

Read only

former_member582701
Contributor
0 Likes
1,533

Hi,

I copy you an example of orders (my idoc is an exteneded from standard idoc ordersp)

CONSTANTS: c_prevsegnam LIKE EDIDD-SEGNAM VALUE 'E1EDK01',

c_zpedido_wm LIKE EDIDD-SEGNAM VALUE 'ZPEDIDO_WM'.

*/ Second constant is the segnam of our idoc. Later we will fill the idoc segnam with this. First is the name of the previous segment (you need write the name of the segment previous to yours)

DATA: BEGIN OF wa_order,

kunnr LIKE ZPEDIDO_WM-kunnr,

bzirk LIKE ZPEDIDO_WM-bzirk,

abhod LIKE ZPEDIDO_WM-abhod,

abhov LIKE ZPEDIDO_WM-abhov,

vdatu LIKE ZPEDIDO_WM-vdatu,

vzeit LIKE ZPEDIDO_WM-vzeit,

zdocref LIKE ZPEDIDO_WM-zdocref,

comentario LIKE ZPEDIDO_WM-comentario,

muelle_aut LIKE ZPEDIDO_WM-muelle_aut,

END OF wa_order.

*/ It is our segment. (wa_order LIKE ZPEDIDO_WM is a valid definition too)

You need programm all code into an user exit (rcs have told the user exit u need)

Then....

IF int_edidd-segnam = c_prevsegnam.

CLEAR wa_pedido.

CLEAR int_edidd. " internal table like EDIDD - It's our idoc. Usually User exit function passes the table

*/ Here you fill your segment with the necessary data.

wa_order-bukrs = 'hi'.

wa_order-bzirk = 'hello'.

wa_order-abhod = '2'.

*/ Now you append it into idoc

int_edidd-segnam = c_zpedido_wm.

MOVE wa_pedido TO int_edidd-sdata.

APPEND int_edidd.

Take care with the position of all segments. You must fill your segment after the corresponding segment (look at we30 for see the order of segments)

I hope it helps you.

Regards