cancel
Showing results for 
Search instead for 
Did you mean: 

Passing different parameters to BAPI bassed on click of the button

Former Member
0 Kudos

Hi All,

In my VC application I have two input fields as From date and To Date. I am allowing the user to enter these dates. I have The bapi which i am going call will accepts 3 parameters. The third parameter should not be entered by the user in the user interface.

I have two buttons need to be placed . so,

I need to pass that 3rd parameter to the bap, depends on the button i click.

If i click on first button, i need to pass as "F" for the BAPI to the third parameter.

If click on the secnod button, i need to pass "L" for the BAPI third parameter.

can u tell any body , how to achieve this, click on any of the available buttons passing different parameter to BAPI .

Regards

Vijay

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

HI Vishal ,

If the Problem is solved i would request you to close the thread & mark the question as answered.

Reagrding your new query.

FYI

Error 1033 Virtual variables are not supported.

Error 1025 Cannot redefine a final method. The method cannot be extended because it is marked as final in the base class .

In case it does nt help you.Please let me .Replies will be late as iam traveling out.

Thanx

Pankaj Prasoon

raju_saravanan
Contributor
0 Kudos

Hi Pankaj Prasoon

I Need a help from you.

1. I have one form view with 12 fields. I using one bapi for save and another one for retrieving. Out of these fields,two fields values are hard coded drop down lists. Remaining values are user needs to be entered. Hence when the user enters values and hitting the submit button, the entered values should be saved in first bapi

(These works very fine for me)

2. Using the hard coded field values (Two drop down values) i need to retrieve the saved data through second bapi by cliking another button called RETRIVE.

When i am trying retrieve with another form view, it is working. But i want the result in the first form view, hence the user can update any wrong data which they entered before.

Appriciate your quick response. Points will be awarded.

Regards

Saravanan.r

Former Member
0 Kudos

HI Vishal,

Start this approach as fresh one .

1) Drag the Bapi onto the storyboard.

From the find data ,

1.1 Select the system name from System Drop Down.

1.2 Write the name of the Bapi which has to be found.

1.3 Drag the Bapi onto the Story board.

2) Define and Test It.

2.1 Right Click on the Bapi

2.2 Define is to select the output and input fields.

2.3 Test is to check whether the bapi is working fine or not.

3) Drag a form from the input port of the BAPI

3.1 Click on the "input" port of the bapi (towards right).

3.2 Check the option of form.

3.3 It will automatically create the input field and map them to the Bapi

3.4 Also Submit button and event "Submit" is created by default.

3.5 If you notice there is line from the input form to the BAPI.

3.6 "Submit"(which is the event) name will be written on the Line.

3.7 Double click on the line.

3.8 On the Right hand side you will find Configure Element.

3.9 You can see the Mapped values.

3.10 There you can fill in the reuired values which you want.

4) Create a separate Button SAY "SubmitB", create the corresponding event. Connect to the bapi using this event of "Submitb".

(Similarly can be done for this event , just change the name of the event on the line to "Submitb".

5) NOW you have two events , and two buttons .

6) Depending on the events pass the value to the bapi (can hardcode the value "T"/"F"

See i cant put snapshots over here ,incase you still fell trouble call me or drop a mail at prasoonpankaj@gmail.com.

Thanx

Pankaj

Former Member
0 Kudos

Hi Pankaj,

Thanks for the quick reply. I have got solved my problem very easily. good solution.

I have learned the new point.

Acutally i am new to the VC, Started working from only from the last 3 weeks.

I have still couple of issues

In that one issue is. "Exporting the Table data to Excel."

My VC version is 7.0

Portal version NW 2004s.

if u give the solution for that . Really it will be good.

By refering the following link, i have implemented Export To Excell functionality in VC.

2) Another one that's in the Visual Composer WIKI:

https://wiki.sdn.sap.com/wiki/display/VC/Exportingdatafrom+VC

When i copied the following formula in the respective formula window, then it is giving the following error. can any body awareof what is the problem.

copied formula :

"pcd!3aportal_content!2fcom.sap.pct!2fplatform_a

dd_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.b

ex?QUERY=" & STORE@REPTNAME &

"&BI_COMMAND_1-

BI_COMMAND_TYPE=EXPORT&BI_COMMAND

1-EXPORTFORMAT=XLS&BI_COMMAND_1-

null="

I have copied same formula which is given in that doc. now i have added one field

REPTNAME. Now i have come from that problem. Formula showin as valid. when i click on check button.

Now when i compile , i havnt got any error, but when i deploy i am getting the following error

Error in compiling Flex application: Error 1002: String literal was not properly terminated

(D:\usr\sap\EPD\JC01\j2ee\cluster\server0\GUIMachine_Business_Packages\NewTestModel_28609\FLEX_COMPILATION_FOLEDR\AADMV.mxml:265)

Error 1033: ')' expected

(D:\usr\sap\EPD\JC01\j2ee\cluster\server0\GUIMachine_Business_Packages\NewTestModel_28609\FLEX_COMPILATION_FOLEDR\AADMV.mxml:266)

Error 1205: The statement 'dd_ons' is incomplete.

(D:\usr\sap\EPD\JC01\j2ee\cluster\server0\GUIMachine_Business_Packages\NewTestModel_28609\FLEX_COMPILATION_FOLEDR\AADMV.mxml:266)

Error 1025: Left side of assignment operator must be variable or property.

(D:\usr\sap\EPD\JC01\j2ee\cluster\server0\GUIMachine_Business_Packages\NewTestModel_28609\FLEX_COMPILATION_FOLEDR\AADMV.mxml:268)

Error 1033: ':' expected

can u tell me where is the problem

Thanks in Advance

Regards

Vijay

Former Member
0 Kudos

HI Vishal/Ankur/Sooraj.

If the question is

1) You have a single form.

2) Two Button in a Form.

3) Each button genrates separate events.

4) Depending on the button value is being Send.

If this is the scenario i would recommend you to do the following.

1) Drag the Bapi onto the storyboard.

2) Define and Test It.

3) Drag a form from the input port of the BAPI.(it will automatically create Submit button and submit event).

4) Create a separate Button SAY "SubmitB", create the corresponding event. Connect to the bapi using this event of SUBITB

5) NOW you have two events , and two buttons .

6) Depending on the events pass the value to the bapi (can hardcode the value "T?F"

Thanx

Pankaj Prasoon

Former Member
0 Kudos

Hi Pankaj,

Thansk for the suggestion and reply.

Where (In which controller) i need to hot code the those values. Right now i have added the formula in the expression box,

As this "Input type" parameters is defined as a mandatory parameter in RFC. if i wont place any kind of the input control corresponding to this parameter. It is showing the error when compile the model , it is giving the error.

Can u elabrate, where i need to hot code. those values, can u tell me with have any separate inputfield for the "input_type" parameter?

Thanks for the help in advance

Regards

Vijay

Former Member
0 Kudos

Hi,

In input form, use two toggle buttons BTN1, BTN2 (default false) with custom actions. Use a hidden expression box for third value and use the formula

IF(@BTN1==true,'F', IF(@BTN2==true,'L','F'))

for its default value.

Hope it helps

Regards,

Sooraj

Former Member
0 Kudos

hi sooraj,

Thanks for the reply

As u said,

1) i am not sure about what is taggle buttons. but i have created two buttons

2) Where i need to change default as false for the buttons. ( i havent find the option for the buttons)

3) Where i need to use that hidden expressions. Because in the buttons i can find the formula only in two places

1) at the Hidden place

2) at the dissable place

These two places will make any sense to add that formula in any of these property

You have not mentioned about the third inputfield to place in the form or not in visible mode.

But still i have placed the third inputfield name as "Input3" in the form and i made that invisible. And i have added two buttons BTN1 and BTN2

I have created two buttons in the input forms. now to diffrentiate the input to the 3rd input field in the runtime , i have added the following formula for the third input filed in the "default value" property.

IF(@BTN1 == true,'F',IF(@BTN2 == true, 'L','F'))

It is giving the following error when i press on the check button after entered the formula.

error.

Bad or missing field "BTN1".

so can u please correct me where i am done the mistake. i am requesting u to elabrate your explanation.

It is an urgent requirement.

Regards

Vijay

Former Member
0 Kudos

Hi Vishal,

> As u said,

> 1) i am not sure about what is taggle buttons. but i

> have created two buttons

You had added Push Buttons?? Toggle buttons can be found in the same list. Data type for them will be boolean. name them as btn1 and btn2.

> 2) Where i need to change default as false for the

> buttons. ( i havent find the option for the buttons)

Double click to open the control properties for BTN1. Default value can be set in the first tab. (the bottom textbox)

> 3) Where i need to use that hidden expressions.

> Because in the buttons i can find the formula only in

> two places

>

> 1) at the Hidden place

> 2) at the dissable place

>

> These two places will make any sense to add that

> formula in any of these property

>

> You have not mentioned about the third inputfield to

> place in the form or not in visible mode.

>

> But still i have placed the third inputfield name as

> "Input3" in the form and i made that invisible. And i

> have added two buttons BTN1 and BTN2

>

>

> I have created two buttons in the input forms. now to

> diffrentiate the input to the 3rd input field in the

> runtime , i have added the following formula for the

> third input filed in the "default value" property.

>

> IF(@BTN1 == true,'F',IF(@BTN2 == true, 'L','F'))

>

>

>

> It is giving the following error when i press on the

> check button after entered the formula.

> error.

>

> Bad or missing field "BTN1".

>

> so can u please correct me where i am done the

> mistake. i am requesting u to elabrate your

> explanation.

Hi,

You have two input controls which are visible. Add a toggle button, name it BTN1. Open its control properties and set default value to false.

Do it for BTN2 too.

Add custom actions for these two buttons.

Now add an expression box, (string) and name it STR1. Double click to open its control properties, check hidden checkbox, and paste the formula in the Default value.

Map the actions so that datasource takes values from your two fields and third from the expression field

Regards,

Sooraj

Former Member
0 Kudos

Hi Sooraj

Thanks for the quick reply. I am able to move forward. soory for bothering u

But when i copy this following formula to expression box .It is always picking up only "F" , Even if press the BTN1 or BTN2.

For confirmation , the expression box hidden attribute unchecked. so that this will be visible at the runtime and i can see what exactly passing to that. so it clearly showing the value in the expression is "F".

By the way i have found only "Expression" attribute for entering the formula in the "expression box". i have not found any default value attribute.

But can u tell me either of the buttons i press it is taking only "F" not the "L"

one question. when i copy this expression in the expression box, when click any of the button , will that automatically takes the corresponding value in the forumula if BTN1 == true. like that..

Regards

Vijay

IF(@BTN1 == true,'F',IF(@BTN2 == true, 'L','F'))

Former Member
0 Kudos

Hi,

You will be clicking either BTN1 or BTN2 only at a tim, rt?

Make sure you had default value = false for both BTN1 and BTN2.

Ok, remove the 'F' from the second if condition. set it blank like this.

IF(@BTN1 == true,'F',IF(@BTN2 == true, 'L',' ' )) and see the result.

The problem came as BTN1s default value was true. Then whatever you do on BTN2, it will not affect the expression box.

Sooraj

Former Member
0 Kudos

Hi Sooraj, Thnaks for the reply. I hope u may need to spend some time to read this test sceniorio's which i am explaining

I am clicking on the either of the buttons BTN1, BTN2 's only at a time.

I have set the default value = false for both buttons.

I have removed the "F" for the second if expression. For the confirmation, i have made expression as visible status true only, Now it is not showing the "F" by default.

But it is acting very diffrently, i will expalin u the scenorio's which i have tested.

One scenorio.

1) first time when the form loaded there is no value dispalying in the expression box.so i have entered the corresponding dates.

so when i click on the "BTN1" . it is displaying the "F" in the expression box. then i am gettin the respective values in the output table.

Again if click on the same "BTN1". with the same date range, it is clearing the epression box. showing as empty aswell as , it is clearing the table as empty.

Again if i click (3rd click) on the same "BTN1" , it will agin display the "F" and displaying the data.

2nd Scenorio.*when the expression box is cleared after 2nd click happend in the BTN1

This time with the same data range , when i click on the "BTN2" , now in the expression box displaying the "L", showing the corresponding data in expression box.

Again if i click on the same " BTN2" with the same data range. It is also acting like a BTN1 like clearing the expression box and clearing the data also.

Afain if click(3rd click..) on the same BTN2..it will act like same way BTN1 is acting.

3rd Sceniorio. when i click on the BTN2 when it is showing the "L" in the expression box and showing data. Then(this time expressin box is not clear it is holding the "L") next click if do on the "BTN1" it will display immediately ". Then

it will display the "F" in the expression box, and i am getting the corresponding data. Then again if click on the same "BTN1" then it is diplaying the "L" even if click on the BTN1" itself and displaying the "L" corresponding data.

This scenorio, on every click of the first Button it is displaying the alternatively "F", "L" showing the corresponding data.

This is really very strange for me ...

Regards

Vijay

ankur_garg5
Active Contributor
0 Kudos

Hi Vishal,

Ok, i am giving you a step by step solution, hope it works:

1)Drag a layer in your story board.

2)Put 3 input forms in this layer A, B, C

3)Put your <b>From Date</b> and <b>To Date</b> fields in your form A.

4)Don't put any button on this form A. Connect the output port of form A to both form B and form C

5)So now you would have both From Date and To Date fields available in Form B as well as form C. Let them be invisible.

6)Put an input field in form B and give its default value as "F" and make the field invisible.

7)Put an input field in form C and give its default value as "L" and make the filed invisible.

8)Put a button in form B and associate an event with it. Lets say the name of this event is <b>First</b>. Connect the output port of form B to your BAPI and associate the event as First on the connecting line.

9)Put a button in form C and associate an event with it. Lets say the name of this event is <b>Second</b>. Connect the output port of form C to your BAPI and associate the event as Second on the connecting line.

10)You need to give the Navigation Control of your iView as <b>Tab Strip</b>. This is needed because, now if you see your layout tab of your storyboard, you will see that the top header bars of the three input forms have disappeared. So now you can place the three forms in such a way that Form B and Form C lie horizontally under Form A.

Width of Form A = Width of Form B + Width of Form C

When you will deploy, you will not be able to make out that there are 3 forms, it will look as if there is only one form.

Do reward points if it solves your problem.

Bye

Ankur