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

How to create Inbound Idocs in a ABAP program? Any function Module?

Former Member
0 Likes
4,243

Hello Experts,

My requirement is : I have sales order data which I extracted from third party system in my internal tables. In the same box I need to create inbound Idocs and then consequently create sales orders.

I have used the function module IDOC_INBOUND_WRITE_TO_DB to create inbound Idocs from Sales Orders data in internal tables. I have populated all the data records with correct PSGNUM and HLEVEL values. My plan is to create inbound idocs with this function module and send those to IDOC_INPUT_ORDERS function module which creates Sales Orders.

If a sales order in the internal table in ABAP program contains only one item, then I am getting correct idocs. But if more than one item exists for a sales order then the line item segments which got repeated in Idoc are having PSGNUM and HLEVEL values as zero when I checked in WE02. As a result the hierarchy from the second item segment is getting disturbed and getting the status 60.

I populated T_EDIDD with data records from IDOC_INBOUND_WRITE_TO_DB.

To the function module IDOC_INPUT_ORDERS, T_EDIDC and T_EDIDD are the input. I observed that in T_EDIDD also the PSGNUM and HLEVEL values are blank.

I am getting Status 60 with message 'EDI: Syntax error in IDoc (segment cannot be identified)' for idocs which have more than one item.

I need to extract sales data from third party and create inbound idocs and create sales orders in one ABAP program only. I need to display corresponding Idoc numbers for the corresponding third party sales order number in a listoutput.

Can anybody please provide inputs?

Regards.

Hello Experts,

My requirement is : I have sales order data which I extracted from third party system in my internal tables. In the same box I need to create inbound Idocs and then consequently create sales orders.

I have used the function module IDOC_INBOUND_WRITE_TO_DB to create inbound Idocs from Sales Orders data in internal tables. I have populated all the data records with correct PSGNUM and HLEVEL values. My plan is to create inbound idocs with this function module and send those to IDOC_INPUT_ORDERS function module which creates Sales Orders.

If a sales order in the internal table in ABAP program contains only one item, then I am getting correct idocs. But if more than one item exists for a sales order then the line item segments which got repeated in Idoc are having PSGNUM and HLEVEL values as zero when I checked in WE02. As a result the hierarchy from the second item segment is getting disturbed and getting the status 60.

I populated T_EDIDD with data records from IDOC_INBOUND_WRITE_TO_DB.

To the function module IDOC_INPUT_ORDERS, T_EDIDC and T_EDIDD are the input. I observed that in T_EDIDD also the PSGNUM and HLEVEL values are blank.

I am getting Status 60 with message 'EDI: Syntax error in IDoc (segment cannot be identified)' for idocs which have more than one item.

I need to extract sales data from third party and create inbound idocs and create sales orders in one ABAP program only. I need to display corresponding Idoc numbers for the corresponding third party sales order number in a listoutput.

Can anybody please provide inputs?

Regards.

9 REPLIES 9
Read only

Former Member
0 Likes
1,882

to proces inobund idoc..

60 Error during syntax check of IDoc (inbound)

so find go to user exit or program and correct the syntax and process the below inbound program to create idoc..


Program RBDAPP01 for status 64
Program RBDAGAIE for status 32 and 60 (Edited IDocs)

regards,

Prabhudas

Read only

0 Likes
1,882

Hi Prabhudas,

Thankyou for your reply.

But I have to create Inbound Idocs from the ABAP progam first. That is failing as a result of disturbed hierarchy level (HLEVEL) and PSGNUM values.

HLEVEL and PSGNUM are having zeroes from the second line item segment. They are having correct values up to first line item for the same Idoc.

Regards.

Read only

0 Likes
1,882

Hi

Try getting the value of the segment number and hierarcy fro the idoc itself and recreate it in the ABAP program.

I am doing a similar one where i use the function module and get the data from what is input input in the idoc.

Display the data for a succesful idoc and get the 2 values from the display and then put that into the ABAP program.

Read only

0 Likes
1,882

Hi Anjali,

Thanks for the response.

.

I have passed the PSGNUM and HLEVEL values while populating the data records. Then I sent the data records and control record information to the function module IDOC_INBOUND_WRITE_TO_DB. Inside this function module there is code to clear the PSGNUM values and HLEVEL values.

  • for compatibility: clear administration data of data records

perform data_records_wipe

tables

t_data_records.

FORM DATA_RECORDS_WIPE

TABLES

T_DATA_RECORDS_IN STRUCTURE EDIDD.

LOOP AT T_DATA_RECORDS_IN.

CLEAR: T_DATA_RECORDS_IN-MANDT,

T_DATA_RECORDS_IN-DOCNUM,

T_DATA_RECORDS_IN-SEGNUM,

T_DATA_RECORDS_IN-PSGNUM,

T_DATA_RECORDS_IN-HLEVEL.

modify t_data_records_in.

ENDLOOP.

ENDFORM. " DATA_RECORDS_WIPE

This is the code which is clearing all the PSGNUM and HLEVEL values. After coming out of this function module we are getting the error idocs created with disturbed hierarchy.

I need to create INBOUND Idocs with the data in ABAP program.

Please let me know if any inputs? Is there any function module existing to create Inbound Idocs inside an ABAP program?

Regards

Read only

0 Likes
1,882

Can anybody provide their valuable inputs?

Read only

0 Likes
1,882

Hi ,

You can use FM IDOC_INBOUND_SINGLE to create inbound Idocs. Mention Idoc type and message type in the control record.

Regards,

Deepthi

Read only

0 Likes
1,882

Hi Deepthi,

Thankyou for your reply.

I have made use of that function module also. But no use. IDOC_INBOUND_SINGLE again calls the function module IDOC_INBOUND_WRITE_TO_DB inside.

Is there any other way?

REgards.

Read only

Former Member
0 Likes
1,882

Hi,

Check this sample program.

https://www.sdn.sap.com/irj/sdn/wiki?path=?path=/display/SCM/SCM%2bInbound%2bIdoc%2bProgram

It is in the SCM Code Gallery

cheers

Aveek

Read only

Former Member
0 Likes
1,882