Calling function in OAF
Hi all,
I am new in OAF. Pls tell how can I call fuction in OAF.
Thanks
Vikram.
import java.sql.CallableStatement;
import java.sql.SQLException;
import java.sql.Types;
import oracle.jdbc.driver.OracleCallableStatement;
DBTransaction txn = getDBTransaction();
String sql = "BEGIN :1 := FND_MESSAGE.GET; END;";
CallableStatement cs = txn.createCallableStatement(sql, 1);
String messageBuffer = "";
try
((OracleCallableStatement)cs.registerOutParameter(1, Types.VARCHAR, 0, 2000);
cs.execute();
messageBuffer = cs.getString(1);
cs.close();
catch (SQLException sqle)
try { cs.close } catch (Exception(e) {}
throw OAException.wrapperException(sqle);
}
Similar Messages
-
How to call pl/sql function from oaf
Dear Friends,
I am trying to call a function from oaf page .but iam getting error like
java.sql.SQLException: ORA-01861: literal does not match format string
ORA-06512: at line 1
THis is my function ,,callable statement
FUNCTION CAR_LOAN_VALIDATION(P_PERSON_ID IN NUMBER
,P_DEDUCTION_START_DATE IN DATE
,P_DEDUCTION_END_DATE IN DATE
,P_LOAN_VALUE IN NUMBER
RETURN VARCHAR2
IS
l_message VARCHAR2(100);
l_contract_type VARCHAR2(50);
l_loan_eligible_date DATE;
l_grade VARCHAR2(15);
l_old_loan_end_date DATE;
l_max_loan_end_date DATE;
l_remaining_amount NUMBER;
l_eligible_amt NUMBER;
BEGIN
BEGIN
SELECT --papf.person_id,
(SELECT meaning
FROM hr_lookups
WHERE lookup_type = 'ADTC_CONTRACT_TYPE'
AND lookup_code = attribute3) contract_type,
ADD_MONTHS (papf.original_date_of_hire, 11) loan_eligible_date,
DECODE (paaf.ass_attribute2,
'Chairman', 'Chairman',
SUBSTR (ass_attribute2, INSTR (ass_attribute2, '.', 1, 1) + 1,
3)
) grade,
(SELECT nvl(MAX (deduction_end_date),null)
FROM xxadtc_car_loan_request
WHERE person_id = p_person_id) old_loan_end_date,
to_date(ADD_MONTHS (p_deduction_start_date, 47)) max_loan_end_date
--to_date(ADD_MONTHS (sysdate, 47)) max_loan_end_date
INTO l_contract_type
,l_loan_eligible_date
,l_grade
,l_old_loan_end_date
,l_max_loan_end_date
FROM per_all_people_f papf, per_all_assignments_f paaf
WHERE SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date
AND papf.business_group_id = 81
AND papf.person_id = paaf.person_id
AND SYSDATE BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND papf.person_id =P_PERSON_ID;
EXCEPTION
WHEN others THEN
DBMS_OUTPUT.PUT_LINE('Error ');
END;
-- get Previous Car loan amount --
BEGIN
SELECT to_number(prrv.result_value)
INTO l_remaining_amount
FROM per_all_people_f papf,
per_all_assignments_f paaf,
pay_assignment_actions pac,
pay_run_results prr,
pay_run_result_values prrv,
pay_element_types_f petf,
pay_input_values_f pivf,
pay_element_classifications pec,
pay_payroll_actions ppa,
per_time_periods ptp
WHERE SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date
AND papf.person_id = paaf.person_id
AND papf.business_group_id = 81
AND SYSDATE BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND paaf.assignment_id = pac.assignment_id
AND pac.assignment_action_id = prr.assignment_action_id
AND prr.run_result_id = prrv.run_result_id
AND prr.element_type_id = petf.element_type_id
AND SYSDATE BETWEEN petf.effective_start_date AND petf.effective_end_date
AND prrv.input_value_id = pivf.input_value_id
AND SYSDATE BETWEEN pivf.effective_start_date AND pivf.effective_end_date
AND pivf.NAME = 'Remaining Amount'
AND petf.classification_id = pec.classification_id
AND pac.payroll_action_id = ppa.payroll_action_id
AND ppa.time_period_id = ptp.time_period_id
AND TO_CHAR (ptp.pay_advice_date, 'Mon-YYYY') =
TO_CHAR (SYSDATE, 'Mon-YYYY')
AND petf.element_name = 'Motar Ahlami Loan'
--and employee_number='10185'
AND papf.person_id = p_person_id;
EXCEPTION
WHEN no_data_found THEN
--DBMS_OUTPUT.PUT_LINE('ERROR: No data!');
l_remaining_amount:=0;
WHEN others THEN
DBMS_OUTPUT.PUT_LINE('Error ');
END;
select GET_CAR_LOAN_ELIGI_AMT(P_PERSON_ID)
into l_eligible_amt
from dual;
IF l_contract_type NOT IN ('Permanent') THEN
l_message := 'Contract Type Is not valid';
END IF;
IF l_loan_eligible_date < SYSDATE THEN
l_message:= 'Date of Join is less then one year';
END IF;
IF l_grade IN ('US','00','AUS','EM') THEN
l_message:= 'Your are not Eligible Grade';
END IF;
IF l_old_loan_end_date < SYSDATE THEN
l_message:= 'Previous Loan Duration is not completed';
END IF;
IF l_max_loan_end_date > P_DEDUCTION_END_DATE THEN
l_message:= 'Maxinum number of monthly payment of 48 month';
END IF;
IF l_remaining_amount >0 THEN
l_message:= 'Previous Car Loan amount is pending till';
END IF;
IF l_eligible_amt < p_loan_value THEN
l_message:= 'Please check Eligible Amount ';
END IF;
RETURN nvl(l_message,'S');
EXCEPTION
WHEN NO_DATA_FOUND
THEN
RETURN 'Error';
END CAR_LOAN_VALIDATION;
END XX_CAR_LOAN_REQUEST_PKG;
CALLABLE STATEMENT CODE ---CO CODE
if(pageContext.getParameter("Submit")!=null) {
OAViewObject vo2 = (OAViewObject)am.findViewObject("XxadtcCarLoanRequestEOVO1");
if(vo1!=null){
vo1.getCurrentRow().setAttribute("LoanStatus","Pending Approval");
int xxpersonId = pageContext.getEmployeeId();
String xxDeductionStartDate = vo2.getCurrentRow().getAttribute("DeductionStartDate").toString();//pageContext.getParameter("DeductionStartDate").toString();
// SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy/mm/dd");
// Date convertedDate1 = dateFormat1.parse("xxDeductionStartDate");
String xxDeductionEndDate = vo2.getCurrentRow().getAttribute("DeductionEndDate").toString();//pageContext.getParameter("DeductionEndDate").toString();
// SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyy/mm/dd");
// Date convertedDate2 = dateFormat2.parse("xxDeductionEndDate");
String xxLoanValue = vo2.getCurrentRow().getAttribute("LoanValue").toString();//pageContext.getParameter("LoanValue").toString();
int iLoanValue = Integer.parseInt(xxLoanValue);
System.out.println("Entered into submit loop");
System.out.println("xxpersonId id is:"+xxpersonId);
System.out.println("xxDeductionStartDate id is:"+xxDeductionStartDate);
System.out.println("xxDeductionEndDate id is:"+xxDeductionEndDate);
System.out.println("xxLoanValue id is:"+xxLoanValue);
OADBTransaction txn = am.getOADBTransaction();
String sql ="BEGIN :1 :=XXADTC_CAR_LOAN_REQUEST_PKG.CAR_LOAN_VALIDATION(:2,:3,:4,:5); END;";
CallableStatement cs = txn.createCallableStatement(sql,1);
String outputval = null;// int outputval = 0;
try {
System.out.println("Entered in try loop of callable funtion validation");
cs.setInt(2,xxpersonId);
System.out.println("cs setInt(2,xxpersonId);is executed");
cs.setString(3,xxDeductionStartDate);
System.out.println("cs.setString(3,xxDeductionStartDate is executed);");
cs.setString(4,xxDeductionEndDate);
System.out.println("cs.setString(4,xxDeductionEndDate is executed);");
// cs.setDate(3,xxDeductionStartDate);
// cs.setDate(4,xxDeductionEndDate);
cs.setInt(5,iLoanValue);
cs.registerOutParameter(1,Types.VARCHAR);// cs.registerOutParameter(1,Types.NUMERIC);
cs.execute();
outputval = cs.getString(1);// txn.commit();
System.out.println(outputval);
txn.commit();
if(outputval.equals("S"))
am.invokeMethod("apply");
else
throw new OAException("Organization name is:"+outputval,OAException.INFORMATION);
txn.commit();
catch(Exception sqle){
try {
cs.close();
catch (Exception e)
throw OAException.wrapperException(e);
throw OAException.wrapperException(sqle);
Please help .where is the error is.
please help
let me know for any clarification.
Thanks
Aravinda.Hi Arvinda,
Refer Below code.
// In Controller
java.sql.Date DeductionSDate; //declare variable
//In PFR
String xxDeductionStartDate = vo2.getCurrentRow().getAttribute("DeductionStartDate");
OADBTransaction txn = am.getOADBTransaction();
if(xxDeductionStartDate!=null)
java.sql.Date startDate= txn.getOANLSServices().stringToDate(xxDeductionStartDate);
DeductionSDate = startDate;
Set this to cs.setDate(3,DeductionSDate);
Thanks,
Dilip -
Calling a function in OAF page
Hi Frnds,
Iam trying to call a function in oaf page but somehow its not working , can u please identify mistake in my code .
the below is CO code:
public void processRequest(OAPageContext oapagecontext, OAWebBean oawebbean)
super.processRequest(oapagecontext, oawebbean);
OAApplicationModule am=oapagecontext.getApplicationModule(oawebbean);
OAViewObject vo = (OAViewObject)am.findViewObject("CandidateApplicantDetailsVO");
String Nationality =null;
CandidateApplicantDetailsVORowImpl row =null;
int i=0;
if(vo!=null)
int cnt= vo.getRowCount();
oapagecontext.writeDiagnostics(this, "row count is:"+cnt,1);
if (cnt > 0)
RowSetIterator rs=vo.createRowSetIterator("rs");
if(rs!=null)
while(rs.hasNext())
row=(CandidateApplicantDetailsVORowImpl)rs.next();
if(row!=null)
Nationality = row.getNationality();
oapagecontext.writeDiagnostics(this, "Nationality is :"+Nationality,1);
String outputVal;
try
OADBTransaction txn = am.getOADBTransaction();
CallableStatement cs = txn.createCallableStatement("BEGIN :1:= hr_general.decode_lookup(:2,:3);END;",2);
oapagecontext.writeDiagnostics(this, "Inside the try block",1);
System.out.println("3");
cs.setString(2,Nationality);
cs.setString(3,"NATIONALITY");
cs.registerOutParameter(1,Types.VARCHAR);
System.out.println("4");
cs.execute();
System.out.println("executed");
outputVal=cs.getString(1);
oapagecontext.writeDiagnostics(this,"The Nationality Value is:"+outputVal,2);
cs.close();
//txn.commit();
catch(Exception e)
//cs.close();
System.out.println("6");
throw new OAException(e.getMessage());
} // row loop
} // while
} //rowset loop
}// count loop
}//viewobj loop
} // End of PR
public void processFormRequest(OAPageContext oapagecontext, OAWebBean oawebbean)
super.processFormRequest(oapagecontext, oawebbean);
when i run this page , the controller was going inside the try block but the Output was not getting. can somebody figure out where iam missing.
Thanks to all in advance
have a good day :)
GK.Hi Frnds,
I got the problem,
Iam trying to send a Default value NATIONALITY in setString
cs.setString(2,Nationality);
cs.setString(3,"NATIONALITY");
I have changed the lines to
String lookup_type="NATIONALITY"
cs.setString(2,Nationality);
cs.setString(3,"Lookup_type);
now i got the o/p, hope this may help others -
Call function POPUP_TO_CONFIRM after Excel close
Good morning
I have written code like this
DATA: EXCEL TYPE OLE2_OBJECT.
DATA: BOOKS TYPE OLE2_OBJECT.
DATA: BOOK TYPE OLE2_OBJECT.
DATA: CELL TYPE OLE2_OBJECT.
DATA: FONT TYPE OLE2_OBJECT.
DATA: FILE TYPE OLE2_OBJECT.
CREATE OBJECT EXCEL 'EXCEL.APPLICATION'.
CALL METHOD OF EXCEL 'WORKBOOKS' = FILE.
CALL METHOD OF FILE 'OPEN'
EXPORTING
#1 = 'C:temp8D.xls'
#2 = 1.
CALL METHOD OF EXCEL 'CELLS' = CELL
EXPORTING
#1 = 6
#2 = 'C'.
SET PROPERTY OF CELL 'VALUE' = zak_pomoc.
CALL METHOD OF EXCEL 'QUIT'.
FREE OBJECT EXCEL.
If user has modified the 8D file I want display this file on the screen, but first function POPUP_TO_CONFIRM should ask him if he really wants to show file.
I make it like this.
call function 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = 'Display report'
TEXT_QUESTION = 'Display report 8D?'
DEFAULT_BUTTON = '1'
DISPLAY_CANCEL_BUTTON = 'X'
START_COLUMN = 25
START_ROW = 6
IMPORTING
answer = ans.
if ans eq '1'.
DATA gs_excel TYPE ole2_object .
DATA gs_wbooks TYPE ole2_object .
DATA gs_wbook TYPE ole2_object .
DATA gs_application TYPE ole2_object .
CREATE OBJECT gs_excel 'EXCEL.APPLICATION' .
SET PROPERTY OF gs_excel 'Visible' = 1 .
GET PROPERTY OF gs_excel 'Workbooks' = gs_wbooks .
GET PROPERTY OF gs_wbooks 'Application' = gs_application .
*--Opening the existing document
CALL METHOD OF gs_wbooks 'Open' = gs_wbook
EXPORTING
#1 = 'c:temp8D.xls'.
endif.
But there is my problem because two windows: first- asking about saving the file and the second- asking about showing the file, pop up in this same time.
What condition should I write to call second window after this first one?
Please, any suggestions?
Thank you.Hello
I'm just beginner and there is one thing I don't understand. Between lines
CALL METHOD OF EXCEL 'QUIT'
and
FREE OBJECT EXCEL
the window 'Do you want save changes' appears. And in that moment what is the value that says if the user chooses OK or QUIT?
If I would know that value, I could call function POPUP_TO_CONFIRM in the right moment. -
Call Function Destination in a background job
I am having a problem using:
CALL FUNCTION 'TABLE_ENTRIES_GET_VIA_RFC'
DESTINATION p_dest
in a background job.
I am working on a program that would compare the same table in 2 different systems and write the differences. It works when I run it in the foreground. However, I want to run this in a nightly background job. However, it is failing and I beleive that it is the result of the program needing a user to interactively logon to the remote system.
How can I bypass the logon screen or enter information into the logon screen using a background job?
Thanks.
JonHi Jonathan,
Would you like to reward some points to the poster to thank them as a part of SDN Contributor Recognition Program?
You can click on the yellow star on the right of each post header to reward points.
For more information:
https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm
John. -
Uncatchable exception: BSP calling Function Module
Hi all,
currently i'm facing a very weird problem. My application class calls function module
HR_INFOTYPE_OPERATION. Normally, in case of an error, the function module gives you back a return parameter. But if i call it from my BSP, the processing doesn't leave the function module. It directly throws an exception ERROR_MESSAGE_STATE instead of writing the message into parameter return.
If i call the function module with the same parameters from a report, it works fine and the error message is written to return parameter without throwing an exception.
What am i doing wrong? I don't want that exception and need to go on with filled parameter result.
Regards
Mark-AndréHi MA,
try using ERROR_MESSAGE in the exceptions list, like this.
CALL FUNCTION 'func_name'
EXPORTING
string = text
pos = position
IMPORTING
string1 = text1
string2 = text2
EXCEPTIONS
string1_too_small = 1
string2_too_small = 2
ERROR_MESSAGE = 3
OTHERS = 4.
Cheers
Graham Robbo -
What is the use of CALL FUNCTION MODULE - AT BACKGROUND TASK?
Hi experts,
I found Call functional module in background task will make the FM run at the next commit work as some people said. So I have some questions:
1 if we use COMMIT WORK commend, the pending FM will be called? If there are several FMs called at background task, what is the sequence of them? How many conditions will trigger the running of these FMs?
2 Where can I find the log of this pending FMs? In SAP library, it says there are 2 tables. But I checked these tables and can only find the FM name and user of it. And I can not understand content of these tables. It seems one is for the main information of FM, and the other is for the data of the FM, maybe the parameters.
3 If I call a FM in this way, Can I canncel it before the next commit work in some way?
Finally, thanks for reading and help.HI,
When the COMMIT WORK statement is executed, the function modules registered for the current SAP-LUW are started in the order in which they were registered. ROLLBACK WORK deletes all previous registrations for the current SAP-LUW.
If the specified destination is not available when COMMIT WORK is executed, an executable program called RSARFCSE is started in background processing. By default, this tries to start the function modules registered for a SAP-LUW in their destination every 15 minutes and up to 30 times. These parameters can be changed in the transaction SM59. If the destination does not become available within the defined time, it is recorded in the database table ARFCSDATA as the entry "CPICERR". The entry in the database table ARFCSSTATE is deleted after a standard period of eight days -
How to fill data when call function of sap standard script form?
Hi every experts,
<Priority Normalized>
In our system, when we log in 'FR', we can print purchase order in language Franch,in t_code:ME22N. And when logging in 'EN', we can print it in language English, in ME22N. The English form is just only translated from Franch, with all same structure and frame. The form is done by script form.
And when logging in 'ZH', we create a new program, calling function smartform, instead of translating from EN language. Because of different structure and frame, I don't know the way to write script, so I print puchase order by smartform, when logging in 'ZH'.
But I have a new issue. Our MM module consultant needs me to print Chinese form if one condition, print English form in other condition.
So I have no idea to solve it. Because in my program, I get data to fill smartform and call function of smartform. And I don't know how to get data to fill script form. I only know the function name, 'OPEN_FORM' 'WRITE_FORM' 'CLOSE_FORM'.....
If I only call the several functions, I will get only frame without no data. So who can tell me how to do????
<Urgency downgraded>
Edited by: Suhas Saha on Jul 26, 2011 3:34 PM
Edited by: Vinod Kumar on Jul 26, 2011 4:09 PMHi,
Normally if we look in NACE transaction, you can see that upto five different FORMS can be assigned to a single output type . i.e. for each form there will be a seperate routine through which it gets called. But it all start from the first form only.
so you need to write your code in the ENTRY of the first form and if it does not satisfy do not go for processing of it but just exit of that form ENTRY. so that it will take you to next form.
hope this helps.
Thanks,
Venkatesh -
Function Module CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
Hello All,
While using CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH' to download to Unix file in GLD (Version 4.5b) the F.M is working fine, but in KLD(Version ECC 6.0) CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH' is not working & the error message is displayed saying incomplete filename.
Could you let me know any alternate Function Module/ Method in this regard.
ThanksHi,
In ECC6 also Its Working fine only.
1. Go to SE37 -> Enter FM Name -> Test(F8).
2. Give any file path and test it.
Thanks,
Reward If Helpful. -
Call function 'gui_download'
Hallo Friends,
I am using the above fuction in my program. I want the header of my internal table to be writen als header in the text file. So, I created another Itab (Itab-col_1) and appended all the headers in this, which I later use as below.
Problem:
1.
I am not satisfied with the downloaded output in file.txt I want the header to be excactly over the column content. Please see my output:
MANDT LIFNR LAND1 NAME1 NAME2 NAME3
010§§§§§§0000010000§§§§§§§§§§§§§§§§§§DE§§§§§§Test
010§§§§§§0000100000§§§§§§§§§§§§§§§§§§US§§§§§§TEST
§ § means Space
It is Obvious LAND1 should be over DE / US, NAME1 should be over Test / TEST etc etc
2.
I would like filed seperator to be ( ; ) not space. The flag 'X' gives space.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = str
filetype = 'ASC'
write_field_separator = 'X'
dat_mode = 'X'
TABLES
data_tab = itab_kreditor
fieldnames = itab_datei_col_header
EXCEPTIONS
file_write_error = 1
file_not_found = 19
OTHERS = 22.
So, how can I solve these two problems.
Blacky.CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = BIN_FILESIZE
filename = filename
FILETYPE = 'ASC'
APPEND = ' '
<b> WRITE_FIELD_SEPARATOR = ';'</b>
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH = FILELENGTH
TABLES
data_tab = data_tab
FIELDNAMES = FIELDNAMES
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards
Vasu -
Fm CALL FUNCTION 'GUI_DOWNLOAD'
hi experts:
How to add a field name line in fm 'GUI_DOWNLOAD'?
allenhI,
DATA: V_PATH TYPE STRING.
V_PATH = P_FILE.
**-- Function GUI_DOWNLOAD is used to save the data back in the
**-- flat file from the internal table
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = V_PATH
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = I_PIPE
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
****DO REWARD IF USEFULL
VIJAY -
Call function RFC in a loop and kill old session
Hi,
we have a problem with a program.
here's a part of the code:
DO.
CALL FUNCTION 'YC_REFRESH_GPT_START_CM25' STARTING NEW TASK 'TEST'
EXPORTING
i_profile = p_prfl
i_werks = p_werks
i_arbpl_low = s_arbpl-low
i_arbpl_high = s_arbpl-high
TABLES
t_arbpl = it_arbpl.
PERFORM wait_for_refresh.
PERFORM terminate_session.
ENDDO.
So the program does a call function, waits a while, then terminates the session and recalls the function.
Apparently, like this the data should be updated.
But in the terminate session, the session is terminated using:
CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_delete_mode
ID 'MODE' FIELD l_mode.
And it works the first time, but the second time there is a dump.
So, is there another way to achieve what this program is trying to do?
Or is there another way to kill the session?
Thanks!!Hi,
the DLL will stay in memory as long as there is a program running which has not closed (unloaded) the DLL.
Doing repetitive calls to the DLL is irrelevant in this context. LV opens the DLL as soon as needed and will only unload it when there is no VI in memory which has a CLN to that DLL...
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
Approximate operator and recursive call function in abap
Dear expert,
Please give me an example about Approximate operator and recursive call function in abap
thanks so muchHi
About Approximate operator, you can go to tcode 'ABAPDOCU', searching CO,CN,CA etc...each of them have example there.
And recursive function,
Say here is a FM,
FUNCTION recursive_get_number.
*import im_num type i.
*export ex_num type i.
ex_num = im_num + 1.
IF ex_num GE 100.
EXIT.
ELSE.
CALL FUNCTION recursive_get_number
EXPORTING
im_num = ex_num
IMPORTING
ex_num = ex_num.
ENDIF.
ENDFUNCTION.
When you call this function from outside with importing parameter '1', then will return you 100.
regards,
Archer. -
Call function in abap routine of infopackage
Experts,
Good day. I have a problem concerning the data to be imported in my ods.I can't find a similar thread corcerning my problem. My File date field should contain only 2 years and 3months data of recent data. I'm using a call function fima_date_create to filter values of zfile_date.
CALL FUNCTION 'FIMA_DATE_CREATE'
EXPORTING
I_DATE = sy-datum
I_FLG_END_OF_MONTH = ' '
I_YEARS = 2-
I_MONTHS = 3-
I_DAYS = 0
I_CALENDAR_DAYS = 0
I_SET_LAST_DAY_OF_MONTH = ' '
IMPORTING
E_DATE =
E_FLG_END_OF_MONTH =
E_DAYS_OF_I_DATE =
The sy-datum becomes the High value and the date generated by this FM will be the low value. I already tested this function module and it is what i want. How Should I write the ABAP code for this in the abap routine for my infopackage? Or what steps do I need to take.Hi,
When you choose the option to write a routine for one of the characteristics in the infopackage selections, you get a window to write your code with some prewritten code as below. Modify it as shown below, for your requirement.
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = 'CALDAY'.
l_idx = sy-tabix.
START of YOUR CODE
<----
Required logic -
>
L_T_RANGE-LOW = <lower limit of range>.
L_T_RANGE-HIGH = <upper limit of range>.
L_T_RANGE-SIGN = 'I'.
L_T_RANGE-OPTION = 'BT'.
END of YOUR CODE
modify l_t_range index l_idx.
p_subrc = 0.
Hope this helps. -
Help:alternate for calling function in where clause
Hi ,
In below query i'm calling function in where clause to avoid COMPLETE status records,due to this query taking 700 secs to return result.If i'm remove below function condition it's returning results with in 5 secs.Can you some one advice to any alternate idea for this?
WHERE mark_status != 'COMPLETE'
SELECT assessment_school,
subject,
subject_option,
lvl,
component,mark_status,
mark_status
NULL AS grade_status,
NULL AS sample_status,
:v_year,
:v_month,
:v_formated_date,
:v_type,
cand_lang
FROM
(SELECT assessment_school,
subject,
subject_option,
lvl,
programme,
component,
paper_code,
cand_lang,
mark_entry.get_ia_entry_status(:v_year, :v_month, assessment_school, subject_option, lvl, cand_lang, component, paper_code) AS mark_status
FROM
(SELECT DISTINCT ccr.assessment_school,
ccr.subject,
ccr.subject_option,
ccr.lvl,
ccr.programme,
ccr.language AS cand_lang,
ccr.paper_code,
ccr.component
FROM candidate_component_reg ccr
WHERE ccr.split_session_year = :v_year
AND ccr.split_session_month = :v_month
AND EXISTS
(SELECT 1
FROM IBIS.subject_component sc
WHERE sc.year = ccr.split_session_year
AND sc.month = ccr.split_session_month
AND sc.paper_code = ccr.paper_code
AND sc.assessment_type = 'INTERNAL'
AND sc.subject_option NOT LIKE '%self taught%'
AND sc.component NOT IN ('PERFORMANCE PRODUCTION','PRESENTATION WORK','REFLECTIVE PROJECT','SPECIAL SYLLABUS INT. ASSESSMENT')
AND NVL(ccr.withdrawn,'N') = 'N'
AND ccr.mark_status != 'COMPLETE'
AND EXISTS
(SELECT 1
FROM school s
WHERE s.school_code = ccr.assessment_school
AND s.training_school = 'N'
WHERE mark_status != 'COMPLETE';One thing you can test quickly is to put the function call in it's own select ...from dual.
This might make a difference.
However, only you can check this, I don't have your tables or data.
So, what happens if you use:
paper_code,
cand_lang,
(select mark_entry.get_ia_entry_status(:v_year, :v_month, assessment_school, subject_option, lvl, cand_lang, component, paper_code) from dual ) AS mark_status
FROM
(SELECT DISTINCT ccr.assessment_school, --<< is the DISTINCT really needed?
ccr.subject,
ccr.subject_option,
...Also, try to find out the purpose of that above DISTINCT, is it really needed or is there some join missing?
Maybe you are looking for
-
Itunes 10.1 won't launch on Windows 7 x64
itunes version 10.1 for Windows 7 64-bit won't launch after install. I tried launching it under a different user. I tried disabling my antivirus software. I tried using the desktop shortcut, Start menu shortcut, and itunes.exe. The Event Viewer does
-
Hello I have create a program that start with a splash image defined in the manifest.mf file with the statement SplashScreen-Image: data/images/splash.jpg. When i run the program with jre 1.6.0 I see an undesidered flickering of the splash image.Can
-
GPP: Item Level Targeting - How are collections evaluated?
We are looking at optimizing a new VDI environment and are overhauling are GPOs which will be applied to those machines. Using a third party product, we're moving some of the user based settings into its management stack. There are additional debat
-
Google screen saver quit functioning after the new FF4 was loaded. Keeps asking me to download it again (GSS). What gives? How do I fix this?
-
Regarding TABLE CONTROL IN MODULE POOL
Hi all, I have implemented a table control in a custom transaction . In the PBO of the code I have moved the internal table data to the screen fields similarly in the PAI of the screen I have moved the screen data to the interanal table and iam