cancel
Showing results for 
Search instead for 
Did you mean: 

How to Info record long text with VBA

michael_propst
Explorer
0 Kudos

I am very new to VBA and I am trying to create a macro to copy the contents of an existing PIR in ME13 and create a new PIR in ME11.

I can get my macro (excel VBA) to copy all of the fields except for the two text fields. Can someone show me an example of how to copy the long text?

I have searched for answers in the forums but have not found any that I can make sense of.  I have never used or accessed the tables that I have seen referenced.

Any help would be greatly appreciated.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member213011
Participant
0 Kudos

the typical syntax to get the content of any field in sap is

some_text_variable = session.findbyid("sap_field_id").text

can you share the codes you have now in order for us to understand your situation?

michael_propst
Explorer
0 Kudos

I am able to copy text using the sap field ID that you referred to but not for long text as it is not in a sap field with an ID, or at least not in one that I can identify. From what I understand you have to reference the table the text is stored in and I have no idea how to do this.

In the first pic,

Text line 1 is    /app/con[0]/ses[0]/wnd[0]/usr/sub:SAPMM06I:0103/txtRM06I-LTEX1[1,11]

Text line 2 is    /app/con[0]/ses[0]/wnd[0]/usr/sub:SAPMM06I:0103/txtRM06I-LTEX2[2,11]

It's the extended text past line five (see second pic) that I can not get to.  See below.

former_member213011
Participant
0 Kudos

Have you tried SAP script recorder to get the field name?

michael_propst
Explorer
0 Kudos

Yes. That is what I used to get the filed names of the text boxes shown in the first screen shot. When you double click on the text boxes to open up the text editor and view all of the text, then the script recorder does not list a filed name for the window containg the text.  From what I have researched, I  need to use the function module READ_TEXT or READ_TABLE but I am not sure of how to do so.

former_member213011
Participant
0 Kudos

I've tested the transaction you describe and come to the text editor. It is a GuiShell subtype OfficeIntegration which cannot be recorded directly via script recording.

I'm not sure how to read the text but you can use AppActivate and SendKeys to write something to it.

If you look at this thread: http://scn.sap.com/message/13905688#13905688 Holger have some codes using RFC but I have no experience with RFC to offer any further assistance. Sorry.