rammanohar.tiwari

October 2005 Previous month Next month

Before I start, let me tell you that I am not going to use smilies to make you understand that humour was indeed intended. Please use your senses and place a smiley [ ;-) ] wherever you understood or when it becomes unbearable otherwise.




I noticed that unlike ABAP Forum, where competition is killing people ( or at least crashing systems..and so I guess marketing should be discouraged over there ), Weblogs are in desperate need for some innovative marketing. Ponits for comments or discouraging weblogs like this one ;-)...you decide the marketing stretegy. 

Welcome Mr. gv_current_viewer and congratulations for being the 1000th victim… sorry I mean 1000th intellectual viewer of this weblog. [ In fact there were a lot many others who could not manage to get counted. ]


You should have already noticed that this weblog is a lot different from others in a sense that it provides a lot more flexibility and features. e.g did you see the title? I thought why I should bother myself so much about the title, that’s why I made it a field-symbol. Now you can use your own imaginations and assign the title that you want.
[ Revolutionary concept ..right? Thanks !! ]

What else? This weblog also greets you with your own, most lovable name in the world.
[ Curse SDN if it doesn’t ….goodness they promised me to populate the gv_current_viewer variable with the current user name, at run time.]

I know, you must have been already impressed with all these features but did you notice the hidden gv_counter that tracks only the intellectual viewers. So are you wondering whether you belong to that class? Guess what?...I know you won’t believe it ..But you were counted …
congratulations again!!
[ Don’t tell this to anyone. I am writing this line as an update to my weblog….I saw my own weblog so many times…it didn’t count me once...some bug, it seems..well it's a beta version....]


You know, answering questions on ABAP forum is a lot easier. [ I mean you don’t need to lie too much to sell your wrong answers. But it seems to be tough here.]


Moving further, let me tell you something about the subject of my weblog. Oh come-on ..not everything in this weblog can be left on your imaginations...[find a better use of yours somewhere else]

Well, it’s about an ABAP program that converts ABAP Report Code ( SAP Ver 4.7 ) into HTML and downloads to your PC. The HTML document downloaded using this utility is readable and also navigation is possible for variables and form-routines.

Hay ..Wait a minute….don’t change the channel…..



Guys I am working on my new generation Netweaver skills as well but then it will take time… And listen to me; I also have a brilliant futuristic idea. Basically it’s an extension of weather magnets (using BSPs, PHPs,..and all that Ps & Qs ) invented by my fellow webloggers.

Well, this is to implement a disaster control mechanism for SAP systems. It will ensure that at the time of any natural or man-made disaster, in a particular geographical area, all affected SAP systems will receive the Red Alert through the weather magnet. Further, just after receiving any such alerts, within minutes, the SAP system will automatically generate a delta backup and will transmit the backup files to the other end of the world…of course over a secure network..
Immediately after the backup, it will trigger the system shut-down. So you can just concentrate on saving the life of your girlfriend(s) rather than SAP systems.
[ Well..now I have some idea about your preferences….]
I am sure, you will agree to me that once implemented this system will be very useful in the moment of crisis.


So you see, if the quality of my this weblog is slightly(?) on the lower side it’s just because I am working on something more important.
[ Ok Boss …That was all crap…actually it’s already around a month now since I received my weblog authorizations and I’ve not posted a single weblog as yet.]


You know what could be the consequences, if I won’t post a weblog now..

SDN, might rightly right-off my rights to write a weblog.. right away..

[ Wow…Did you notice it? I am trying to be a SAP Technical Consultant for the last 7 years.. would have been president somewhere ..guess where? ]


Please don't copy and use the ABAP code given below....
No..no..I am not saying its copyrighted..just that it won't work. Rather use the text version - Scroll right in the frame below and use the text file link.
[Let me know if that works.]


Also please close that lovable yahoo geocities pop-up.
[ or else read that also in case you are in a desperate need to read something better.]
Actually, my personal site is on geocities( cost-cutting) and I am their Brand-Ambassador (in some way ).
[You know, we are good at cost cutting and also on presenting the disadvantages as benefits.]
Ok..I am in no mood to start the outsourcing (offshoring) debate.
Just in case someone objects, this code is already published on SDN under Codes section but then I have to write my first weblog somehow. I am sorry I've nothing else at the moment.
[ However, I swear to *** that I will donate all my SDN points earned due to this weblog for initiatives towards World Peace and... SAP implementations, in case too much peace is boring ]
Does that help?


BTW, I've removed the code IFRAME, as it was creating problems...and if you like you can always search it in Codes section...anyway forget the code...read the weblog ;-)..and also check my other weblog to see the example of downloaded code in HTML. This weblog is for marketing purpose only, so we'll only talk about weblogs, no codes /articles / problems but 100% pure weblog.

I can’t believe, you came this far. So here is a surprise gift for the 1000th intellectual weblog viewer:
A fridge-fresh SAP joke, for your eyes ( and senses ) only:
I swear to ***, it’s based on a real life story.

A SAP Project Manager, from one of my previous organizations [it goes without saying and you know why, don't you?], was looking for a technical consultant having some experience with SAP version 11. And the advertisement was published, as a requirement for SAP Version-11, in the leading newspapers of the country.

BTW, the Request for Proposal, forwarded by the customer, was for ….SAP XI
Probably, they think that SAP TechEd is for technical consultants. Renaming it to SAP ManEd-05 might help. Or if you like to be brief ..MAD'05 is not a bad idea.


....Boy you have nothing else to do..Now get on to your work !!
END_OF_WEBLOG

Just kidding ;-)

I saw a few un-answered questions on SDN on how to attach documents and URLs with the Business Objects, in background and then it should appear in GOS attachment list. So I am trying to understand the basics inside GOS.

[Those un-answered question are years old so I am not sure if GOS is obsolete & now it is only used in Waldorf ;-) ]

However, I did manage to write a program using the inside- logic of GOS, to attach Notes and URLs in background. [ Wow...finally I discovered that the earth is flat & it's standstill ;-)...any doubts.. ]

Anyway ...here we go..

Attaching documents to Business Objects in background / providing a custom GOS like functionality for BSPs:
[ Actually, I pretend that I know BSPs just because I have some experience with JSPs/HTML and..ABAP is...well no... It’s not my mother tongue ;-). So I confidently used to pass suggestions about BSPs as long as I don't have to write it by myself. ]

The Problem:
Since GOS can only be used with SAPGui Front-end ( OK..may be with ITS as well) and only in foreground, mass-attachment of documents (in background) can’t be handled with GOS. However, the basic applications (Classes & Methods), used in GOS, can be utilized to create a custom program for this purpose.

Use: Since this new program will have the ability to run in background, irrespective of front-end, the same code can also be utilized to provide a GOS like facility in BSPs or while developing an upload program for attaching documents/URLs to Business Objects, in background.

Inside GOS:
Basically, inside the application, main business object and attachment, both are treated as Business Objects and then a link is maintained between both the object instances. The relationship type, while maintaining the link, describes whether the attached object is a URL or a file attachment, note and so on.

However, while the main business object, to which you are trying to attach the document / URL is already known e.g. for Purchase order the Object type ('BUS2012’ )is known and instance (?) exists in database but the instance for the attachment has to be created first before the linking.

Attachment can be a URL / a Note / a File and so you need to first upload (data as well in case of file) the attahcment info, and in the process also get a business object instance generated of BO type ‘MESSAGE’.

The program
The program-processing will have following steps:

 

  • Upload the File to be attached or in case of URL just get the URL name. In case of mass upload, the input can be read from a data-file on application server, having info (e.g. URL / File Path ) against the Business Object key ( e.g. Purchase Order Number ).
  • Create an instance of BO type ‘MESSAGE’ using BO Method MESSAGE.Create. In case you are not comfortable with BO macros, simply call the main FM used within. The important part here is to pass the document type e.g. URL, EXT (for external files), and contents of file as well the file type ( e.g. TXT, PDF ) in case of File attachments. Here the document type can be derived from the relationship type of the link.
  • Now, the attachment is created in database as a ‘MESSAGE’ and instance is known. We’ll refer to this as object_b and main Business Object as objet_a.
  • Now, maintain the link.

Check the attached documents through GOS toolbarÔɆ Attachment List, using main business objects’ transaction e.g. ME23N for Purchase Orders. Sample Code
*---------------------------------------------------------------------** 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.*---------------------------------------------------------------------*REPORT  Z_RMTIWARI_ATTACH_DOC_TO_BO             .* Include for BO macros  INCLUDE : &ltcntn01&gt.* 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 'ZFRIENDS', " e.g. 'BUS2012'   P_BO_ID  LIKE OBL_S_PBOR-INSTID DEFAULT '00007',    " 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 headerline.* 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.  swc_set_element LT_MESSAGE_CONTAINER 'DocumentContent' LT_DOC_CONTENT.  swc_call_method LO_MESSAGE 'CREATE' LT_MESSAGE_CONTAINER.* Refresh to get the reference of create 'MESSAGE' object for attachment  swc_refresh_object LO_MESSAGE.* Get Key of new object  swc_get_object_key LO_MESSAGE LV_MESSAGE_KEY.* Now we have attachment as a business object instance. We can now* attach it to our main business object instance.* Create main BO object_a  data: LO_IS_OBJECT_A type SIBFLPORB.  LO_IS_OBJECT_A-INSTID = P_BO_IDLO_IS_OBJECT_A-TYPEID = P_BOTYPELO_IS_OBJECT_A-CATID  = 'BO'.* Create attachment BO object_b  data: LO_IS_OBJECT_B type SIBFLPORB.  LO_IS_OBJECT_B-INSTID = LV_MESSAGE_KEYLO_IS_OBJECT_B-TYPEID = P_DOCTYLO_IS_OBJECT_B-CATID  = 'BO'.*TRY.CALL METHOD CL_BINARY_RELATION=&gtCREATE_LINK  EXPORTING    IS_OBJECT_A            = LO_IS_OBJECT_A*    IP_LOGSYS_A            =    IS_OBJECT_B            = LO_IS_OBJECT_B*    IP_LOGSYS_B            =    IP_RELTYPE             = P_RELTYP*    IP_PROPNAM             =*    I_PROPERTY             =*  IMPORTING*    EP_LINK_ID             =*    EO_PROPERTY            =    .*CATCH CX_OBL_PARAMETER_ERROR .*CATCH CX_OBL_MODEL_ERROR .*CATCH CX_OBL_INTERNAL_ERROR .*ENDTRY.* Check if everything OK...who cares!!  commit work.

Actions