*---------------------------------------------------------------------*
* Report Z_RMTIWARI_ATTACH_DOC_TO_BO
*---------------------------------------------------------------------*
* Written By : Ram Manohar Tiwari
* Function : We need to maintain links between Business Object and
* the attachment.Attachment document is basiclally a
* business object of type 'MESSAGE'.In order to maintain
* links, first the attachment will be crated as Business
* Object of type 'MESSAGE' using Message.Create method.
* Need to check if we can also use FM
* 'SO_DOC_INSERT_WITH_ORIG_API1' or SO_OBJECT_INSERT rather
* than using Message.Create method.
*---------------------------------------------------------------------*
* Include for BO macros
INCLUDE : <cntn01>.
* Load class.
CLASS CL_BINARY_RELATION definition load.
CLASS CL_OBL_OBJECT definition load.
PARAMETERS:
* Object_a
P_BOTYPE LIKE obl_s_pbor-typeid DEFAULT 'ZFREINDS', " e.g. 'BUS2012'
P_BO_ID LIKE OBL_S_PBOR-INSTID DEFAULT '000009', " Key e.g. PO No.
* Object_b
P_DOCTY LIKE obl_s_pbor-typeid DEFAULT 'MESSAGE' NO-DISPLAY,
P_MSGTYP LIKE SOFM-DOCTP DEFAULT 'URL' NO-DISPLAY,
* Relationship
P_RELTYP LIKE mdoblrel-reltype DEFAULT 'URL'.
types: BEGIN OF TY_MESSAGE_KEY,
FOLTP TYPE SO_FOL_TP,
FOLYR TYPE SO_FOL_YR,
FOLNO TYPE SO_FOL_NO,
DOCTP TYPE SO_DOC_TP,
DOCYR TYPE SO_DOC_YR,
DOCNO TYPE SO_DOC_NO,
FORTP TYPE SO_FOR_TP,
FORYR TYPE SO_FOR_YR,
FORNO TYPE SO_FOR_NO,
END OF TY_MESSAGE_KEY.
DATA : LV_MESSAGE_KEY type TY_MESSAGE_KEY.
DATA : LO_MESSAGE type SWC_OBJECT.
DATA : LT_DOC_CONTENT type standard table of SOLI-LINE with header
line.
* First derive the Attachment's ( MESSAGE )document type.
P_DOCTY = 'MESSAGE'.
CASE P_RELTYP.
* In case of URls
WHEN 'URL'.
P_MSGTYP = 'URL'.
* In case of Notes / Private Notes
WHEN 'NOTE' OR 'PNOT'.
P_MSGTYP = 'RAW'.
WHEN 'ATTA'.
P_MSGTYP = 'EXT'.
* Not implemented as yet...exit
EXIT.
WHEN OTHERS.
* ....exit
EXIT.
ENDCASE.
*----------------------------------------------------------------*
* Create an initial instance of BO 'MESSAGE' - to call the
* instance-independent method 'Create'.
swc_create_object LO_MESSAGE 'MESSAGE' LV_MESSAGE_KEY.
* define container to pass the parameter values to the method call
* in next step.
swc_container LT_MESSAGE_CONTAINER.
* Populate container with parameters for method
swc_set_element LT_MESSAGE_CONTAINER 'DOCUMENTTITLE' 'Title'.
swc_set_element LT_MESSAGE_CONTAINER 'DOCUMENTLANGU' 'E'.
swc_set_element LT_MESSAGE_CONTAINER 'NO_DIALOG' 'X'.
swc_set_element LT_MESSAGE_CONTAINER 'DOCUMENTNAME' P_DOCTY.
swc_set_element LT_MESSAGE_CONTAINER 'DOCUMENTTYPE' P_MSGTYP.
* 'DocumentContent' is a multi-line element ( itab ).
* In case of URLs..it should be concatenated with &KEY& in the begining.
CASE P_MSGTYP.
WHEN 'URL'.
LT_DOC_CONTENT = '&KEY&http://www.rmtiwari.com' .
append LT_DOC_CONTENT.
* In case of Notes or Private Notes, get the data from files on appl
* server or from wherever(? - remember background).
WHEN 'RAW'.
LT_DOC_CONTENT = 'Hi How r u?' .
append LT_DOC_CONTENT.
* In case of File attachments
WHEN 'EXT'.
* Upload the file contents using open dataset in lt_doc_content .
* Some conversion ( Compress ) might be required.
* Not sure at this point
ENDCASE.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.