Skip to Content
0

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

Feb 17, 2017 at 03:57 PM

63

avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

avatar image
Former Member Feb 17, 2017 at 03:58 PM
0
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");
Share
10 |10000 characters needed characters left characters exceeded