Quantcast
Channel: SCN : Discussion List - Scripting Languages
Viewing all 325 articles
Browse latest View live

SAP Script - Label Printing Issue

$
0
0

Hi,

 

I have a requirement.

 

When we do label printing in our project for PUTAWAY label, we use standard text in SAP script.

 

Standard Text : ZPRINT_300DPI which is hardcoded in the SAP script and this is printing fine in zebra printer.

 

When they re-print the same, it will go to MOBILE printer and not ZEBRA printer.

 

Mobile printer should be 200 DPI and we have a separate standard text ZPRINT_200DPI.

 

Now the requirement says that, based on the user printer settings, I need to pass either 300 or 200 DPI standard texts.

 

Is this possible. Please suggest.

 

Thanks,

Prabu


Automatically upload file to SharePoint using scripting

SAP Scripting Issue: Control could not be found by ID. -

$
0
0

Hi

We were trying to change the baseline date for approx 50000 document lines.

 

Recorded a script. It work fine for some of the part but at times it throws error and getting error "Control could not be found by ID. -" for the same thing. I could not understand the reason.

 

Can someone help me please...? I need to make sure that it run smoothly. I was thinking of if there is any syncing issue between ECC response and script spped, but not sure. If it is response issue then can we apply some wait time or something else. Currently not sure what to do.

 

Below is the code I have:

**********************************************************************

If Not IsObject(application) Then

   Set SapGuiAuto  = GetObject("SAPGUI")

   Set application = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(connection) Then

   Set connection = application.Children(0)

End If

If Not IsObject(session) Then

   Set session    = connection.Children(0)

End If

If IsObject(WScript) Then

   WScript.ConnectObject session,     "on"

   WScript.ConnectObject application, "on"

End If

 

 

 

 

REM Set up connection to the Excel data to be keyed into SAP:

Set objExcel = GetObject(,"Excel.Application")

Set objSheet = objExcel.ActiveWorkbook.ActiveSheet

 

 

session.findById("wnd[0]").maximize

session.findById("wnd[0]/tbar[0]/okcd").text = "/nfb02"

session.findById("wnd[0]").sendVKey 0

 

 

For i = 1 to objSheet.UsedRange.Rows.Count

 

 

session.findById("wnd[0]/usr/txtRF05L-BELNR").text = Trim(Cstr(objSheet.Cells(i, 1).Value2))

session.findById("wnd[0]/usr/ctxtRF05L-BUKRS").text = "Test"

session.findById("wnd[0]/usr/txtRF05L-GJAHR").text = "2016"

session.findById("wnd[0]/usr/txtRF05L-GJAHR").setFocus

session.findById("wnd[0]/usr/txtRF05L-GJAHR").caretPosition = 4

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/usr/cntlCTRL_CONTAINERBSEG/shellcont/shell").setCurrentCell -1,"BUZEI"

session.findById("wnd[0]/usr/cntlCTRL_CONTAINERBSEG/shellcont/shell").selectColumn "BUZEI"

session.findById("wnd[0]/usr/cntlCTRL_CONTAINERBSEG/shellcont/shell").selectedRows = ""

session.findById("wnd[0]/usr/cntlCTRL_CONTAINERBSEG/shellcont/shell").pressToolbarButton "&SORT_ASC"

 

 

session.findById("wnd[0]/mbar/menu[1]/menu[1]").select

session.findById("wnd[1]/usr/txtRF05L-BUZEI").text = Trim(Cstr(objSheet.Cells(i, 2).Value2))

session.findById("wnd[1]/usr/txtRF05L-BUZEI").caretPosition = 2

session.findById("wnd[1]/tbar[0]/btn[0]").press

session.findById("wnd[0]/mbar/menu[1]/menu[0]").select

session.findById("wnd[0]/usr/ctxtBSEG-ZFBDT").text = Trim(Cstr(objSheet.Cells(i, 3).Value2))

session.findById("wnd[0]/usr/ctxtBSEG-ZFBDT").setFocus

session.findById("wnd[0]/usr/ctxtBSEG-ZFBDT").caretPosition = 10

session.findById("wnd[0]/tbar[0]/btn[11]").press

session.findById("wnd[0]").sendVKey 0

 

 

Next

 

*************************************************************

Find Cell Content. How to capture msg that entry is not found?

$
0
0

Hi Experts,

 

I want to write script to check if there are any documents (purchase order, invoice etc) attached to quotation. this can be viewed in DOCUMENT FLOW.

I want to do most easy way (opinion of a total dummy, novice etc.): use FIND function in document flow and check if there are cell with entry: PURCHASE ORDER or INVOICE. If entry is not found I will know that quotation is still open and not invoiced.

 

The purpose of whole this exercise is to create macro in EXCEL to check long list of quotation numbers and check if they are invoiced or not not.

Do you know how to catch that a message box is displayed "no entry found"???

 

Thanks in advance for your support!

Problems selecting tab via script

$
0
0

Hi everyone,

 

I've started scripting a few days ago and it works quite well.

But there is one issue I'm still fighting with:

 

I would like to run the transaction MM01 via VBA Excel script to create part numbers full automatically.

The code works fine until the following bold line:

 

.....

session.findById("wnd[0]/tbar[1]/btn[30]").press 'Select Button "Zusatzdaten"

session.findById("wnd[0]/usr/tabsTABSPR1/tabpZU05").Select 'Jump to Tab 5 "Grunddatentext"

session.findById("wnd[0]/usr/tabsTABSPR1/tabpZU05/ssubTABFRA1:SAPLMGMM:2110/subSUB2:SAPLMGD1:2031/cntlLONGTEXT_GRUNDD/shellcont/shell").Text = TEXTVARIABLE

session.findById("wnd[0]/tbar[0]/btn[11]").press 'Enter to Save and Close Session.

 

 

Selecting tab no. 5 works just a few times but after some loops (<10) the screen looks like this and my code stops working:

Problem.PNG

Instead of jumping to tab 5 the SAP screen looks like a freezed mixture of tab no. 1 an tab no. 5. And then it stops working.

Selecting tabs is (in my case) always a problem.

Can anyone please tell me how to select a tab without freezing? Why is it not working?

 

Thanks in advance.

 

Matthias

Viewing all 325 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>