‎2009 Mar 16 8:05 AM
Hi All,
For our company needs, i created a table to regroup all users authorizations.
And then i created an IDoc to send this data to a Java interface program.
Connection is OK.
I created a message type, logical system and so on ..
When i use WE19 my Java application receive an empty IDoc containing only header data (EDIDC).
Then i coded a Function Module to fulfill the IDoc.
The data is retrieved, the internal tables are fulfilled but no IDoc generation!
Here is my FM :
FUNCTION ZKO_ZLSF_IDOC_FCT.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(OBJECT) LIKE NAST STRUCTURE NAST
*" REFERENCE(CONTROL_RECORD_IN) LIKE EDIDC STRUCTURE EDIDC
*" EXPORTING
*" REFERENCE(CONTROL_RECORD_OUT) LIKE EDIDC STRUCTURE EDIDC
*" REFERENCE(OBJECT_TYPE) LIKE WFAS1-ASGTP
*" TABLES
*" ITAB_EDIDD STRUCTURE EDIDD
*" ITAB_EDIDC STRUCTURE EDIDC
*"----------------------------------------------------------------------
********************************************
** Constantes **
********************************************
DATA :
* Segments names
C_HEADER_SEGMENT LIKE EDIDD-SEGNAM VALUE 'ZKO_ZLSFHDR',
C_USERS_DETAILS LIKE EDIDD-SEGNAM VALUE 'ZKO_ZLSFALRT',
* IDoc Type
C_ZLSF_IDOC LIKE EDIDC-IDOCTP VALUE 'ZKO_ZLSFIDOC',
* Message Type
C_ZLSF_MESSAGE LIKE EDIDC-MESTYP VALUE 'ZKO_ZLSFMSG'.
*********************************************
** Data declarations **
*********************************************
* Field string for data record
DATA: FS_INT_EDIDD LIKE EDIDD.
* Report header data
DATA: FS_ZLSFHDR_DATA LIKE ZKO_ZLSFHDR.
* Users / LSR Roles details
DATA: FS_ZLSFALRT_DATA LIKE ZKO_ZLSFALRT.
* List key
DATA: P_BLOCK LIKE ZLSF-DBLOCKFLAG.
**********************************************
** Internal tables **
**********************************************
DATA: wt_zlsf LIKE ZLSF occurs 0 with header line.
********** Select application data ************
P_BLOCK = OBJECT-OBJKY.
select single * from ZLSF where DBLOCKFLAG = P_BLOCK.
select * from ZLSF into table wt_zlsf where DBLOCKFLAG = P_BLOCK.
************ Build Control Record *************
clear CONTROL_RECORD_OUT.
move CONTROL_RECORD_IN to CONTROL_RECORD_OUT.
CONTROL_RECORD_OUT-DIRECT = '1'.
CONTROL_RECORD_OUT-MESTYP = C_ZLSF_IDOC.
control_record_out-idoctp = C_ZLSF_MESSAGE.
control_record_out-rcvprt = 'LS'.
control_record_out-rcvprn = 'ZKO_LSFREP'.
CONTROL_RECORD_OUT-SERIAL = SY-DATUM.
CONTROL_RECORD_OUT-SERIAL+8 = SY-UZEIT.
CONTROL_RECORD_OUT-SNDPRN = EDIDC-SNDPRN.
CONTROL_RECORD_OUT-SNDPRT = EDIDC-SNDPRT.
**************** Build data records ***************
FS_ZLSFHDR_DATA-MANDT = ZLSF-MANDT.
FS_ZLSFHDR_DATA-LSFDATE = ZLSF-LSFDATE.
FS_INT_EDIDD-SEGNAM = C_HEADER_SEGMENT.
FS_INT_EDIDD-SDATA = FS_ZLSFHDR_DATA.
APPEND FS_INT_EDIDD TO ITAB_EDIDD.
*----------- Report details ------------*
LOOP AT wt_zlsf.
*
*
* Populating internal table FS_ZLSFALRT_DATA
*
*
FS_INT_EDIDD-SEGNAM = C_USERS_DETAILS.
FS_INT_EDIDD-SDATA = FS_ZLSFALRT_DATA.
APPEND FS_INT_EDIDD TO ITAB_EDIDD.
ENDLOOP.
************** Pass control to the ALE layer ******************
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = CONTROL_RECORD_OUT
TABLES
COMMUNICATION_IDOC_CONTROL = ITAB_EDIDC
MASTER_IDOC_DATA = ITAB_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.
WRITE: / 'IDoc NOT generated',SY-SUBRC.
ELSE.
LOOP AT ITAB_EDIDC.
WRITE: / 'IDoc generated', ITAB_EDIDC-DOCNUM.
ENDLOOP.
COMMIT WORK.
ENDIF.
ENDFUNCTION.Here is the testing header :
MANDT 135
DOCREL 46C
DIRECT 1
RCVPOR A000000018
RCVPRT LS
RCVPRN ZKO_LSFREP
STDMES ZKO_ZL
OUTMOD 2
SNDPOR SAPVRI
SNDPRT US
SNDPRN VRICLNT135
MESTYP ZKO_ZLSFMSG
IDOCTP ZKO_ZLSFIDOCWhen i test i have Exception code 5!
Did i miss something ?
Thank you for your help.
Regards
‎2009 Mar 16 9:24 AM
Hi,
Have you checked whether the segments / IDoc type are in 'Released' state? Is the syntax check of the IDoc Type Successful?
Regards, Murugesh
‎2009 Mar 16 9:48 AM
Hi Murugesh,
Thank you for your answer.
My segments/IDoc are in Release state.
I found a warning when i check the IDoc :
Field DBLOCKFLAG: External length 000003 larger than 000001 for appl. data element FLAGI am a beginner and this was my first attempt with the IDocs.
I will create a new segment tomorrow.
Regards
Anes Maaref
Edited by: Sami BEN JAMAA on Mar 16, 2009 10:49 AM
‎2009 Mar 17 3:45 AM
Hi,
Have you made entries in WE81 and WE82 of your message type, extension type...........?
Thanks,
Asit Purbey.
‎2009 Mar 17 8:21 AM
Hi,
I created a new segment without any warning, i released it. I created a new IDoc too, released it.
And I still have the same error when i test my Function Module.
I checked everything about configuration.
Regards
Anea Maaref
‎2009 Mar 17 11:44 AM
I am not able to understand DBLOCKFLAG, Can you tell me what is this field, its data element?
And please try to Blank out this field before you use DISTRIBUTE Function Module.
There is something wrong with particular field.
Regards
Shital