Outbound Fm

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Outbound Fm as PDF for free.

More details

  • Words: 235
  • Pages: 7
FUNCTION·MASTER_IDOC_CREATE_XAMPLE. *"--------------------------------------------------------------------*" *"Local·interface: *"·······IMPORTING *"·············VALUE(APPL_HEADER)·LIKE·XHEAD·STRUCTURE··XHE AD *"·······TABLES *"··············APPL_ITEM·STRUCTURE··XITEM *"-------------------------------------------------------------------*·variables·of·general·interest ··DATA: *·······control·record·for·the·IDoc ········IDOC_CONTROL·LIKE·EDIDC, *·······data·records·for·the·IDoc ········T_IDOC_DATA·LIKE·EDIDD·OCCURS·0·WITH·HEADER·LINE, *·······table·for·the·IDocs·created·by·MASTER_IDOC_CONTROL ········T_COMM_CONTROL·LIKE·EDIDC·OCCURS·0·WITH·HEADER·LINE, *·······partner·type·for·logical·system ········C_PARTNER_TYPE_LOGICAL_SYSTEM·LIKE·EDIDC-RCVPRT, *·······help·variable·for·the·check·if·an·IDoc·has·to·be·cr eated ········H_CREATE_IDOC. *·variables·specific·for·this·example ··DATA: *·······field·strings·with·IDoc·segment·structure ········E1XHEAD·LIKE·E1XHEAD, ········E1XITEM·LIKE·E1XITEM, *·······data·to·be·put·to·the·control·record ········C_MESSAGE_TYPE·LIKE·EDIDC-MESTYP·VALUE·'XAMPLE', ········C_BASE_IDOC_TYPE·LIKE·EDIDC-IDOCTP·VALUE·'XAMPLE01', *·······segment·types·to·be·put·to·the·data·record·table ········C_HEADER_SEGTYP·LIKE·EDIDD-SEGNAM·VALUE·'E1XHEAD', ········C_ITEM_SEGTYP·LIKE·EDIDD-SEGNAM·VALUE·'E1XITEM'. *·check·if·an·IDoc·has·to·be·created,·read·the·distribution ·model ··CALL·FUNCTION·'ALE_MODEL_DETERMINE_IF_TO_SEND' ·······EXPORTING ············MESSAGE_TYPE···········=·C_MESSAGE_TYPE *·········SENDING_SYSTEM·········=·'·' *·········RECEIVING_SYSTEM·······=·'·' *·········VALIDDATE··············=·SY-DATUM

·······IMPORTING ············IDOC_MUST_BE_SENT······=·H_CREATE_IDOC. *····exceptions *·········own_system_not_defined·=·1 *·········others·················=·2. ··IF·H_CREATE_IDOC·IS·INITIAL. *···no·message·flow·maintained·in·the·model,·nothing·to·do ····EXIT. ··ENDIF. *·put·the·application·header·record·to·the·IDoc ··MOVE-CORRESPONDING·APPL_HEADER·TO·E1XHEAD. *·convert·SAP·codes·to·ISO·codes ··PERFORM·E1XHEAD_CODES_SAP_TO_ISO ····USING ······APPL_HEADER ····CHANGING ······E1XHEAD. *·append·record·to·IDoc·data·table ··T_IDOC_DATA-SEGNAM·=·C_HEADER_SEGTYP. ··T_IDOC_DATA-SDATA·=·E1XHEAD. ··APPEND·T_IDOC_DATA. ··LOOP·AT·APPL_ITEM. *···put·the·application·item·record·to·the·IDoc·segment ····MOVE-CORRESPONDING·APPL_ITEM·TO·E1XITEM. *···convert·currency·amounts·from·SAP·internal·to·neutral·f ormat ····PERFORM·E1XITEM_CURRENCY_SAP_TO_IDOC ······USING ········APPL_HEADER-CURRENCY ······CHANGING ········E1XITEM. *···convert·SAP·codes·to·ISO·codes ····PERFORM·E1XITEM_CODES_SAP_TO_ISO ······USING ········APPL_ITEM ······CHANGING ········E1XITEM. *···left·justify·all·non·character·fields ····PERFORM·E1XITEM_CONDENSE

······CHANGING ········E1XITEM. *···append·record·to·IDoc·data·table ····T_IDOC_DATA-SEGNAM·=·C_ITEM_SEGTYP. ····T_IDOC_DATA-SDATA·=·E1XITEM. ····APPEND·T_IDOC_DATA. ··ENDLOOP. ··CALL·FUNCTION·'MASTER_IDOC_DISTRIBUTE' *·in·update·task···"if·application·document·is·posted·in·up date·task ·······EXPORTING ············MASTER_IDOC_CONTROL············=·IDOC_CONTROL ·······TABLES ············COMMUNICATION_IDOC_CONTROL·····=·T_COMM_CONTROL ············MASTER_IDOC_DATA···············=·T_IDOC_DATA. *······exceptions *···········error_in_idoc_control··········=·1 *···········error_writing_idoc_status······=·2 *···········error_in_idoc_data·············=·3 *···········sending_logical_system_unknown·=·4 *···········others·························=·5. *·A·commit·work·has·to·be·done.·It·could·also·be·done·in·th e·calling *·application. ··COMMIT·WORK. ··READ·TABLE·T_COMM_CONTROL·INDEX·1. ··IF·SY-SUBRC·<>·0. *·no·IDoc·was·created,·you·can·react·here,·if·neccessary ··ENDIF. ENDFUNCTION. *&--------------------------------------------------------------------* *&······Form··E1XITEM_CONDENSE *&--------------------------------------------------------------------* *·······text··············································· ············* *---------------------------------------------------------------------* *··-->··p1········text *··<--··p2········text

*---------------------------------------------------------------------* FORM·E1XITEM_CONDENSE ··CHANGING ····IDOC_SEGMENT·LIKE·E1XITEM. *·left·justify·all·non·character·fields ··CONDENSE:·IDOC_SEGMENT-QUANTITY, ············IDOC_SEGMENT-VALUE. ENDFORM.·······························"·E1XITEM_CONDENSE *&--------------------------------------------------------------------* *&······Form··E1XITEM_CURRENCY_SAP_TO_IDOC *&--------------------------------------------------------------------* *·······text··············································· ············* *---------------------------------------------------------------------* *··-->··p1········text *··<--··p2········text *---------------------------------------------------------------------* FORM·E1XITEM_CURRENCY_SAP_TO_IDOC ··USING ····CURRENCY_CODE·LIKE·TCURC-WAERS ··CHANGING ····IDOC_SEGMENT·LIKE·E1XITEM. ··CALL·FUNCTION·'CURRENCY_AMOUNT_SAP_TO_IDOC' ·······EXPORTING ············CURRENCY····=·CURRENCY_CODE ············SAP_AMOUNT··=·IDOC_SEGMENT-VALUE ·······IMPORTING ············IDOC_AMOUNT·=·IDOC_SEGMENT-VALUE. *······exceptions *···········others······=·1. ENDFORM.·······························"·E1XITEM_CURRENCY_S AP_TO_IDOC *&--------------------------------------------------------------------* *&······Form··E1XHEAD_CODES_SAP_TO_ISO *&--------------------------------------------------------------------* *·······text···············································

············* *---------------------------------------------------------------------* *··-->··p1········text *··<--··p2········text *---------------------------------------------------------------------* FORM·E1XHEAD_CODES_SAP_TO_ISO ··USING ····APPL_DATA·LIKE·XHEAD ··CHANGING ····IDOC_SEGMENT·LIKE·E1XHEAD. *·convert·a·currency·code·from·SAP·code·to·ISO·code ··IF·NOT·APPL_DATA-CURRENCY·IS·INITIAL. ····CALL·FUNCTION·'CURRENCY_CODE_SAP_TO_ISO' ·········EXPORTING ··············SAP_CODE·=·APPL_DATA-CURRENCY ·········IMPORTING ··············ISO_CODE·=·IDOC_SEGMENT-CURRENCY. *······exceptions *···········not_found·=·1 *···········others····=·2. ··ELSE. ····IDOC_SEGMENT-CURRENCY·=·APPL_DATA-CURRENCY. ··ENDIF. *·convert·a·country·from·SAP·code·to·ISO·code ··IF·NOT·APPL_DATA-COUNTRY·IS·INITIAL. ····CALL·FUNCTION·'COUNTRY_CODE_SAP_TO_ISO' ·········EXPORTING ··············SAP_CODE·=·APPL_DATA-COUNTRY ·········IMPORTING ··············ISO_CODE·=·IDOC_SEGMENT-COUNTRY. *······exceptions *···········not_found·=·1 *···········others····=·2. ··ELSE. ····IDOC_SEGMENT-COUNTRY·=·APPL_DATA-COUNTRY. ··ENDIF. ENDFORM.·······························"·E1XHEAD_CODES_SAP_ TO_ISO *&--------------------------------------------------------------------* *&······Form··E1XITEM_CODES_SAP_TO_ISO *&---------------------------------------------------------

------------* *·······text··············································· ············* *---------------------------------------------------------------------* *··-->··p1········text *··<--··p2········text *---------------------------------------------------------------------* FORM·E1XITEM_CODES_SAP_TO_ISO ··USING ····APPL_DATA·LIKE·XITEM ··CHANGING ····IDOC_SEGMENT·LIKE·E1XITEM. *·convert·a·unit·of·measure·from·SAP·code·to·ISO·code ··IF·NOT·APPL_DATA-UNIT·IS·INITIAL. ····CALL·FUNCTION·'UNIT_OF_MEASURE_SAP_TO_ISO' ·········EXPORTING ··············SAP_CODE·=·APPL_DATA-UNIT ·········IMPORTING ··············ISO_CODE·=·IDOC_SEGMENT-UNIT. *······exceptions *···········not_found···=·1 *···········no_iso_code·=·2 *···········others······=·3. ··ELSE. ····IDOC_SEGMENT-UNIT·=·APPL_DATA-UNIT. ··ENDIF. *·convert·a·package·type·from·SAP·code·to·ISO·code ··IF·NOT·APPL_DATA-SHIP_INST·IS·INITIAL. ····CALL·FUNCTION·'SAP_TO_ISO_PACKAGE_TYPE_CODE' ·········EXPORTING ··············SAP_CODE·=·APPL_DATA-SHIP_INST ·········IMPORTING ··············ISO_CODE·=·IDOC_SEGMENT-SHIP_INST. *······exceptions *···········not_found·=·1 *···········others····=·2. ··ELSE. ····IDOC_SEGMENT-SHIP_INST·=·APPL_DATA-SHIP_INST. ··ENDIF. ENDFORM.·······························"·E1XITEM_CODES_SAP_ TO_ISO

Related Documents

Outbound Fm
November 2019 10
Outbound Dream
June 2020 6
Fm
June 2020 24
Fm
October 2019 44
Fm
June 2020 23
Fm
May 2020 20