Inbound IDOC commit
Dear all,
I need to clarify scneario below:
INBOUND process
Receive an Idoc, and inbound FM Z_TEST_IN will be executed. In inbound FM Z_TEST_IN, i have to update both Table ZHEADER and ZITEM. Since they are Header and item table, so if one of the table updating failed I've to perform rollback.
This is what i plan to do. Create 2 update task FM, one for ZHEADER update and one for ZITEM update. It will look like this:
Function Z_TEST_IN
CALL FUNCTION 'Z_UPDATE_HEADER'
IN UPDATE TASK
CALL FUNCTION 'Z_UPDATE_ITEM'
IN UPDATE TASK
ENDFUNCTION
My question would be:
1. Is there a system COMMIT WORK predefined in ALE layer? Or should i code an explicit COMMIT WORK in Inbound FM Z_TEST_IN?
2. Let's say update fail on one of the table, then ROLLBACK WORK will be triggered. So i'm aspecting data will not update to both tables, but how about the Inbound Idoc creation? Will the idoc still be created and shown in WE05?
Your comment is highly appreciated. Thanks in advance.
Hi,
1.You are using the Zfunction module,So you need to commit explicitly.
2.For standard ,implicitly done.
3.There is no need to create inbound IDoc.While processing only the Inbound idoc created.
4.Suppose if u want to create just go for We30.
5.We05 for just gives the list of idocs created.
To Create Idoc we need to follow these steps:
Create Segment ( WE31)
Create Idoc Type ( WE30 )
Create Message Type ( WE81 )
Assign Idoc Type to Message Type ( WE82 )
Creating a Segment
Go to transaction code WE31
Enter the name for your segment type and click on the Create icon
Type the short text
Enter the variable names and data elements
Save it and go back
Go to Edit -> Set Release
Follow steps to create more number of segments
Create IDOC Type
Go to transaction code WE30
Enter the Object Name, select Basic type and click Create icon
Select the create new option and enter a description for your basic IDOC type and press enter
Select the IDOC Name and click Create icon
The system prompts us to enter a segment type and its attributes
Choose the appropriate values and press Enter
The system transfers the name of the segment type to the IDOC editor.
Follow these steps to add more number of segments to Parent or as Parent-child relation
Save it and go back
Go to Edit -> Set release
Create Message Type
Go to transaction code WE81
Change the details from Display mode to Change mode
After selection, the system will give this message The table is cross-client (see Help for further info). Press Enter
Click New Entries to create new Message Type
Fill details
Save it and go back
Assign Message Type to IDoc Type
Go to transaction code WE82
Change the details from Display mode to Change mode
After selection, the system will give this message The table is cross-client (see Help for further info). Press Enter.
Click New Entries to create new Message Type.
Fill details
Save it and go back
Regards,
Shiva.
Similar Messages
-
User Exit / Badi after (inbound idoc) database commit
Hello Folks,
I want to know the User Exit/Badi that can be used after inbound idoc gets posted, as i want to use perform on commit statement.
Thanks & Regards,
Nishanth KumarHi Sengupta,
Usually there are no user-exits after COMMIT.
What you need to do is register a call which will be executed after COMMIT, from one of the available user-exits.
To do this, SAP provides 2 methods:
1. PERFORM xxx ON COMMIT
2. Function Module with attribute "Update Module"
Check ABAP keyword help for more information for PERFORM xxx ON COMMIT.
<a href="http://help.sap.com/saphelp_46c/helpdata/en/34/8e72cc6df74873e10000009b38f9b8/frameset.htm">http://help.sap.com/saphelp_46c/helpdata/en/34/8e72cc6df74873e10000009b38f9b8/frameset.htm</a>
Hope this helps.
Regards,
Sumant.
PS: Reward points if this is helpful. -
Creation of Inbound IDOC from a flat file.
Hi all,
I hav to create Purchse Order using inbound IDOC in which I hav to take data from a .xls or any flat file.
Can any one help me with this. i.e wat r the steps involed to do so.
Regards.
RahulHello,
Why do u want to create a Idoc for creating PO from flat file - you can simply use BAPI. Ok if you want to create PO only using Idoc.
I think message type is ACC_PURCHASE_ORDER0.
I just made one sample program to you how to create a PO with Idoc method. Here i am doing for Material Master Creation. Let me know if want any clarification.
********Poorna********
TABLES : MARA, MAKT, EDP13.
DATA : I_EDIDC LIKE EDIDC OCCURS 0 WITH HEADER LINE,
I_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE.
PARAMETERS : P_MATNR LIKE MARA-MATNR.
START-OF-SELECTION.
REFRESH I_EDIDC.
SELECT * FROM EDP13 WHERE MESTYP = 'ZMATMASTER'.
MOVE-CORRESPONDING EDP13 TO I_EDIDC.
I_EDIDC-IDOCTP = EDP13-IDOCTYP.
APPEND I_EDIDC.
ENDSELECT.
READ TABLE I_EDIDC INDEX 1.
I_EDIDD-SEGNAM = 'ZMATMASTER'.
SELECT SINGLE * FROM MARA WHERE MATNR = P_MATNR.
SELECT SINGLE * FROM MAKT WHERE MATNR = P_MATNR
AND SPRAS = SY-LANGU.
I_EDIDD-SDATA+0(18) = MARA-MATNR.
I_EDIDD-SDATA+18(40) = MAKT-MAKTX.
I_EDIDD-SDATA+58(4) = MARA-MTART.
I_EDIDD-SDATA+62(1) = MARA-MBRSH.
I_EDIDD-SDATA+63(3) = MARA-MEINS.
APPEND I_EDIDD.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = I_EDIDC
OBJ_TYPE = ''
CHNUM = ''
tables
communication_idoc_control = I_EDIDC
master_idoc_data = I_EDIDD
EXCEPTIONS
ERROR_IN_IDOC_CONTROL = 1
ERROR_WRITING_IDOC_STATUS = 2
ERROR_IN_IDOC_DATA = 3
SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
OTHERS = 5
COMMIT WORK.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
Creation of Inbound Idoc for the Outbound Idoc in same client
Hi,
My requirement:
Whenver an PO is created an Outbound IDOC is generated in system ABC with client 100.I want to pass this IDOC data to create an Inbound Idoc for Sales Order(SO) in the same client.
It would be helpful if anyone can answer on how to Transfer the Outbound Idoc after it crosses the port.
I found there is a field for function module in WE21,can this be used to get the requirement done.
Please suggest.
Regards,
AmarExample of a program that create and post an inbound idoc....maybe that will help you:
report zzinbound_idoc.
data: g_idoc_control_record like edi_dc40 occurs 0 with header line.
data: g_edidd like edi_dd40 occurs 0 with header line.
data: g_e1bpache09 like e1bpache09.
parameter: mode type c default 'A'.
refresh: g_idoc_control_record, g_edidd.
clear: g_idoc_control_record, g_edidd.
*-Build Control Record -*
g_idoc_control_record-mestyp = 'ACC_DOCUMENT'. "Message type
g_idoc_control_record-idoctyp = 'ACC_DOCUMENT03'. "IDOC type
g_idoc_control_record-direct = '2'. "Direction
* Receiver
case sy-sysid.
when 'DE2'.
g_idoc_control_record-rcvpor = 'SAPDE2'. "Port
g_idoc_control_record-rcvprn = 'IDOCLEGACY'. "Partner number
endcase.
g_idoc_control_record-rcvprt = 'LS'. "Partner type
g_idoc_control_record-rcvpfc = ''. "Partner function
* Sender
g_idoc_control_record-sndpor = 'A000000002'. "tRFC Port
case sy-sysid.
when 'DE2'.
g_idoc_control_record-sndprn = 'IDOCLEGACY'. "Partner number
endcase.
g_idoc_control_record-sndprt = 'LS'. "Partner type
g_idoc_control_record-sndpfc = ''. "Partner function
g_idoc_control_record-refmes = 'Customer clearing'.
append g_idoc_control_record.
*-Build Idoc Segments -*
*---E1KOMG
clear g_edidd.
clear g_e1bpache09.
g_edidd-segnam = 'E1BPACHE09'.
g_edidd-segnum = 1.
move g_e1bpache09 to g_edidd-sdata.
append g_edidd.
*-Create idoc -*
*-Syncronous
if mode = 'S'.
call function 'IDOC_INBOUND_SINGLE'
exporting
pi_idoc_control_rec_40 = g_idoc_control_record
* PI_DO_COMMIT = 'X'
* IMPORTING
* PE_IDOC_NUMBER =
* PE_ERROR_PRIOR_TO_APPLICATION =
tables
pt_idoc_data_records_40 = g_edidd
exceptions
idoc_not_saved = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
*-Asynchronus
else.
call function 'IDOC_INBOUND_ASYNCHRONOUS'
in background task as separate unit
tables
idoc_control_rec_40 = g_idoc_control_record
idoc_data_rec_40 = g_edidd.
commit work.
endif.
write: / 'Well done!'. -
Help required in posting inbound idocs
Hi,
We are facing a problem during integration testing to post inbound idocs.
The scenario is :
A custom FM is written to process the inbound idocs, which does the following processes in sequence.
1. BAPI used to create Goods Receipt
2. BDC used to create Delivery using VL01N
3. BDC used to create Handling Unit using VL02N
4. BDC used to create Post Goods Issue using VL02N
The VL01N creates a deivery, and using that delivery BDC calls VL02N to create HU.
In unit testing the idocs are success, but when multiple idocs are used in integration testing, all fails either during delivery creation or HU creation.
The error message we often get when HU is failed is : "Runtime error RAISE_EXCEPTION has occured ".
We have also incorporated a commit work and wait of 5 seconds after each BDC to avoid locking problem if any.
The partner profile is set to ' trigger by background program'.
Standard program RBDAPP01 is scheduled to collect the IDocs in status 64 and then to be processed.
The package size used is 1, inorder to process idocs one by one to avoid locking.
Should any object type be given in RBDAPP01 ?
If so, is it required to maintain any record for that object type in table TBD55 to process idocs serially in RBDAPP01 ?
Any help in this regard is appreciated.
Thanks in advance
Regards
Meena GeorgeHi,
We are facing a problem during integration testing to post inbound idocs.
The scenario is :
A custom FM is written to process the inbound idocs, which does the following processes in sequence.
1. BAPI used to create Goods Receipt
2. BDC used to create Delivery using VL01N
3. BDC used to create Handling Unit using VL02N
4. BDC used to create Post Goods Issue using VL02N
The VL01N creates a deivery, and using that delivery BDC calls VL02N to create HU.
In unit testing the idocs are success, but when multiple idocs are used in integration testing, all fails either during delivery creation or HU creation.
The error message we often get when HU is failed is : "Runtime error RAISE_EXCEPTION has occured ".
We have also incorporated a commit work and wait of 5 seconds after each BDC to avoid locking problem if any.
The partner profile is set to ' trigger by background program'.
Standard program RBDAPP01 is scheduled to collect the IDocs in status 64 and then to be processed.
The package size used is 1, inorder to process idocs one by one to avoid locking.
Should any object type be given in RBDAPP01 ?
If so, is it required to maintain any record for that object type in table TBD55 to process idocs serially in RBDAPP01 ?
Any help in this regard is appreciated.
Thanks in advance
Regards
Meena George -
INBOUND IDOC not updating the basic data field which is created newly
Hi,
i am creating an inbound IDOC for material master creation in that in basic data1 i have created 2 custom field in general data 1 is updating and another is not updating with the value in iDOC.
User exits codes are fine. but data is not updating.
can some one help hw to resolve this..
regards,
thanigaiHi,
Are you Debug the function module in Process code of IDOC and use COMMIT WORK in that Function module. -
Inbound IDOC Mass processing - No status message
Hi Friends,
I am updating a database table using inbound IDOC. But in batch job when XI passes multiple IDOCS,
for some IDOCs there is no status message even though i coded for status message.
If i rerun IDOC in BD87 then it work fine.
please help.
regards,
madanHi Madan,
Since you are loading multiple idoc to the system due to high load in the production system data is not commiting properly. So use external commit work statement in you code. this will reduce the performance but logic will work.
COMMIT WORK [AND WAIT].
Effect
The statement COMMIT WORK completes the current SAP LUW and opens a new one, storing all change requests for the current SAP LUW in the process. In this case, COMMIT WORK performs the following actions:
It executes all subroutines registered using PERFORM ON COMMIT.
The sequence is based on the order of registration or according to the priority specified using the LEVEL addition. Execution of the following statements is not permitted in a subroutine of this type:
PERFORM ... ON COMMIT|ROLLBACK
COMMIT WORK
ROLLBACK WORK
The statement CALL FUNCTION ... IN UPDATE TASK can be executed.
Triggering an internal event for the Persistence Service of the Object Services.
If event handlers are registered by the Persistence Service, these collect the changes to the objects managed by the Persistence Service and transfer them via CALL FUNCTION ... IN UPDATE TASK to a specific update function module that is registered as the last update module.
This executes all high-priority (VB1) update function modules in the order of their registration and in a common database LUW. If you do not specify the addition AND WAIT, the program does not wait until the update work process has executed it (asynchronous updating), but instead is resumed immediately after COMMIT WORK. However, if the addition AND WAIT is specified, program processing after COMMIT WORK will not continue until the update work process has executed the high-priority update function modules (synchronous updating).
When all high-priority update function modules are completed successfully, the statement executes the low-priority (VB2) update function modules in the order of registration together in a common database LUW.
After the execution of high-priority update function modules, the individual function modules registered using CALL FUNCTION ...IN BACKGROUND TASK|UNIT are executed in a separate database LUW for each destination.
Within an update function module started using COMMIT WORK, the execution of statements that lead to a database commit is not permitted. In particular, the following are forbidden:
Thanks,
Raghav -
Hello All,
We have a ALE concept to transfer data between clients. We have made the settings and the process was fine. But on some days Inbound Idoc is not getting generated with respect to the outbound Idoc, and after some times once again system comes to normal state and the idoc generation is fine. How ever we dont have any root cause for the failure of Idoc generation. Could someone let me know where i can chk the info and what all the parammetres needs to be checked.
Note ; There are no issues in ALE ocnfig settings.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.
Srikanta Gope. -
How to cancel/reverse an inbound idoc?
I wish to cancel then reverse an inbound idoc specifically, WPUUMS01 (sales data compressed) as if the idoc never existed and wasn't processed in SAP.
The said idoc was already processed in SAP and the material and billing documents (in WPER) were already created.
Hope someone could help me on how to go about this.
Thanks!hello ,
may be u can try to look in for the concerned bapi and then delet tht record via tht bapi for e.g say to delete a create sales order demo code is -
DATA: T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
DATA: BAPISDH1X LIKE BAPISDH1X.
PARAMETERS: P_VBELN LIKE VBAK-VBELN.
SET THE DELETION FLAG
BAPISDH1X-UPDATEFLAG = 'D'.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = P_VBELN
order_header_inx = BAPISDH1X
tables
return = T_RETURN
COMMIT WORK. -
Inbound Idoc for own Message type
Dear All,
I have created a message type for outbound and sent data to the Java System.But when distributing in BD64 inbound parameters are not getting created.
For inbound idoc if i am creating a new message type,How i can get data from external server and commit it in database.
We have to write any program as we do for outbound?
Another issue outbound idoc is in waiting status i have to process it in BD87.How i can sent it immediately and in partner profile, distributing in module view BD64 i have given Transfer IDoc Immediately.
PLZ reply ASAP.
Thanks & Regards,
Arun.Dear rhea,
I want to receive the IDOC data for message type WPUUMS from a java server. Currently i am working on sample values for segments
E1WPU01
E1WPU02
E1WPU03
E1WPU04
E1WPU05
E1WXX01
I am facing problems in passing the correct values .
Its throwing a error message status 51.(Application document not posted) IDoc not fully processed.
can you help me with some dummy data for all the fields in the above segments.
reply ASAP
regards
arun -
Help in inbound idoc posting using bdc
Hi,
We are facing a problem during integration testing to post inbound idocs.
The scenario is :
A custom FM is written to process the inbound idocs, which does the following processes in sequence.
1. BAPI used to create Goods Receipt
2. BDC used to create Delivery using VL01N
3. BDC used to create Handling Unit using VL02N
4. BDC used to create Post Goods Issue using VL02N
The VL01N creates a deivery, and using that delivery BDC calls VL02N to create HU.
In unit testing the idocs are success, but when multiple idocs are used in integration testing, all fails either during delivery creation or HU creation.
The error message we often get when HU is failed is : "Runtime error RAISE_EXCEPTION has occured ".
We have also incorporated a commit work and wait of 5 seconds after each BDC to avoid locking problem if any.
The partner profile is set to ' trigger by background program'.
Standard program RBDAPP01 is scheduled to collect the IDocs in status 64 and then to be processed.
The package size used is 1, inorder to process idocs one by one to avoid locking.
Should any object type be given in RBDAPP01 ?
If so, is it required to maintain any record for that object type in table TBD55 to process idocs serially in RBDAPP01 ?
Any help in this regard is appreciated.
Thanks in advance
Regards
Meena GeorgeRefer these links and see if they are useful:
http://help.sap.com/saphelp_nw04/helpdata/en/0b/2a66c9507d11d18ee90000e8366fc2/content.htm
Regards,
Ravi -
Need Code to generate Inbound Idocs
Hi friends
i have a flat file consists of delivery confirmation data
by using this i need to generate inbound idocs
i filled all the segments in idoc type /afs/delvry03 and message type whscon
can any one have the code to generate inbound idocs
please remember that here i am not using XI
thanks
AnilHi this is for Stand alone Programs, I hope it is useful to you.
Program Flow
The program logic contains the following blocks:
1. Provide a selection screen to allow a user to specify the various objects for which IDocs are to be generated.
2. Determine the key of the application document from the object specified in step 1.
3. Select application data from the database using the object key identified in step 2.
4. Populate control record information.
5. Populate an internal table of type EDIDD with data records for the various segments.
6. Call the ALE service layer (MASTER_IDOC_DISTRIBUTE) to create the IDocs in the database.
7. Commit work.
The program in Listing 32-2 generates the monthly report IDoc ZMREPT01, which illustrates a stand-alone outbound process.
Listing 32-2
REPORT ZARNEDI1 MESSAGE-ID ZE.
Parameters
object key (Social security number for the employee)
PARAMETERS: P_SSN LIKE ZEMPDETAIL-SSN.
message type
PARAMETERS: P_MESTYP LIKE EDMSG-MSGTYP OBLIGATORY.
destination system
PARAMETERS: P_LOGSYS LIKE TBDLST-LOGSYS.
Constants
DATA:
segment names
C_HEADER_SEGMENT LIKE EDIDD-SEGNAM VALUE 'Z1EMHDR',
C_WEEKLY_DETAILS_SEGMENT LIKE EDIDD-SEGNAM VALUE 'Z1WKDET',
C_CLIENT_DETAILS_SEGMENT LIKE EDIDD-SEGNAM VALUE 'Z1CLDET',
C_SUMMARY_SEGMENT LIKE EDIDD-SEGNAM VALUE 'Z1SUMRY',
idoc type
C_MONTHLY_REPORT_IDOC_TYPE LIKE EDIDC-IDOCTP VALUE 'ZMREPT01'.
Data declarations
idoc control record
data: control_record_out like edidc.
employee header data
DATA: FS_EMPHDR_DATA LIKE Z1EMHDR.
employee weekly details data
DATA: FS_WEEKDET_DATA LIKE Z1WKDET.
client details data
DATA: FS_CLIENTDET_DATA LIKE Z1CLDET.
employee monthly summary data
DATA: FS_SUMMARY_DATA LIKE Z1SUMRY.
total hours and amount for the summary segment
DATA: TOTAL_HRS_MONTH TYPE I,
TOTAL_AMT_MONTH TYPE I.
Database Tables
Application data tables
TABLES: ZEMPDETAIL, ZEMPWKDET.
Internal tables
DATA:
weekly details - appplication data
IT_WKDET LIKE ZEMPWKDET OCCURS 0 WITH HEADER LINE,
data records
INT_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE,
communication idocs geneerated
IT_COMM_IDOCS LIKE EDIDC OCCURS 0 WITH HEADER LINE.
Program logic
********************Select Application Data***************************
SELECT SINGLE * FROM ZEMPDETAIL WHERE SSN = P_SSN.
IF SY-SUBRC NE 0.
MESSAGE E001 WITH P_SSN.
EXIT.
ENDIF.
SELECT * FROM ZEMPWKDET INTO TABLE IT_WKDET WHERE SSN = P_SSN.
IF SY-SUBRC NE 0.
MESSAGE E002 WITH P_SSN.
EXIT.
ENDIF.
********************Build Control Record******************************
Fill control record information
CONTROL_RECORD_OUT-MESTYP = P_MESTYP.
control_record_out-idoctp = c_monthly_report_idoc_type.
control_record_out-rcvprt = 'LS'.
control_record_out-rcvprn = p_logsys.
********************Build Data Records********************************
*--Employee header--
fill the employee header information
FS_EMPHDR_DATA-LNAME = ZEMPDETAIL-LNAME.
FS_EMPHDR_DATA-FNAME = ZEMPDETAIL-FNAME.
FS_EMPHDR_DATA-SSN = ZEMPDETAIL-SSN.
FS_EMPHDR_DATA-DOB = ZEMPDETAIL-DOB.
fill the administrative section of the data record
INT_EDIDD-SEGNAM = C_HEADER_SEGMENT.
INT_EDIDD-SDATA = FS_EMPHDR_DATA.
append the employee header data record to the IDoc data
APPEND INT_EDIDD.
*--Employee weekly details--
LOOP AT IT_WKDET.
fill the weekly details for each week
FS_WEEKDET_DATA-WEEKNO = IT_WKDET-WEEKNO.
FS_WEEKDET_DATA-TOTHOURS = IT_WKDET-TOTHOURS.
FS_WEEKDET_DATA-HRLYRATE = IT_WKDET-HRLYRATE.
add administrative information to the data record
INT_EDIDD-SEGNAM = C_WEEKLY_DETAILS_SEGMENT.
INT_EDIDD-SDATA = FS_WEEKDET_DATA.
append the data for the week to the IDoc data
APPEND INT_EDIDD.
Client details of each week
FS_CLIENTDET_DATA-CLSITE = IT_WKDET-CLSITE.
FS_CLIENTDET_DATA-WORKDESC = IT_WKDET-WORKDESC.
add administrative information to the data record
INT_EDIDD-SEGNAM = C_CLIENT_DETAILS_SEGMENT.
INT_EDIDD-SDATA = FS_CLIENTDET_DATA.
append the client details for the week to the IDoc data
APPEND INT_EDIDD.
ENDLOOP.
*--Employee monthly summary--
compute total hours and amount for the month
LOOP AT IT_WKDET.
TOTAL_HRS_MONTH = TOTAL_HRS_MONTH + IT_WKDET-TOTHOURS.
TOTAL_AMT_MONTH = TOTAL_AMT_MONTH + ( IT_WKDET-TOTHOURS *
IT_WKDET-HRLYRATE ).
ENDLOOP.
fill the summary information
FS_SUMMARY_DATA-TOTHRS = TOTAL_HRS_MONTH.
FS_SUMMARY_DATA-TOTAMT = TOTAL_AMT_MONTH.
condense the summary record fields to remove spaces
CONDENSE FS_SUMMARY_DATA-TOTHRS.
CONDENSE FS_SUMMARY_DATA-TOTAMT.
add administrative information to the data record
INT_EDIDD-SEGNAM = C_SUMMARY_SEGMENT.
INT_EDIDD-SDATA = FS_SUMMARY_DATA.
append summary data to the IDoc data
APPEND INT_EDIDD.
*************Pass control to the ALE layer****************************
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = control_record_out
TABLES
COMMUNICATION_IDOC_CONTROL = IT_COMM_IDOCS
MASTER_IDOC_DATA = INT_EDIDD
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 NE 0.
MESSAGE E003 WITH P_SSN.
ELSE.
LOOP AT IT_COMM_IDOCS.
WRITE: / 'IDoc generated', IT_COMM_IDOCS-DOCNUM.
ENDLOOP.
COMMIT WORK.
ENDIF. -
Hi,
iam working on an inbound IDOC TPSSHT01, i need to add an extrta field and segment , so i create an data element and Z segment and add the field in the segment
i have to copy the TPSSHT01 to a ZTPSSHT01 and do the IDoc extension ,
i have to copy the function module IDOC_INPUT_SHIPPL to Z_IDOC_INPUT_SHIPPL
Can any body let me know what are the steps that i have to follow to process the inbound idoc with the above requirment
Cheers,
SaiHi ,
Follow this procedure .
In bound Idoc
Step 1: Create segment
a. T.code WE31
b. Enter a new segment type and press create button
c. Give a short text
d. Enter the field names say FIELD NAME : MATNR ;; DATA ELEMENT: CHAR(18)
e. Save the segment (zkrishseg)
Step 2: Create IDOC type
a. T.code WE30
b. Enter a new IDOC type name
c. Choose the basic type and press the create button.
d. Choose the create new option button and enter a description and press enter
e. Place the cursor on the type name and then press create button.
f. Enter the segment name created in step 1 and check the mandatory segment check box
g. Enter minimum number and maximum number as 1 and press enter.
h. Then save the IDOC type. (zkrishtyp)
Step 3: Create message type
a. T.code WE81
b. Press change button.
c. Press new entries button.
d. Enter a message type and short text and press save button. (zkrishmsg)
Step 4: Assign message type to IDOC type.
a. T.code WE82
b. Press change button
c. Press new entries button.
d. Enter the created message type, IDOC type and version release (46B or 46C)
Step 5: Create a function module for inbound. (Z_IDOC_KRISH_INBOUND)
Step 5A: Create characteristics of inbound FM.
a. T.code BD51
b. Click New entries
c. Enter the IDOC function module name and 1(individual type) in input t..
d. Save it.
Step 6: Assignment of FM to log, message and type.
a. T.code WE57
b. Go for change mode and click new entries.
c. In processing by enter FM name and enter F as type.
d. Enter basic type (idoc type-zkrishtyp) and message type (zkrishmsg) in the respective text boxes.
e. Choose the direction as 2 Inbound.
f. Save the data.
Step 7. : Creation of inbound process code.
a. T.code WE42
b. Go to change mode and click create entries.
c. Enter a new process code and description (zidockrish)
d. Enter the FM name in the identification text box
e. Choose processing with ALE service
f. Choose processing by FM and click Save button
g. In the next screen, select the FM name and click save button
Step 7a : Creation of inbound process code.
h. T.code SM59
i. Select R/3 connection and click create.
j. Enter all system related things(for Eg. Connection type as 3, Target host as SAP04,
Description , and Logon details and save.
Step 8: Define a port
a. T.code WE21
b. Click on Transactional RFC and press the Create button
c. Enter a port name and description. (ztestkrish)
d. Choose the release type.
e. Choose the RFC destination.
f. To create RFC destination go to SPRO and search RFC destination and create.
g. Save the data.
Step 9. Define logical system
a. T.code SALE
b. Click down the sending and receiving systems
c. Click down the logical systems
d. Choose Define logical system.
e. Go for new entries.
f. Enter a new name and description and save it. (zkrishlog)
Step 10. Create partner profile
a. T.code WE20
b. Choose partner type LS and click create.
c. Enter the logical system name in partner number
d. Then Save . Here Type is US.
e. click + icon(create inbound parameter) in the bottom. Note: Two table control subscreens will appear. One for inbound and the other for outbound. Click + icon in inbound area.
f. Enter the message type, process code and save the data.
Step 11. Checking the Idoc
a. T.code WE19,
b. Choose radio Basic type , enter the type name(zkrishtyp) and press execute button.
c. Click on EDIDC Number.
d. Enter partner Number, Partner type, Port Number for sender and recipient ( data remains same here for sender and recipient)
e. Enter Message type and press ENTER.
f. Click on empty space corresponding to SEGMENT name and enter Paarameters like MATNR, WERKS and CHARG etc .
g. Click standard inbound properties here and press enter see the result .
h. T.code WE02
i. Enter IDOC number press ENTER see the status.
Function Module in Inbound
Import Parameters
INPUT_METHOD LIKE BDWFAP_PAR-INPU Inbound method for the IDoc inb
MASS_PROCESSING LIKE BDWFAP_PAR-MASS Flag: Mass processing
Export Parameters
WORKFLOW_RESULT LIKE BDWF_PARAM-RESULT Final value of method
APPLICATION_VARIABLELIKE BDWF_PARAM-APPL_VAR Variable to be used by
IN_UPDATE_TASK LIKE BDWFAP_PAR-UPDATETASK Flag: Application has
CALL_TRANSACTION_DONLIKE BDWFAP_PAR-CALLTRANS Flag: Application
tables
IDOC_CONTRL LIKE EDIDC Control record (IDoc)
IDOC_DATA LIKE EDIDD Data record (IDoc)
IDOC_STATUS LIKE BDIDOCSTAT ALE IDoc status (subset of al
RETURN_VARIABLES LIKE BDWFRETVAR Assignment of IDoc or documen
SERIALIZATION_INFO LIKE BDI_SER Serialization objects for one
Source code
FUNCTION ZASHOKMODULE.
""Local interface:
*" IMPORTING
*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" VALUE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
*" EXPORTING
*" VALUE(WORKFLOW_RESULT) LIKE BDWF_PARAM-RESULT
*" VALUE(APPLICATION_VARIABLE) LIKE BDWF_PARAM-APPL_VAR
*" VALUE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
*" VALUE(CALL_TRANSACTION_DONE) LIKE BDWFAP_PAR-CALLTRANS
*" TABLES
*" IDOC_CONTRL STRUCTURE EDIDC
*" IDOC_DATA STRUCTURE EDIDD
*" IDOC_STATUS STRUCTURE BDIDOCSTAT
*" RETURN_VARIABLES STRUCTURE BDWFRETVAR
*" SERIALIZATION_INFO STRUCTURE BDI_SER
data: begin of w_data occurs 0.
include structure edidd.
data: end of w_data.
data: wa_data like ZASH1.
data : i_data like standard table of wa_data initial size 0.
*tables : zhemal1.
data : begin of wa_zhemal1.
include structure zhemal1.
data : end of wa_zhemal1.
data : i_ZHEMal1 like standard table of wa_ZHEMal1 initial size 0.
read table idoc_data with key SEGNAM = 'ZASH1'.
loop at IDOC_DATA into W_DATA where segnam = 'ZASH1'.
WA_DATA = W_DATA-SDATA.
wa_data = w_data-sdata.
append wa_data to i_data.
endloop.
MOVE IDOC_DATA-DOCNUM TO IDOC_STATUS-DOCNUM.
IDOC_STATUS-MSGID = 'ZABC'.
IDOC_STATUS-STATUS = 53.
IDOC_STATUS-MSGTY = 'S'.
IDOC_STATUS-MSGNO = '001'.
APPEND IDOC_STATUS.
LOOP AT i_data into wa_data.
wa_ZHEMal1-VBELN = wa_data-VBELN.
wa_ZHEMal1-POSNR = wa_data-POSNR.
wa_ZHEMal1-MATNR = wa_data-MATNR.
wa_ZHEMal1-MATWA = wa_data-MATWA.
wa_ZHEMal1-MATKL = wa_data-MATKL.
append wa_ZHEMal1 to i_ZHEMal1.
insert ZHEMal1 from table i_ZHEMal1 accepting duplicate keys .
ENDLOOP.
ENDFUNCTION.
For Out bond Steps are
1. Create segment
2. Create Type
3. Create Message Type
4. Assign message Type to Idoc Type.
5. Create Port
6. Define Logical systems.
7. Define Partner profile.
8. Create a Report program.
Report program Out bond
REPORT ZASH1 .
Outbound standalone idoc creation *
Program Name : Y_VENMAST_OUTBOUND_STANDALONE *
Description : Outbound standalone idoc creation for training *
to Unilever offshore team members *
Created by : Satyam Computer Services Ltd. *
Created on : 04.01.2002 *
Modification Log *
Developer Date Transport # Details *
Subramony 04.01.2002 *
Tables Declaration *
TABLES : zhemal1.
Internal table declaration *
data : i_zhem1 Like standard table of zhem1 with header line.
data : control_record_out like edidc.
*data: p type p decimals 2,
c(10) type c.
start-of-selection.
p = '3.14'.
c = p.
overlay c with '0000000000000'.
write c.
DATA : BEGIN OF I_EDIDD OCCURS 0.
INCLUDE STRUCTURE EDIDD.
DATA : END OF I_EDIDD.
DATA : BEGIN OF I_EDIDC OCCURS 0.
INCLUDE STRUCTURE EDIDC.
DATA : END OF I_EDIDC.
DATA : BEGIN OF I_zhemal1 OCCURS 0,
VBELN LIKE zhemal1-VBELN,
POSNR LIKE zhemal1-POSNR,
MATNR LIKE zhemal1-MATNR,
MATWA LIKE zhemal1-MATWA,
MATKL LIKE zhemal1-MATKL,
END OF I_zhemal1.
SELECT-OPTIONS : S_vbeln FOR zhemal1-vbeln .
START-OF-SELECTION.
PERFORM F_GET_zhemal1.
END-OF-SELECTION.
Building Control record
CONTROL_RECORD_OUT-MESTYP = 'ZASH1'.
CONTROL_RECORD_OUT-IDOCTP = 'ZASH1'.
CONTROL_RECORD_OUT-RCVPRT = 'LS'.
CONTROL_RECORD_OUT-RCVPRN = 'ZASH1'.
CONTROL_RECORD_OUT-sndPRT = 'LS'.
CONTROL_RECORD_OUT-sndPRN = 'ZASH1'.
PERFORM F_PROCESS_OUTPUT.
*PERFORM F_FILL_EDIDD.
PERFORM F_CREATE_IDOC.
Form F_GET_Y1COTU110 *
FORM F_GET_zhemal1.
SELECT VBELN POSNR MATNR MATWA MATKL
FROM ZHEMAL1
INTO TABLE I_ZHEMAL1
WHERE VBELN IN S_VBELN.
ENDFORM. " F_GET_zhemal1
Form f_process_output *
FORM F_PROCESS_OUTPUT.
LOOP AT I_zhemal1.
I_zhem1-VBELN = I_zhemal1-VBELN.
I_zhem1-POSNR = I_zhemal1-POSNR.
I_zhem1-MATNR = I_zhemal1-MATNR.
I_zhem1-MATWA = I_zhemal1-MATWA.
I_zhem1-MATKL = I_zhemal1-MATKL.
i_edidd-segnam = 'ZASH1'.
i_edidd-sdata = I_zhem1.
append i_edidd.
clear i_edidd.
ENDLOOP.
ENDFORM. " f_process_output
Form f_create_edidc *
FORM F_CREATE_IDOC.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = CONTROL_RECORD_OUT
TABLES
COMMUNICATION_IDOC_CONTROL = I_EDIDC
MASTER_IDOC_DATA = I_EDIDD
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_EDIDC.
WRITE :/ 'IDoc Generated :' , I_EDIDC-DOCNUM.
ENDLOOP.
COMMIT WORK.
ENDIF.
ENDFORM. " f_create_idoc
Please reward if useful. -
Collective inbound idocs into R/3 system using master_idoc_distribute FM
Hi All,
I want to process inbound idocs (4 idocs collectively) in R/3 using master_idoc_distribute function module. The idoc is coming into system as one idoc having 4 segments (each segment for each idoc and contains sub segments too). I want to call master_idoc_distribute for each idoc for sending it to external system. I am using a custom FM for calling the master_idoc_distribute and assigning it into process code inbound for processing the incoming idoc.
The FM is working for one idoc perfectly but throwing error for more than idocs coming in collectively. Any help is appreciated.
Thanksuse commit work saparately after each function module call
-
How to post inbound idoc in sap system?
Dear All,
How to post inbound Idoc in sap system?
Regards,
Amar
Edited by: amar kumar on Nov 23, 2009 2:53 PMHi Amar,
Use the FM IDOC_WRITE_AND_START_INBOUND to post an inbound IDoc. Just build the EDIDD and *EDIDC8 tables and enter a profile for a inbound message type from a partner. It returns a IDoc number. Don't forget to do commit work.
Regards
Abhii
Maybe you are looking for
-
I upgraded last night to IOS - not sure what version and now I can't find my music or some of my apps that I had on my Iphone? Do I need to do something else? Helen
-
Creative Cloud Desktop Failed to Install
This is the second time in 3 months this has happened, and I fully expect this to happen again once I fix it. This message occurs when I try to start Application Manager after it tries to update itself. Who wrote this app?? The app manager is nowh
-
How to make the search faster in a table ?
hi , i have got a table wich has one field as a primary key , and this table got 500000 records in it wich i try to pop up the (LOV) it takes about one minute to be retreived i dodnt know how to make it faster ? could anyone help me how to make fast
-
Podcasts won't stay in the order I choose
This is related to another thread I saw on here. But my issue is a little different so I started another one. I have a 2nd generation shuffle and updated versions of iTunes and Mac OS X (well almost... 10.4.9). I have reset the iPod several times and
-
APP-Line Item in diff. currency
Dear all, There is a line item in vendor records, posted in diff. currency (other than company code corrency). While APP (F110) system not paying that amount, showing the following message: ayment method selection for items due now to the amount of S