Quantcast
Channel: SCN : All Content - SAP Training and Education
Viewing all articles
Browse latest Browse all 945

How to save invoice PDF in folder with help of Script

$
0
0

Hi,

 

I have record below code but i am unable to save PDF in folder. Can anyone help me in below code how to save PDF in folder?

 

And i have to post 60 to 70 customer invoices every month is there any automatic process to do it.

 

In below code is for post one invoice in one time for second time i have to change contract number and amount and then run the code same process for other invoices is their any method or shortcut to just add different contracts and there amount in script which i have to posted and then run the code one time and post the multiple invoices in different contracts with their amount.

 

 

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

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

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

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

session.findById("wnd[0]/usr/ctxtVBAK-AUART").text = "dr"

session.findById("wnd[0]/usr/ctxtVBAK-AUART").caretPosition = 2

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

session.findById("wnd[1]/usr/tabsMYTABSTRIP/tabpRKON/ssubSUB1:SAPLV45C:0302/ctxtLV45C-VBELN").text = "12345"

session.findById("wnd[1]/usr/tabsMYTABSTRIP/tabpRKON/ssubSUB1:SAPLV45C:0302/ctxtLV45C-VBELN").caretPosition = 10

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

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\02/ssubSUBSCREEN_BODY:SAPMV45A:4415/subSUBSCREEN_TC:SAPMV45A:4902/tblSAPMV45ATCTRL_U_ERF_GUTLAST/txtVBAP-ZMENG[2,0]").setFocus

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\02/ssubSUBSCREEN_BODY:SAPMV45A:4415/subSUBSCREEN_TC:SAPMV45A:4902/tblSAPMV45ATCTRL_U_ERF_GUTLAST/txtVBAP-ZMENG[2,0]").caretPosition = 12

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

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_ITEM/tabpT\05").select

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_ITEM/tabpT\05/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN/ctxtKOMV-KSCHL[1,12]").text = "zpr0"

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_ITEM/tabpT\05/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN/txtKOMV-KBETR[3,12]").text = "100"

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_ITEM/tabpT\05/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN/txtKOMV-KBETR[3,12]").setFocus

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_ITEM/tabpT\05/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN/txtKOMV-KBETR[3,12]").caretPosition = 16

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

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\02/ssubSUBSCREEN_BODY:SAPMV45A:4415/subSUBSCREEN_TC:SAPMV45A:4902/tblSAPMV45ATCTRL_U_ERF_GUTLAST/cmbVBKD-ZLSCH[79,0]").key = "1"

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\02/ssubSUBSCREEN_BODY:SAPMV45A:4415/subSUBSCREEN_TC:SAPMV45A:4902/tblSAPMV45ATCTRL_U_ERF_GUTLAST/cmbVBKD-ZLSCH[79,0]").setFocus

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

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\09/ssubSUBSCREEN_BODY:SAPMV45A:4152/subSUBSCREEN_TEXT:SAPLV70T:2100/cntlSPLITTER_CONTAINER/shellcont/shellcont/shell/shellcont[1]/shell").text = "PO No: 1234" + vbCr + ""

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\09/ssubSUBSCREEN_BODY:SAPMV45A:4152/subSUBSCREEN_TEXT:SAPLV70T:2100/cntlSPLITTER_CONTAINER/shellcont/shellcont/shell/shellcont[1]/shell").setSelectionIndexes 11,11

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

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

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

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

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

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

session.findById("wnd[0]/usr/cmbRV60A-FKART").key = "F5"

session.findById("wnd[0]/usr/cmbRV60A-FKART").setFocus

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

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

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

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

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

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

session.findById("wnd[0]/usr/tblSAPMV60ATCTRL_UEB_FAKT").getAbsoluteRow(0).selected = true

session.findById("wnd[0]/usr/tblSAPMV60ATCTRL_UEB_FAKT/ctxtVBRP-POSNR[0,0]").setFocus

session.findById("wnd[0]/usr/tblSAPMV60ATCTRL_UEB_FAKT/ctxtVBRP-POSNR[0,0]").caretPosition = 0

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

session.findById("wnd[0]/usr/tblSAPDV70ATC_NAST3/ctxtDNAST-KSCHL[1,0]").text = "za02"

session.findById("wnd[0]/usr/tblSAPDV70ATC_NAST3/ctxtDNAST-KSCHL[1,0]").caretPosition = 4

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

session.findById("wnd[0]/usr/ctxtNAST-LDEST").text = "locl"

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

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

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

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

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

session.findById("wnd[1]/usr/tblSAPLVMSGTABCONTROL").getAbsoluteRow(0).selected = true

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

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

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

 

Thanks,

Rahul


Viewing all articles
Browse latest Browse all 945

Trending Articles



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