‎2006 Jan 04 12:39 PM
I have written a program for generating an idoc in sendng system.. with my Z idoc type. I want to send basic material data thru my program and create tht material on the recv system.
Pls chk code below.
The idoc shows a code of 03 in sending system. But at recvng system it shows code of 51-error-Application document not posted.
Pls tell me the steps involved or rather where iam going wrong..
-
Code----
TABLES: MARA,MAKT.
DATA DECLARATION **********
constants *********
DATA: C_HEADER_SEG LIKE EDIDD-SEGNAM VALUE 'ZRAJA_SEGMENT'. "'E1MARAM'.
IDOC CONTROL RECORD
DATA : CONT_REC_OUT LIKE EDIDC.
DATA : FS_DATA LIKE ZRAJA_SEGMENT.
INTERNAL TABLE ******
DATA : BEGIN OF I_MATNR OCCURS 0,
MATNR LIKE MARA-MATNR, " mat name
MTART LIKE MARA-MTART, " mat type
MBRSH LIKE MARA-MBRSH, " ind sector
MEINS LIKE MARA-MEINS, " uom
MAKTX LIKE MAKT-MAKTX, " desc
END OF I_MATNR.
DATA REC*********************
DATA : INT_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE.
COMM IDOC***************
DATA : IT_COMM_IDOCS LIKE EDIDC OCCURS 0 WITH HEADER LINE.
***************PARAMETERS**********************
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
PARAMETERS: P_MATNR LIKE MARA-MATNR OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION LOGIC *****************
SELECT MATNR MTART MBRSH MEINS FROM MARA
INTO TABLE I_MATNR
WHERE MATNR = P_MATNR . "'TESTAMOL2'.
CHECK SY-SUBRC EQ 0.
LOOP AT I_MATNR.
SELECT SINGLE MAKTX FROM MAKT INTO I_MATNR-MAKTX
WHERE MATNR = I_MATNR-MATNR
AND SPRAS = SY-LANGU .
IF SY-SUBRC EQ 0.
MODIFY I_MATNR.
ENDIF.
ENDLOOP.
BUILD CONTROL RECORD *************
CONT_REC_OUT-MESTYP = 'MATMAS' .
CONT_REC_OUT-IDOCTP = 'ZRAJAMAS'. "'MATMAS01'
CONT_REC_OUT-RCVPRT = 'LS' . " Partner type of receiver
CONT_REC_OUT-RCVPRN = 'LOGSYS250' . " Partner number of receiver
BUILD DATA RECORDS *******************
LOOP AT I_MATNR.
INT_EDIDD-SEGNAM = C_HEADER_SEG.
INT_EDIDD-SDATA = I_MATNR.
APPEND INT_EDIDD.
ENDLOOP.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = CONT_REC_OUT " control rec
OBJ_TYPE = ''
CHNUM = ''
TABLES
COMMUNICATION_IDOC_CONTROL = IT_COMM_IDOCS " comm idoc-o/p
MASTER_IDOC_DATA = INT_EDIDD " data,seg info
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.
COMMIT WORK.
LOOP AT IT_COMM_IDOCS.
WRITE: / 'IDOC GENERATED ' , IT_COMM_IDOCS-DOCNUM.
ENDLOOP.
ENDIF.
‎2006 Jan 04 4:25 PM
hi amol
as said earlier it looks more like a data problem.i had faced a problem where on the sender system it showed a status 03 but the idoc never reached the receiver system.is this what is happening in your case?or is it that the idoc reaches but fails to post the document?
please give us more information
bye
‎2006 Jan 04 12:43 PM
Hi Amol,
It looks more like a Data problem to me.
Check the exact message in we05 transaction in the receiving system. It would tell you what is the problem in creating the material.
REgards,
Ravi
‎2006 Jan 04 12:57 PM
Check whether u assigned Custom IDOC type to msgtype in WE82 correctly.
‎2006 Jan 04 4:25 PM
hi amol
as said earlier it looks more like a data problem.i had faced a problem where on the sender system it showed a status 03 but the idoc never reached the receiver system.is this what is happening in your case?or is it that the idoc reaches but fails to post the document?
please give us more information
bye
‎2006 Jan 04 4:31 PM
Hi Amol,
This error seems to be because of some validations you do for the inbound process. Just check the inbound FM how are you handling this IDoc. Is there anything which you are checking for in the inbound process but are not sending it while you make an outbound.
The best way is go to we19 and put all the values thats being sent in the outbound IDoc and debug and test it in your receiver system. Just see whatz goind wrong.
Regards,
Srikanth
Message was edited by: Srikanth Lodd