cancel
Showing results for 
Search instead for 
Did you mean: 

How do I write a script for VA01 that calls VF01 with SD document number that was created

laurel_chung2
Explorer
0 Kudos

Hi Personas experts,

I have been working on VA01 flavor to create credit/debit memos. Once user has entered all the necessary information I tried to add a script button that would do the following:

1) Save the reference document that the memo request was based on so it can be displayed at the end

2) saves the sd credit memo request (VA01) and save the document number so it can be displayed at the end

3) creates the billing document (VF01) - and saves the document number so it can be displayed at the end

However once I try to run the script the page becomes unresponsive. Can you give me some guidance please.

Accepted Solutions (0)

Answers (1)

Answers (1)

laurel_chung2
Explorer
0 Kudos
here is my script
//save reference document

var refDoc =
session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP*/tabpT\\06/ssubSUBSCREEN_BODY:SAPMV45A:4311/txtVBAK-XBLNR").text;


session.utils.put("refDoc",refDoc);

//press save to create memo request document
session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP*/tabpT\\03/ssubSUBSCREEN_BODY:SAPMV45A:4303/ctxtVBKD-INCO1").setFocus();
session.findById("wnd[0]/tbar[0]/btn[11]").press();

//save memo request document
var memoReq =
session.findById("wnd[0]/sbar").getMessageParameter(0);
session.utils.put("memoReq", memoReq);

//go to VF01 to create billing document
session.findById("wnd[0]/tbar[0]/okcd").text =
"/nvf01";

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

//press save to process memo request which should already
be on the screen

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

//save billing document
var billingDoc = session.findById("wnd[0]/sbar").getMessageParameter(0);
session.utils.put("billingDoc", billingDoc);

//go back to va01

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

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


//fill in text boxes in status box
session.findById("wnd[0]/usr/boxPersonas_148699715815464/txtPersonas_148699732315295").text
= session.utils.put("refDoc");

session.findById("wnd[0]/usr/boxPersonas_148699715815464/txtPersonas_148699734136192").text
= session.utils.put("memoReq");


session.findById("wnd[0]/usr/boxPersonas_148699715815464/txtPersonas_148699739535674").text
= sesssion.utils.put("billingDoc");