Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

IDoc outbound

REPORT ZPGI_IDOC_CREATE MESSAGE-ID ZERR.

SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-BL1

NO INTERVALS.

PARAMETERS: SLSORDER LIKE LIKP-VBELN.

PARAMETERS: P_MESTYP LIKE EDMSG-MSGTYP OBLIGATORY.

PARAMETERS: P_LOGSYS LIKE TBDLST-LOGSYS.

PERFORM ARE_YOU_SURE.

SELECTION-SCREEN END OF BLOCK BL1.

*AT SELECTION-SCREEN.

*SET PF-STATUS'JOY'.

*....................................................

*DECLARE CONSTANTS

*....................................................

DATA:

*variables

REACTION TYPE C,

*segment names

C_SALESORDERNUMBER LIKE EDIDD-SEGNAM VALUE 'Z1VBELN',

C_LFART LIKE EDIDD-SEGNAM VALUE 'Z1LFART',

C_WADAT_IST LIKE EDIDD-SEGNAM VALUE 'Z1WADAT_IST',

C_VSTEL LIKE EDIDD-SEGNAM VALUE 'Z1VSTEL',

C_LSTEL LIKE EDIDD-SEGNAM VALUE 'Z1LSTEL',

C_ROUTE LIKE EDIDD-SEGNAM VALUE 'Z1ROUTE',

C_KODAT LIKE EDIDD-SEGNAM VALUE 'Z1KODAT',

C_KUNNR LIKE EDIDD-SEGNAM VALUE 'Z1KUNNR',

C_STDAT LIKE EDIDD-SEGNAM VALUE 'Z1STDAT',

C_WBSTK LIKE EDIDD-SEGNAM VALUE 'Z1WBSTK',

C_PGI_IDOC_TYPE LIKE EDIDC-IDOCTP VALUE 'ZIPGI_IDOC_TYPE'.

*..................................................................

*data declaration

*..................................................................

*idoc control record

data : control_record_out like edidc.

*other data declaration

DATA: SALES_ORDER_NUM LIKE Z1VBELN.

DATA: DEL_TYPE LIKE Z1LFART.

DATA: ACTUAL_GOODS_MOVEMENT_DATE LIKE Z1WADAT_IST.

DATA: SHIPPING_POINT LIKE Z1VSTEL.

DATA: LOADING_POINT LIKE Z1LSTEL.

DATA: ROUTE_PGI LIKE Z1ROUTE.

DATA: PICK_DATA LIKE Z1KODAT.

DATA: CUST_NO LIKE Z1KUNNR.

DATA: LOCAL_DATE LIKE Z1STDAT.

DATA: TOTAL_GOOD_MOV LIKE Z1WBSTK.

*Database tables

TABLES:LIKP,VBUK,VBAP.

DATA:

INT_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE,

IT_COMM_IDOCS LIKE EDIDC OCCURS 0 WITH HEADER LINE,

IT_LIKP LIKE LIKP OCCURS 0 WITH HEADER LINE,

IT_VBUK LIKE VBUK OCCURS 0 WITH HEADER LINE,

IT_VBAP LIKE VBAP OCCURS 0 WITH HEADER LINE.

*----


  • PROGRAM LOGIC

*----


*SELECT APPLICATION DATA

SELECT * FROM LIKP WHERE VBELN = SLSORDER.

IF SY-SUBRC <> 0.

MESSAGE E001 WITH SLSORDER.

EXIT.

ENDIF.

ENDSELECT.

SELECT * FROM VBUK WHERE VBELN = SLSORDER.

IF SY-SUBRC <> 0.

MESSAGE E001 WITH SLSORDER.

EXIT.

ENDIF.

ENDSELECT.

SELECT * FROM VBAP WHERE VBELN = SLSORDER.

IF SY-SUBRC <> 0.

MESSAGE E001 WITH SLSORDER.

EXIT.

ENDIF.

ENDSELECT.

*Fill the control record Information.

control_record_out-MESTYP = P_MESTYP.

control_record_out-IDOCTP = c_pgi_idoc_type.

control_record_out-RCVPRT = 'LS'.

control_record_out-RCVPRN = P_LOGSYS.

  • FILL THE DATA RECORD

SALES_ORDER_NUM-VBELN = LIKP-VBELN.

INT_EDIDD-SEGNAM = C_SALESORDERNUMBER.

INT_EDIDD-SDATA = SALES_ORDER_NUM.

APPEND INT_EDIDD.

DEL_TYPE-LFART = LIKP-LFART.

INT_EDIDD-SEGNAM = C_LFART.

INT_EDIDD-SDATA = DEL_TYPE.

APPEND INT_EDIDD.

ACTUAL_GOODS_MOVEMENT_DATE-WADAT_IST = LIKP-WADAT_IST.

INT_EDIDD-SEGNAM = C_WADAT_IST.

INT_EDIDD-SDATA = ACTUAL_GOODS_MOVEMENT_DATE.

APPEND INT_EDIDD.

SHIPPING_POINT-VSTEL = LIKP-VSTEL.

INT_EDIDD-SEGNAM = C_VSTEL.

INT_EDIDD-SDATA = SHIPPING_POINT.

APPEND INT_EDIDD.

LOADING_POINT-LSTEL = LIKP-LSTEL.

INT_EDIDD-SEGNAM = C_LSTEL.

INT_EDIDD-SDATA = LOADING_POINT.

APPEND INT_EDIDD.

ROUTE_PGI-ROUTE = LIKP-ROUTE.

INT_EDIDD-SEGNAM = C_ROUTE.

INT_EDIDD-SDATA = ROUTE_PGI-ROUTE.

APPEND INT_EDIDD.

PICK_DATA-KODAT = LIKP-KODAT.

INT_EDIDD-SEGNAM = C_KODAT.

INT_EDIDD-SDATA = PICK_DATA-KODAT.

APPEND INT_EDIDD.

CUST_NO-KUNNR = LIKP-KUNNR.

INT_EDIDD-SEGNAM = C_KUNNR.

INT_EDIDD-SDATA = CUST_NO-KUNNR .

APPEND INT_EDIDD.

local_date-stdat = VBAP-STDAT.

INT_EDIDD-SEGNAM = C_STDAT.

INT_EDIDD-SDATA = local_date-stdat.

APPEND INT_EDIDD.

TOTAL_GOOD_MOV-WBSTK = VBUK-WBSTK .

INT_EDIDD-SEGNAM = C_WBSTK.

INT_EDIDD-SDATA = TOTAL_GOOD_MOV-WBSTK.

APPEND INT_EDIDD.

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

EXPORTING

MASTER_IDOC_CONTROL = CONTROL_RECORD_OUT

  • OBJ_TYPE = ''

  • CHNUM = ''

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 <> 0.

MESSAGE E002 WITH SLSORDER.

ELSE.

LOOP AT it_comm_idocs.

WRITE: / 'IDOC GENERATED',IT_COMM_IDOCS-DOCNUM.

ENDLOOP.

COMMIT WORK.

ENDIF.

FORM ARE_YOU_SURE.

CLEAR REACTION.

CALL FUNCTION 'POPUP_TO_DECIDE_INFO'

EXPORTING

DEFAULTOPTION = 'N'

TEXTLINE1 = TEXT-010

TITEL = TEXT-012

START_COLUMN = 25

START_ROW = 6

IMPORTING

ANSWER = REACTION

EXCEPTIONS

OTHERS = 1.

ENDFORM.

in the above program the IDOC IS GENERATED BUT..when I am viewing it in WE02....its not showing sny fields in the segments or any values.......please tell me places where I will correct it.

thnks

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question