Call for BAPI_GOODSMVT_CREATE inside MB_DOCUMENT_BEFORE_UPDATE
Hi
My requirement is -
When I do MIGO for a outbound delivery, GR should happen simultaneously in background for a PO.
I tried to implement interface MB_DOCUMENT_BEFORE_UPDATE where I call BAPI_GOODSMVT_CREATE
I tried to test the BAPI independantly , It is working properly for my requirment. But when I call it inside above BADI it is giving dump saying MB_DOCUMENT_POST called for second time.
I guess, the problem is BAPI is trying to post the GR for PO before posting of delivery is complete.
Please suggest options to acheive this.
Regards
Harshada
Thanks for reply.
I did create FM and called it in BADI but it gave the same result as I called BAPI directly from enhance program.
and what do you mean 'NEW TASK' Is that you mean call function in update task?
I did try call function in update task but it didn't work.
The problem is BAPI function returned that Mat XXX Batch XXX is alreay locked by XXX and also cannot get created material doc number.
Similar Messages
-
Input parameters for BAPI_GOODSMVT_CREATE --MIGO--GR for Outbound Delivery
Hi Friends,
We have to create a Goods Receipt against an Outbound Delivery ( movement type "101" ) using the BAPI <b>BAPI_GOODSMVT_CREATE</b>.
In online the user is using <b>MIGO</b> transaction for the same. There he will choose the GOODS RECEIPT for OUTBOUND DELIVERY and enters the delivery number. The movement type "101" is used.
Could you please tell me the GM code and the required fields to be passed for the above scenario.
I have gone through the example program in the link...
http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm
<b>but unable to find how to use this BAPI for simulating MIGO transaction.</b>
<b>The fields available are with us are...</b>
Delivery. No. --- Doc. Date - Posting Date-Quantity-Storage Location-
Reason for movement-External qty-External qty unit-Goods recipient-Excise Selection
Are these fields sufficient for doing MIGO with this BAPI or do we require more fields???
Thanks and Regards,
Bharatsee the following code. it may be useful.
LOOP AT I_TAB.
count = sy-tabix.
SELECT SINGLE * FROM ZMM_GR_UPLOAD1
WHERE SOLOMON_GR = I_TAB-SOLOMON_GR AND
SOLOMON_GRDAT = I_TAB-SOLOMON_GRDAT.
IF SY-SUBRC = 0.
I_TAB-FLAG = 'C'.
modify i_tab index count.
concatenate 'File Name : ' name into i_msg1.
append i_msg1.
CONCATENATE 'ERROR PO : ' I_TAB-SOL_PONO
' WAS ALREADY UPLOADED' INTO I_MSG1.
APPEND I_MSG1.
CLEAR I_TAB-FLAG.
CONTINUE.
ELSE.
REFRESH I_ITEMS.
CLEAR I_ITEMS.
CONCATENATE I_MAIN-SOLOMON_GRDAT+4(4)
I_MAIN-SOLOMON_GRDAT+2(2)
I_MAIN-SOLOMON_GRDAT+0(2) INTO G_DATE.
gmhead-pstng_date = G_DATE.
gmhead-doc_date = sy-datum.
gmhead-pr_uname = sy-uname.
"01 - MB01 - Goods Receipts for Purchase Order
gmcode-gm_code = '01'.
refresh itab.
clear itab.
SORT I_MAIN BY SOLOMON_GR.
LOOP AT I_MAIN WHERE SOLOMON_GR = I_TAB-SOLOMON_GR.
itab-move_type = '101'.
itab-mvt_ind = 'B'.
itab-plant = I_MAIN-WERKS.
itab-material = I_MAIN-MATNR.
itab-entry_qnt = I_MAIN-ERFMG.
itab-stge_loc = 'OMR1'.
itab-move_stloc = pcitab-recv_loc.
itab-REF_DOC = 'exnum123'.
itab-NO_MORE_GR = 'X'.
itab-WITHDRAWN = ''.
itab-stge_loc = I_MAIN-LGOBE.
itab-po_number = I_MAIN-EBELN.
itab-po_item = I_MAIN-EBELP.
itab-unload_pt = I_MAIN-ABLAD2.
append itab.
ENDLOOP.
if not itab[] is initial.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gmhead
goodsmvt_code = gmcode
* TESTRUN = ' '
IMPORTING
goodsmvt_headret = mthead
* MATERIALDOCUMENT =
MATDOCUMENTYEAR =
tables
goodsmvt_item = itab
GOODSMVT_SERIALNUMBER =
return = errmsg.
clear errflag.
loop at errmsg.
if sy-tabix = 1.
concatenate 'File Name : ' name into i_msg1.
append i_msg1.
concatenate 'Sol PO : ' I_TAB-SOL_PONO ' '
I_TAB-SOL_PODT into i_msg1.
append i_msg1.
endif.
if errmsg-type eq 'E'.
write:/'Error in function', errmsg-message.
errflag = 'X'.
else.
write:/ errmsg-message.
endif.
move errmsg-message to i_msg1.
append i_msg1.
endloop.
if errflag is initial.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
commit work and wait.
if sy-subrc ne 0.
write:/ 'Error in updating'.
exit.
else.
concatenate 'File Name : ' name into i_msg1.
append i_msg1.
concatenate 'Sol PO : ' I_TAB-SOL_PONO ' '
I_TAB-SOL_PODT into i_msg1.
append i_msg1.
write:/ mthead-mat_doc, mthead-doc_year.
ZMM_GR_UPLOAD1-SOLOMON_GR = I_TAB-SOLOMON_GR.
CONCATENATE I_TAB-SOLOMON_GRDAT+4(4)
I_TAB-SOLOMON_GRDAT+2(2)
I_TAB-SOLOMON_GRDAT+0(2) INTO
ZMM_GR_UPLOAD1-SOLOMON_GRDAT.
ZMM_GR_UPLOAD1-SOLOMON_GRDAT = I_TAB-SOLOMON_GRDAT.
INSERT ZMM_GR_UPLOAD1.
COMMIT WORK.
I_TAB-FLAG = 'C'.
MODIFY I_TAB INDEX COUNT.
CONCATENATE mthead-mat_doc mthead-doc_year
into i_msg1.
append i_msg1.
perform upd_sta.
endif.
endif.
endif.
ENDIF.
ENDLOOP. -
Error when calling a method inside a form routine...
Hello experts,
I am trying to call a method inside a form but it is giving me an error. The error is:
Access not possible using 'NULL' object reference.
Anyway, below is my code guys:
START-OF-SELECTION.
DATA: main TYPE REF TO lcl_main,
old_and_new TYPE REF TO lcl_old_and_new,
check_changes TYPE REF TO lcl_check_changes,
messages TYPE REF TO lcl_messages.
CREATE OBJECT: main, old_and_new, check_changes, messages.
FORM get_orig_contents_of_zts0001 *
FORM get_orig_contents_of_zts0001.
CALL METHOD main->export_old_recs.
ENDFORM.
Help would be greatly appreciated. Thanks a lot and take care!Before the "START-OF-SELECTION " just add this sentense :
<b>class lcl_main definition deferred.</b>
CLASS Definition.
ENDCLASS.
CLASS Implementation.
ENDCLASS.
START-OF-SELECTION.
*Do your coding here
<b>in this way we are deferring the class definition for later</b> -
Display invalid pattern name while calling the procedure inside the package
Hi ,
I'am trying to call a package which is having procedure ,from JDBC in which one of the return type is Varray from the procedure.When i'am calling the procedure inside the package
from java showing invalid name pattern name.Just i'am placing the code snippet for package and calling java through package.
Package body
create or replace package body Rewards_Summary_Package as
PROCEDURE Rewards_Summary_Procedure
(v_Tot_Earned_Points OUT NUMBER, v_TOT_REDEEMED OUT NUMBER, v_TOT_PTS_EXP OUT NUMBER,
v_TOT_AVAILABLE OUT NUMBER, v_TIER_NAME OUT VARCHAR2,VA OUT t_varray,V_PR_CON_ID IN VARCHAR2) AS
v_ACCRUALED_VAL NUMBER := 0;
v_USED_VAL NUMBER := 0;
/*v_TOT_ACCRUALED_VAL NUMBER := 0;
v_TOT_USED_VAL NUMBER := 0;
V_PR_TIER_ID VARCHAR2(30);
V_PR_CON_ID VARCHAR2(30);
V_EXPIRY_DT DATE;
v_month varchar2(30);
v_date date;
v_next_month_date date;
v_TIER_NAME VARCHAR2(50);
v_TOT_AVAILABLE NUMBER := 0;
v_EARNED NUMBER := 0;
v_TOT_EARNED NUMBER := 0;
v_TOT_REDEEMED NUMBER := 0;
v_TOT_EXPIRED NUMBER := 0;
v_EARNED_TOTAL NUMBER := 0;
v_TOT_EXPIRED_MONTH NUMBER := 0;
v_TOT_PTS_EXP NUMBER := 0;
v_TOT_RDMD_CANCELLED NUMBER :=0;
v_TOT_EARNED_POINTS NUMBER :=0;*/
v_FIRST_DT DATE;
v_LAST_DT DATE;
v_MEMBER_ID VARCHAR2(30);
V_EXPIRED_VAL Number;
v_TOT_PRDPTS_RDMD NUMBER := 0;
v_TOT_PTS_RDMD NUMBER := 0;
v_CAN_ACCRUAL_POINTS NUMBER := 0;
BEGIN
/*TotalRwdPoints and Tier Name*/
SELECT TR.NAME,MEM.POINT_TYPE_A_VAL,MEM.ROW_ID INTO v_TIER_NAME,v_TOT_AVAILABLE,v_MEMBER_ID
FROM SIEBEL.S_LOY_MEMBER MEM, SIEBEL.S_LOY_TIER TR WHERE MEM.PR_DOM_TIER_ID=TR.ROW_ID
AND MEM.PR_CON_ID=V_PR_CON_ID;
vTotPrdPtsRdmd
SELECT NVL(SUM(A.VALUE),0) INTO v_TOT_PRDPTS_RDMD from SIEBEL.S_LOY_RDM_ITM A,SIEBEL.S_LOY_ATTRDEFN B
WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND A.TYPE_CD='Product'
AND A.TXN_ID IS NOT NULL;
vTotPtsRdmd
SELECT NVL(SUM(A.VALUE),0) INTO v_TOT_PTS_RDMD from SIEBEL.S_LOY_RDM_ITM A,SIEBEL.S_LOY_ATTRDEFN B
WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND (A.TYPE_CD='Product' or A.TYPE_CD='Transfer')
AND A.TXN_ID IS NOT NULL;
vTotRewardPtExp
SELECT NVL(SUM(A.VALUE),0) INTO v_TOT_PTS_EXP FROM SIEBEL.S_LOY_RDM_ITM A,SIEBEL.S_LOY_ATTRDEFN B
WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND A.TYPE_CD='Expired'
AND a.TXN_ID IS NULL;
vCanAccrualPoints
SELECT NVL(SUM(A.ACCRUALED_VALUE),0) INTO v_CAN_ACCRUAL_POINTS from SIEBEL.S_LOY_ACRL_ITM A,SIEBEL.S_LOY_ATTRDEFN B
WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRIB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND A.TYPE_CD='Cancellation';
v_Tot_Earned_Points := v_TOT_AVAILABLE+v_TOT_PRDPTS_RDMD+v_TOT_PTS_EXP-v_CAN_ACCRUAL_POINTS;
v_TOT_REDEEMED := v_TOT_PTS_RDMD-v_CAN_ACCRUAL_POINTS;
DBMS_OUTPUT.PUT_LINE(' Total Earned: '|| v_Tot_Earned_Points || ' Total Redeemed: '|| v_TOT_REDEEMED || ' Total Expired: '|| v_TOT_PTS_EXP
|| ' Balance Points: '|| v_TOT_AVAILABLE || ' Tier Name: '|| v_TIER_NAME);
select trunc(sysdate,'MONTH') INTO v_FIRST_DT from dual;
va:= t_varray(Null,Null,Null,Null,Null,Null);
FOR a in 1 .. 6 LOOP
select trunc(last_day(v_FIRST_DT)) INTO v_LAST_DT from dual;
SELECT SUM(AI.ACCRUALED_VALUE),SUM(AI.USED_VALUE) INTO v_ACCRUALED_VAL,v_USED_VAL from SIEBEL.S_LOY_ACRL_ITM AI,SIEBEL.S_LOY_ATTRDEFN A
WHERE AI.MEMBER_ID = v_MEMBER_ID AND A.ROW_ID = AI.ATTRIB_DEFN_ID AND A.INTERNAL_NAME = 'Point 1 Value'
AND trunc(AI.EXPIRATION_DT) >= v_FIRST_DT AND trunc(AI.EXPIRATION_DT) <= v_LAST_DT;
V_EXPIRED_VAL := NVL(v_ACCRUALED_VAL-v_USED_VAL,0);
va(a):=V_EXPIRED_VAL;
v_FIRST_DT := add_months(v_FIRST_DT,1);
End loop;
END;
end;
Package declaration
create or replace package Rewards_Summary_Package as
TYPE t_varray IS VARRAY(6) OF NUMBER;
PROCEDURE Rewards_Summary_Procedure
(v_Tot_Earned_Points OUT NUMBER, v_TOT_REDEEMED OUT NUMBER, v_TOT_PTS_EXP OUT NUMBER,
v_TOT_AVAILABLE OUT NUMBER, v_TIER_NAME OUT VARCHAR2,VA OUT t_varray,V_PR_CON_ID IN VARCHAR2);
end;
java code
I had tried using java types and Oracle types
conn=SiebelServiceDatasource.getConnection(SSBConstants.REWARDS_PROP_LOG_SUFIX);
// ArrayDescriptor.TYPE_VARRAY
ocstmt=(OracleCallableStatement)conn.prepareCall(" {call REWARDS_SUMMARY_PACKAGE.REWARDS_SUMMARY_PROCEDURE(?,?,?,?,?,?,?)}");
//ocstmt=(OracleCallableStatement)conn.prepareCall(" call Test_Array(?,?)");
ocstmt.registerOutParameter(1,OracleTypes.INTEGER);
ocstmt.registerOutParameter(2,OracleTypes.INTEGER);//1-616BH
ocstmt.registerOutParameter(3,OracleTypes.INTEGER);
ocstmt.registerOutParameter(4,OracleTypes.INTEGER);
ocstmt.registerOutParameter(5,OracleTypes.VARCHAR);
ocstmt.registerOutParameter(6,OracleTypes.ARRAY,"SIEBEL.T_VARRAY");
ocstmt.setString(7,contactSiebelRowId);
ocstmt.execute();
Showing the following invalid name pattern SIEBEL.T_VARRAY
Please help
Thanks in advance
Kirancreate or replace package Rewards_Summary_Package as
TYPE t_varray IS VARRAY(6) OF NUMBER;
end;You've declared your type inside the package. You need to declare it as a SQL type, which is not part of a PL/SQL package. -
GetOutputStream() has already been called for this response
I have a problem with my servlet,
i compiled my code,it works normally but there is an error occured when it works.
The error is :
java.lang.IllegalStateException: getOutputStream() has already been called for this response
* at org.apache.catalina.connector.Response.getWriter(Response.java:607)*
* at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:196)*
* at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125)*
* at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:118)*
* at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:179)*
* at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:116)*
* at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:76)*
* at org.apache.jsp.KaptchaExample_jsp._jspService(KaptchaExample_jsp.java:209)*
* at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)*
* at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*
* at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)*
* at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)*
* at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)*
* at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*
* at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)*
* at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)*
* at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)*
* at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)*
* at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)*
* at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)*
* at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)*
* at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)*
* at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)*
* at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)*
* at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)*
* at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)*
* at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)*
* at java.lang.Thread.run(Thread.java:534)*
here is my code :
Iterator iter = ImageIO.getImageWritersByFormatName(imageFormat);
* if( iter.hasNext() ) {*
* ImageWriter writer = (ImageWriter)iter.next();*
* ImageWriteParam iwp = writer.getDefaultWriteParam();*
* if ( imageFormat.equalsIgnoreCase("jpg") || imageFormat.equalsIgnoreCase("jpeg") ) {*
* iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);*
* iwp.setCompressionQuality(imageQuality);*
* //writer.setOutput(ImageIO.createImageOutputStream(response.getWriter()));*
* IIOImage imageIO = new IIOImage(bufferedImage, null, null);*
* writer.write(null, imageIO, iwp);*
* response.flushBuffer();*
please help me,would u give me a solutions for my problem..i really appreciate if you want to give a solution.
Regards,
Dany FauziActually the stack trace indicates the the error is happening in KaptchaExample.jsp, not in a Servlet. I'm guessing that the code you've presented is in a scriptlet (i.e. inside the JSP in <% %> brackets). This is altogether the wrong place for it. JSPs are purely for generating HTML and to try and generate image responses in one is doomed to failure. Write a servlet class to generate your image file. If you want to embed a dynamically generated image in an HTML page, then you need to generate HTML which accesses the Servlet through the <img src=... tag, i.e. the browser retrieves the image data as a separate transaction.
The immediate source of the crash is that the JSP already opened the output stream in order to write HTML output, so it's too late to try and open it for the writing of image data. -
Oracle Execution Time for function inside view
Hi Guys,
i would like to ask if i call a function inside a view , how does it behave in term of execution time and performance
For Example i have a view as below
create or replace view CUST.CUST_VIEW
select a.nice , a.getCustomDisplay(a.name,a.pin,a.dos,b.master_key) as custom from CUST.customer as a , CUST.master as b
where a.idno = b.main_id_no
AND the function look like this
create or replace function getCustomDisplay(a varchar2,b varchar2,c varchar2,d varchar2)
begin
select * from CUST.MAPPING_MATRIX order by idno asc;
for loop
//logic goes here to determine the result return from matrix
end
My Question is for example
1. If i do select * from CUST.CUST_VIEW ( return 1000 records for example ) , so the function getCustomDisplay will be executed 1000 times also right ( that means select * from CUST.MAPPING_MATRIX order by idno asc; will also be executed 1000 times ) ?
2. If i do select * from CUST.CUST_VIEW where rownum <= 20 , how many times getCustomDisplay() function will be executed ?
The reason i ask this because recently we saw a few million execution times per day from AWR report for this query
"select * from CUST.MAPPING_MATRIX order by idno asc;"
But when i investigate , and put a logger whenever it call getCustomDisplay , the query above as mention in item no 2 only will be executed as many as the record that will be returned from ( view + where condition ).
3. will it affect performance if my view return a lot of records ? or is there any way to improve it?
ThanksHi
i have other solutions that seems work for reducing number of execution times but do you think its scalable and feasible ?
CREATE OR REPLACE package body ACER.TYPE_CAT_PASS_UTIL_TEST as
*/* Private package data */*
TYPE g_rec IS RECORD (
id_no VARCHAR2 (4),
type_pass VARCHAR2 (3),
scheme_ind VARCHAR2 (5),
cat_pass VARCHAR2 (2),
entrepass VARCHAR2 (2),
display_type_pass VARCHAR2 (15),
display_cat_pass VARCHAR2 (5),
display_type_pass_desc VARCHAR2 (80),
rule_id VARCHAR2 (5)
TYPE g_tab_type IS TABLE OF g_rec INDEX BY BINARY_INTEGER;
g_tab g_tab_type;
i BINARY_INTEGER;
procedure initializeTypePassMatrix(test IN varchar2) as
begin
if(g_tab.COUNT < 1)then
FOR appln_rec in (
SELECT tb_type_cat_pass_matrix.id_no,
tb_type_cat_pass_matrix.type_pass,
tb_type_cat_pass_matrix.scheme_ind,
tb_type_cat_pass_matrix.cat_pass,
tb_type_cat_pass_matrix.entrepass,
tb_type_cat_pass_matrix.display_type_pass,
tb_type_cat_pass_matrix.display_cat_pass,
tb_type_cat_pass_matrix.display_type_pass_desc,
tb_type_cat_pass_matrix.rule_id
FROM tb_type_cat_pass_matrix ORDER BY id_no asc)
LOOP
dbms_output.put_line('g_tab.COUNT before insert: ' || g_tab.COUNT);
i := g_tab.COUNT + 1;
g_tab (i).id_no := appln_rec.id_no;
g_tab (i).type_pass := appln_rec.type_pass;
g_tab (i).scheme_ind := appln_rec.scheme_ind;
g_tab (i).cat_pass := appln_rec.cat_pass;
g_tab (i).entrepass := appln_rec.entrepass;
g_tab (i).display_type_pass := appln_rec.display_type_pass;
g_tab (i).display_cat_pass := appln_rec.display_cat_pass;
g_tab (i).display_type_pass_desc:= appln_rec.display_type_pass_desc;
g_tab (i).rule_id := appln_rec.rule_id;
DBMS_OUTPUT.put_line ('g_tab.count after insert: ' || g_tab.COUNT);
END LOOP;
else
DBMS_OUTPUT.put_line ('g_tab>=1, no need to initialize');
end if;
exception
when others then
dbms_output.put_line('error happen'||DBMS_UTILITY.format_error_backtrace);
Logger.ERROR('TYPE_CAT_PASS_UTIL.initializeTypePassMatrix',SQLCODE,SQLERRM || ' ' ||DBMS_UTILITY.format_error_backtrace,'SYSTEM');
end initializeTypePassMatrix;
procedure populateTypeCatPassFullDesc(typePass IN varchar2, schemeInd IN varchar2,catPass IN varchar2,entrePass IN varchar2, displayTypePass IN OUT varchar2,displayTypePassDesc IN OUT varchar2, displayCatPass IN OUT varchar2 )is
v_displayTypePass varchar2(15) :='-';
v_displayTypePassDesc varchar2(100) :='-';
v_displayCatPass varchar2 (2):='-';
v_type_pass varchar2(3) := '';
v_scheme_ind varchar2(5) := '';
v_cat_pass varchar2(2);
v_entrepass varchar2(2);
v_flag_valid_1 boolean:=false;
v_flag_valid_2 boolean:=false;
v_flag_valid_3 boolean:=false;
v_flag_valid_4 boolean:=false;
v_appln_rec g_rec;
begin
dbms_output.put_line('line 1');
initializeTypePassMatrix('test');
FOR nomor in g_tab.FIRST .. g_tab.LAST
LOOP
v_appln_rec := g_tab(nomor);
dbms_output.put_line('line 2.1');
v_flag_valid_1 :=false;
v_flag_valid_2 :=false;
v_flag_valid_3 :=false;
v_flag_valid_4 :=false;
v_type_pass := v_appln_rec.type_pass;
v_scheme_ind := v_appln_rec.scheme_ind;
v_cat_pass := v_appln_rec.cat_pass;
v_entrepass := v_appln_rec.entrepass;
dbms_output.put_line('line 2.2');
if(typePass = v_type_pass or v_type_pass = 'NA') then
v_flag_valid_1:= true;
end if;
if(schemeInd = v_scheme_ind or v_scheme_ind='NA') then
v_flag_valid_2 := true;
elsif(schemeInd is null and v_scheme_ind is null) then
v_flag_valid_2 := true;
end if;
if(catPass = v_cat_pass or v_cat_pass='NA') then
v_flag_valid_3 := true;
elsif(catPass is null and v_cat_pass is null) then
v_flag_valid_3 := true;
end if;
if(entrePass = v_entrepass or v_entrepass='NA') then
v_flag_valid_4 := true;
end if;
if(v_flag_valid_1 = true and v_flag_valid_2 = true and v_flag_valid_3 = true and v_flag_valid_4 = true) then
v_displayTypePass := v_appln_rec.display_type_pass;
v_displayCatPass := v_appln_rec.display_cat_pass;
v_displayTypePassDesc := v_appln_rec.display_type_pass_desc;
dbms_output.put_line('rule id got :'||v_appln_rec.rule_id);
dbms_output.put_line('rule no got :'||v_appln_rec.id_no);
exit when (0 = 0);
end if;
END LOOP;
displayTypePass := v_displayTypePass;
displayCatPass := v_displayCatPass;
dbms_output.put_line('1type:' || v_displayTypePassDesc);
displayTypePassDesc := v_displayTypePassDesc;
dbms_output.put_line('2type:' || displayTypePassDesc);
dbms_output.put_line('type:' || v_displayTypePass);
dbms_output.put_line('cat :' || v_displayCatPass);
exception
when others then
dbms_output.put_line('error happen'||DBMS_UTILITY.format_error_backtrace);
Logger.ERROR('TYPE_CAT_PASS_UTIL.populateTypeCatPass',SQLCODE,SQLERRM || ' ' ||DBMS_UTILITY.format_error_backtrace,'SYSTEM');
end populateTypeCatPassFullDesc;
function getDisplayTypePass(typePass IN varchar2, schemeInd IN varchar2,catPass IN varchar2,entrePass IN varchar2) return varchar2 is
v_displayTypePass varchar2(15) :='-';
v_displayTypePassDesc varchar2(100) :='-';
v_displayCatPass varchar2(2) :='-';
begin
populateTypeCatPassFullDesc(typePass,schemeInd,catPass,entrePass,v_displayTypePass,v_displayTypePassDesc,v_displayCatPass);
return v_displayTypePass;
exception
when others then
dbms_output.put_line('error happen'||DBMS_UTILITY.format_error_backtrace);
Logger.ERROR('TYPE_CAT_PASS_UTIL.populateTypeCatPass',SQLCODE,SQLERRM || ' ' ||DBMS_UTILITY.format_error_backtrace,'SYSTEM');
end getDisplayTypePass;
end TYPE_CAT_PASS_UTIL_TEST;
By Using like above even i do query on select * from <some_view) it will be only one execution for
SELECT tb_type_cat_pass_matrix.id_no,*
**tb_type_cat_pass_matrix.type_pass,**
**tb_type_cat_pass_matrix.scheme_ind,**
**tb_type_cat_pass_matrix.cat_pass,**
**tb_type_cat_pass_matrix.entrepass,**
**tb_type_cat_pass_matrix.display_type_pass,**
**tb_type_cat_pass_matrix.display_cat_pass,**
**tb_type_cat_pass_matrix.display_type_pass_desc,**
**tb_type_cat_pass_matrix.rule_id**
**FROM tb_type_cat_pass_matrix ORDER BY id_no asc*
the key point is the initializeTypePassMatrix function but it seems the variable only works for one session ?
if i open new session it will be reset again . -
Call a function inside a package from a stored procedure
Hello:
I am kind of new to the stored procedure. Does anyone know how to call a function inside a package from another stored procedure?
I have a existing function (func_b) inside a package (pack_a) and it returns a cursor. I want to call this function from a stored procedure (proc_c) so that I use the data inside the cursor.
can I do the following in proc_c:
my_cursor1 SYS_REFCURSOR;
begin
my_cursor1 := exec pack_a.func_b
end
It will be very helpful if anyone can point me to any reading or example. Thank you very much for your information.guys:
Thank you for your information so far. I need some more help here. I was able to run the function in my stored procedure. However, I was not able to print the result on the screen to view the cursor result, although I am using dbms_output.put_line statement inside my stored procedure.
I use the following statement to execute my stored procedure on sql*plus. I can tell the stored procedure is executed successfully, but I did see anything printed:
DECLARE TEMP VARCHAR2(100);
BEGIN PROC_LAWS_CAD_NAME_SEARCH('LPD', 'TEST DEVICE ID', 'TEST LAST NAME', 'TEST FIRST NAME', 'F', '11112009', TEMP); END;
I tried to use 'set serveroutput on' and got the following error:
ERROR:
ORA-06502: PL/SQL: numeric or value error: host bind array too small
ORA-06512: at line 1
I am kind of confused now. thank you for your help.
Jack
Here is my procedure:
create or replace
PROCEDURE PROC_SEARCH
( AGENCY_ID IN VARCHAR2,
DEVICE_ID IN VARCHAR2,
L_NAME IN VARCHAR2,
F_NAME IN VARCHAR2,
SEX IN VARCHAR2,
DOB IN VARCHAR2,
CAD_NAME_SCH_RESULT_STR OUT VARCHAR2)
AS
v_agy_id varchar2(10);
v_device_id varchar2(20);
v_l_name varchar2(25);
v_f_name varchar2(15);
v_sex varchar2(1);
v_dob date;
-- this cursor is going to be used to store a list of warrant matching
-- name search criteria
cad_srch_cursor sys_refcursor;
objSrch SEARCH_RESULT_TEMP%ROWTYPE;
BEGIN
cad_srch_cursor := SEARCH_PKG.SEARCH('TESTING', 'TESTER', null, null,null, null, getPhonetic('TESTING'));
LOOP
FETCH cad_srch_cursor INTO objSrch;
EXIT WHEN cad_srch_cursor%NOTFOUND;
--insert into SEARCH_RESULT_TEMP (name_last) values (objSrch.name_last);
CAD_NAME_SCH_RESULT_STR := objSrch.name_last;
dbms_output.put_line('First:'||objSrch.name_first||':Last:'||objSrch.name_last||':Middle:'||objSrch.name_middle);
end LOOP;
END PROC_LAWS_SEARCH;
----------------------------------------- -
Calling a Function inside a procedure
Can you call a function inside a procedure?...if so....how?
Not all built-in functions can be used directly in an assignment.
SQL> CREATE PROCEDURE p (p_val IN VARCHAR2) AS
2 l_v VARCHAR2(10);
3 BEGIN
4 l_v := DECODE(p_val,'YES','TRUE','FALSE');
5 END;
6 /
Warning: Procedure created with compilation errors.
SQL> show error
Errors for PROCEDURE P:
LINE/COL ERROR
4/4 PL/SQL: Statement ignored
4/11 PLS-00204: function or pseudo-column 'DECODE' may be used inside
a SQL statement onlyTTFN
John -
Call to action inside c:forEach (simple question)
Here's my problem: I have a pojo called Document, inside this pojo I have an id, the document name and description and the document file.
When displaying my JSP (called DetailProcess), I have a list of documents, that I have to show the user and let him click the document name and start downloading. To display the names I used:
<c:forEach items="${searchProcess.document}" var="document">
<p>><U><c:out value="${document.name}"/></U>
</c:forEach>Example output:
> Infomations
> Price guide
> Offers
What I want to do now, is call a method that will download the file of the document which is stored inside the database. The method is inside the same Action that generated this JSP (DetailProcessAction). I was told that I had to use a hidden field containing the id of the document, and create a javascript that would receive this id and call the download method.
But I have no ideia how to do this. I mean, placing a hidden field contaning the id, and allowing the user to click the name and send a call for the javascript. Also, I don't think that using javascript might be the best ideia, since some people have it disabled...
Can someone give me a help, and tell me the best way to do this?Well, you will need to use a link with a document id to uniquely identify the document to download. The link would point to an action on the server that does the download. So, for example, you would want the output in HTML to be:
<p><a href="downloadDocument?name=Informations">Informations</a></p>An example of the JSTL would be:
<c:forEach ${searchProcess.document}" var="document">
<c:url var="dlPage" value="downloadDocument">
<c:param name="name" value="${document.name}"/>
</c:url>
<p><a href="<c:out value="${dlPage}"/>"><c:out value="${document.name}"/></a></p>
</c:forEach>Then on the receiving side of the request, whatever you map the downloadDocument action to, you would get the name of the document to download from the request parameter:
String documentToDownload = request.getParameter("name");and call the method which causes the document to be downloaded. -
Call func 'BAPI_GOODSMVT_CREATE' problem
hi
ı have a trouble with 'BAPI_GOODSMVT_CREATE'
in this code its giving error like this "Error in function
Update control of movement type is incorrect (entry 301 X X _ Q)"
ı give manually in migo it says ok
FORM bapi.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
gmhead-pr_uname = sy-uname.
gmcode-gm_code = '04'. "01 - MB01 - Goods Receipts for Purchase Order
loop at gt_out.
itab-move_type = '301'.
itab-mvt_ind = 'Q'.
itab-plant = gt_out-werks.
itab-material = gt_out-maktx .
itab-entry_qnt = gt_out-erfmg.
itab-move_stloc = gt_out-tlgort.
itab-stge_loc = gt_out-flgort.
itab-BATCH = gt_out-charg.
itab-WBS_ELEM = gt_out-wbs.
itab-VAL_TYPE = gt_out-charg.
gmhead-pstng_date = gt_out-postd.
gmhead-doc_date = gt_out-doc_d.
* itab-po_number = pcitab-pur_doc.
* itab-po_item = pcitab-po_item.
* concatenate pcitab-del_no pcitab-del_item into itab-item_text.
* itab-move_reas = pcitab-scrap_reason.
append itab.
endloop.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gmhead
goodsmvt_code = gmcode
* TESTRUN = ' '
IMPORTING
goodsmvt_headret = mthead
* MATERIALDOCUMENT =
* MATDOCUMENTYEAR =
tables
goodsmvt_item = itab
* GOODSMVT_SERIALNUMBER =
return = errmsg
clear errflag.
loop at errmsg.
if errmsg-type eq 'E'.
write:/'Error in function', errmsg-message.
errflag = 'X'.
else.
write:/ errmsg-message.
endif.
endloop.
if errflag is initial.
commit work and wait.
if sy-subrc ne 0.
write:/ 'Error in updating'.
exit.
else.
write:/ mthead-mat_doc, mthead-doc_year.
* perform upd_sta.
endif.
endif.
ENDFORM.problem resolved
change wbs element with code is below
all problems resolved
itab-val_wbs_elem = '00009001'.
*numan p_wbs düzeltme
itab-wbs_elem = '00009001'.
itab-spec_mvmt = 'R'.
*numanitab-val_wbs_elem -->itab-wbs_elem.
* itab-po_number = pcitab-pur_doc.
* itab-po_item = pcitab-po_item.
* concatenate pcitab-del_no pcitab-del_item into itab-item_text.
* itab-move_reas = pcitab-scrap_reason.
perform conversion_exit_abpsp_output
changing :
itab-val_wbs_elem.
perform conversion_exit_abpsp_output
changing :
itab-wbs_elem.
form conversion_exit_abpsp_output using p_value.
call function 'CONVERSION_EXIT_ABPSP_OUTPUT'
exporting
input = p_value
importing
output = p_value.
endform. " CONVERSION_EXIT -
Calling abstract method inside constructor
what will happen if you call abstract method inside a constructor ?
AMARSHI wrote:
Then wat is the purpose of that object then.
When u create an object then the control will move to the default constructor,If there is one. Not all classes have default constructors. Some c'tor will be called though.
inside the constructor u r having an abstract method.
But theere are 2 cases now:
1 the top-level class is an abstract class
2 the abstract class is an inner class.
1. for case 1 , u cannot create an object ,so no need of having the constructor.Yes, you can create an object. You can instantiate a concrete subclass. The abstract parent's constructor is still called, and that c'tor may call an abstract method, which will be implemented in the concrete subclass, or some class between it and the parent.
2.for case 2 u cannot have an object like:
outerClass obj = new innerAbstractClass()I have no idea what you're talking about here. -
Item OK checkbox for BAPI_GOODSMVT_CREATE
Hi,
I am uploading GR using bapi BAPI_GOODSMVT_CREATE.
How to update 'Item OK' checkbox in BAPI.
Please help.
MonikaHi,
Pass only the item which need to create GR and its not required to set flag for Item ok.
Sample Code:
DATA: gt_goodsmvt_header LIKE bapi2017_gm_head_01,
gt_goodsmvt_item LIKE bapi2017_gm_item_create OCCURS 0 WITH HEADER LINE,
gt_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: gt_goodsmvt_headret LIKE bapi2017_gm_head_ret,
goodsmvt_code_tmp TYPE bapi2017_gm_code,
testrun TYPE c VALUE 'X'.
data: l_return like BAPIRET2.
gt_goodsmvt_header-pstng_date = sy-datum.
gt_goodsmvt_header-doc_date = sy-datum.
***<<<<<<<<<<<BAPI Communication Structure: Material Document Header Data>>>>>>>
gt_goodsmvt_item-material = lt-matnr .
gt_goodsmvt_item-plant = lt-werks.
gt_goodsmvt_item-stge_loc = lt-lgort.
gt_goodsmvt_item-deliv_numb_to_search = lt-vbeln.
gt_goodsmvt_item-deliv_item_to_search = lt-posnr.
gt_goodsmvt_item-move_type = lt-bwart . "'101'.
gt_goodsmvt_item-entry_qnt = lt-lfimg . "'50'.
gt_goodsmvt_item-entry_uom = lt-vrkme.
gt_goodsmvt_item-mvt_ind = lt-kzbew.
gt_goodsmvt_item-po_number = lt-vgbel.
gt_goodsmvt_item-po_item = lt-vgpos.
gt_goodsmvt_item-no_more_gr = 'X'.
APPEND gt_goodsmvt_item.
goodsmvt_code_tmp = '01'. "Assign code to transaction for BAPI goods movement
****<<<<<<<Post goods movements with MB_CREATE_GOODS_MOVEMENT>>>>>>>>>>>>>>>>>>>
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = gt_goodsmvt_header
goodsmvt_code = goodsmvt_code_tmp
testrun = testrun
IMPORTING
goodsmvt_headret = gt_goodsmvt_headret
TABLES
goodsmvt_item = gt_goodsmvt_item
GOODSMVT_SERIALNUMBER =
return = gt_return.
IF gt_return[] IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = l_return.
WRITE:/3 'ASN Number', gt_goodsmvt_item-deliv_numb_to_search,
/3 'Item',gt_goodsmvt_item-deliv_item_to_search.
ELSE.
read table gt_return index 1.
WRITE: 'ERROR',
/ gt_return-message.
ENDIF.
Regards,
Vino -
Call Stored Procedure inside a db trigger
Is that possible to call stored procedure inside a db trigger ?
I User this code:
Create Or Replace Trigger Sale.Send_Auto_Email_Trg
After Insert
On Sale.Sale_Technical_Support
--Referencing New As New Old As Old
For Each Row
Declare
Pragma Autonomous_Transaction;
vn_count Number := 0;
vn_msg Number;
vv_exec Varchar2(5000);
Begin
If Inserting And :New.Ticket_Status = 2 Then
Begin
Begin
Select Count(*)
Into vn_count
From Sale_Technical_Support
Where Sending_Flag = 1
And Support_Type = 2;
Exception When No_Data_Found Then
vn_count := 0;
End;
If vn_count >= 1 And :New.Problem_Desc Is Not Null Then
Technical_Support_Mailing('[email protected]', -- To
'[email protected]',
'[email protected]', -- Bcc
'[email protected]', -- From
'رموز وصلاحيات',
2);
End If;
End;
End If;
End;
/No errors but the procedure doesn't executed !!!!!1) If you are using autonomous transactions for anything other that writing log data that you want to preserve even if the triggering transaction fails, you're probably doing something wrong. There is no reason to use an autonomous transaction here.
2) You don't want to send email from a trigger. You don't want to do anything non-transactional in a trigger. Oracle will, for example, rollback and re-execute parts of a statement for write consistency. If you send email in a trigger, you may get multiple emails for a single update. You may also get emails for updates that were never committed. And if the email server happens to be down, your transactions will fail.
3) If you use an autonomous transaction, the trigger will have a completely different transaction context from the parent. So when you query the table within the trigger, you won't be able to see any of the uncommitted changes including the changes that caused the trigger to fire. My guess is that you are assuming that the row that you inserted is visible to the trigger.
Justin -
Mb1b transaction for BAPI_GOODSMVT_CREATE
Hello,
i have to create a zbapi in which the user has to expose only selected fields(lgort, charg, and receiving storage location).
i ll expose only those fields in importparameters of ZBAPI.
In the source code, how to approach this and call the fm bapi_goodsmvt_create to update mb1b transaction.
Can anyone give me source code to develop this in function module???In YOur Z Bapi call the original bapi.
Fill the bapi structures with the import parameters you have for the z bapi.
Pass the exporting parameters that are obtained from the original bapi to the exporting parameters of the Z bapi.
Sample:
FUNCTION Z_GOODSMVT_CREATE.
""Local interface:
*" IMPORTING
*" VALUE(GOODSMVT_HEADER) LIKE BAPI2017_GM_HEAD_01 STRUCTURE
*" BAPI2017_GM_HEAD_01
*" VALUE(GOODSMVT_CODE) LIKE BAPI2017_GM_CODE STRUCTURE
*" BAPI2017_GM_CODE
*" VALUE(TESTRUN) LIKE BAPI2017_GM_GEN-TESTRUN DEFAULT SPACE
*" EXPORTING
*" VALUE(GOODSMVT_HEADRET) LIKE BAPI2017_GM_HEAD_RET STRUCTURE
*" BAPI2017_GM_HEAD_RET
*" VALUE(MATERIALDOCUMENT) TYPE BAPI2017_GM_HEAD_RET-MAT_DOC
*" VALUE(MATDOCUMENTYEAR) TYPE BAPI2017_GM_HEAD_RET-DOC_YEAR
*" TABLES
*" GOODSMVT_ITEM STRUCTURE BAPI2017_GM_ITEM_CREATE
*" GOODSMVT_SERIALNUMBER STRUCTURE BAPI2017_GM_SERIALNUMBER
*" OPTIONAL
*" RETURN STRUCTURE BAPIRET2
Pass variables here..
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = GOODSMVT_HEADER
GOODSMVT_CODE = GOODSMVT_CODE
TESTRUN = TESTRUN
IMPORTING
GOODSMVT_HEADRET = GOODSMVT_HEADRET
MATERIALDOCUMENT = MATERIALDOCUMENT
MATDOCUMENTYEAR = MATDOCUMENTYEAR
TABLES
GOODSMVT_ITEM = GOODSMVT_ITEM
GOODSMVT_SERIALNUMBER = GOODSMVT_SERIALNUMBER
RETURN = RETURN.
endfunction.
Regards,
Ravi -
Call ADF applications inside EBS.
We are in the process of implementing couple of ADF applications with EBS security realm. I created a simple test app with a simple page and trying to use the EBS JAAS authentication, but its not authorizing for the pages. It looks like its authenticating fine.
HEre are our Server configuration.
Webloogic version - 10.3.6.0
JDeveloper Version - 11.1.2.1
Middleware version : 11.1.1.5 + interim patches
p12917525_111150_Generic.zip
p12979653_111150_Generic.zip
The security model works fine in the Jdev Integrated WLS.
I went through serveral documents including Oracle document E28169-01 (note 974949.1). We don't want to call ADF applications inside EBS. Basically we just want to use the EBS Authentication and Authorization for our ADF applications.
As I mentioned earlier, its definitely authenticating my credentials, but its not authoring the page.User,
I've done something like what Timo describes. We have deployed an application that exposes links to an external BI server to serve up reports/Discoverer workbooks. The URL is obviously different for dev/test/prod - so, what we did was to have a configuration table in the DB that defines such type of configuration parameters. We then have an application-scoped managed bean that sources its attributes from the database table and we refer to that managed bean using EL to construct the URLs. I didn't use web.xml/properties files for this because I wanted to have an EAR deployment artifact that could be deployed to any environment with no change.
John
Maybe you are looking for
-
Kernel panics despite all fixes
First, the specs of my system: OSX 10.3.9 G4 Dual 450 with 1gb ram Apple 17" Studio Monitor (clear one) 40 gb Maxtor drive and 120 gb Seagate drive with a 30 gb "Scratch" partition CS2, Office X, Firefox, Apple Mail, Fetch, Dreamweaver, Lotus Notes (
-
Resources are not configurable under RMCM and User
Hi I am using UCCX 8 with CUCM. Whatevere Agnet / end user I am making in CUCM its coming to UCCX. But I can not getting them onder RMCM. When I am going uder tools>viewuser and clicking one user and Configuring resources its gives error "Error Occur
-
Config mail accounts in difference OUs have difference limit message size
Mail Server is installed by Netscape Messaging Server 4.15.In Directory Server have alot of Organizational unit.I want to config mail accounts in difference OUs have difference limit sended and recieved message size. Ex: OU 1 ( acc1,acc2...) : I want
-
PAPI processRun() doesn't work
Hi, I need to write a java application witch run a BPM process, wait the end and read the output arguments in End activity. I used processRun() (PAPI library) but my engine doesn't support it and raise this exception: java.lang.UnsupportedOperationEx
-
PLS-00394: wrong number of values
Hi, I have this SET SERVEROUT ON DECLARE v_line varchar2(100); Cursor C_TBS is Select A.tablespace_name, A.total_size "Taille totale Ko", B.Free_space "Space disponible Ko", ((A.total_size-B.Free_space)*100/A.total_size) "% Occupied Espace