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: 

How to create IDocs from Flat file

Former Member
0 Kudos

Hi ,

How to create IDocs from the Flat file . For my business requirement LSMW through IDoc will not fit .

Thanks for watching this thread .

Regards

Sree

4 REPLIES 4

Former Member
0 Kudos

Hi,

you can do this scenario by using XI (FILE 2 IDOC)

Regards

sri

0 Kudos

Hi Kanth ,

Thanks for ur reply , I am expecting an independent solution with out middle wares or XI . The solution I am expecting like to be handled in ABAP other than the middle ware.

Regards

Sree

0 Kudos

Hi Sree,

You can create Inbound IDoc directly from your custom program after reading the flat file.

For this you need to use the Function Module IDOC_INBOUND_WRITE_TO_DB to create the IDoc.


  CALL FUNCTION 'IDOC_INBOUND_WRITE_TO_DB'
    EXPORTING
      pi_do_handle_error      = v_do_handle_error
      pi_return_data_flag     = ' '
    IMPORTING
      pe_idoc_number          = control_record_db_in-docnum
      pe_inbound_process_data = v_inbound_process_data_in
    TABLES
      t_data_records          = i_data_records_db   "IDoc Data 
    CHANGING
      pc_control_record       = control_record_db_in  "Control Data
    EXCEPTIONS
      idoc_not_saved          = 1
      OTHERS                  = 2.

After this you can use the FM 'IDOC_START_INBOUND' to process the IDoc.


    CALL FUNCTION 'IDOC_START_INBOUND'
         EXPORTING
              pi_inbound_process_data = v_inbound_process_data_in
              pi_called_online        = c_check     "'X'
              succ_show_flag          = c_check     "'X'
         TABLES
              t_control_records       = i_control_records
         EXCEPTIONS
              OTHERS                  = 1.

Or else you can process the Inbound IDoc using transaction like BD87