PHP Check box in Flash
Hello all,
I have a flash form that has three checkboxes and some input
text boxes. My form uses a PHP script that works perfect for the
text but not the Check boxes. I'm not using the checkbox component,
I'm using a check box i got from flash kit. Below is the code for
the checkbox movie and my php code. What do I have to declare in
the my php file to have the check box work?
on (press) {
if (Number(CB_1) == 0) {
tellTarget ("checkbox1") {
gotoAndStop(2);
CB_1 = 1;
showstate1 = "yes";
} else {
tellTarget ("checkbox1") {
gotoAndStop(1);
CB_1 = 0;
showstate1 = "no";
This is my php code
<?
// Enter your contact email address here
$adminaddress = "[email protected]";
// Enter the address of your website here include
http://www.
$siteaddress ="www.mysite.com";
// Enter your company name or site name here
$sitename = "my site";
No need to change anything below unless you want to add or
subtract functions or change the wording of things sent back to the
flash file ...
// Gets the date and time from your server
$date = date("m/d/Y H:i:s");
// Gets the IP Address
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);
//Process the form data!
// and send the information collected in the Flash form to
Your nominated email address
if ($action != ""):
mail("$adminaddress","New User has Registered",
"A visitor at $sitename registered!\n
Personal Info
Name: $fname
Last Name: $lname
Address: $add
City: $city1
State: $state
Zip: $zip
Telephone: $tele
E-mail: $email
Recieve Free Book: $showstate1
Invitation to Seminar: $showstate2
Schedule Free Visit: $showstate3
Comments
$comment
Logged Info :
Using: $HTTP_USER_AGENT
Hostname: $ip
IP address: $REMOTE_ADDR
Date/Time: $date","FROM:$adminaddress");
//This sends a confirmation to your visitor
mail("$email","Thank You for visiting $sitename",
"Hi $fname,\n
We will process your request and send you a user name and
password within 48hrs.
Thank you for your registering at $sitename!\n
$sitename
$siteaddress","FROM:$adminaddress");
//Confirmation is sent back to the Flash form that the
process is complete
$sendresult = "Thank you for comments and questions. You will
receive a confirmation email shortly.";
$send_answer = "answer=";
$send_answer .= rawurlencode($sendresult);
echo "$send_answer";
1. You have not posting anything to show how Flash is
communicating wit the
server PHP script and it a guess that the variable in the
checkbox is not
getting sent.
2. Code with tellTarget is old and will be completely
obsolete as you want
to migrate this to newer and newer features in Flash for the
future.
Lon Hosford
www.lonhosford.com
Flash, Actionscript and Flash Media Server examples:
http://flashexamples.hosfordusa.com
May many happy bits flow your way!
"Asesino" <[email protected]> wrote in
message
news:[email protected]...
> Hello all,
> I have a flash form that has three checkboxes and some
input text boxes.
> My
> form uses a PHP script that works perfect for the text
but not the Check
> boxes.
> I'm not using the checkbox component, I'm using a check
box i got from
> flash
> kit. Below is the code for the checkbox movie and my php
code. What do I
> have
> to declare in the my php file to have the check box
work?
>
> on (press) {
> if (Number(CB_1) == 0) {
> tellTarget ("checkbox1") {
> gotoAndStop(2);
> }
> CB_1 = 1;
> showstate1 = "yes";
> } else {
> tellTarget ("checkbox1") {
> gotoAndStop(1);
> }
> CB_1 = 0;
> showstate1 = "no";
> }
> }
>
>
> This is my php code
>
> <?
>
> // Enter your contact email address here
> $adminaddress = "[email protected]";
>
> // Enter the address of your website here include
http://www.
> $siteaddress ="www.mysite.com";
>
> // Enter your company name or site name here
> $sitename = "my site";
>
> /*******************************************************
>
> No need to change anything below unless you want to add
or subtract
> functions
> or change the wording of things sent back to the flash
file ...
>
> *******************************************************/
>
> // Gets the date and time from your server
> $date = date("m/d/Y H:i:s");
>
> // Gets the IP Address
> if ($REMOTE_ADDR == "") $ip = "no ip";
> else $ip = getHostByAddr($REMOTE_ADDR);
>
> //Process the form data!
> // and send the information collected in the Flash form
to Your nominated
> email address
> if ($action != ""):
> mail("$adminaddress","New User has Registered",
> "A visitor at $sitename registered!\n
> ---------------------------------------------
> Personal Info
> Name: $fname
> Last Name: $lname
> Address: $add
> City: $city1
> State: $state
> Zip: $zip
> Telephone: $tele
> E-mail: $email
> ---------------------------------------------
> Recieve Free Book: $showstate1
> Invitation to Seminar: $showstate2
> Schedule Free Visit: $showstate3
> ---------------------------------------------
> Comments
> $comment
>
> ------------------------------
>
> Logged Info :
> ------------------------------
> Using: $HTTP_USER_AGENT
> Hostname: $ip
> IP address: $REMOTE_ADDR
> Date/Time: $date","FROM:$adminaddress");
>
> //This sends a confirmation to your visitor
> mail("$email","Thank You for visiting $sitename",
> "Hi $fname,\n
> We will process your request and send you a user name
and password within
> 48hrs.
> Thank you for your registering at $sitename!\n
>
> $sitename
> $siteaddress","FROM:$adminaddress");
>
> //Confirmation is sent back to the Flash form that the
process is complete
> $sendresult = "Thank you for comments and questions. You
will receive a
> confirmation email shortly.";
> $send_answer = "answer=";
> $send_answer .= rawurlencode($sendresult);
> echo "$send_answer";
>
>
>
>
Similar Messages
-
How to use check box in flash 8?
How to use check box in flash 8?
If you want it to happen when someone clicks the checkbox, then you need to add a listener for that event.
var cbListener:Object = new Object();
cbListener.click = function (evt:Object) {
if (cb.selected) {
gotoAndStop(2);
cb.addEventListener("click", cbListener);
(Note: "cb" and "cbListener" are names that were made up for this example. They could be anything you want to name them) -
PHP check boxes not sending info to DB? what am i missing
I have a checkbox that needs to stay checked but for some reason it isnt staying check as it is not passing the information to the database.
once the check is check it then directs to a new page
here is what i have so far..
there are three boxes then send to different pages and different columns in the DB but i have just included one as an example
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form3")) {
$updateSQL = sprintf("UPDATE plus_signup SET signedElease=%s WHERE userid=%s",
GetSQLValueString(isset($_POST['signedElease']) ? "true" : "", "defined","1","0"),
GetSQLValueString($_POST['userid'], "text"));
mysql_select_db($database_hostprop, $hostprop);
$Result1 = mysql_query($updateSQL, $hostprop) or die(mysql_error());
$updateGoTo = "e-lease.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $updateGoTo));
<form action="<?php echo $editFormAction; ?>" method="post" name="form3" id="form3">
<div align="right"><span id="sprycheckbox1">
<span class="body-text">E-Lease</span><br />
<input type="image" src="../images/smalldownload.png" width="35" height="35" alt="download" value="submit"/>
</a>
<input type="checkbox" name="SignedLeaseShed" id="leaseshedule" <?php if (!(strcmp(htmlentities($row_Recordset1['SignedLeaseShed'], ENT_COMPAT, 'utf-8'),"1"))) {echo "checked=\"checked\"";} ?> />
<br />
</span></div>
<input type="hidden" name="MM_update" value="form3" />
<input type="hidden" name="userid" value="<?php echo $row_Recordset1['userid']; ?>" />
</form>
<div id="ErrorZone"><span class="checkboxRequiredMsg">
<table width="400" border="1" cellspacing="0" cellpadding="0">
<tr>
<td><table width="400" border="0" cellspacing="10" cellpadding="0">
<tr>
<td>Agreement:<br /></td>
</tr>
<tr>
<td>By you ticking the box above 'Electronically Sign', you are confirming that you agree</td>
</tr>
<tr>
<td><strong>Terms and Conditions</strong></td>
</tr>
<tr>
<tr>
<td>I have read and understand the statement above</td>
</tr>
</table></td>
</tr>
</table>
</span></div>
<script type="text/javascript">
var sprycheckbox1 = new Spry.Widget.ValidationCheckbox("sprycheckbox1", {additionalError: 'ErrorZone'});
</script>
i was trying it another way but wanted to try this way aswell so i get a full understanding of it.
thanks in advanceWhat is the name of the form field you are evaluating in your update statement? What the name of the field on your form? Are they the same?
-
Problem getting check boxes and radio button to click with applescript
This is my script, it runs through without error, i can see the check box lightly flash like its being focused in on, but it wont actually check mark the box. it does this with all my check boxes and radio buttons.
tell application "Adobe InDesign CS3"
activate
end tell
tell application "System Events"
tell process "InDesign"
tell menu bar 1
click menu bar item 12
key code 125
key code 125
key code 124
key code 125
key code 125
key code 36
delay 1
end tell
tell window "Variable Links"
click checkbox "Use InDesign Tags Filter"
end tell
end tell
end tellHi craneium and welcome
For me this script fails, going through it step by step it seems confused, as I have highlighted out in the below code.
where is the window "Variable Links, may be I can help.
tell application "Adobe InDesign CS3"
activate
end tell
tell application "System Events"
tell process "InDesign"
tell menu bar 1
click menu bar item 12 --opens spotlight search in help
key code 125 -- highlights indesign help
key code 125 -- highlights welcome screen
key code 124 -- goes to apple
key code 125 -- goes to about this computer
key code 125 -- highlights software update
key code 36 -- starts software update
delay 1 -- ?
end tell
tell window "Variable Links" -- error cant get window variable links
click checkbox "Use InDesign Tags Filter"
end tell
end tell
end tell
Budgie -
Hi all,
I'm currently using this PHP script below for a form in a flash site.
http://www.flashadvisor.com/tutorial/Beginners/Custom_PHP_Email_Form-5.html
I wanted to add either a check box or radial box for an RSVP form that I'm creating where the person can check something like "are you attending, yes or no". How can I modify the script above to include that?
Thanksyou'll need to extract the data from your checkbox (use the selected property), assign it to a _level0 variable and add code to the php file to parse that variable.
but what you should do is look for a tutorial the uses loadvars to send and receive data to and from php. -
I am new to using flash and need to know how to add check boxes and forms
I have been going mad trying to figure this out as well as searching until exhaustion.
So I am hoping someone can point me in the right direction.
Okay here is what I am trying to accomplish.
I have laid out my design as a psd and brought it into adobe flash pro cs5.
I have menu items such as toppings that I want to put check boxes next to each and then once someone goes thru the page and places their choices,I want to be either be emailed what they have chosen from the form... This seems like it might be the easier of the ways to capture data, Or if there is a better way in flash to capture this data, I would take that as well.
SO here is as far as I can get.
Imported the psd and added one checkbox in front of the first item and labeled it strawberries. Now I really don't want the word strawberries to show up at all on the page,just the checkbox. But I am not sure if the label for the checkbox actually passes on the value of the checkbox.
I admit I am lost.
I did also slice and export this same image into dreamweaver and then I made a separate apDiv for each checkbox, and added into a form. It emails the results,but it is not outputting it in a very readable way.
Oh I also brought this int Flash Catalyst and added the checkboxes, but I don't know where to go from there.
So if anyone can let me know the proper way to do this or point me to some videos or tutorials or even a sample file that I can alter....
I would really appreciate it.
Thankshttp://www.flashloaded.com/userguides/ezform/formelements.html
-
Multiple check boxes in an update form using php
I have a database of the membership of a club. One field in the database is input by checking multiple check boxes. When the insert member record is submitted and multiple check boxes are selected, the information becomes an array of text separated by commas. When the user goes back to the update form, the check boxes are not showing checked in the appropriate fields. Please go to my test site where you will be able to see the code that I have created so far: http://www.usreboot.com/phphelp.php. You will find the php code for the update form in a pdf file located there. You will need a user name and password to look at the update record page. Here you go: user name: wyane, password: wayne. I have submitted this request in the past and have not found success so far. Thanks for your help, Wayne Rowlands
I am so close. If a member has only one check box checked. I get the check box checked in the update form. Here is the updated code:
If the member has a number of check boxes checked, none of the check boxes are checked. I am so close. Maybe you can figure out what I am missing. Thanks, Wayne -
Basic example on Check-boxes using AS3.0 in flash
Hi all,
I need a basic example containing 3 or 5 check-boxes and
should display the names of check-boxes which are
selected in a text-box.
Thanx a lot...Go to the help subject "CheckBox class" and click "view
examples": The example is an exact answer to your question :-) -
Check box w/validation form troubles
hello there, I am under a major, major Deadline!
I have a flash and php contact form with a validation made
with all input text boxes. I need to add 1 check box to the form,
but I don't know how to pass it to through.
here is the code I have for my form now.
function checkForm():Boolean {
// this checks whether required fields have been filled in
// initialize missing flag on assumption everything OK
var missing:Boolean = false;
// clear all error text fields
error1_txt.text = error2_txt.text=error3_txt.text="";
// check each field
// if problem is encountered, display message
// and set missing flag to true
if (text_field_1.text == "") {
error1_txt.text = "Please enter your name";
missing = true;
if (text_field_2.text.indexOf("@") == -1) {
error2_txt.text = "Please enter a valid email address";
missing = true;
if (text_field_5.text == "") {
error3_txt.text = "You have not entered any comments";
missing = true;
// if missing is true, return false
// otherwise return true
return missing ? false : true;
function sendMessage():Void {
// check whether form has been correctly filled in
var formOK:Boolean = checkForm();
// if no problems, process the form and send variables to
PHP script
if (formOK) {
// Form processing goes here
message.from = text_field_1.text;
message.email = text_field_2.text;
message.comments = text_field_5.text;
message.sendAndLoad("feedback.php?ck="+ new
Date().getTime(), messageSent);
// display message informing user that email is being sent
gotoAndStop("sending");
function backToForm():Void {
// send playhead back to the main form
gotoAndStop("theForm");
// create and apply text format for date
var dateDisplay:TextFormat = new TextFormat();
dateDisplay.font = "Georgia,Times,_serif";
theDate_txt.setNewTextFormat(dateDisplay);
theDate_txt.autoSize = "left";
// create LoadVars instance to retrieve date from PHP script
var getDate:LoadVars = new LoadVars();
// initialize LoadVars to send form data
// and receive response from the PHP script
var message:LoadVars = new LoadVars();
var messageSent:LoadVars = new LoadVars();
// load date from PHP
getDate.load("
http://localhost/phpflash/ch02/today2.php");
// assign theDate property of the LoadVars instance to text
field
getDate.onLoad = function() {
theDate_txt.text = this.theDate;
messageSent.onLoad = function() {
if (this.sent == "OK") {
gotoAndStop("acknowledge");
} else {
gotoAndStop("failure");
failure_txt.text = this.reason;
gotoAndStop("theForm");
any help would be greatly appreciated.
thanks,
hutchif by check box you mean a radio button, you can add the
following to your code: -
Multiple check boxes in an update form
I have a database of the membership of a club. One field in the database is input by checking multiple check boxes. When the insert member record is submitted and multiple check boxes are selected, the information becomes an array of text separated by commas. When the user goes back to the update form, the check boxes are not showing checked in the appropriate fields. Please go to my test site where you will be able to see the code that I have created so far: http://www.usreboot.com/phphelp.php. You will need a user name and password to look at the update record page. Here you go: user name: wyane, password: wayne. I have submitted this request in the past and have not found success so far. Thanks for your help, Wayne Rowlands
Thanks for getting back with me. I do have two tables. One table is the "members" table where all the information for the members is stored. One of the columns is "currentClubPositions". The database has another table which is "positions" which has the list for the positions that a member of the club could serve on. Members of the club may be serving on a number of positions at once, therefore the check boxes. Also, the club is adding and deleting positions over time, so I wanted an easy way to add them and delete them without having to go into phpmyadmin to do this. I have created a form that updates the "positions" table. The check boxes that show up in the insert member record and update member record are dynamic so that when the table "positions" changes, the forms change dynamically as do the queries to sort the database change dynamicaly. When the check boxes are entered, I use the implode function to make the values an array of text separated by commas and that value is inserted in one field of the members table named "currentClubPosition". I am all ears to hear a better way. Take a look at the web pages (see the original post) that I have created and you will see how all this ties together. Thanks, Wayne Rowlands
-
Hi All,
Iam new to these kind of programs.
have to put check boxes and text boxes in the list and then save it.
for example if 10 materials are displayed. for each material have to put check box and text box. if check box is checked and save button is clicked, only checked materials need to be saved along with value in text box.
Please let me know the code, valuable answers are rewarded.
Thanks in advance
joghi jog,
check the below links
How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
If u find it useful mark the points
Regards,
Naveen -
Form is not working of multiple form check boxs, source posted. HELP.
Form is not working of multiple form check boxs, source posted. HELP.
I'm trying to have golive form be able to check one, two or all of the options in Graphics field.
As is it will only post results from the last checked box.
Here's the page
http://www.perfection-press.com/Pages/ContactForm.html
Here's where source in golive has scanning,design,filesupplied.
[code removed to fix forum topic display]Since the checkboxes all have the same name, the values are over-writing each other when being passed to the PHP script. The best way to fix that is to add a pair of empty square [] brackets after the checkbox names, so make the names "graphics[]" instead of "graphics". That tells PHP that the values are being passed as a list (an array) instead of a single value. As long as your processing script knows what to do from there (and it does), should solve the problem.
By the way, I noticed that two of the checkboxes were named "graphics" and the other was "graphic" (singular). You'll want to fix that too so they're all the same. -
Can I get a sample program of ALV (oops) with check boxes in it. thank you.
Types: begin of lt_io.
include structure mara. " Your Structure
Types: style_table type lvc_t_style.
Types: end of lt_io.
data: lt_io type table of lt_io,
ls_layout type lvc_s_layo,
lt_fcat type lvc_t_fcat,
lo_grid type ref to cl_gui_alv_grid.
field-symbols: <io> type lt_io,
<fcat> type lvc_s_fcat.
... fill your output table ....
ls_layout-stylefname = 'STYLE_TABLE'.
loop at lt_io assigning <io>.
PERFORM set_style USING 'CHECKBOX' "Your Filename
CHANGING <io>.
endloop.
... Fill Your Field Catalog lt_fcat
read table lt_fcat assigning <fcat>
where fieldname = 'CHECKBOX'.
<fcat>-checkbox = 'X'.
create grid control lo_grid.
CALL METHOD lo_grid->set_table_for_first_display
EXPORTING
is_layout = ls_layout
CHANGING
it_fieldcatalog = lt_fcat
it_outtab = lt_io[].
FORM set_button_to_line
USING iv_fieldname TYPE lvc_fname
CHANGING cs_io TYPE io.
DATA: ls_style TYPE lvc_s_styl,
lt_style TYPE lvc_t_styl.
ls_style-fieldname = iv_fieldname.
if cs_io-checkbox = ' '.
ls_style-style = cl_gui_alv_grid=>mc_style_enabled.
else.
ls_style-style = cl_gui_alv_grid=>mc_style_disabled.
endif.
ls_style-maxlen = 2.
INSERT ls_style INTO TABLE io-style_table.
ENDFORM. "set_icon_to_status_line
[/code].
A classical report is a program that generates a single list, which must contain all of the required detail information.
1) This procedure may result in extensive lists from which the user has to pick the relevant data.
2) For background processing, this is the only possible method. After starting a background job, there is no way of influencing the program.
3) The desired selections must be made beforehand and the list must provide detailed information.
4) For dialog sessions, there are no such restrictions.
5) The user is present during the execution of the program and can control and manipulate the program flow directly.
6) To be able to use all advantages of the online environment, classical reporting was developed into interactive reporting.
ALV is Application List viewer. Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length. In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output. The report output can contain up to 90 columns in the display with the wide array of display options.
Advantages.
Collapse multiple reports into one, drastically cutting down your report development time
Save many hours using built-in ALV sorting, subtotaling and filtering capabilities
Add conditional structures into your ALV report: No programming required!
Combine ALV with display variants to meet a wide range of reporting requirements more easily
Dynamically reorder column layouts and add/subtract fields
Enable users and analysts to save their own personalized variants
All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
1. SIMPLE REPORT.
The important function modules are
a. Reuse_alv_list_display
b. Reuse_alv_fieldcatalog_merge
c. Reuse_alv_events_get
d. Reuse_alv_commentary_write
e. Reuse_alv_grid_display
A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
The important parameters are :
I. Export :
i. I_callback_program : report id
ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status
iii. I_callback_user_command : routine where the function codes are handled
iv. I_structure name : name of the dictionary table
v. Is_layout : structure to set the layout of the report
vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
II. Tables :
i. t_outtab : internal table with the data to be output
B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
The Important Parameters are :
I. Export :
i. I_program_name : report id
ii. I_internal_tabname : the internal output table
iii. I_inclname : include or the report name where all the dynamic forms are handled.
II Changing
ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is
declared in the type pool SLIS.
C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
Parameters :
I. Import :
Et_Events : The event table is returned with all possible CALLBACK events
for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
II. Export :
I_List_type :
0 = simple list REUSE_ALV_LIST_DISPLAY
1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
3 = hierarchical-sequential block list
REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
Parameters :
I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
This internal table has three fields :
Typ : H header, S selection , A - action
Key : only when typ is S.
Info : the text to be printed
E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
Parameters : same as reuse_alv_list_display
This is an example for simple list.
2. BLOCK REPORT
This is used to have multiple lists continuously.
The important functions used in this report are:
A. REUSE_ALV_BLOCK_LIST_INIT
B. REUSE_ALV_BLOCK_LIST_APPEND
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_BLOCK_LIST_DISPLAY
A. REUSE_ALV_BLOCK_LIST_INIT
Parameters:
I. I_CALLBACK_PROGRAM
II. I_CALLBACK_PF_STATUS_SET
III. I_CALLBACK_USER_COMMAND
This function module is used to set the default gui status etc.
B. REUSE_ALV_BLOCK_LIST_APPEND
Parameters :
Export :
I. is_layout : layout settings for block
II. it_fieldcat : field catalog
III. i_tabname : internal table name with output data
IV. it_events : internal table with all possible events
Tables :
i. t_outtab : internal table with output data.
This function module adds the data to the block.
Repeat this function for all the different blocks to be displayed one after the other.
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
This function module is used for hierarchical sequential blocks.
D. REUSE_ALV_BLOCK_LIST_DISPLAY
Parameters : All the parameters are optional.
This function module display the list with data appended by the above function.
Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
3. Hierarchical reports :
Hierarchical sequential list output.
The function module is
A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
Parameters:
I. Export:
i. I_CALLBACK_PROGRAM
ii. I_CALLBACK_PF_STATUS_SET
iii. I_CALLBACK_USER_COMMAND
iv. IS_LAYOUT
v. IT_FIELDCAT
vi. IT_EVENTS
vii. i_tabname_header : Name of the internal table in the program containing the
output data of the highest hierarchy level.
viii. i_tabname_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
ix. is_keyinfo : This structure contains the header and item table field
names which link the two tables (shared key).
II. Tables
i. t_outtab_header : Header table with data to be output
ii. t_outtab_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using REUSE_ALV_FIELDCATALOG_MERGE.
Important Attributes :
A. col_pos : position of the column
B. fieldname : internal fieldname
C. tabname : internal table name
D. ref_fieldname : fieldname (dictionary)
E. ref_tabname : table (dictionary)
F. key(1) : column with key-color
G. icon(1) : icon
H. symbol(1) : symbol
I. checkbox(1) : checkbox
J. just(1) : (R)ight (L)eft (C)ent.
K. do_sum(1) : sum up
L. no_out(1) : (O)blig.(X)no out
M. outputlen : output length
N. seltext_l : long key word
O. seltext_m : middle key word
P. seltext_s : short key word
Q. reptext_ddic : heading (ddic)
R. ddictxt(1) : (S)hort (M)iddle (L)ong
S. datatype : datatype
T. hotspot(1) : hotspot
declarations for spl.group.
GT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV
GT_SORT TYPE SLIS_T_SORTINFO_ALV, "for sort
DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR LS_SORT.
LS_SORT-FIELDNAME = 'FIELD1'.
LS_SORT-SPOS = 1.
LS_SORT-UP = 'X'.
ls_sort-subtot = 'X'. "subtotal
APPEND LS_SORT TO E06_LT_SORT.
APPEND LS_SORT TO E06_LT_SORT.
LS_SORT-FIELDNAME = 'FIELD2'.
LS_SORT-SPOS = 2.
LS_SORT-UP = 'X'.
ls_sort-subtot = 'X'. "subtotal
APPEND LS_SORT TO E06_LT_SORT.
for creating the group..
DATA: LS_SP_GROUP TYPE SLIS_SP_GROUP_ALV.
CLEAR LS_SP_GROUP.
LS_SP_GROUP-SP_GROUP = 'A'.
LS_SP_GROUP-TEXT = TEXT-005.
APPEND LS_SP_GROUP TO E07_LT_SP_GROUP.
and pass this info to FM...
layout-sUBTOTALS_TEXT = 'SUbt...'
and pass spl group info to fieldcatalog also...
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_SPECIAL_GROUPS = GT_SP_GROUP[]
IT_SORT = GT_SORT[]
TYPES :
BEGIN OF ty_vbak,
vkorg TYPE vbak-vkorg, " Sales organization
kunnr TYPE vbak-kunnr, " Sold-to party
vbeln TYPE vbak-vbeln, " Sales document
netwr TYPE vbak-netwr, " Net Value of the Sales Order
waerk TYPE vbak-waerk, " Document currency
END OF ty_vbak.
DATA:
vbak TYPE vbak,
gt_vbak TYPE TABLE OF ty_vbak.
SELECT-OPTIONS :
s_vkorg FOR vbak-vkorg, " Sales organization
s_kunnr FOR vbak-kunnr, " Sold-to party
s_vbeln FOR vbak-vbeln. " Sales document
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
Form f_read_data
FORM f_read_data.
SELECT vkorg kunnr vbeln netwr waerk
UP TO p_max ROWS
INTO TABLE gt_vbak
FROM vbak
WHERE kunnr IN s_kunnr
AND vbeln IN s_vbeln
AND vkorg IN s_vkorg.
ENDFORM. " F_READ_DATA
Form f_display_data
FORM f_display_data.
TYPE-POOLS: slis. " ALV Global types
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = 'VBAK'.
ls_fieldcat-do_sum = &2.
ls_fieldcat-cfieldname = &3.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
ls_sort-subtot = &2.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
ls_layout TYPE slis_layout_alv.
m_fieldcat 'VKORG' '' ''.
m_fieldcat 'KUNNR' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'NETWR' 'X' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
m_sort 'VKORG' 'X'. " Sort by vkorg and subtotal
m_sort 'KUNNR' 'X'. " Sort by kunnr and subtotal
m_sort 'VBELN' ''. " Sort by vbeln
ls_layout-cell_merge = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = gt_vbak.
ENDFORM.
Check out these sample programs
BCALV_GRID_01
This program illustrates how the events for print processing PRINT_TOP_OF_PAGE,
PRINT_END_OF_PAGE, PRINT_TOP_OF_LIST,PRINT_END_OF_LIST are handled. The
corresponding handler methods control the appearance of the list printed.
BCALV_GRID_02
Show a detail list in an amodal window. There is no second dynro needed in contrast to
BCALV_GRID_03.
BCALV_GRID_03
This program implements a function on event DOUBLE_CLICK. According to the selected line data
from table SBOOK is selected and displayed by a second ALV Control in a dialog dynpro.
BCALV_GRID_04
Illustrates the use of exceptions (lights or leds). According to the values of SFLIGHT-SEATSOCC, the
lights are set to 1 (red), 2 (yellow) or 3 (green).
BCALV_GRID_05
Demonstrate the creation of an own toolbar button.
BCALV_GRID_06
Demonstrate the creation of an own context menu.
BCALV_GRID_07
Append a menu button to the standard toolbar.
BCALV_GRID_08
Append a menu with default button to the standard toolbar. It is exactly the same as
BCALVC_TB_WITH_MENU except for methods HANDLE_MENU_BUTTON and HANDLE_TOOLBAR.
Editable ALV grids
BCALV_EDIT_01
This report illustrates the simplest case of using an editable/noneditable ALV Grid Control.
BCALV_EDIT_02
This report illustrates how to set chosen cells of an ALV Grid Control editable.
BCALV_EDIT_03
In this example the user may change values of fields SEATSOCC (occupied seats) and/or PLANETYPE.
The report checks the input value(s) semantically and provides protocol messages in case of error
BCALV_EDIT_04
This report illustrates how to add and remove lines to a table using the ALV Grid Control and how to
implement the saving of the new data.
BCALV_EDIT_05
This example shows how to use checkboxes within an ALV Grid Control. You learn:
(1) how to define a column for editable checkboxes for an attribute of your list
(2) how to evaluate the checked checkboxes
(3) how to switch between editable and non-editable checkboxes
BCALV_EDIT_06
This example shows how to define a dropdown listbox for all cells of one column in an editable ALV
Grid Control.
BCALV_EDIT_07
This example shows how to define dropdown listboxes for particular cells of your output table.
BCALV_EDIT_08
This report implements an ALV Grid Control with an application specific F4 help. The following aspects
are dealt with:
(1) how to replace the standard f4 help
(2) how to pass the selected value to the ALV Grid Control
(3) how to build an f4 help, whose value range depend on a value of another cell.
Check this link tooo
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/07/23/oopsALVin+ABAP&showComments=true
The ALV Grid Control is a tool with which you can output non-hierarchical lists in a
standardized format. The list data is displayed as a table on the screen.
The ALV Grid Control offers a range of interactive standard list functions that users need
frequently (find, sort, filter, calculate totals and subtotals, print, print preview, send list,
export list (in different formats), and so on. These functions are implemented in the
proxy object class. You as the programmer have the possibility to turn off functions not
needed. In most cases the implementations of the standard functions provided by the
control are sufficient. However, if required, you can adjust these implementations to
meet application-specific needs.
You can add self-defined functions to the toolbar, if necessary.
The ALV Grid Control allows users to adjust the layout of lists to meet their individual
requirements (for example, they can swap columns, hide columns, set filters for the
data to be displayed, calculate totals, and so on). The settings (list customizing) made
by a specific user are called a display variant. Display variants can be saved on a userspecific
or on a global basis. If such display variants exist for a list, they can be offered
to the user for selection. If a display variant is set as the default variant, the associated
list is always displayed based on the settings of this variant.
2. REUSE_ALV_LIST_DISPLAY
REUSE_ALV_GRID_DISPLAY
REUSE_ALV_FIELDCATALOG_MERGE
REUSE_ALV_COMMENTARY_WRITE
3. Use of Field Catalog is to determines the technical properties & add formating information of the column.
6. all the definition of internal table, structure, constants are declared in a type-pool called SLIS.
7.fieldcat-fieldname
fieldcat-ref_fieldname
fieldcat-tabname
fieldcat-seltext_m
5. Form user_command using r_ucomm like sy-ucomm rs_selfield type slis_selfield.
Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length.
In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output.
The report output can contain up to 90 columns in the display with the wide array of display options.
The commonly used ALV functions used for this purpose are;
1. REUSE_ALV_VARIANT_DEFAULT_GET
2. REUSE_ALV_VARIANT_F4
3. REUSE_ALV_VARIANT_EXISTENCE
4. REUSE_ALV_EVENTS_GET
5. REUSE_ALV_COMMENTARY_WRITE
6. REUSE_ALV_FIELDCATALOG_MERGE
7. REUSE_ALV_LIST_DISPLAY
8. REUSE_ALV_GRID_DISPLAY
9. REUSE_ALV_POPUP_TO_SELECT
Purpose of the above Functions are differ not all the functions are required in all the ALV Report.
But either no.7 or No.8 is there in the Program.
How you call this function in your report?
After completion of all the data fetching from the database and append this data into an Internal Table. say I_ITAB.
Then use follwing function module.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'Prog.name'
I_STRUCTURE_NAME = 'I_ITAB'
I_DEFAULT = 'X'
I_SAVE = 'A'
TABLES
T_OUTTAB = I_ITAB.
IF SY-SUBRC <> 0.
WRITE: 'SY-SUBRC: ', SY-SUBRC .
ENDIF.
ENDFORM. " GET_FINAL_DATA
The object F_IT_ALV has a field, the activity ACTVT, which can
contain four permitted values: 01, 02, 03 and 70. Each of the
activities 01, 02 and 70 controls the availability of particular
functions (in the menu and the toolbar) of the ALV line item list:
a) 01: "Settings -> Display variant -> Save..."
b) 02: "Settings -> Display variant -> Current..." and
"Settings -> Display variant -> Current header rows "
c) 70: "Settings -> Display variant -> Administration..."
Activity 03 corresponds to the minimum authorization, which is the
most restricted one: The user can only select layouts which have
been configured already. In particular, all of the other functions
named above are inactive with activity 03.
Now if you want to permit a user to change the column selection and
the headers as well as to save the layout thus created, for example,
but if you do not want to permit the user to administrate the
layouts, you grant him or her the authorization for activities 01
and 02.
Check this link it will be mosty usefull for u
http://www.sap-img.com/fu017.htm
check this link
http://abapprogramming.blogspot.com/
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5dc3e690-0201-0010-1ebf-b85b3bed962d
Changing width of a custom container dynamically
Display Page numbers in ALV
Insert picture in selection screen.
Logo in OO ALV Grid
check these links
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
Try these links
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
For More alv report examples check these Tcodes LIBS, BIBS Here u can find more number of examples on alv reports of different kinds
check this sample code for intercative alv report
TYPE-POOLS: SLIS.
*type declaration for values from ekko
TYPES: BEGIN OF I_EKKO,
EBELN LIKE EKKO-EBELN,
AEDAT LIKE EKKO-AEDAT,
BUKRS LIKE EKKO-BUKRS,
BSART LIKE EKKO-BSART,
LIFNR LIKE EKKO-LIFNR,
END OF I_EKKO.
DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
WA_EKKO TYPE I_EKKO.
*type declaration for values from ekpo
TYPES: BEGIN OF I_EKPO,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
END OF I_EKPO.
DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
WA_EKPO TYPE I_EKPO .
*variable for Report ID
DATA: V_REPID LIKE SY-REPID .
*declaration for fieldcatalog
DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
declaration for events table where user comand or set PF status will
be defined
DATA: V_EVENTS TYPE SLIS_T_EVENT,
WA_EVENT TYPE SLIS_ALV_EVENT.
declartion for layout
DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
declaration for variant(type of display we want)
DATA: I_VARIANT TYPE DISVARIANT,
I_VARIANT1 TYPE DISVARIANT,
I_SAVE(1) TYPE C.
*PARAMETERS : p_var TYPE disvariant-variant.
*Title displayed when the alv list is displayed
DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
INITIALIZATION.
V_REPID = SY-REPID.
PERFORM BUILD_FIELDCATLOG.
PERFORM EVENT_CALL.
PERFORM POPULATE_EVENT.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_REPORT.
*& Form BUILD_FIELDCATLOG
Fieldcatalog has all the field details from ekko
FORM BUILD_FIELDCATLOG.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'AEDAT'.
WA_FIELDCAT-SELTEXT_M = 'DATE.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'LIFNR'.
WA_FIELDCAT-NO_OUT = 'X'.
WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG
*& Form EVENT_CALL
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "EVENT_CALL
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
ENDIF.
ENDFORM. "POPULATE_EVENT
*& Form data_retrieval
retreiving values from the database table ekko
FORM DATA_RETRIEVAL.
SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
ENDFORM. "data_retrieval
*& Form bUild_listheader
text
-->I_LISTHEADEtext
FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA HLINE TYPE SLIS_LISTHEADER.
HLINE-INFO = 'this is my first alv pgm'.
HLINE-TYP = 'H'.
ENDFORM. "build_listheader
*& Form display_alv_report
text
FORM DISPLAY_ALV_REPORT.
V_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = I_TITLE_EKKO
I_GRID_SETTINGS =
IS_LAYOUT = ALV_LAYOUT
IT_FIELDCAT = I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'ZLAY1'
I_SAVE = 'A'
is_variant = i_variant
IT_EVENTS = V_EVENTS
TABLES
T_OUTTAB = IT_EKKO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "display_alv_report
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
PERFORM BUILD_FIELDCATLOG_EKPO.
PERFORM EVENT_CALL_EKPO.
PERFORM POPULATE_EVENT_EKPO.
PERFORM DATA_RETRIEVAL_EKPO.
PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_EKPO.
ENDCASE.
ENDFORM. "user_command
*& Form BUILD_FIELDCATLOG_EKPO
text
FORM BUILD_FIELDCATLOG_EKPO.
WA_FIELDCAT-TABNAME = 'IT_EKPO'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKPO'.
WA_FIELDCAT-FIELDNAME = 'EBELP'.
WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MENGE'.
WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-SELTEXT_M = 'UOM'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'NETPR'.
WA_FIELDCAT-SELTEXT_M = 'PRICE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG_EKPO
*& Form event_call_ekpo
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL_EKPO.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH -
ALV - Desactivate Check box on a specific line
Hello all,
I need your help for desactivate my checkbox on ALV GRID on specific line.
See on the screen shot on the link :
http://www.casimages.com/img.php?i=101006040322252671.jpg
See the implementation of my ALV and my Catalog :
g_container type scrfname value 'BCALV_GRID_DEMO_0100_CONT1',
g_grid type ref to cl_gui_alv_grid,
g_custom_container type ref to cl_gui_custom_container,
g_event_receiver type ref to lcl_event_receiver,
gt_fieldcat type lvc_t_fcat,
gs_layout type lvc_s_layo.
types: begin of gs_outtab.
types: checkbox type c. "field for checkbox
* §B1.Extend your output table by a field to dis- or enable
* cells for input.
types: celltab type lvc_t_styl. "field to switch editability
include structure zpvprevmaj.
types: end of gs_outtab.
form build_fieldcat changing pt_fieldcat type lvc_t_fcat.
call function 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZPVPREVMAJ'
CHANGING
ct_fieldcat = pt_fieldcat.
*§A2.Add an entry for the checkbox in the fieldcatalog
clear ls_fcat.
ls_fcat-fieldname = 'CHECKBOX'.
* Essential: declare field as checkbox and
* mark it as editable field:
ls_fcat-checkbox = 'X'.
ls_fcat-edit = 'X'.
* do not forget to provide texts for this extra field
ls_fcat-coltext = text-f01.
ls_fcat-tooltip = text-f02.
ls_fcat-seltext = text-f03.
* optional: set column width
ls_fcat-outputlen = 2.
append ls_fcat to pt_fieldcat.
endform. "build_field
gs_layout-stylefname = 'CELLTAB'.
gs_layout-info_fname = 'LINE_COLOR'.
perform color_line.
call method g_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_fieldcatalog = gt_fieldcat
it_outtab = gt_outtab[].
"it_sort = it_sortcat.
Thank you very much for your answers
Edited by: Emilien P. on Oct 6, 2010 4:10 PM
Edited by: Emilien P. on Oct 6, 2010 4:13 PMI think is no possible with the style i try a little tutorial. I have test the style for normal cell and in comment i test with the check box and the checkbox always display !! :
You can easly test this program in SAP and if anyone arrive to no display the checkbox in line 6, he will be my god Thank you :
report ZCO_AFFACT_TEST.
TYPE-POOLS: SLIS.
*- Fieldcatalog
DATA: IT_FIELDCAT TYPE LVC_T_FCAT.
DATA: X_FIELDCAT TYPE LVC_S_FCAT.
DATA: X_LAYOUT TYPE LVC_S_LAYO.
" FOR DISABLE
DATA: LS_EDIT TYPE LVC_S_STYL,
LT_EDIT TYPE LVC_T_STYL.
" FOR DISABLE
DATA: BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
STYLE TYPE LVC_T_STYL, "FOR DISABLE
END OF IT_VBAP.
DATA: LS_OUTTAB LIKE LINE OF IT_VBAP.
SELECT VBELN
POSNR
UP TO 10 ROWS
INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
FROM VBAP.
DATA:L_POS TYPE I VALUE 1.
CLEAR: L_POS.
L_POS = L_POS + 1.
X_FIELDCAT-SELTEXT = 'VBELN'.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-EDIT = 'X'.
"Delete commentary for test with check box.
"X_FIELDCAT-CHECKBOX = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
x_fieldcat-ref_field = 'VBELN'.
x_fieldcat-ref_table = 'VBAK'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SELTEXT = 'POSNR'.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
"FOR DISABLE HERE 6ROW IS DISABLED
SY-TABIX = 6.
LS_EDIT-FIELDNAME = 'VBELN'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 10.
INSERT LS_EDIT INTO TABLE LT_EDIT.
LS_EDIT-FIELDNAME = 'POSNR'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 6.
INSERT LS_EDIT INTO TABLE LT_EDIT.
INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-STYLE.
MODIFY IT_VBAP INDEX SY-TABIX FROM LS_OUTTAB TRANSPORTING
STYLE .
X_LAYOUT-STYLEFNAME = 'STYLE'.
" UP TO HERE
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT_LVC = X_LAYOUT
IT_FIELDCAT_LVC = IT_FIELDCAT
TABLES
T_OUTTAB = IT_VBAP[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Edited by: Emilien P. on Oct 7, 2010 3:09 PM -
Making Check box a required field
Hi Guys,
I am currently creating a form to put on my website and it is
working okay. However, I want a check box for people to tick
confirming they have read the terms and conditions.
I cannot work out how to make it so the form will not send
without the box bring ticked.
If i could get it set up so that when trying to submit the
form without having the box ticked it would leave a message
explaining the box needs to be ticked that would be good to!
Can anyone help me please? Am at my wits end!!!On 19 Mar 2007 in macromedia.dreamweaver, jameshuk wrote:
> I am currently creating a form to put on my website and
it is
> working okay. However, I want a check box for people to
tick
> confirming they have read the terms and conditions.
>
> I cannot work out how to make it so the form will not
send without
> the box bring ticked.
>
> If i could get it set up so that when trying to submit
the form
> without having the box ticked it would leave a message
explaining
> the box needs to be ticked that would be good to!
The only way to do that client-side is with Javascript (which
is not a
bad measure for cutting down on spambots), but it's not
reliable. The
only way to do it reliably is serverside. PHP:
<?php
if ($_POST['checkbox'] == 'checked') {
// Process form
} else {
// Send back to check checkbox
?>
Joe Makowiec
http://makowiec.net/
Email:
http://makowiec.net/email.php
Maybe you are looking for
-
Converting a Wide String to unsigned long long?
Hi there, I am looking for a way to convert a string to unsigned long long on Solaris. On AIX and Linux, there is wcstoull. However, I do not find that in solaris. So, I plan to use swscanf ( str, L"%llu", &val). However, running thru Rational Purify
-
HOW TO DISPLAY MY OWN PF STATUS IN ALV LIST DISPLAY
Hi All, i am developing one program in this program i am displaying output by using alv list display. after displaying the out SAP predefined pf status is coming. here i need my own pf status. any body can send me the sample code ir modify my code if
-
REP-56092 WHEN RUN REPORT IN WEB LAYOUT
I have installed report 9iDS and can run report in paper layout without any problem. However , when I press "Run Web Layout" button , I get message rep-56092 NO CLASS DEFINED FOR DESTINATION TYPE SCREEN WHEN RUN WEBLAYOUT. Do anybody has idea why thi
-
Is there any limit for VISA allocate DMA memory ?
Hi, I have get an error: -1073807300, when I allocate memory for DMA larger than 4M Bytes. Is there any limit for allocate memory for DMA ? I have run the attach vi on win7 32bit or 64bit, It seems there is a limit at about 4M Bytes. However I can al
-
Lightroom CS 5.5 Catalog Won't Open - So much work lost.
My Most important Lightroom CS5.5 Catalog won't open. I have a Mac. I guess it didn't shut down properly. I called support and was not allowed to speak with technical support. I have hundreds of hours of work which are lost if I cannot open it. The e