cancel
Showing results for 
Search instead for 
Did you mean: 

Input screen data into BLT

former_member329434
Participant
0 Kudos

Hi Friends,

I want to develop a webpage, where user will do a data entry and clicks on submit button. Once the user clicks button, I want to pass those values into a BLT .I shall map incoming webpage(html) values with that of  a BAPI and will take BAPI response back with the results at the bottom.

I am aware how to call BAPI and take response from BLT .I Just want to know how to pass those screen fields into BLT. Can any one guide please.

Thanks,

Suman

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Suman,

   Refer for more details. You could either use an applet like iCommand. Then use the applet's executeComman() method to trigger the call.

Or you can use direct HTTP Call from the web page.

I have edited the source from the above post to give it a form like look.

Here is my source code

<!DOCTYPE HTML>

<HTML>

<HEAD>

          <TITLE>Your Title Here</TITLE>

          <META http-equiv="X-UA-Compatible" content="IE=edge">

          <META http-equiv='cache-control' content='no-cache'>

          <META http-equiv='expires' content='0'>

          <META http-equiv='pragma' content='no-cache'>

          <SCRIPT language="JavaScript">

function getXML(_url){

// code for IE7+, Firefox, Chrome, Opera, Safari

if (window.XMLHttpRequest){

  xmlhttp=new XMLHttpRequest();

} else {// code for IE6, IE5

  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

}

xmlhttp.open("POST",_url,false);

xmlhttp.send();

xmlDoc=xmlhttp.responseXML;

return xmlDoc;

}

// Fuction to Call the Trx defined in the Javascript Variable at the end

function startTrx(){

var url = "/XMII/Runner?Transaction=" + currTrxFullPath + "&OutputParameter=*";

var url = url + "&one="+document.getElementById('one').value;

var url = url + "&two="+document.getElementById('two').value + "&content-type=text/xml";

//alert(url);

var returnedXML = getXML(url);

//alert("XML Doc: " + returnedXML.xml); // Display the Full XML Element

currTrxId= returnedXML.getElementsByTagName('Rowsets')[0].getAttribute('TransactionID');

alert("Transaction ID: " + currTrxId); // Display the Transaction Id

alert("Output: " + returnedXML.getElementsByTagName(currTrxField)[0].text); // Display the Value Returned in the Field

}

// Javascript Variables;

var currTrxId = -1; // Currently Running Transaction Id

var currTrxFullPath = "Default/Transactions/HelloWorld_Runner_Output"; // Full Path of the Transaction as in the WorkBench

var currTrxField = "Out"; // Field to be returnd

          </SCRIPT>

</HEAD>

<BODY>

<form>

Input 1(number): <input id = "one" type="text" name="FirstName" value=""><br>

Input 2(number): <input id = "two" type="text" name="LastName" value="Mouse"><br>

<button type="button" onclick=startTrx()>Add Me!</button>

</form>

</form>

</BODY>

</HTML>

In this example I have used the transaction to calculate sum of two numbers . The transaction takes in two parameters (one,two). The value of the input fields are passed to this parameter and appended in URL. The Output parameter Name is Out.

Regards

Tufale Ashai.

former_member329434
Participant
0 Kudos

Hi Ashai/ Rohit,

Thank you for your valid inputs.  I want to get clarify few things from the above post for a better understanding.

I have simulated the same example in my environment and couldnt get the desired out put. could see alerts only , not the appended output as mentioned in post. As mentioned,created variable as Out in the transaction .

clarifications:

1)var url = "/XMII/Runner?Transaction=" + currTrxFullPath + "&OutputParameter=*";

from the above statement..  modified as:( do i need to add + symbols in between)?

var url = "http://192.100 .101 22:50000/XMII/Runner?Transaction=abc_trx + Transaction/abc_trx+"&OutputParameter=*";

2)var currTrxFullPath = "Default/Transactions/HelloWorld_Runner_Output"; // Full Path of the transaction

modified as:

var currTrxFullPath = "http://192.100.101.22:50000/Transaction/abc_trx";

I am not getting desired output. Please let me know how should I build my transaction properties to receives those two inputs and send output .

based on the above example, I want to build a webpage and pass those variables to transaction and from there to BAPI and response back .

I appreciate your patience and time and request you to guide me further.

Thanks,

Suman

Former Member
0 Kudos

1)var url = "/XMII/Runner?Transaction=" + currTrxFullPath + "&OutputParameter=*";

Keep the url variable as it is.. no change. "/XMII..." would automatically pickup you workbench's server and host name.

2)var currTrxFullPath = "Default/Transactions/HelloWorld_Runner_Output"; // Full Path of the transaction

This is the path of the transaction. If your transaction is in "Project1" under "Folder1". Then the path would be Project1/Folder1/TransactionName.

You could also get the path from the workbench. Open the transaction, on the left bottom panel, there are three tabs. The third one (forgot the name ) will have the path of the transaction. Place the path in the currTrxFullPath variable.

The reason of not getting the output is because of wrong transaction path.

For the example to work,

1. Your transaction should contain, 2 input parameters of type integer. Name them "one" and "two" . So create two transaction properties

2. Your transaction should contain 1 Output parameter of type interger. Name it "Out". Create a transaction property for this and select the Output parameter flag.

3. Your transaction should contain an Assignment action block.

    In the assignment action block, Target should be "Out", expression should be Transaction.one + Transaction.two . In short, create a expression to add two input parameters and assign in to the output. It should do.

former_member329434
Participant
0 Kudos

Hi Ashai,

Now , I am able to see the result. Thank you once again for a detail explanation. Can I follow the same approach where I have to key in 10 variables from webpage into a transaction and call a BAPI from there and  take the response back from ECC to MII webpage.

Please suggest.

Thanks,

Suman

former_member329434
Participant
0 Kudos

Hi Ashai,

Now , I am able to see the result. Thank you once again for a detail explanation. Can I follow the same approach where I have to key in 10 variables from webpage into a transaction and call a BAPI from there and  take the response back from ECC to MII webpage.

Please suggest.

Thanks,

Suman

former_member329434
Participant
0 Kudos

Hi Ashai,

Now , I am able to see the result. Thank you once again for a detail explanation. Can I follow the same approach where I have to key in 10 variables from webpage into a transaction and call a BAPI  and  take response back from ECC on to MII webpage.

I also have few drop down lists from the same webpage, where user will select appropriate for him.

six single input text fields

and two drop down lists( for user selection)

if possible please give me a small example for ref for one text field and one for drop down.....

Kindly suggest.

Thanks,

Suman

Former Member
0 Kudos

Glad to be of help .

You can pass as many inputs as you want. Similar to text boxes, you can create list box, check box or any HTML element and pass the input to the variables.

These variables can then be pass to your BAPI and the output of it can be displayed in web page.

For list box,

you can use,

var x=document.getElementById("list1").selectedIndex; // list1 is the id of the list box
var y=document.getElementById("list1").options;

var value = y[x];

you could refer w3schools.com for more info on javascript / HTML


Answers (1)

Answers (1)

former_member211944
Active Participant
0 Kudos

Hi Suman,

Use this URL in your webpage:

<protocol>://<server>:<port>/XMII/Runner?Transaction=<transaction path>&<Input Param Name>=<Input Param Value>&j_user=<user name>&j_password=<password>&Content-Type=text/xml

So for input parameters you just have to add <Input Param Name>=<Input Param Value> in the URL.

Create the input params in the transaction, and then add them in the URL as mentioned above.

Also you can have any number of input params in the URL.

Make sure that the names of the input matched in the URL and transaction.

Have a look at the following information in the MII Help document which details out all the types of parameters you can use in this call:

SAP Library - Content Development

Regards,

Rohit Negi.