cancel
Showing results for 
Search instead for 
Did you mean: 

Copy "document icon" to new sheet from "SEM-BPS 1" sheet

Former Member
0 Kudos

Hi,

I'm using SAP VB Macros to copy data from SEM-BPS 1 sheet to new sheet. Everything seems to be working fine but <b>document icons</b> are not being copied from SEM sheet to new sheet.

Rather than just <b>moving</b> the value, I even tried to <b>copy entire cell</b> from SEM sheet and <b>paste</b> it into new sheet from within macro. It seems to be working but only a <b>very thin & small line</b> is being created in new sheet <b>for document link</b> which is almost <b>invisible</b>. I'll have to find out this small invisible line and click on it to get the document.

has any one got any experiences on this? once we enable layout with documents, How does document icon is created in SEM-BPS 1? Is the icon physically stored some where in SAP?

How do I copy exact document icon from SEM-BPS 1 to new sheet?

I appreciate sharing your ideas.

<b><u>Note:</u> moving</b> cells in VB just copies the <b>value</b> where as <b>copying cells</b> in VB copies <b>the entire cell</b> with format,font,shapes etc..</b>

Accepted Solutions (0)

Answers (1)

Answers (1)

gerd_schoeffl
Advisor
Advisor
0 Kudos

Hi,

I did a little prototype using

Range("A9:F14").Select

Selection.Copy

I encounter the same problem. I fear that this has s.th. to do with the Excel version - I am using Office 2003 and I can remember that I did not have this problem when I was still using and old version.

Unfortunately "autofit" also does not work properly. I see several options:

1. In the sheet you are copying to use columns with a fixed width that is large enough.

2. Via macro read the width of each column and set the width of the column you are pasting to to the same value.

3. Use another document symbol that is in the left corner of the cell. This can be done via a modification.

You must be aware that if you are using a scenario with an additional sheet and documents then you cannot create new documents on this additional sheet. You can only display and change existing documents. Unfortunately there is no way to get around this restriction.

Best regards,

Gerd Schoeffl

SAPNetWeaver RIG BI EMEA

Former Member
0 Kudos

Hi Gerd,

thank you so much for your reply.

After adjusting the width of the columns, I could able to see full size document icon.

But, unfortunately, our scenario (creating documents on new sheet) is just the same scenario you were explaining at the end of your previous post. Infact, my next question would have been this hadn't you discussed about this.

as per my requirements, I should be able to do this provided if I can copy documents from 1 characteristic value to another characteristic value. Can I do this?

I've a 1st layout that doesn't use macros. So, If on this layout, a document is created for Characteristic VERSION value 100, Can I copy this document to Characteristic VERSION values 200 & 300?

So, if i open a 2nd layout that uses macros, I could able to see 3 documents for 3 different versions 100, 200 & 300 on new sheet.

As Version 200 & 300 already have documents (copy of 100), now we should be able to change version 200 & 300 documents from the new sheet and save it.

Can I do this? Hope am clear.

gerd_schoeffl
Advisor
Advisor
0 Kudos

Hi,

Yes, your scenario will work. There is some delivered functionality for copying (and deleting) documents. We have shipped function modules (UPF_DOC_COPY_INIT, UPF_DOC_COPY_EXIT) in the function group UPFX that you can use in a planning function type Exit. You can find some more information about these function modules in the source code (large comment at the beginning of the coding) and a step by step description in a How to paper (documents in BPS).

Regards,

Gerd Schoeffl

Former Member
0 Kudos

Hi Gerd,

Thanks a million for your reply.

I was able to make it work for my scenario. But, I still have couple of concerns/issues that I had faced during my testing.

let's say I've layout1 without macros where users can create documents easily & directly on SEM-BPS 1 &

I've layout2 with macros where users can't create documents and user exit copies documents from layout1 to layout2 so as to give

1. Can I create a new document using user exit? (this is incase, users forget to create document on layout1 and wish to create document on layout2)

Please note that once data is available to layout2 means data no longer exists in layout1 (reposting functions make data available from layout1 to layout2 which makes it impossible to create documents on new sheet of layout2)

2. I had noticed that, though am able to edit the document on new sheet (with macros) of layout2 but couldn't able to delete the same. Can I not delete the document from new sheet & still able to edit the same?

3. I came across 2 document icons but couldn't able to figure out why it's creating 2 document icons? one icon on right most upper corner of the cell & 2nd icon on left most lower corner of the cell. 2nd icon almost appeard in the next row of cells.

Is there any setting to deactivate 2nd icon? But, I wonder 2 document icons are not being created for all cells?

4. Can I copy a document from version 100 to (2 versions 200 & 300) at a time? (means 2 documents at a time)

I did try with UPC_Y_LOW (200) & UPC_Y_HIGH (300)(didn't work).

I even tried creating 2 set of exit parameters with same "from 100" & different "to 200" & "to 300". (didn't work).

I had to create 2 exit functions one for each version & call each function subsequently to make it work.

5. HOW TO "Documents in BPS" explains that we need to create extra functions to delete documents while deleting data in some cases. Is this true? if it is, Could you please share your ideas.

greatly appreciate your help.

gerd_schoeffl
Advisor
Advisor
0 Kudos

Hi,

First of all let me explain why you cannot create new documents (and delete existing ones) in the new sheet:

When you create a new document you have to specify the characteristic/keyfigure combination. The only way you can do this in a planning layout is by selecting the cell where you want to create the document. If you select a cell in the sheet SEM-BPS 1 the system will know which characteristic/keyfigure combination is behind that cell and can create the layout. If you mark a cell on your additional sheet the system does not have any information which is the underlying combination (you might have reordered the cells etc.). Thus having no selection on the first sheet the system cannot decide where to create the document. The same is true for deleting documents as here you also have to specify the cell in order to specify the characteristic/keyfigure combination.

You have 2 options - either the users just switch to sheet SEM-BPS 1 and create/delete the documents there or you write a planning function type xits that creates a document. Unfortunately you will have to know a lot about the internal interfaces to create a new document via an exit function so this way is not trivial...

1. (see above) - yes, but requires a bit of knowledge.

2. (see above). You might use a planning function to delete the document. We also have shipped the function modules for that: UPF_DOC_DEL_INIT/UPF_DOC_DEL_EXIT.

3. I have never seen that before. Does this happen on sheet SEM-BPS 1? If so it is probably a bug - OSS message. If it is on your sheet then please check you VBA coding.

4. Please have a look at the explanation in UPF_DOC_COPY_INIT again. There is say how the exit parameters have to be called and what their meaning is. You can only copy from one version to exactly one other version. You either can copy the coding to a new function module and change the behavior or create 2 parameter groups - one for each copy. There is no need to create two planning function. Please check whether you setup of the planning function (and especially the exit parameters) is correct.

5. The standard delete function only deletes transaction data but not the documents. The reason is because deleting data in the BPS can happen because of different reasons:

- You want to set all values to zero but do not want to loose the meta infomation about the planning object. In this case you would keep the documents already entered.

- You want to finally erase a planning object and never use it again. Then you also want to delete all document information.

You have to decide what scenario you are using and thus if you want to delete the documents as well have to use the delivered function modules and set up a delete function for documents.

Best regards,

Gerd Schoeffl

Former Member
0 Kudos

Hi Gerd,

1st, let me thank you for providing so much of valuable information.

am working on attaching documents using Copy Documents standard FM's (UPF_DOC_COPY_INIT, UPF_DOC_COPY_EXIT), and now am facing a problem. It's kind of complicated but I hope i'll put it clear for your understanding.

I've a gloabl planning sequence that includes 2 functions.

1. Copy documents function from KFTYPE 2001 to 2004.

2. repost 2 records from STATUS 1 to 2.

so, Initially, user enters record for MATERIAL1 with "KFTYPE 2001 , MAT1 & STATUS 1" and creates a document.

when user executes gloabl planning sequence, 1st, documents are copied for KFTYPE 2004 from 2001 with STATUS 1 and later all 2 records are reposted to STATUS 2 from 1.

this if fine.

Now, I've 2 single documents for each KFTYPE 2001, 2004.

Now, let's say user repeats the process for MATERIAL2 with "KFTYPE 2001, MAT2 & STATUS 1" and creates a document.

when user executes gloabl planning sequence, 1st, documents are copied for KFTYPE 2004 from 2001 for MATERIAL2 with STATUS 1 and later all 2 records are reposted to STATUS 2 from 1.

Now, If i look at documents,

I've 2 single documents for each KFTYPE 2001, 2004 for MATERIAL2 (Correct)

I've 3 documents 1 for KFTYPE 2001 and 2 for KFTYPE 2004 for MATERIAL1 (WRONG)

I couldn't able to understand why it is again creating (Copying from 2001 to 2004) documents for MATERIAL1 eventhough MATERIAL1 is not selected in the plannig package of COPY DOCUMENTS during 2nd time as only with STATUS 1 are included for COPY DOCUMENTS funciton.

Characteristics MATERIAL, KFTYPE are document attributes (flag checked in infoobject definition)

Characteristic STATUS is not document attribute.

I even double checked package selection.

COPY DOcuments function runs on a package with selections as follows

Material : No selection

KFTYPE : 2001, 2004

STATUS : 1

Repost function runs on a different package with selections as follows

Material : No selection

KFTYPE : 2001, 2004

STATUS : 1 & 2

I even double checked parameters in Copy Document Planning funciton.

I've included all characteristics as "Fields to be changed"

I've even created 6 parameters with "KFTYPE, FROM, TO" & "STATUS, FROM, TO" with values 0METYPE, 2001, 2004 & ZSTATUS, 1, 1.

Note: This is happening even in stand alone SEM-BPS 1 sheet without macros.

Hope it is clear & thanks in advance for your help

former_member93896
Active Contributor
0 Kudos

Hello,

at one point you write that "MATERIAL1 is not selected in the plannig package" but later when you show the package selection, there is no restriction on material. No restriction means select everything. So if you run the copy function again, it will copy the first and the second document.

If you don't want this to happen, you have to restrict the planning package to the right materials. Alternatively, you could enhance the exit function to check if a document exists already for a given value combination and not copy it again in that case.

Regards

Marc

SAP NetWeaver RIG

Former Member
0 Kudos

Hi Marc,

even if there is no Material selection, I've restricted STATUS to only 1.

So, 1st time, only MATERIAL1 will be selected into planning package & gets reposted to STATUS 2.

now, MATERIAL1 record is with STATUS 2.

Now, 2nd time, let's say I creted record with MATERIAL2 & with STATUS1.

now, records are

MATERIAL1 STATUS2

MATERIAL2 STATUS1

Now, because of selection on planning package (COPY DOCUMENTS Planning package) with STATUS1, MATERIAL1 should not be used in COPY DOCUMENTS planning funciton. am i right?

I double checked that there is no document already exists for the given combination.

hope it is clear.

thanks,

Message was edited by: IPBWSEM

gerd_schoeffl
Advisor
Advisor
0 Kudos

Hi,

Could you check the definition of the parameter group you are using for doing the copy?

In any planning function the planning package must include the data (documents) that should be changed. In a copy function the data to be changed is the TARGET of the function. The source of the copy will not be changed and does not need to be included in the planning package. The system will read the definition of the parameter group and select the "from" values as reference data. Thus I think your problem is not the planning package but how your parameter group is set up. Could you check this again?

Best regards,

Gerd Schoeffl

Former Member
0 Kudos

Hi Gerd,

that's a very useful information. you wrote..

<b>The source of the copy will not be changed and does not need to be included in the planning package. The system will read the definition of the parameter group and select the "from" values as reference data. </b>

This is how I've defined COPY DOCUMENTS parameter Group. Do you see anything wrong?

I've included all characteristics of planning level as "Fields to be changed".

Parameter exit function is defined as follows.

11CHAR UPC_Y_CHANM

12FROM UPC_Y_LOW

13FROM UPC_Y_LOW

21CHAR UPC_Y_CHANM

22FROM UPC_Y_LOW

23FROM UPC_Y_LOW

Parameter Group is defined as follows

Characteristic = 0METYPE

Lower limit = 2001

Lower limit = 2004

Characteristic = ZSTATUS

Lower limit = 1

Lower limit = 1

appreciate your continuing help

gerd_schoeffl
Advisor
Advisor
0 Kudos

Hi,

The parameter group looks all right to me. If I scroll up I see that your planning package uses "Material = blank". That is all materials are selected. Now in the parameter group the status is set to 1 and thus the system will copy all documents that exist for any material and status = 1. And as you still have a document (but no record...!) on material=1, status=1 you get the above behavior. Maybe you just have to delete the documents once you do a realignment of the data (realignment is nothing else than a combination of a copy and a delete). In the function group UPFX you will also find some function modules for deleting documents.

Best regards,

Gerd Schoeffl

Former Member
0 Kudos

Hi Gerd,

Thank you so much for your reply. Somehow, I managed to delete the documents.

Though it's doing some unexpected results, Our users insist on documents usage.

Now that I have this following requirement.

<b> We've a layout that doesn't use macros. </b>

We'd like to attach a document for each line that is entered on this layout. All the document attribute characteristics are included in this layout.

Document contents & technical name can be any thing.

Should I be able to do this?

This ensures that users be able to edit documents on other layouts which is crucial.

hope it is clear

gerd_schoeffl
Advisor
Advisor
0 Kudos

Hi,

The only way to create a document in your scenario would be to create a planning function that

1. reads the existing documents

2. determines which line in the layout does not have a document (for this the definition of the layout needs to be known in the planning function).

3. create an empty document

Have a look at the coding of the copy function for documents. The coding you need is quite similar to that.

Best regards,

Gerd

Former Member
0 Kudos

Hi Gerd,

thank you so much for your reply.

As this thread is getting longer that makes page alignment inproper, I've created a new thread.

Could you please look at my new post.

Appreciate your help.