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: 

internal table to idoc

Former Member
0 Kudos
79

hi all,

my requirement is as follows:

i have to fetch data from an excel sheet to the sap system for the creation of business partners.

this has to be done using idocs.i am new to idocs.till now i have been able to fetch data into an internal ttable from an excel sheet.now i need to populate this data into an idoc.

1)how to go about this?can anyone give me sample code.

2)also once the data has been fetched into the idoc how to create new business partners with this.i m working on crm5.2 application

i will be grateful for ne help.

kind regards

shilpi pasricha

1 REPLY 1

Former Member
0 Kudos
42

You can the direction from the following psuedo:

PERFORM build_control_record.

*Loop thro each material and build the relevent segments, and create the

*communication idoc for the receiver.

LOOP AT it_mara.

PERFORM build_e1seg1.

PERFORM build_z1seg2.

PERFORM build_z1seg3.

and so on...

*Create the communication idocs for the material for the receiver.

PERFORM create_comm_idocs.

ENDLOOP.

*example on how to fill the segments

FORM build_e1maram .

CLEAR e1maram.

e1maram-msgfn = '004'.

MOVE-CORRESPONDING it_mara TO e1maram.

CLEAR t_idoc_data.

t_idoc_data-segnam = 'E1MARAM'.

t_idoc_data-sdata = e1maram.

APPEND t_idoc_data.

ENDFORM.

FORM create_comm_idocs .

  • Distribute IDOC

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

EXPORTING

master_idoc_control = f_idoc_header

TABLES

communication_idoc_control = t_idoc_comm_control

master_idoc_data = t_idoc_data

EXCEPTIONS

error_in_idoc_control = 01

error_writing_idoc_status = 02

error_in_idoc_data = 03

sending_logical_system_unknown = 04.

COMMIT WORK.

CALL FUNCTION 'DEQUEUE_ALL'.

ENDFORM. " CREATE_COMM_IDOCS