cancel
Showing results for 
Search instead for 
Did you mean: 

BSP Help

Former Member
0 Kudos

Hi,

I am new to BSP...

I have a issue to be done where

in the display I have the check boxes, and for the selected values,I have to delete corresponding values/fiels from the DB.

I think I have to pass the selected values to a new IT.....

But I have no clue how to pass the selected values to new IT.

I want some help regarding ,creating an IT and passing the selected values into the same and finally deleting the corresponding values from the DB.

I am attaching the present code in it.

If any other detail required, pls do let me know.

OnInputProcessing..

  • event handler for checking and processing user input and

  • for defining navigation

DATA: USER_TYPE(12) TYPE C.

  • These variables are used for setting the cookie.

DATA: USR TYPE STRING,

EDATE TYPE SY-DATUM,

ETIME TYPE SY-UZEIT.

USER_TYPE = REQUEST->GET_FORM_FIELD( NAME = 'id_name' ).

CASE EVENT_ID.

WHEN 'select'.

  • pass variables to next page

NAVIGATION->SET_PARAMETER( NAME = 'email' ).

NAVIGATION->SET_PARAMETER( NAME = 'contract_date' ).

NAVIGATION->SET_PARAMETER( NAME = 'system' ).

NAVIGATION->SET_PARAMETER( NAME = 'description' ).

NAVIGATION->SET_PARAMETER( NAME = 'reason' ).

NAVIGATION->SET_PARAMETER( NAME = 'id_name' VALUE = USER_TYPE ).

NAVIGATION->GOTO_PAGE( 'SUBMIT.HTM' ).

WHEN 'back'.

NAVIGATION->GOTO_PAGE( 'MAIN.HTM' ).

WHEN 'back'.

NAVIGATION->GOTO_PAGE( 'MAIN.HTM' ).

ENDCASE.

The Layout.

<%@page language="abap"%>

<!-- Presents user with a list of accounts that exist on target system

based-->

<!-- on the SEA that was entered. -->

<%

data: userids_wa type t_userids_wa,

user3_wa type t_user_wa,

zusr01_wa type t_zusr01_wa,

systems_wa type t_zaum_systems_wa.

%>

<html>

<head>

<title> SAP User Capability Validation/Modification Web App (UCWA) </title> </head>

<!-- Include portal header and navigation components... --> <%@ include file = "header.htm" %>

<h2>SAP User Request Form</h2>

<body class="bspBody1">

<%

loop at it_userid into userids_wa.

endloop.

loop at it_systems into systems_wa.

endloop.

%>

<form name="role_confirmation" method="post"> <table>

<!List user accounts that belong to the SEA that was entered> <p> Here are the following accounts that belong to the email address that you provided. Please choose the role that you wish to remove:

</p>

<p>

<b> SAP ID: <%=userids_wa-uname%> </b>

</p>

<p>

<table width="75%" border = 1>

<tr>

<td>

</td>

</tr>

<%loop at it_user3 into user3_wa where sod_lvl > 0.%> <%at first.%> <tr> <td><b> SYSTEM</b></td> <td><b> ROLE NAME </b></td> <td><b> ENABLES </b></td> </tr> <%endat.%> <tr> <td> <input type="checkbox"

name="id_role" >

</td>

<td>

<%= user3_wa-agr_name%>

</td>

<td>

<%= user3_wa-func_id1%> , <%= user3_wa-func_id2%> </td>

</tr>

<%

endloop.

%>

</table>

</p>

<p>

<tr>

<td>

<input type="submit" name="OnInputProcessing(select)" value="Remove selected roles"> <input type="submit" name="OnInputProcessing(select)" value="No Changes, all roles required"> <input type="submit" name="OnInputProcessing(back)" value="Back to main page">

</td>

</tr>

</p>

</table>

</form>

<%

%>

</body>

<%@ include file = "footer.htm" %>

</html>

Thanks,

Ajaz

Accepted Solutions (1)

Accepted Solutions (1)

norbertk
Participant
0 Kudos

hi syed,

at first, you would have to supply your checkboxes with a value, e.g. <input type="checkbox"

name="id_role" value="<%= user3_wa-role_id %>">.

within oninputprocessing, you can then add the selected ids to an internal table in this way:

request->get_form_fields( CHANGING fields = lt_fields ).

LOOP AT lt_fields INTO ls_fields WHERE name = 'id_role'.

ls_struct-role_id = ls_fields-value.

APPEND ls_struct TO lt_tab.

ENDLOOP.

then you can do what you want with your int. table, or do the delete directly within the above loop, or...

hope this helps,

norbert koelbl

Former Member
0 Kudos

Hi Norbert,

Thanks for ur valuable code.

In the, request->get_form_fields( CHANGING fields = lt_fields ).

when compiled, it shows that

ME-> IT_FIELDS is not type-compatible with FORMAL PARAMETER "FIELDS".

I have declared an Internal table IT_USER3, to fetch the values. How to proceed.

Awaiting for your reply at the earliest.

Thanks

Ajaz

norbertk
Participant
0 Kudos

lt_fields has to be of type TIHTTPNVP

Former Member
0 Kudos

Hi Syed,

Why dont you try <htmlb:tableView> for this purpose.

Check sample application SBSPEXT_TABLE, execute multiselect.bsp.

Cheers

Ankur

Former Member
0 Kudos

Hi,

Thanks for the update regarding the type for it_fields.

I still find it difficult to proceed.

LOOP AT it_fields INTO ws_fields WHERE name = 'role_id'.

ls_struct-role_id = ls_fields-value.

APPEND ls_struct TO lt_tab.

ENDLOOP.

I have used ws_fields...what should be its type declaration, ls_struct..? ls_fields, and finally lt_tab.

I am sure, you would be able to help me through.

Once through, I assure u that I would reward ur solution with best points.

Thanks in Advance.

Ajaz

norbertk
Participant
0 Kudos

data: it_fields type TIHTTPNVP,

ws_fields like line of lt_fields.

and the loop something like that:

LOOP AT it_fields INTO ws_fields WHERE name = 'role_id'.

ws_USER3-role_id = ls_fields-value.

ws_user3-... = ...

APPEND ws_USER3 TO IT_USER3.

ENDLOOP.

does that help?

Former Member
0 Kudos

Hi,

Thanks for the update again,

is it

LOOP AT it_fields INTO ws_fields WHERE name = 'role_id'.

ws_USER3-role_id = ws_fields-value.

ws_user3-uname = ws_fields-value.

endloop.

In the table it_fields, the values r not updating.

you had mentioned

ws_USER3-role_id = ls_fields-value.

what is ls_fields??

waiting for ur update.

Thanks

Ajaz

norbertk
Participant
0 Kudos

ls_fields was an error by me, it has to be ws_fields.

i try to make it clear:

it_fields contains the name-value-pairs of all your form-fields, and there should be several entries with name 'role_id' if several role_id-checkboxes are selected.

i don't know what you want to do with the role_ids. if you want to update your it_user3, then you could do it like this:

modify it_user3 from ws_user3.

Former Member
0 Kudos

Hi,

Sorry for keeping u troubled.

my code is

data ws_user3 type ygtest.

data: it_fields type TIHTTPNVP,

ws_fields like line of it_fields.

LOOP AT it_fields INTO ws_fields WHERE name = 'role_id'.

ws_user3-uname = ws_fields-value.

ws_user3-AGR_NAME = ws_fields-value.

ws_user3-FUNC_ID1 = ws_fields-value.

ws_user3-FUNC_ID2 = ws_fields-value.

ws_user3-SOD_LVL = ws_fields-value.

ws_USER3-role_id = ws_fields-value.

endloop.

While debugging, i find the corresponding fields in the table it_fields-name = sap-params

it_fields-value =ZW1haWw9c2hhaWslMmVzYWxlZW0lNDBocCUyZWNvbSZjb250cmFjdF9kYXRlPSs<

getting display of role_id for 8 rows, with blank values.

...

oninputpro<select

system |DVL..

There r no other values being updated for ws_user3.

can u provide some help, why role_id is not getting updated in it_fields.

Thanks

Ajaz

norbertk
Participant
0 Kudos

are the role_id's written into the checkbox-values?

<input type="checkbox"

name="id_role" value="<%= user3_wa-role_id %>">

you could check it by looking into the html-source...

Former Member
0 Kudos

Hi,

thanks for the pain taken...

well the code in the layout is

<td>

<input type="checkbox"

name="role_id" value="<%= user3_wa-role_id %>">.

</td>

For each selected checkbox, I find the row of role_id in the table lt_fields. but the values r empty.

dont know how to proceed with that....

Thanks

Ajaz

norbertk
Participant
0 Kudos

hm... is your it_user3 correctly filled with the role-ids when you loop over it? could you set a breakpoint at the corresponding line in the layout or just look into to the resulting html-source?

Former Member
0 Kudos

Hi Norbert,

The field, it_user3-role_id is not being updated, it is Blank.

What could be the value for role_id.

In declaration, Role_id is dec as char(1).

Thanks,

Ajaz

Former Member
0 Kudos

Hi Norbert,

the table it_user3, which has the value role_id of charecter data type has to be assigned a value 'X', when the check boxes are selected, in the WEB PAGE. But that logic is yet to be done.

Hope the problem could be solved.

Thanks again,

Ajaz

norbertk
Participant
0 Kudos

hi again,

i fear i don't know what you exactly want to achieve, but perhaps you can try this if i understand it correctly:

<input type="checkbox" name="role_id" value="<%= sy-tabix %>">.

and

data: lf_tabix type i.

LOOP AT it_fields INTO ws_fields WHERE name = 'role_id'.

lf_tabix = ws_fields-value.

read table it_user3 into ws_user3 index lf_tabix.

ws_user3-role_id = 'X'.

modify it_user3 from ws_user3.

endloop.

Former Member
0 Kudos

Hi Norbert,

Well thanks for keeping updated me regardingly.

I have almost solved the problem off.

I had to call the cookies for getting the corresponding values.

Regards,

Ajaz

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I'm not sure what you mean by the following:

" think I have to pass the selected values to a new IT."

What do you mean "new IT"?

Do you need help with the event handeling? Or is the actual database update that you want help with?

Former Member
0 Kudos

Hi Thomas,

Thanks for the reply.

IT meant Internal Table.

I actually want to catch the selected rows in an Internal table. From there I want to do the further processing.

Hope I am clear.

Awaiting for ur reply.

Thanks

Ajaz