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: 

Reg: Idoc generation

Former Member
0 Kudos
92

Hi All,

AS per my understanding for SPEC2K idoc generation, SAP generates two IDOCS. one of standard SAP message type and another is of SPEC2K type .

<b>My requirement</b> : if the customer requested items are not available then both the SAP message IDOC and SPEC2K idocs should be generated.

If the customer requested items are available then only SAP message type idoc should be triggered and <b>SPEC2K idoc should not be triggered</b>.

Is there any settings by which I can achive this.

Thanks in Advance.

Vijay.

2 REPLIES 2

Former Member
0 Kudos
53

Go through the following Steps

Try with the follwoing steps

Sending System(Outbound ALE Process)

Tcode SALE „³ for

a) Define Logical System

b) Assign Client to Logical System

Tcode SM59-RFC Destination

Tcode BD64 ¡V Create Model View

Tcode BD82 ¡V Generate partner Profiles & Create Ports

Tcode BD64 ¡V Distribute the Model view

This is Receiving system Settings

Receiving System(Inbound ALE )

Tcode SALE „³ for

a) Define Logical System

b) Assign Client to Logical System

Tcode SM59-RFC Destination

Tcode BD64 ¡V Check for Model view whether it has distributed or not

Tcode BD82 -- Generate partner Profiles & Create Ports

Tcode BD11 Getting Material Data

Tcode WE05 ¡V Idoc List for inbound status codes

Message Type MATMAS

Tcode BD10 ¡V Send Material Data

Tcode WE05 ¡V Idoc List for watching any Errors

1)a Goto Tcode SALE

Click on Sending & Receiving Systems-->Select Logical Systems

Here Define Logical Systems---> Click on Execute Button

go for new entries

1) System Name : ERP000

Description : Sending System

2) System Name : ERP800

Description : Receiving System

press Enter & Save

it will ask Request

if you want new request create new Request orpress continue for transfering the objects

B) goto Tcode SALE

Select Assign Client to Logical Systems-->Execute

000--> Double click on this

Give the following Information

Client : ERP 000

City :

Logical System

Currency

Client role

Save this Data

Step 2) For RFC Creation

Goto Tcode SM59-->Select R/3 Connects

Click on Create Button

RFC Destination Name should be same as partner's logical system name and case sensitive to create the ports automatically while generating the partner profiles

give the information for required fields

RFC Destination : ERP800

Connection type: 3

Description

Target Host : ERP000

System No:000

lan : EN

Client : 800

User : Login User Name

Password:

save this & Test it & RemortLogin

3)

Goto Tcode BD64 -- click on Change mode button

click on create moduleview

short text : xxxxxxxxxxxxxx

Technical Neme : MODEL_ALV

save this & Press ok

select your just created modelview Name :'MODEL_ALV'.

goto add message type

Model Name : MODEL_ALV

sender : ERP000

Receiver : ERP800

Message type :MATMAS

save & Press Enter

4) Goto Tcode BD82

Give Model View : MODEL_ALV

Partner system : ERP800

execute this by press F8 Button

it will gives you sending system port No :A000000015(Like)

5) Goto Tcode BD64

seelct the modelview

goto >edit>modelview-->distribute

press ok & Press enter

6)goto Tcode : BD10 for Material sending

Material : mat_001

Message Type : MATMAS

Logical System : ERP800

and Execute

7)goto Tcode : BD11 for Material Receiving

Material : mat_001

Message Type : MATMAS

and Execute --> 1 request idoc created for message type Matmas

press enter

Thanks & regards

Sreenivas

Here Master Idoc set for Messge type MATMAS-->press Enter

1 Communication Idoc generated for Message Type

this is your IDOC

Thanks & Regards

Abhay.

rewards point

Former Member
0 Kudos
53

Hi ,

See the following code :

Program To Generate IDoc

&----


*& Report ZZ_Program_To_Create_Idoc

&----


report zz_program_to_create_idoc .

tables: ekko,ekpo.

selection-screen skip 3.

selection-screen begin of block b1 with frame title titl.

selection-screen skip.

select-options s_ebeln for ekko-ebeln.

selection-screen skip.

selection-screen end of block b1.

data: header_segment_name like edidd-segnam value 'Z1EKKO',

item_segment_name like edidd-segnam value 'Z1EKPO',

idoc_name like edidc-idoctp value 'Z19838IDOC1'.

data: header_segment_data like z1ekko,

item_segment_data like z1ekpo.

data: control_record like edidc.

data: messagetyp like edmsg-msgtyp value 'ZZ9838MESG1'.

data: i_communication like edidc occurs 0 with header line,

i_data like edidd occurs 0 with header line.

data: begin of i_ekko occurs 0,

ebeln like ekko-ebeln,

aedat like ekko-aedat,

bukrs like ekko-bukrs,

bsart like ekko-bsart,

lifnr like ekko-lifnr,

end of i_ekko.

data: begin of i_ekpo occurs 0,

ebelp like ekpo-ebelp,

matnr like ekpo-matnr,

menge like ekpo-menge,

meins like ekpo-meins,

netpr like ekpo-netpr,

end of i_ekpo.

start-of-selection.

select ebeln aedat bukrs bsart lifnr from ekko

into table i_ekko where ebeln in s_ebeln.

select ebelp

matnr

menge

meins

netpr

from ekpo

into table i_ekpo

where ebeln in s_ebeln.

control_record-mestyp = messagetyp.

control_record-rcvprt = 'LS'.

control_record-idoctp = idoc_name.

control_record-rcvprn = '0MART800'.

loop at i_ekko.

header_segment_data-ebeln = i_ekko-ebeln.

header_segment_data-aedat = i_ekko-aedat.

header_segment_data-bukrs = i_ekko-bukrs.

header_segment_data-bsart = i_ekko-bsart.

header_segment_data-lifnr = i_ekko-lifnr.

i_data-segnam = header_segment_name.

i_data-sdata = header_segment_data.

append i_data.

select ebelp

matnr

menge

meins

netpr

from ekpo

into table i_ekpo

where ebeln = i_ekko-ebeln.

loop at i_ekpo.

item_segment_data-ebelp = i_ekpo-ebelp.

item_segment_data-matnr = i_ekpo-matnr.

item_segment_data-menge = i_ekpo-menge.

item_segment_data-meins = i_ekpo-meins.

item_segment_data-netpr = i_ekpo-netpr.

i_data-segnam = item_segment_name.

i_data-sdata = item_segment_data.

append i_data.

endloop.

clear i_ekpo.

refresh i_ekpo.

endloop.

call function 'MASTER_IDOC_DISTRIBUTE'

exporting

master_idoc_control = control_record

  • OBJ_TYPE = ''

  • CHNUM = ''

tables

communication_idoc_control = i_communication

master_idoc_data = i_data

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 id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

else.

loop at i_communication.

write: 'IDOC GENERATED', i_communication-docnum.

endloop.

commit work.

endif.

initialization.

titl = 'ENTER THE PURCHASE ORDER NUMBER'.

Reward points if helpful.

Regards.

Abhay.

Rewards point