Skip to Content

EXCEL VBA Vs SAP: Copy text from textbox to LongText in SAP- Hash sign #

After a year hello again.

Im here to ask You for help. Today I hope it is quite simple, but Im stuck...:

I have automation on sending data from excel - textbox- to orders LongTexts in -SAP. Im using CO02.

Now the problem is when it copy the text into window in SAP it is ok - the same - I save the order change. When I open it again and go to the given longtext, there are many # signs on ends of lines.

I figured out that when it copy data from Textbox to SAP box window - text is the same but there are tabs or spaces on the ends of lines.... when I click on the end of some line, cursor jumps "Tab/Space" after text end. When I delete these spaces, hash signs disappear. The paragraph  function in excel does not shows any spaces.

Hope the problem is described understandable. Can send  screens it would be immediately clear.

Can someone propose a formatting to EXCEL BOX text or SAP LONGTEXT window?

Thanks in advance.

Mirek. 

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Oct 03, 2014 at 01:35 PM

    try replacing the linefeed, carriage return or CRLF characters with a space or empty string

    Session.FindById("wnd[0]/usr/...").Text = Repalce(vbLF,,,xlsheet.cells(1,1))

    vbLf = linefeed only

    vbCr = Carriage Return only - this one is definitely is good for the text boxes on text tabs on a PR or Delivery Doc

    vbCrLF = CR and LF combined

    Try each one individually to see which one is causing the problem and which one you can leave in to keep your line wrapping on the SAP side.  I didn't test out in the prod order (CO02) long description box specifically.  It seems that different long text boxes can act differently


    Add comment
    10|10000 characters needed characters exceeded

    • Find out whats generating the # signs. When I copy data from excel sheet and select more than first column (thats where longtext is), it makes "delimiters" in textbox - Tabs + spaces- and in SAP it is number of # signs = if I select 5 columns, in SAP will be my text + 4x#  everywhere.

      So is there format function like: MYTEXTBOX = Format(MYTEXTBOX, without tabs,delimiters..)?

      Moreover I do not understand use of  function vbLf

                                 Replace(vbLF,,,xlsheet.cells(1,1))   its like:

      string = replace(vbLf,,,string)?

      Thanks again for your reply.