Checked box validation
Hi All,
I am using oracle Forms 10G on windows.
I need help on how to validate that only one check box is checked in detail block. I have multiple records in the detail block and I have check boxes for each record in the detail block.
I have a button to select the values from the detail records where the check box is checked. But I want to make sure that only one record is check not more than one.
And How to move the cursor to the checked record if the focus or cursor is in an unchecked record.
Thanks,
One way would be to create a forms level variable (Global, Parameter item, Forms Package Specificaiton, etc) to record the record number of a checked record. Each time a user clicks a check box, you would check your variable to see if it is greater than 0. If its greater than zero then you know the user has already checked a check box and you know which record needs to be unchecked. Another option would be to just pop a message to the user to uncheck any checked records. I like the first option because it is more user friendly. Here is a code sample. I like using Forms Package spec variables because of they have a smaller memory footprint, but you can use a Block item, Parameter, Global, etc to record the record variable.
/* Sample When-Checkbox-Changed trigger */
DECLARE
n_curr_record NUMBER := 0;
BEGIN
IF ( Forms_Var.checked_record > 0 ) THEN
n_curr_record := :system.trigger_record;
/* Forms_VAR is a Forms Program Unit Package Specification */
Go_Record(Forms_VAR.Checked_Record);
:YOUR_BLOCK.YOUR_CHECKBOX_ITEM := 0;
/* Assumes you are using 0 = unchecked and 1 = checked */
Go_Record(n_curr_record);
/* return to the current record */
END IF;
END;Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly.
Similar Messages
-
Check Box Validation in Offline Form
Dear Experts,
I have a requirement in an offline form where I have six check boxes, and out of the six check boxes
user can only select any three.
Request you to please suggest how to achieve this.
Warm Regrads,
Upendra AgrawalThanks a ton Shaira.
Full points to you
Just wondering what is the "Validation Script Message" for each UI.
warm regards,
Upendra Agrawal -
Problem in check box validation
Hi All
I have designed a form in screen painter which contains the employee details.
I have kept two check boxes MALE and FEMALE with itemuid as chmale and chfemale.
I wont to do some validation.
It is check box so I can check both of them,so I need to do validation
My code
Case SAPbouiCOM.BoEventTypes.et_CLICK
Try
Select Case pVal.ItemUID
Case "chmale"
oCheckFemale = oForm.Items.Item("chfemale").Specific
If oCheckFemale.Checked = True Then
oCheckMale.Checked = True
oCheckFemale.Checked = False
End If
Case "chfemale"
oCheckMale = oForm.Items.Item("chmale").Specific
If oCheckMale.Checked = True Then
oCheckMale.Checked = False
oCheckFemale.Checked = True
End If
End Select
This is not working.
SAP hangs up for some time.Hi,
You are missing with BubbleEvent=true;
Below is My Code in C# and its working perfactly for the same requirement as yours.
I have Done it on ItemClick BeforeAction
oCheckBox1 = (SAPbouiCOM.CheckBox)oForm.Items.Item("4").Specific;
oCheckBox2 = (SAPbouiCOM.CheckBox)oForm.Items.Item("5").Specific;
if (pVal.ItemUID == "4" && oCheckBox1.Checked == false)
oCheckBox2.Checked = false;
if (pVal.ItemUID == "5" && oCheckBox2.Checked == false)
if (oCheckBox1.Checked == true)
oCheckBox1.Checked = false; -
Hello all,
I need to perform validations on text field. I have two check boxes and by checking any one or both of them, a combination of text fields appear. I want to write four validations and one of them is shown below. I just have the basic idea, can anyone help me in writing it the correct way and what validation method(sql, item not null, regular exp, etc) to select?
BEGIN
IF(check box 1 is checked and check box 2 is unchecked) THEN
:P3_TEXT_FIELD_1 := required;
:P3_TEXT_FIELD_2 := required;
:P3_TEXT_FIELD_3 := null;
END IF;
END;
thanks,
ToopranHello,
Thanks for the suggestion. I am having the validation of the type function returning error text and this is the actual code that I am using in my application.
BEGIN
IF :P11_WRITING_OBJ_FLAG IS NULL AND :P11_LAB_SCIENCE_FLAG IS NULL THEN
:P11_NOTE_4 := NULL;
:P11_NOTE_5 := NULL;
:P11_NOTE_6 := NULL;
:P11_NOTE_8 := NULL;
IF :P11_NOTE_1 IS NULL THEN
return 'enter a value in the text field';
ELSE IF :P11_NOTE_2 IS NULL THEN
return 'enter a value in the text field';
ELSE IF :P11_NOTE_3 IS NULL THEN
return 'enter a value in the text field';
END IF;
END IF;
IF :P11_WRITING_OBJ_FLAG IS NOT NULL AND :P11_LAB_SCIENCE_FLAG IS NULL THEN
:P11_NOTE_1 := NULL;
:P11_NOTE_2 := NULL;
:P11_NOTE_3 := NULL;
:P11_NOTE_8 := NULL;
IF :P11_NOTE_4 IS NULL THEN
return 'enter a value in the text field';
ELSE IF :P11_NOTE_5 IS NULL THEN
return 'enter a value in the text field';
ELSE IF :P11_NOTE_6 IS NULL THEN
return 'enter a value in the text field';
ELSE IF :P11_NOTE_7 IS NULL THEN
return 'enter a value in the text field';
END IF;
END IF;
IF :P11_WRITING_OBJ_FLAG IS NULL AND :P11_LAB_SCIENCE_FLAG IS NOT NULL THEN
:P11_NOTE_4 := NULL;
:P11_NOTE_5 := NULL;
:P11_NOTE_6 := NULL;
:P11_NOTE_7 := NULL;
IF :P11_NOTE_1 IS NULL THEN
return 'enter a value in the text field';
ELSE IF :P11_NOTE_2 IS NULL THEN
return 'enter a value in the text field';
ELSE IF :P11_NOTE_3 IS NULL THEN
return 'enter a value in the text field';
ELSE IF :P11_NOTE_8 IS NULL THEN
return 'enter a value in the text field';
END IF;
END IF;
IF :P11_WRITING_OBJ_FLAG IS NOT NULL AND :P11_LAB_SCIENCE_FLAG IS NOT NULL THEN
IF :P11_NOTE_1 IS NULL THEN
return 'enter a value in the text field';
ELSE IF :P11_NOTE_2 IS NULL THEN
return 'enter a value in the text field';
ELSE IF :P11_NOTE_3 IS NULL THEN
return 'enter a value in the text field';
ELSE IF :P11_NOTE_4 IS NULL THEN
return 'enter a value in the text field';
ELSE IF :P11_NOTE_5 IS NULL THEN
return 'enter a value in the text field';
ELSE IF :P11_NOTE_6 IS NULL THEN
return 'enter a value in the text field';
ELSE IF :P11_NOTE_7 IS NULL THEN
return 'enter a value in the text field';
ELSE IF :P11_NOTE_8 IS NULL THEN
return 'enter a value in the text field';
END IF;
END IF;
END;
:P11_WRITING_OBJ_FLAG IS NULL and :P11_LAB_SCIENCE_FLAG are the check boxes and P11_NOTE_1 to P11_NOTE_8 are the 8 text fields that I want to validate based upon which box is checked.
I am getting this error when I enter some values in the text field and click on SAVE button:
ORA-06550: line 70, column 4: PLS-00103: Encountered the symbol ";" when expecting one of the following: if The symbol "if" was substituted for ";" to continue. ORA-06550: line 70, column 22: PLS-00103: Encountered the symbol ";" when expecting one of the following: if The symbol "if" was substituted for ";" to continue. ORA-06550: line 70, column 73: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: begin case declare end exit for goto if loop mod null pragm
Error ERR-1024 Unable to run "function body returning text" validation.
Please help.
thanks,
Toopran -
Check box validation using Javascript
Hi Everyone,
I am using LiveCycle with my form that have multiple sections in the form that have questions that have a check box yes or check box no next to it. The user can either choose yes or no. Note: I am not using radio buttons. I am looking for a Javascript function or code that when clicking a button I have set up as "regular" can check to see if a user selected either check boxes (yes) or check box (no) and validate that in that section the user has answered all question by selecting either yes or no. Example; Section (1) has (5) questions with a yes or no check box next to each question. I want to validate that the user selected 5 check boxes for this section (regardless if yes or no was answered for each) if only 2 out od the 5 questions were answered with either yes or no. I generate an error message.
I already have a function that searches the form and tells me how many manditory text fields have been left blank and throws an error. I would like the check box function to be the same. Any help would be appreciated.
Thanks
Jaganfunction validateCheckBox()
if(document.TestJsp.BONUS.checked)
return true;
var len = document.TestJsp.BONUS.length;
for(i = 0 ; i < len; i++)
if(document.TestJsp.BONUS.checked)
return true;
return false;
Sorry for the triple post. :=) -
Emtpy check box validation in javascript
Friends I want to validate check boxes thru javascript,but I can do it if only one checkbox is there,but my requirement is to tell the page that it is alright even if one checkbox out of many is checked.Please tell me how to do it.
Thanks
MS
<SCRIPT>
function onSave() {
(document.TestJsp.BONUS.checked)?
alert("The box is checked"):
alert("The box is not checked")
</SCRIPT>
<TR>
<TD>
<INPUT TYPE="CHECKBOX" NAME ="BONUS" VALUE="1" >
</TD>
</TR>
<TR>
<TD>
<INPUT TYPE="CHECKBOX" NAME ="BONUS" VALUE="2" >
</TD>
</TR>
<TR>
<TD>
<INPUT TYPE="SUBMIT" NAME ="SUBMITBUTTON" VALUE="1" onClick="onSave()">
</TD>
</TR>function validateCheckBox()
if(document.TestJsp.BONUS.checked)
return true;
var len = document.TestJsp.BONUS.length;
for(i = 0 ; i < len; i++)
if(document.TestJsp.BONUS.checked)
return true;
return false;
Sorry for the triple post. :=) -
Agree to terms and conditions check box
I am using a checkbox for users to indicate that they agree to the forms terms and conditions. On Submit how can I validate that the box was checked and if not block the Submit process from completing until the checkbox is selected.
Make the submit button presence 'hidden', add a second button that performs the check box validation and if the validation succeeds, call 'click' on the submit button.
// form1.page1.subform1.callSubmitBtn::click - (JavaScript, client)
if (form1.page1.subform1.cb.rawValue == "0") {
xfa.host.messageBox("Please agree to terms and conditions.","Agree",0);
else {
form1.page1.subform1.submitBtn.execEvent("click");
Steve -
Validation of check boxes...help needed
Hi
I have a form in which i need to do a validation between several check boxes there are two categories fo check boxes i want a validation so that one category of the check boxes are checked at a instance
I am using the following code ..but i think the code is all wrong
DECLARE
l_concat VARCHAR2(6);
l_concat_1 VARCHAR2(6);
BEGIN
SELECT BULLAE_FLG||CHERRY_RED_FLG||CYANOTIC_FLG||FLUSHED_FLG||GREY_FLG||JAUNDICED_FLG ||MOTTLED_FLG ||PALE_FLG ||PINK_FLG ||PURPLE_FLG into l_concat FROM SKCOLOR;
select normal_flg into l_concat_1 from skcolor ;
IF l_concat IS NULL THEN
IF l_contact_1 IS NULL THEN
return false;
ELSE
RETURN TRUE;
END IF;
ELSE IF l_concat IS NOT NULL THEN
IF l_contact_1 IS NOT NULL THEN
return false;
ELSE
RETURN TRUE;
END IF;
ELSE
RETURN TRUE;
END IF;
END;
any suggestions ....thanks in advanceHI,
Can you eloborate your problem still more clearly.
Morever i think you need to increase the size of the l_concat, you are concatenating more than 10 flags into a variable of just 6 which will throw an exception, -
Validating forms using check boxs
hi i am trying to validate a form using check boxs where all of the elements have the same name. Using the code below it enables validation when only one check box is available, however with muliple check-boxs it goes into and eternal loop and never executes the code! Any help on this matter would be most appreciated.
<SCRIPT language="javaScript">
function validate()
if (!document.myform.pkey.checked)
alert("Please Select a Questionnaire to delete!!");
return false;
</SCRIPT>Hi,
When you have multiple checkboxes with same name, it will form an array of check boxes. So you have to validate them as below.
flag=0;
if(chkcntr>1)
for(i=0;i<frm.ch.length;i++)
if(frm.ch.checked)
flag=1;
break;
else
if(frm.ch.checked)
flag=1;
if(flag==1)
//checkbox selected,can give any action
else
// checkbox not selected,give alert -
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: -
Validating Yes/No Check boxes in Livecycle designer ES2
Hi everyone,
I need to validate 5 questions that have yes and no check boxes for "insured" "Spouse" and "Dependents" in one section of my form in LCD ES2 . I am looking for a javascript code that can check if for each ("insured" "Spouse" and "Dependents") 5 questions has at least a yes or no checked under each and if not an error message is produced. Thanks for any help you can provided.
Thanks
JaganDoes anyone have any tips on how to resolve this? My LiveCycle form is a dynamic form. It seems like livecycle Designer ES2 has corrupted it or designer ES2 has a bug that makes reader and acrobat print engine not recognize the pages.
Any help would be great.
Thanks,
Josh -
in one of my alv has two rows, one column is check box, i have to validate at least one check box should be selected, could any one pls let me know how to solve this issue
Thanks
VijayaHi Vijaya,
Once you read the values into internal table using GET_STATIC_ATTRIBUTES_TABLE then use the below code
LT_NODE->GET_STATIC_ATTRIBUTES_TABLES(IMPORTING TABLE = IT_TABLE ).
Then READ TABLE IT_TABLE into WA_TABLE where CHECKBOX = 'X'. This could result you either true or false. If true proceed as you like.
Loop on Internal table just to see if CHECKBOX is checked or not would be a performance problem rather than that just use READ statement.
Regards,
Rafi -
Check Box for each row in report -- all rows deleting when pressing DELETE
Hello experts! I have set up a report with a check box for each row. When I click the DELETE button to delete the selected rows, every single one of the rows get deleted...even the ones that are not selected. I have my process point set to "On Submit - After computations and validations".
This is my delete process (SHG is the table and SHG_ID is the primary key):
FOR i in 1..HTMLDB_APPLICATION.G_F01.count
LOOP
DELETE FROM SHG
WHERE SHG_ID = HTMLDB_APPLICATION.G_F01(i);
END LOOP;
Also, I've added to query in the region source this line:
htmldb_item.checkbox(1, SHG_ID) del,
Where does the "1" come into this? Not sure what I am doing wrong!
Message was edited by:
user477193
Message was edited by:
user477193The 1 (first argument to all the htmldb_item.* APIs) corresponds to the array number in htmldb_application.g_fNN. So 1 will populate array g_f01, 2 will populate g_f02 and so on.
Your code seems fine, it should delete only the checked rows. Are you sure there is no other process on the page that might be deleting the rows? See if you can put up an example on htmldb.oracle.com -
Item Partners Check box in Sales Order
Hi all,
What is the functionality and configuration settings of Item Partners Check box in sales order, partner function tab line item level?
When i find the check box marking then it allows me changes by double clicking of the partner and changing the address, but when the same check box is not marked then it is in dispaly mode when i double click it.
So please suggest me how to control its features.
Thanks in Advance,
Cheers,
Anil.Hello,
If this indicator is activated, the partner is validated at item level.
It may happen that in a business transaction the partner in the document header does not apply to all items, for example, if specific goods for a customer are normally delivered to another ship-to party.
In sales documents and billing documents you can enter one of the deviating partners from the document header at item level.
When creating a document , the system copies the document header partners to the items. If you want to define another partner than the one in the document header at item level, overwrite the proposal from the item partner screen.
Prase -
Hi Experts,
i hae to create a check box for account assaignment default value ticked, ifit is ticked out put should come other wise output should not come
could any one help me, account assaignment field is ekpo-knttp.
i am giving the code below
REPORT zmmr_po_spendreport NO STANDARD PAGE HEADING
MESSAGE-ID zs.
Program ID : *
Version : 1.0 *
SAP Version : R/3 System Ver. 4.6C *
Program Name : ZMMR_PO_SPENDREPORT *
Created by : Venu Goli *
Created on : 6/1/2007 *
Description : A Report on Direct and Indirect spend to find out *
the lead time in PO and Invoice creation *
Tables
TABLES: ekko, "Purchasing Document Header
ekpo, "Purchasing Document Item
rbkp. "Document Header: Invoice Receipt
Type-Pools
TYPE-POOLS : slis. " Has to be declared to use ALVs
To hold ALV field catgory data
DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF it_fieldcat.
Internal tables declarations
Internal table to hold Report data
DATA: BEGIN OF it_output OCCURS 0,
dir_indir(9),
bukrs LIKE ekko-bukrs, "company code
ebeln LIKE ekko-ebeln, "Purchasing Document Number
ebelp LIKE ekpo-ebelp, "Item
aedat LIKE ekko-aedat, "Date on which the record was created
belnr LIKE rseg-belnr, "Accounting document number
bldat LIKE rbkp-bldat, "Document date in document
budat LIKE rbkp-budat, "Posting date in the document
wrbtr LIKE rseg-wrbtr, "Amount in document currency
curr LIKE t880-curr, "Price unit (Local Curr)
bednr LIKE ekpo-bednr, "Requirement tracking number
lifnr LIKE ekko-lifnr, "Vendor's account number
name1 LIKE lfa1-name1, "name1
name2(30), "preparer name
name3(30), "requester name
gjahr LIKE rseg-gjahr, "Fiscal year
ernam LIKE ekko-ernam, "Name of Person who Created the Object
kursf LIKE rbkp-kursf, "Exchange rate
shkzg LIKE rseg-shkzg, "Debit/credit indicator
banfn LIKE ekpo-banfn, "Purchase requisition number
knttp LIKE ekpo-knttp, "account assignment category
END OF it_output.
Selection Screen
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_bukrs LIKE ekko-bukrs OBLIGATORY,
kntpp AS CHECKBOX DEFAULT 'X'.
SELECT-OPTIONS: s_invdat FOR rbkp-bldat, "Document date in document
s_vendor FOR ekko-lifnr, "Vendor's account number
s_purcdo FOR ekko-ebeln, "Purchasing Document no
s_credat FOR ekko-aedat OBLIGATORY,"create date
s_plant FOR ekpo-werks, "Plant
s_doctyp FOR ekko-bsart, "Purchasing document type
s_purorg FOR ekko-ekorg, "Purchasing organization
s_trcnum FOR ekpo-bednr, "Requirement tracking number
s_knttp FOR ekpo-knttp. "account assignment category
SELECTION-SCREEN: END OF BLOCK b1.
DATA: count TYPE i VALUE 0. " Used to count records
INITIALIZATION *
INITIALIZATION.
At Selection Screen
AT SELECTION-SCREEN.
Checking for the input values of selection screen fields.
PERFORM validate_params.
Start Of Selection
START-OF-SELECTION.
PERFORM get_data.
End Of Selection
END-OF-SELECTION.
SUBROUTINE TO CALL THE FUNCTION MERGE TO ENSURE PROPER DISPLAY.
PERFORM merge_fieldcatalog.
PERFORM modify_fieldcat.
PERFORM alv_report.
FORM validate_params *
FORM validate_params.
Validate company code
SELECT SINGLE COUNT(*) FROM t001 WHERE bukrs = p_bukrs.
IF sy-subrc <> 0.
MESSAGE e021 WITH 'Please enter a valid Company code'.
ENDIF.
*Validate Vendor.
SELECT SINGLE COUNT(*) FROM lfa1 WHERE lifnr IN s_vendor.
CASE sy-subrc.
WHEN 0.
WHEN OTHERS.
MESSAGE e021 WITH 'Please enter a valid Vendor'.
ENDCASE.
*Validate PO doc type
SELECT SINGLE COUNT(*) FROM t161 WHERE bsart IN s_doctyp.
CASE sy-subrc.
WHEN 0.
WHEN OTHERS.
MESSAGE e021 WITH 'Please enter a valid PO Doc. Type'.
ENDCASE.
*Validate plant
SELECT SINGLE COUNT(*) FROM t001w WHERE werks IN s_plant.
CASE sy-subrc.
WHEN 0.
WHEN OTHERS.
MESSAGE e021 WITH 'Please enter a valid Plant. Type'.
ENDCASE.
*Validate Purch. Org
SELECT SINGLE COUNT(*) FROM t024e WHERE ekorg IN s_purorg.
CASE sy-subrc.
WHEN 0.
WHEN OTHERS.
MESSAGE e021 WITH 'Please enter a valid Purch. Org.'.
ENDCASE.
ENDFORM. " PERFORM VALIDATE_PARAMS.
FORM get_data *
FORM get_data.
DATA: l_persnumber LIKE usr21-persnumber.
Get PO data
SELECT a~bukrs a~ebeln b~ebelp a~aedat a~lifnr a~ernam
b~knttp b~bednr b~banfn
c~belnr c~wrbtr c~gjahr c~shkzg
d~bldat d~budat d~kursf
e~dir_indir
INTO CORRESPONDING FIELDS OF TABLE it_output
FROM ekko AS a
JOIN ekpo AS b ON b~ebeln = a~ebeln
JOIN rseg AS c ON c~ebeln = b~ebeln
AND c~ebelp = b~ebelp
AND c~bukrs = a~bukrs
JOIN rbkp AS d ON d~belnr = c~belnr
AND d~gjahr = c~gjahr
LEFT JOIN zpo_dirindir AS e ON e~knttp = b~knttp
WHERE a~bukrs = p_bukrs
AND a~lifnr IN s_vendor
AND a~ebeln IN s_purcdo
AND a~bsart IN s_doctyp
AND a~ekorg IN s_purorg
AND a~aedat IN s_credat
AND b~knttp IN s_knttp
AND b~werks IN s_plant
AND b~bednr IN s_trcnum.
LOOP AT it_output.
Get posting date, Doc. date & Curr. Key
IF it_output-kursf <> 0.
it_output-wrbtr = it_output-wrbtr * it_output-kursf.
ENDIF.
get local currency
SELECT SINGLE waers INTO it_output-curr FROM t001
WHERE bukrs = it_output-bukrs.
Get vendor name.
SELECT SINGLE name1 FROM lfa1 INTO it_output-name1
WHERE lifnr = it_output-lifnr.
Get PO created person name
SELECT SINGLE persnumber INTO l_persnumber FROM usr21
WHERE bname = it_output-ernam.
IF sy-subrc = 0.
SELECT SINGLE name_text FROM adrp INTO it_output-name2
WHERE persnumber = l_persnumber.
ELSE.
it_output-name2 = it_output-ernam.
ENDIF.
Get get requested by from reciepent point in PO
else PR created by (If PR exists)
CASE it_output-dir_indir.
WHEN 'I'.
Take requested by from Reciepent point.
SELECT SINGLE wempf INTO it_output-name3 FROM ekkn
WHERE ebeln = it_output-ebeln
AND ebelp = it_output-ebelp .
WHEN 'D'.
SELECT SINGLE ernam INTO it_output-name3 FROM eban
WHERE banfn = it_output-banfn
AND ebelp = it_output-ebelp.
IF sy-subrc <> 0.
MOVE it_output-ernam TO it_output-name3.
ENDIF.
SELECT SINGLE persnumber INTO l_persnumber FROM usr21
WHERE bname = it_output-name3.
IF sy-subrc = 0.
SELECT SINGLE name_text FROM adrp INTO it_output-name3
WHERE persnumber = l_persnumber.
ENDIF.
ENDCASE.
translate direction indicator to Indirect or Direct
CASE it_output-dir_indir.
WHEN 'I'. it_output-dir_indir = 'Indirect'.
WHEN 'D'. it_output-dir_indir = 'Direct'.
ENDCASE.
MODIFY it_output.
ENDLOOP.
ENDFORM.
FORM MERGE_FIELDCATALOG *
FORM merge_fieldcatalog.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-cprog
i_internal_tabname = 'IT_OUTPUT'
i_inclname = sy-cprog
CHANGING
ct_fieldcat = it_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
ENDFORM. " MERGE_FIELDCATALOG
FORM modify_fieldcat *
FORM modify_fieldcat.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
LOOP AT it_fieldcat INTO wa_fieldcat.
CASE wa_fieldcat-fieldname.
WHEN 'DIR_INDIR'.
wa_fieldcat-seltext_m = 'Direct/Indirect'.
WHEN 'NAME2'.
wa_fieldcat-seltext_m = 'PREPARER NAME'.
WHEN 'NAME3'.
wa_fieldcat-seltext_m = 'REQUESTER NAME'.
WHEN 'BEDNR'.
wa_fieldcat-seltext_m = 'SSP PO'.
WHEN 'AEDAT'.
wa_fieldcat-seltext_m = 'PO DOCUMENT DATE'.
WHEN 'BLDAT'.
wa_fieldcat-seltext_m = 'INVOICE DOCU DATE'.
WHEN 'BUDAT'.
wa_fieldcat-seltext_m = 'POSTAGE DATE'.
WHEN 'WRBTR'.
wa_fieldcat-seltext_m = 'LOCAL AMOUNT'.
wa_fieldcat-cfieldname = 'CURR'.
wa_fieldcat-ctabname = wa_fieldcat-tabname.
WHEN 'CURR'.
wa_fieldcat-seltext_m = 'LOCAL CURR'.
WHEN 'NAME1'.
wa_fieldcat-seltext_m = 'VENDOR NAME'.
ENDCASE.
MODIFY it_fieldcat FROM wa_fieldcat.
ENDLOOP.
ENDFORM.
FORM ALV_REPORT *
FORM alv_report.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
it_fieldcat = it_fieldcat[]
TABLES
t_outtab = it_output[].
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.REPORT zmmr_po_spendreport NO STANDARD PAGE HEADING
MESSAGE-ID zs.
Program ID : *
Version : 1.0 *
SAP Version : R/3 System Ver. 4.6C *
Program Name : ZMMR_PO_SPENDREPORT *
Created by : Venu Goli *
Created on : 6/1/2007 *
Description : A Report on Direct and Indirect spend to find out *
the lead time in PO and Invoice creation *
Tables
TABLES: ekko, "Purchasing Document Header
ekpo, "Purchasing Document Item
rbkp. "Document Header: Invoice Receipt
Type-Pools
TYPE-POOLS : slis. " Has to be declared to use ALVs
To hold ALV field catgory data
DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF it_fieldcat.
Internal tables declarations
Internal table to hold Report data
DATA: BEGIN OF it_output OCCURS 0,
dir_indir(9),
bukrs LIKE ekko-bukrs, "company code
ebeln LIKE ekko-ebeln, "Purchasing Document Number
ebelp LIKE ekpo-ebelp, "Item
aedat LIKE ekko-aedat, "Date on which the record was created
belnr LIKE rseg-belnr, "Accounting document number
bldat LIKE rbkp-bldat, "Document date in document
budat LIKE rbkp-budat, "Posting date in the document
wrbtr LIKE rseg-wrbtr, "Amount in document currency
curr LIKE t880-curr, "Price unit (Local Curr)
bednr LIKE ekpo-bednr, "Requirement tracking number
lifnr LIKE ekko-lifnr, "Vendor's account number
name1 LIKE lfa1-name1, "name1
name2(30), "preparer name
name3(30), "requester name
gjahr LIKE rseg-gjahr, "Fiscal year
ernam LIKE ekko-ernam, "Name of Person who Created the Object
kursf LIKE rbkp-kursf, "Exchange rate
shkzg LIKE rseg-shkzg, "Debit/credit indicator
banfn LIKE ekpo-banfn, "Purchase requisition number
knttp LIKE ekpo-knttp, "account assignment category
END OF it_output.
Selection Screen
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_bukrs LIKE ekko-bukrs OBLIGATORY,
kntpp AS CHECKBOX DEFAULT 'X'.
SELECT-OPTIONS: s_invdat FOR rbkp-bldat, "Document date in document
s_vendor FOR ekko-lifnr, "Vendor's account number
s_purcdo FOR ekko-ebeln, "Purchasing Document no
s_credat FOR ekko-aedat OBLIGATORY,"create date
s_plant FOR ekpo-werks, "Plant
s_doctyp FOR ekko-bsart, "Purchasing document type
s_purorg FOR ekko-ekorg, "Purchasing organization
s_trcnum FOR ekpo-bednr, "Requirement tracking number
s_knttp FOR ekpo-knttp. "account assignment category
parameters : p_knntp as checkbox default 'X'.
SELECTION-SCREEN: END OF BLOCK b1.
DATA: count TYPE i VALUE 0. " Used to count records
INITIALIZATION *
INITIALIZATION.
At Selection Screen
AT SELECTION-SCREEN.
Checking for the input values of selection screen fields.
PERFORM validate_params.
Start Of Selection
START-OF-SELECTION.
if p_knttp = 'X'.
PERFORM get_data.
else.
message 'no output'.
endif.
End Of Selection
END-OF-SELECTION.
SUBROUTINE TO CALL THE FUNCTION MERGE TO ENSURE PROPER DISPLAY.
PERFORM merge_fieldcatalog.
PERFORM modify_fieldcat.
PERFORM alv_report.
FORM validate_params *
FORM validate_params.
Validate company code
SELECT SINGLE COUNT(*) FROM t001 WHERE bukrs = p_bukrs.
IF sy-subrc <> 0.
MESSAGE e021 WITH 'Please enter a valid Company code'.
ENDIF.
*Validate Vendor.
SELECT SINGLE COUNT(*) FROM lfa1 WHERE lifnr IN s_vendor.
CASE sy-subrc.
WHEN 0.
WHEN OTHERS.
MESSAGE e021 WITH 'Please enter a valid Vendor'.
ENDCASE.
*Validate PO doc type
SELECT SINGLE COUNT(*) FROM t161 WHERE bsart IN s_doctyp.
CASE sy-subrc.
WHEN 0.
WHEN OTHERS.
MESSAGE e021 WITH 'Please enter a valid PO Doc. Type'.
ENDCASE.
*Validate plant
SELECT SINGLE COUNT(*) FROM t001w WHERE werks IN s_plant.
CASE sy-subrc.
WHEN 0.
WHEN OTHERS.
MESSAGE e021 WITH 'Please enter a valid Plant. Type'.
ENDCASE.
*Validate Purch. Org
SELECT SINGLE COUNT(*) FROM t024e WHERE ekorg IN s_purorg.
CASE sy-subrc.
WHEN 0.
WHEN OTHERS.
MESSAGE e021 WITH 'Please enter a valid Purch. Org.'.
ENDCASE.
ENDFORM. " PERFORM VALIDATE_PARAMS.
FORM get_data *
FORM get_data.
DATA: l_persnumber LIKE usr21-persnumber.
Get PO data
SELECT a~bukrs a~ebeln b~ebelp a~aedat a~lifnr a~ernam
b~knttp b~bednr b~banfn
c~belnr c~wrbtr c~gjahr c~shkzg
d~bldat d~budat d~kursf
e~dir_indir
INTO CORRESPONDING FIELDS OF TABLE it_output
FROM ekko AS a
JOIN ekpo AS b ON b~ebeln = a~ebeln
JOIN rseg AS c ON c~ebeln = b~ebeln
AND c~ebelp = b~ebelp
AND c~bukrs = a~bukrs
JOIN rbkp AS d ON d~belnr = c~belnr
AND d~gjahr = c~gjahr
LEFT JOIN zpo_dirindir AS e ON e~knttp = b~knttp
WHERE a~bukrs = p_bukrs
AND a~lifnr IN s_vendor
AND a~ebeln IN s_purcdo
AND a~bsart IN s_doctyp
AND a~ekorg IN s_purorg
AND a~aedat IN s_credat
AND b~knttp IN s_knttp
AND b~werks IN s_plant
AND b~bednr IN s_trcnum.
LOOP AT it_output.
Get posting date, Doc. date & Curr. Key
IF it_output-kursf <> 0.
it_output-wrbtr = it_output-wrbtr * it_output-kursf.
ENDIF.
get local currency
SELECT SINGLE waers INTO it_output-curr FROM t001
WHERE bukrs = it_output-bukrs.
Get vendor name.
SELECT SINGLE name1 FROM lfa1 INTO it_output-name1
WHERE lifnr = it_output-lifnr.
Get PO created person name
SELECT SINGLE persnumber INTO l_persnumber FROM usr21
WHERE bname = it_output-ernam.
IF sy-subrc = 0.
SELECT SINGLE name_text FROM adrp INTO it_output-name2
WHERE persnumber = l_persnumber.
ELSE.
it_output-name2 = it_output-ernam.
ENDIF.
Get get requested by from reciepent point in PO
else PR created by (If PR exists)
CASE it_output-dir_indir.
WHEN 'I'.
Take requested by from Reciepent point.
SELECT SINGLE wempf INTO it_output-name3 FROM ekkn
WHERE ebeln = it_output-ebeln
AND ebelp = it_output-ebelp .
WHEN 'D'.
SELECT SINGLE ernam INTO it_output-name3 FROM eban
WHERE banfn = it_output-banfn
AND ebelp = it_output-ebelp.
IF sy-subrc <> 0.
MOVE it_output-ernam TO it_output-name3.
ENDIF.
SELECT SINGLE persnumber INTO l_persnumber FROM usr21
WHERE bname = it_output-name3.
IF sy-subrc = 0.
SELECT SINGLE name_text FROM adrp INTO it_output-name3
WHERE persnumber = l_persnumber.
ENDIF.
ENDCASE.
translate direction indicator to Indirect or Direct
CASE it_output-dir_indir.
WHEN 'I'. it_output-dir_indir = 'Indirect'.
WHEN 'D'. it_output-dir_indir = 'Direct'.
ENDCASE.
MODIFY it_output.
ENDLOOP.
ENDFORM.
FORM MERGE_FIELDCATALOG *
FORM merge_fieldcatalog.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-cprog
i_internal_tabname = 'IT_OUTPUT'
i_inclname = sy-cprog
CHANGING
ct_fieldcat = it_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
ENDFORM. " MERGE_FIELDCATALOG
FORM modify_fieldcat *
FORM modify_fieldcat.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
LOOP AT it_fieldcat INTO wa_fieldcat.
CASE wa_fieldcat-fieldname.
WHEN 'DIR_INDIR'.
wa_fieldcat-seltext_m = 'Direct/Indirect'.
WHEN 'NAME2'.
wa_fieldcat-seltext_m = 'PREPARER NAME'.
WHEN 'NAME3'.
wa_fieldcat-seltext_m = 'REQUESTER NAME'.
WHEN 'BEDNR'.
wa_fieldcat-seltext_m = 'SSP PO'.
WHEN 'AEDAT'.
wa_fieldcat-seltext_m = 'PO DOCUMENT DATE'.
WHEN 'BLDAT'.
wa_fieldcat-seltext_m = 'INVOICE DOCU DATE'.
WHEN 'BUDAT'.
wa_fieldcat-seltext_m = 'POSTAGE DATE'.
WHEN 'WRBTR'.
wa_fieldcat-seltext_m = 'LOCAL AMOUNT'.
wa_fieldcat-cfieldname = 'CURR'.
wa_fieldcat-ctabname = wa_fieldcat-tabname.
WHEN 'CURR'.
wa_fieldcat-seltext_m = 'LOCAL CURR'.
WHEN 'NAME1'.
wa_fieldcat-seltext_m = 'VENDOR NAME'.
ENDCASE.
MODIFY it_fieldcat FROM wa_fieldcat.
ENDLOOP.
ENDFORM.
FORM ALV_REPORT *
FORM alv_report.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
it_fieldcat = it_fieldcat[]
TABLES
t_outtab = it_output[].
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.
Maybe you are looking for
-
Unable to make microphone to work on NVIDIA MCP55 onboard sound card
Hello. Some time ago, I bought a nice HP xw9400 Workstation (with Dual Core AMD Opteron 2216) from Germany. Despite it's starting to become old by today's standards for some stuff like gaming, it's still quite okay to use and the SAS HDD makes it bo
-
Mini DV Camcorder Has Sound Drop off When Recording to Tape
I'm wondering what my correct a problem with a camcorder... audio seems to stop recording after 45-50 min. Model PV-DV530. Would setting to NTSC Firewire Basic.
-
DW MX 04 Database Controls won't work
This is the first job I have had working with database app. My data base has been built. I can see all my tables in the database window of DW. So I have a connection. Forms were made on asp.net c# files. I insert an ASP.NET object from the insert men
-
Has anyone solved the problem of sending Pages docs to Windows machines?
I am trying to create a business newsletter that can be emailed to anyone who wants it. I'm working with OS X 10.4.10 and Pages. My business partner, who works on a PC, can't read a Pages doc, so I converted it to a pdf, and Windows won't read that,
-
My ipod screen shatter can i get a new screen
can i get a new screen because i ipod touch screen is shattered