What if a function doesn't return a value, and expected to hang.
Hi, i'm using D2K, 6i forms.
i've a function something like this:
/* Function returns current slno for a transaction.
create or replace function gen_auto_slno_fn
(doc_vr varchar2,
branch_vr varchar2)
return varchar IS
genslno VARCHAR2(15) ;
BEGIN
BEGIN
SELECT lpad((nvl(SLNO,0)+1),5,0)
INTO genslno
FROM GEN_SLNO
WHERE doc_name = doc_vr
AND BRANCH_CODE=branch_vr;
return(genslno);
EXCEPTION
WHEN no_data_found then
Dbms_output.put_line('No data found in General Serial number for '||doc_vr);
raise_application_error(-20100,sqlerrm);
END;
END;
My problem is:
suppose if such branch_code does not exist, then
it will go exception part.
I was expecting the 'No data ...error message ' in my forms.
but Instead of that a message such as 'Unhandled exception occurs.
I also tried returning a value like :
EXCEPTION
WHEN no_data_found then
Dbms_output.put_line('No data found in General Serial number for '||doc_vr);
return('ERROR');
--raise_application_error(-20100,sqlerrm);
END;
It was working then.
My question is: how do I display the whole error message on my form and raise form_trigger_failure ?
( also the one in the subject line!)
Message was edited by:
abhijithdev
A comment on using exception handlers and raising exceptions.
WHEN no_data_found then
Dbms_output.put_line('No data found in General Serial number for '||doc_vr);
raise_application_error(-20100,sqlerrm); DBMS_OUTPUT is superfluous and meaningless in production code. It should not be there... and if debugging is required, then it is easy to make it vastly superior than the very primitive DBMS_OUTPUT interface.
Ditto for RAISE_APPLICATION_ERROR. Calling this system procedure directly, does not support logging and tracing and troubleshooting and debugging problems.
One of the basic (I would call it the very most basic) rules in software development is to modularise. This includes wrapping system calls into wrappers - that allows additional flexibility and makes maintenance and development a lot easier.
Instead of calling RAISE_APPLICATION_ERROR, create a wrapper PL/SQL procedure called something like RaiseException().
Input parameters would typically be an error message number. The message for the error can also be passed.. though I prefer to have a message array (static PL/SQL var) that can be used to lookup the error message for that error code.
As all exceptions are now raised via a single proc that you control, you can easily add debug information to it. Log the exception (using an autonomous transaction) in a log table. Add the PL/SQL call stack to the message. Write an error to the alert log for those real critical fubar errors. Call DBMS_OUTPUT if need be. Even send the error message to a DBMS_PIPE for an error console to pick up and display interactively.
Designing and coding wrappers for system calls are a critical cornerstone of an application that is flexible and easy to maintain and extend.
Similar Messages
-
Hello,
I have a report that uses apex_item.checkbox(...) to generate checkbox. This report correctly displays a checkbox for each row. The source code generated in the html page is:
<input type="checkbox" name="f01" value="202" id="P1_CHECKBOX" />
<input type="checkbox" name="f01" value="220" id="P1_CHECKBOX" />
<input type="checkbox" name="f01" value="210" id="P1_CHECKBOX" />
I want to use the javascript function $v() to get the values of the checked checkbox. I thought that this function return the values of all the checked checkbox separated by ':' but I notice that my code alert($v('P1_CHECKBOX')); returns each time only the value of the first checkbox if it is checked.
It returns '202' if the first checkbox is checked but nothing if only the second checkbox is checked and '202' if the first and second checkbox are checked.Hi,
first of all, $v, $x and $s are suppose to only work for page items and not for tabular form columns or manually generated HTML elements.
Second, I think your HTML code is not correct, because each of your checkboxes has the same ID. But the ID has to be unique in the browser DOM tree. So the different checkbox elements should actually be named P1_CHECKBOX_1 .. P1_CHECKBOX_3. Just have a look what is actually generated for a real checkbox page item. BTW, I think you shouldn't name these checkbox elements like a page item, because they are actually not page items. I think that could be confusing for other developers.
Hope that helps
Patrick
My Blog: http://www.inside-oracle-apex.com
APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf -
Doesn't return true value .........
Hi All,
please check the following code.
password (originalPassword) from the database is : xyz
password (password) from the login page is : xyz
when I try for equality for the password :
if(originalPassword.equalsIgnoreCase(password)) {
it doesn't return true value while the password is same that is : xyz ?
I an stuck in the problem.
Please look into the code and solve my problem.
Thanks
public boolean verifyPassword(String username, String password) {
String originalPassword=null;
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://sqlserver:1433","harish","harish");
PreparedStatement pstmt = con.prepareStatement("select password from registration where username='"+username+"'");
//ResultSet rs = pstmt.getResultSet();
ResultSet rs = pstmt.executeQuery();
if(rs.next()) {
originalPassword=rs.getString(1);
pstmt.close();
if(originalPassword.equalsIgnoreCase(password)) {
return true;
} else {
return false;
} catch (Exception e){
System.out.println("Exception: verifyPassword="+e);
return false;
Harish PathakAre you sure there's no space before or after "xyz"? Try adding some debug output to your code:
if(originalPassword.equalsIgnoreCase(password)) {
//foo
} else {
System.out.println("<" + password + "> does not match <" + originalPassword + ">");
} -
What are the function modules used in interactive ALV and parameters?
what are the function modules used in interactive ALV and parameters?
hi sunil
check these links,
About ALV:
http://www.geocities.com/mpioud/Abap_programs.html
ALV Group Heading
http://www.sap-img.com/fu037.htm
and few more,
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
also run the folowing code and see
check this sample code.you will be well versed with all the events of a interactive alv report.mark points if useful.
*& Report ZALV4_INTERACTIVE *
*& interactive alvs *
REPORT ZALV4_INTERACTIVE NO STANDARD PAGE HEADING
MESSAGE-ID ZMSG
LINE-COUNT 37(3)
LINE-SIZE 134.
TYPE-POOLS : SLIS.
TABLES DECLARATION ********************
TABLES : VBRK, " BILLING MASTERS TABLE
VBRP. " BILLING ITEM TABLE
TYPES DECLARATION ********************
TYPES : BEGIN OF TY_VBRK, " types for billing masters table
VBELN TYPE VBRK-VBELN, " billing document
WAERK TYPE VBRK-WAERK, " document currency
VKORG TYPE VBRK-VKORG, " sales organization
FKDAT TYPE VBRK-FKDAT, " billing date
BUKRS TYPE VBRK-BUKRS, " company code
BUTXT TYPE T001-BUTXT, " company name
NETWR TYPE VBRK-NETWR, " net currency value
LINE_COLOR(4) TYPE C,
END OF TY_VBRK.
TYPES : BEGIN OF TY_VBRP, " types for billing document item data
POSNR TYPE VBRP-POSNR, " billing item
FKIMG TYPE VBRP-FKIMG, " actual invoiced quantitty
VRKME TYPE VBRP-VRKME, " sales unit
NETWR TYPE VBRP-NETWR, " net currency value
MATNR TYPE VBRP-MATNR, " material number
ARKTX TYPE VBRP-ARKTX, " short text for sales order item
END OF TY_VBRP.
FIELD CATALOG ********************
DATA : WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
WA_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.
LAYOUT DECLARATION ********************
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
WA_LAYOUT1 TYPE SLIS_LAYOUT_ALV.
EVENTS DECLARATION ********************
DATA : TY_EVENTS TYPE SLIS_ALV_EVENT,
IT_EVENTS TYPE SLIS_T_EVENT.
PF STATUS ********************
DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
USER COMMAND ********************
DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
R_UCOMM LIKE SY-UCOMM.
INTERNAL TABLES ********************
DATA : IT_VBRK TYPE TABLE OF TY_VBRK, "internal table for billing master
IT_VBRP TYPE TABLE OF TY_VBRP, "internal table for billing item
*internal table for field catalog
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.
WORK AREA ********************
DATA : WA_VBRK LIKE LINE OF IT_VBRK, "work area for billing master
WA_VBRP LIKE LINE OF IT_VBRP. "work area for billing item
VARIABLE DECLARATION ********************
DATA : V_DATE TYPE SY-DATUM, " variable to store date values
V_VBELN TYPE VBRK-VBELN, " variable for billing document
V_FKDAT TYPE VBRK-FKDAT, " variable for billing date
V_FLAG(1). " variable for flag
SELECTION SCREEN ********************
SELECT-OPTIONS : S_VBELN FOR VBRK-VBELN , " Billing document
S_FKDAT FOR VBRK-FKDAT, " Billing date
S_MATNR FOR VBRP-MATNR. " Material number
PARAMETERS : R1 RADIOBUTTON GROUP G1, "whole item details
R2 RADIOBUTTON GROUP G1. "selected item details
INITIALIZATION ********************
INITIALIZATION.
V_FLAG = 'X'.
V_DATE = SY-DATUM - 20.
S_FKDAT-SIGN = 'I'.
S_FKDAT-OPTION = 'EQ'.
S_FKDAT-LOW = V_DATE.
S_FKDAT-HIGH = SY-DATUM.
APPEND S_FKDAT.
SELECTION SCREEN VALIDATION ********************
AT SELECTION-SCREEN.
PERFORM CONVERSION. " performs data conversion for input
PERFORM VBELN_VALIDATE. " validating the billing document
PERFORM FKDAT_VALIDATE. " validating the billing date
START OF SELECTION ********************
START-OF-SELECTION.
SET TITLEBAR 'AAAA'.
PERFORM VBRK_POPULATE. " populating the billing master detais
PERFORM FIELDCATALOG. " designing the field catalog
PERFORM EVENTS. " performing the events for top of page
PERFORM DISP_BASICLIST." displaying the basic list
*& Form VBELN_VALIDATE
text validating the billing document
--> p1 text
<-- p2 text
FORM VBELN_VALIDATE .
IF S_VBELN IS INITIAL.
MESSAGE E000 WITH 'Make entries in all required fields'.
ELSE.
SELECT SINGLE VBELN
FROM VBRK
INTO V_VBELN
WHERE VBELN IN S_VBELN.
IF SY-SUBRC <> 0.
MESSAGE I000 WITH 'BILLING DOCUMENT DOESNT EXIST'.
ENDIF.
ENDIF.
ENDFORM. " VBELN_VALIDATE
*& Form FKDAT_VALIDATE
text validating the billing date
--> p1 text
<-- p2 text
FORM FKDAT_VALIDATE .
SELECT SINGLE FKDAT
FROM VBRK
INTO V_FKDAT
WHERE FKDAT IN S_FKDAT.
IF SY-SUBRC <> 0.
MESSAGE I000 WITH 'BILLING DATE DOESNT EXIST'.
ENDIF.
ENDFORM. " FKDAT_VALIDATE
*& Form VBRK_POPULATE
text populating the billing master details
--> p1 text
<-- p2 text
FORM VBRK_POPULATE .
DATA : LD_COLOR(1) TYPE C.
LD_COLOR = 5.
SELECT VBRK~VBELN
VBRK~WAERK
VBRK~VKORG
VBRK~FKDAT
VBRK~BUKRS
VBRK~NETWR
T001~BUTXT
FROM VBRK INNER JOIN T001
ON VBRKBUKRS = T001BUKRS
INTO CORRESPONDING FIELDS OF TABLE IT_VBRK
WHERE VBRK~VBELN IN S_VBELN AND
VBRK~FKDAT IN S_FKDAT.
LOOP AT IT_VBRK INTO WA_VBRK.
LD_COLOR = LD_COLOR + 1.
IF LD_COLOR = 8.
LD_COLOR = 1.
ENDIF.
CONCATENATE 'C' LD_COLOR '10' INTO WA_VBRK-LINE_COLOR.
MODIFY IT_VBRK FROM WA_VBRK.
ENDLOOP.
ENDFORM. " VBRK_POPULATE
*& Form CONVERSION
text data conversion to take leading zeroes into account
--> p1 text
<-- p2 text
FORM CONVERSION .
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = S_VBELN
IMPORTING
OUTPUT = S_VBELN.
ENDFORM. " CONVERSION
*& Form DISP_BASICLIST
text displaying the basic list
--> p1 text
<-- p2 text
FORM DISP_BASICLIST .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = PF_STATUS
I_CALLBACK_USER_COMMAND = USER_COMMAND
I_STRUCTURE_NAME =
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'X'
IS_VARIANT =
IT_EVENTS = IT_EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_VBRK
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. " DISP_BASICLIST
*& Form FIELDCATALOG
text designing the field catalog
--> p1 text
<-- p2 text
FORM FIELDCATALOG .
WA_FIELDCAT-TABNAME = 'IT_VBRK'.
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-SELTEXT_L = 'BILLING DOCUMENT'.
WA_FIELDCAT-COL_POS = 1.
WA_FIELDCAT-EMPHASIZE = 'C610'.
WA_FIELDCAT-KEY = 'X'.
WA_FIELDCAT-OUTPUTLEN = 20.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBRK'.
WA_FIELDCAT-FIELDNAME = 'WAERK'.
WA_FIELDCAT-SELTEXT_L = 'DOCUMENT CURRENCY'.
WA_FIELDCAT-COL_POS = 2.
WA_FIELDCAT-OUTPUTLEN = 20.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBRK'.
WA_FIELDCAT-FIELDNAME = 'VKORG'.
WA_FIELDCAT-SELTEXT_L = 'SALES ORGANIZATION'.
WA_FIELDCAT-EMPHASIZE = 'C610'.
WA_FIELDCAT-COL_POS = 3.
WA_FIELDCAT-OUTPUTLEN = 20.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBRK'.
WA_FIELDCAT-FIELDNAME = 'FKDAT'.
WA_FIELDCAT-SELTEXT_L = 'BILLING DATE'.
WA_FIELDCAT-COL_POS = 4.
WA_FIELDCAT-OUTPUTLEN = 20.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBRK'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_L = 'COMPANY CODE'.
WA_FIELDCAT-COL_POS = 5.
WA_FIELDCAT-OUTPUTLEN = 20.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBRK'.
WA_FIELDCAT-FIELDNAME = 'BUTXT'.
WA_FIELDCAT-SELTEXT_L = 'COMPANY NAME'.
WA_FIELDCAT-COL_POS = 6.
WA_FIELDCAT-OUTPUTLEN = 25.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBRK'.
WA_FIELDCAT-FIELDNAME = 'NETWR'.
WA_FIELDCAT-SELTEXT_L = 'NET CURRENCY VALUE'.
WA_FIELDCAT-COL_POS = 7.
WA_FIELDCAT-OUTPUTLEN = 20.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
ENDFORM. " FIELDCATALOG
*& Form SET_PF_STATUS
text set the pf status
FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'Z50658_PFSTATUS' EXCLUDING EXTAB.
ENDFORM. "SET_PF_STATUS
*& Form SET_USER_COMMAND
text set the user command
FORM SET_USER_COMMAND USING R_UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN 'CLICK'.
IF R1 = 'X'.
IF NOT IT_VBRK IS INITIAL.
SELECT POSNR
FKIMG
VRKME
NETWR
MATNR
ARKTX
FROM VBRP
INTO CORRESPONDING FIELDS OF TABLE IT_VBRP
FOR ALL ENTRIES IN IT_VBRK
WHERE VBELN = IT_VBRK-VBELN.
IF SY-SUBRC <> 0.
MESSAGE I000 WITH ' NO BILLING DETAILS FOUND'.
ELSE.
IF V_FLAG = 'X'.
PERFORM DET_FIELDCATALOG.
V_FLAG = ''.
ENDIF.
PERFORM DET_LISTDISPLAY.
ENDIF.
ENDIF.
ENDIF.
IF R2 = 'X'.
READ TABLE IT_VBRK INTO WA_VBRK INDEX RS_SELFIELD-TABINDEX.
IF SY-SUBRC = 0.
SELECT SINGLE POSNR
FKIMG
VRKME
NETWR
MATNR
ARKTX
FROM VBRP
INTO CORRESPONDING FIELDS OF WA_VBRP
WHERE VBELN = WA_VBRK-VBELN.
ENDIF.
APPEND WA_VBRP TO IT_VBRP.
ENDIF.
IF V_FLAG = 'X'.
PERFORM DET_FIELDCATALOG. "designing the field catalog for items
V_FLAG = ''.
ENDIF.
PERFORM DET_LISTDISPLAY. "displaying the secondary list
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'UP'.
LEAVE TO SCREEN 0.
WHEN 'CANCEL'.
CALL TRANSACTION 'SE38'.
ENDCASE.
ENDFORM. "SET_USER_COMMAND
*& Form DET_FIELDCATALOG
text designing the field catalog for item details
--> p1 text
<-- p2 text
FORM DET_FIELDCATALOG .
WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
WA_FIELDCAT1-FIELDNAME = 'POSNR'.
WA_FIELDCAT1-SELTEXT_L = 'BILLING ITEM'.
WA_FIELDCAT1-COL_POS = 1.
WA_FIELDCAT1-OUTPUTLEN = 20.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
WA_FIELDCAT1-FIELDNAME = 'FKIMG'.
WA_FIELDCAT1-SELTEXT_L = 'INVOICE QUANTITY'.
WA_FIELDCAT1-COL_POS = 2.
WA_FIELDCAT1-OUTPUTLEN = 20.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
WA_FIELDCAT1-FIELDNAME = 'VRKME'.
WA_FIELDCAT1-SELTEXT_L = 'SALES UNIT'.
WA_FIELDCAT1-COL_POS = 3.
WA_FIELDCAT1-OUTPUTLEN = 20.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
WA_FIELDCAT1-FIELDNAME = 'NETWR'.
WA_FIELDCAT1-SELTEXT_L = 'NET CURRENCY VALUE'.
WA_FIELDCAT1-COL_POS = 4.
WA_FIELDCAT1-OUTPUTLEN = 20.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
WA_FIELDCAT1-FIELDNAME = 'MATNR'.
WA_FIELDCAT1-SELTEXT_L = 'MATERIAL NUMBER'.
WA_FIELDCAT1-COL_POS = 5.
WA_FIELDCAT1-OUTPUTLEN = 20.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
WA_FIELDCAT1-FIELDNAME = 'ARKTX'.
WA_FIELDCAT1-SELTEXT_L = 'SALES ORDER ITEM'.
WA_FIELDCAT1-COL_POS = 6.
WA_FIELDCAT1-OUTPUTLEN = 20.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_LAYOUT1-ZEBRA = 'X'.
ENDFORM. " DET_FIELDCATALOG
*& Form DET_LISTDISPLAY
text displaying the secondary list
--> p1 text
<-- p2 text
FORM DET_LISTDISPLAY .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT = WA_LAYOUT1
IT_FIELDCAT = IT_FIELDCAT1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = IT_EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_VBRP
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.
CLEAR IT_VBRP[].
ENDFORM. " DET_LISTDISPLAY
*& Form EVENTS
text
--> p1 text
<-- p2 text
FORM EVENTS .
CLEAR TY_EVENTS.
TY_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
TY_EVENTS-FORM = 'TOP_OF_PAGE'.
APPEND TY_EVENTS TO IT_EVENTS.
ENDFORM. " EVENTS
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
SKIP.
ULINE.
WRITE :/2 ' DATE :', SY-DATUM,
45 'INTELLIGROUP ASIA PVT LTD',
110 'TIME :', SY-UZEIT.
WRITE : /3 'USER :', SY-UNAME,
45 'TITLE :', SY-TITLE,
110 'PAGE :', SY-PAGNO.
ULINE.
SKIP.
ENDFORM. "TOP_OF_PAGE
Cheers
navjot
Reward with points if it is helpful
Message was edited by:
navjot sharma -
SSAS- DAX expression : Is there any DAX function that can return multiple values ?
Hi,
Iam in search of a DAX function that can return multiple values as result. please find below scenario where i want to implement the same.
I have three Tables: Table A (typeid, Cost, Qty ) ,Table B (typeid, Cost, Qty ) , Table C ( typeid,Typename ) .
Table A Table B
Table C
type id cost Qty type id Cost Qty
typeid typename
1 100 100 3 300
300 1 aa
2 200 200 4 400
400 2 bb
3 cc
4
dd
i have to club cost and Qty of two tables(four measures) as two measures in the UI report. There are more columns in these tables that restrict the UNION of the tables.(for the sake
of understanding , i have not mentioned the othr columns). In the UI report(Execl 2013-power pivot) iam plotting these measures against the
Table C.Typeid. Hence the measures drill down against each
Table C. Typeid as shown below:
Typeid Table A.cost Table A.Qty TableB.cost TableB.Qty
1 100 100
2 200 200
3
300 300
4
400 400
My requirement is to club these measures so that the report will be as below
Type id cost Qty
1 100 100
2 200 200
3 300 300
4 400 400
Since i cannot club these in model,as a work around, i created a calculated measure in excel(Analyze tab->Calculations->olap tools->calculated measure) with the condition as below:
new cost = IIF (ISEMPTY(TableA.cost)="TRUE",TableB.cost,TableA.cost)
new Qty = IIF(ISEMPTY(TableA.Qty)="TRUE",TableB.Qty,TableA.Qty) and dragged these new measures into the report. It was working fine as expected.
But this functionality of Creating calculatedmeasure in excel report is possible only in 2013 excel version.
Now the requirement is to get the same result in 2010 excel. Can you please help me in implementing the same in 2010 excel? or any other alternative method to bring the columns in model itself. I tried to create a measure in table A with DAX expression as
: new cost :=CALCULATE(SUM(Table B.cost),ISBLANK(TableA.cost)) -> but this will return only 1 result .i need Sum(Table A.cost) also if it is not blank.
Thanks in advanceYou can use SUMX ( 'Table A', 'Table A'[Cost] + 'Table B'[cost] )
However, if you install the latest version of Power Pivot in Excel 2010, it supports the ISEMPTY function, too.
http://support.microsoft.com/kb/2954099/en-us
Marco Russo http://www.sqlbi.com http://www.powerpivotworkshop.com http://sqlblog.com/blogs/marco_russo -
Is that posible: return a value and AFTER THAT calculate next one?
I would like for better performance have a functionality to, first, return a value (prepared already), after that calculate a next one for next call.
Is that any way to perform it some how in PL/SQL?
After some time I have guess the next way:
Have a table with current and next value
On request read and return next.
To update have a trigger on select to move the next value to the current and calculate the next-to-current into the 'next' column.
Thus, I would need to have 'init'-procedure to set: table, if not exist; trigger, if not exist; set current (the first one) and next one into that table.
It just a plan; I am not sure if all doable.
But it seems kind of heavy.
Is it possible to have it simpler?- I do not ask you to judg my task, processing, reasonability or an idea of sequence implementation.
That's the beauty of the forums - you get that extra help without having to ask!
Also I am not asking to help me in anything!
I do not have any assignment and do not need to anyone resolve my requirements!
Of course you are asking for help when you post on the forums; that is what they are here for.
And to get the best help you need to respond to the questions of the people that are trying to help you. You never responded to what both ramin and gaverill ask you above:
What is your objective? What problem are you trying to solve? Why is it not 'acceptable' to simply calculate the 'next' value when you need it?
For some reason you think using the DBMS_SCHEDULER is 'helpful' but you don't seem to realize that a job is going to be asynchronous to whatever else you are doing. Your code may need a value before the job is finished computing it.
Without knowing the PROBLEM you are trying to solve no one can help you find the most appropriate solution. And using a custom table to roll your own sequence generator is almost ALWAYS the wrong thing to do for both performance and scalability reasons. -
What is the Function MOdule that returns the fields in database table order
Hello Folks
I have a dynamic internal table with fields ( which are not in order). I want to display them in the order of which they are present in the database table? Is there any function module that returns the fields in database order?
FAQ. Please search before posting your question.
Edited by: Suhas Saha on Oct 10, 2011 10:19 PMHi,
You can use this BAPI.
<b>BAPI_SALESORDER_GETLIST</b>
Reward if useful.
Regards,
Vimal -
Function Does Not Return any value .
Hi ,
I am wrtting the below funtion without using any cursor to return any message if the value enters by parameters
does not match with the value reterived by the function select statement or it does not reterive any value that
for the parameters entered .
E.g:
CREATE OR REPLACE FUNCTION TEST_DNAME
(p_empno IN NUMBER,p_deptno IN NUMBER)
RETURN VARCHAR2
IS
v_dname varchar2(50);
v_empno varchar2(50);
V_err varchar2(100);
v_cnt NUMBER := 0;
BEGIN
SELECT d.dname,e.empno
INTO v_dname ,v_empno
FROM scott.emp e , scott.dept d
WHERE e.empno=p_empno
AND d.deptno=p_deptno;
--RETURN v_dname;
IF p_empno IS NOT NULL AND p_deptno IS NOT NULL
THEN IF v_dname is NULL THEN
v_err :='Not Valid';
RETURN v_err;END IF;
ELSIF p_empno IS NOT NULL AND p_deptno IS NOT NULL
THEN IF v_dname is NOT NULL THEN
RETURN v_dname; END IF;
ELSE
RETURN v_dname;
END IF;
END;
Sql Statement
SELECT TEST_DNAME(1234,30) FROM dual
AND IF I enter a valid combination of parameter then I get the below error :
e.g:
SQL> SELECT TEST_DNAME(7369,20) FROM dual
2 .
SQL> /
SELECT TEST_DNAME(7369,20) FROM dual
ERROR at line 1:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "SCOTT.TEST_DNAME", line 24
Where I am missing .
Thanks,Format you code properly and look at it:
CREATE OR REPLACE
FUNCTION TEST_DNAME(
p_empno IN NUMBER,
p_deptno IN NUMBER
RETURN VARCHAR2
IS
v_dname varchar2(50);
v_empno varchar2(50);
V_err varchar2(100);
v_cnt NUMBER := 0;
BEGIN
SELECT d.dname,
e.empno
INTO v_dname,
v_empno
FROM scott.emp e,
scott.dept d
WHERE e.deptno=d.deptno
AND e.empno=p_empno
AND d.deptno=p_deptno;
--RETURN v_dname;
IF p_empno IS NOT NULL AND p_deptno IS NOT NULL
THEN
IF v_dname is NULL
THEN
v_err :='Not Valid';
RETURN v_err;
END IF;
ELSIF p_empno IS NOT NULL AND p_deptno IS NOT NULL
THEN
IF v_dname is NOT NULL
THEN
RETURN v_dname;
END IF;
ELSE
RETURN v_dname;
END IF;
END;
/Both p_empno and p_deptno in
SELECT TEST_DNAME(7369,20) FROM dualare not null. So SELECT will fetch some v_dname and v_empno. Since p_empno and p_deptno iare not null your code will go inside outer IF stmt and will execute its THEN branch. That branch consist of nothing but inner IF statement. And since v_dname is NOT NULL it will bypass that inner IF and exit the outer IF. And there is no RETURN stmt after that outer IF. As a result you get what you get - ORA-06503. Also, both if and elsif in your code check same set of conditions which makes no sense.
SY. -
Function does not return a value
CREATE OR REPLACE PACKAGE BODY Promo_Version_Logo_Pkg IS
FUNCTION Promo_Version_Logo_Rule(Rc IN test.Ot_Rule_Context)
RETURN Ot_Rule_Activation_Result
IS
PRAGMA AUTONOMOUS_TRANSACTION;
v_Result NUMBER;
CURSOR Cur_Promo_Logos IS
SELECT Pvlo.Promo_Id,
Evt.On_Date,
Evt.Channel_Id,
Evt.Start_Time,
Evt.Duration,
Pvlo.Logo_Id
FROM Event Evt,
Event_Technical_Data Etd,
Promo_Version_Logo_Opt Pvlo,
Promo_Timing Pt
WHERE Evt.Event_Technical_Data_Id = Etd.Event_Technical_Data_Id
AND Etd.Promo_Timing_Id = Pt.Promo_Timing_Id
AND Pt.Promo_Timing_Id = Pvlo.Promo_Timing_Id
AND Evt.Channel_Id = Rc.Channelid
AND Evt.On_Date >= Rc.Fromdate
AND Evt.On_Date <= Rc.Todate
AND Evt.Day_Type_Id = Rc.Daytype;
BEGIN
FOR Each_Record IN Cur_Promo_Logos LOOP
v_Result := Testing_Pkg.Insert_Event(v_Channel_Id => Each_Record.Channel_Id,
v_Tx_Time => Each_Record.Start_Time,
v_Tx_Date => Each_Record.On_Date,
v_Content_Id => Each_Record.Logo_Id,
v_Duration => Each_Record.Duration,
v_Event_Type => Uktv_Tools_Pkg.c_Logo_Kind_Code,
v_Container_Id => Each_Record.Promo_Id);
IF v_Result = -1
THEN
EXIT;
END IF;
END LOOP;
END Promo_Version_Logo_Rule;
END Promo_Version_Logo_Pkg;why do I get this "Hint: Function 'Promo_Version_Logo_Rule' does not return a value" after I compile it? The Testing_Pkg.Insert_Event should insert some values somewhere...I just want to try to test it before I move on onto the next bit of it, but I do not understand what I am doing wrong...
ThanksYou need something like:
END LOOP;
RETURN v_Result; -- if this is what you are trying to get the function to do
EXCEPTION
WHEN OTHERS THEN
<exception handling/logging - whatever you want>
RAISE; --this with then raise an error back to the calling process
END Promo_Version_Logo_Rule;This way the function either returns a value, or an exception which can be handled in the calling procedure -
In DEV system, this piece of code is working fine. However when it moves to Testing system it dump due to cl_fpm_factory=>get_instance( ) return initial value. What could be the reason for this? Thanks!
data lo_fpm type ref to if_fpm.
lo_fpm = cl_fpm_factory=>get_instance( ).
wd_this->go_message_manager = lo_fpm->mo_message_manager.Hi Anthony,
how sure are you that the DEV and Test system running the same Netweaver SP versions ?. My doubt is that the test system is not NW7.01 (Ehp-1) . Or some thigs are not enabled in the configuration.
Regards
Senthi -
Hello,
I just purchased a Samsung ML2160 printer and it doesn't work with nor my Pages program, nor the Preview (to print PDF). No matter the way I tried, the Print function doesn't work and I cannot neither print or even enter the printer preferrences menu! My MacBook Pro has worked before with other printers, but now with the Samsung it doesn't work at all... Though, if I drag and drop a document, jpg, pdf in the printer queue, it prints just fine, but that method gives me absolutely no freedom to the printing... Could it be something from the Computer -> Machintosh HD -> Library -> Printers? Because a friend of mine was recently trying to save me some disk space, and therefore erasing part of the HP printer (to remove the previous printer I owned)...
If anyone has any idea, that would be much appreciated
Thank you in advanceDo the sensible thing, as you say neither Preview nor Pages print, try other programs eg TextEdit. If none of them print then it is a System problem and very likely the printer drivers are AWOL or were never installed.
Go to Samsung's website and download their software for the Mac:
http://www.samsung.com/uk/consumer/print-solutions/print-solutions/mono-printers /ML-2160/XEU-support
http://www.samsung.com/uk/support/model/ML-2160/XEU-downloads
Peter -
Query or function that returns distinct values and counts
For the following table:
ID number
address varchar(100)
Where the ID is the primary key and addresses might be repeated in other rows, I'd like to write a query that returns distinct addresses and the count for the number of times the address exists in the table. What's the best way to do this? Thank you in advance.Jlokitz,
select address, count(*)
from table
group by address;
HTH
Ghulam -
Apex 2.2 popup lov doesn't return chosen value
Hey,
I've built a page within one of my applications in apex 2.2 that has an item based on a Popup LOV. I have a pre-built dynamic LOV.
When I run the page the popup icon appears and I can launch the popup. The filters work, and the result set appears. However, if I attempt to click on a value, nothing happens. The window remains opened and no value is returned to the parent window. The browser window shows no sign of javascript errors.
I'm using Theme 11 and the standard popup template.
I've tried this is a different workspace, using the same lov sql etc, and it works ok!
I've tried it elsewhere in a new page within my problematic application, and the problem is replicated there too.
What could be going wrong?
Cheers,
JohnHi,
I have to create a page , with dynamic Popup using query. I am using APEX_ITEM.POPUP_FROM_QUERY(). Dynamic popup is generated, i can able to open the popup, when i click the link of the generated records. It does not return the value.
I feel that , it's like your error.
could you please help me ou.t
Thanks
kam -
'Query not returning string values as expected
Hi
Why would this be happening?
I have an insert statement that looks like this;
UNION ALL
SELECT '59','','last','first','','','','WILLIAMTA','BEB92C5B52566E6594707C69729624BE','','','Senior Officer','Town Name','2','','SUSTAINABLE FOREST MANAGEMENT DIVISION','NAME BRANCH','CURRENT' FROM DUAL
...I then want to create an conditional display statement in an apex application that looks like this;
PLEASE NOT I HAVE REPLACED (the symbols that will not render for not equal to) WITH THE TEXT "NOT EQUAL TO"
SELECT USERNAME
FROM sfm_common.sct_parties
WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION'
AND username = :app_userBut it doesnt return anything and I know it should so I do some tests, below;
1. You will see the first statement returns no records.
2. In the second statement there is a space between N and the quote, and it returns a record
3. In the third test if I make the gap really big it still returns a value.
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Sep 8 14:27:55 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> SELECT DISTINCT null
2 FROM sfm_common.sct_parties
3 WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION'
4 /
no rows selected
SQL> SELECT DISTINCT null
2 FROM sfm_common.sct_parties
3 WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION '
4 /
N
SQL> SELECT DISTINCT NULL
2 FROM sfm_common.sct_parties
3 WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION '
4 /
N
SQL>Would anyone know why this has happened, I have checked my insert scripts and there is no space at the end of the text in the column named 'division'.
Ben
Edited by: Benton on Sep 8, 2009 2:59 PMThe table contains attributes like this;
Col_1
TOMATO
ORANGE
APPLE
NULLSo what I was attempting to do was something like this;
SELECT col_1 FROM table WHERE col_1 != 'TOMATO'
I would then expect to see;
Col_1
ORANGE
APPLE
NULLBut instead I had the following returned;
no rows selected
Which is not correct.
Apparently the fact that the column is 255 characters long is causing a problem, but I really dont understand why because I have other tables where I execute columns that are not the exact length of the content and yet the sort of query that I have used as an example work perfectly fine. For example;
SQL> SELECT name
2 FROM table_name
3 WHERE name != 'HYGIENE MANAGEMENT'
4 /
NAME
ACTION
APPROVALS
AUDITING
BURNING
COLLECTION
COMMUNICATION
COMPLIANCE
DEVELOPMENT
DISTURBANCE
DOCUMENT CONTROL
ERADICATION
11 rows selected.
SQL>And the ddl for the table looks like this;
CREATE TABLE "TABLE_NAME"
( "ACT_ID" NUMBER,
"NAME" VARCHAR2(50 BYTE) NOT NULL ENABLE,
"CREATED_BY" VARCHAR2(50 BYTE) DEFAULT 'USER',
"CREATED_ON" DATE DEFAULT SYSDATE,
"EFF_FROM" DATE DEFAULT SYSDATE,
"EFF_TO" DATE,
"DEFINITION" VARCHAR2(4000 BYTE),
"STATUS" VARCHAR2(15 BYTE) DEFAULT 'CURRENT' NOT NULL ENABLE,
CONSTRAINT "TABLE_NAME_CHK1" CHECK ( status IN ('CURRENT','NOT CURRENT')) ENABLE,
CONSTRAINT "TABLE_NAME_PK" PRIMARY KEY ("ACT_ID");The name field in this instance is 50 characters long and the words 'HYGIENE MANAGEMENT' make up 18 characters.
Ben -
LOV problem ... returning display-value and not key-value
Hi. Sorry for my broken English.
I have a problem with pop-up dynamic LOV.
I have a simple form called Form A containing item_code and item_name. Users can create, update and delete new item by using this form.
Another form called Form B has a field called item_code, and the item_code field is a dynamic pop-up LOV field and a query for this LOV is like this;
select item_name d, item_code r from item_master order by item_code;
When i create the new record in Form B and use LOV to find and get the item code, LOV works fine
and it returns key-value to the item_code field.
But when i try to update the record (I have a link from report page to Form B), value of the item_code field is not the key-value from LOV, but is a
display-value from LOV.
Any ideas?
Thank you.Well, from what you have described, this is working exactly as it should. Form B's LOV is intended to retrun the key value but should show the dispaly value. When you go from the report to the form, the key value is being passed (or should be depending on your code) and Form B ought to show the display value.
So, in short, I would say that Apex is doing what it should. Unless I misunderstand something.
Bruce
Maybe you are looking for
-
Section Code details not captured at the time of vendor clearing
Hi Experts ! I am facing problem in clearing of vendors accounts through F-44 or F-54 . The problem is creating with those vendors accounts which having withholding tax. Error massage is (Fill Section Code) At the posting of down payment and invoici
-
Does anyone know if the Zfd 7 will be backwards compatible with the zfd 4 agent? We are going to wait to upgrade our servers/workstations until 7 comes out. But we need to know if our workstations (6000 of them) with zfd 4 installed on them will comm
-
Unable to see SFSF Adapter in Adapter list
Hi Experts, we are doing the integration with ECC-HCM--> SAP PI ---> SUCCESSFACTOR As per the below link we have deployed the Successfactor components in our SAP PI 7.4 dual stack system. http://scn.sap.com/community/pi-and-soa-middleware/blog/2014/0
-
How to use Crystal report with Java
Dear everyone, i am completely new to Crystal report , please can anyone help me to creat a very simple Report using the Crystal report, the report will show some records from oracle DB. How can i make it by a simple example and with code please? do
-
Keep getting itunes not working when accessing store windows 7
I keep receiving the message" iTunes stopped working" only when trying to access the store. Using windows 7 and have all of the latest updates.