Retain session
hi all,
i have a scenario like this.
i login to my apex application (http://host:7777/pls/apex/f?p=100:101). then a session is created for me. then i open a new browser window and type a URL like http://host:7777/pls/apex/f?p=100:1 but i'm being asked to log in again.
is there a way where my session on the other window is used to any other windows as long as its the same browser?
thanks
allen
hi,
thanks for the reply.
the reason i did not include the session id in the link is because links are generated and sent to email of subscribers. so basically if i include a session id in the link in the email message, all the subscribers will have similar session id which i think will not work?
the scenario i have is i created a forum application... then when threads are created, all subscribers of that thread will receive email messages regarding updates of the thread. in the message is the URL of the thread without the session_id. then for example, i am currently log on to the application using one tab of mozilla firefox. and then i receive an email on the other tab of mozilla firefox. upon clicking the URL in my email, it directs me to the specific thread but of course it will generate a different session_id in which i am not authenticated.
my problem is, what do i need to do so that no new session is generated and retain the current session i have.
thanks,
allen
Similar Messages
-
Hi Techies,
My requirement is, i opened new browser window and access some OA page. it asked me login/pwd. i entered and browse pages. After that i closed browser window without logging out.
Now if i open browser window and type direct page url, how i can avoid login page?
Please help.I think if the page is series of the pageFlow that has Application module retained properly, it will take you to where yu left when yu login again.
But to skip login the second time is not entertained. When pages expire on timeouts and require logins, closing the browser window will kill the session
Thanks -
Hi ,
I have an application A which calls up a popup running in appication B (url = '../B/mypopup.do').
The popup creates a new session and all the values which was ment to be transported to popup is cleared..:-(.
How to retain the session of application A to the popup?
Thanks and Best Regards,
BindiyaHi Eddy,
My popup is called with the following url:
https://ifdmain.wdf.sap.corp/sap(bD1lbiZjPTAwMSZkPW1pbg==)/bc/bsp/sap/appl1/mainpopup.do?mv_controller_name=%2E%2E%2Fapp2%2Fsubpopup.do
As you see, its got the session and subopup.do is called on a container mainpopup.do.
For the first time the data is transfred to the tableview of popup.do. But the DO_HANDLE_EVENT is not triggered when a button is clicked on popup.do. Also the model which was transfrered to popup.do is also cleared.
How to keep the flow of data and events in the popup window?
Thanks and Best Regards,
Bindiya -
How To retain Session Value in OBIEE
I have a requirement to pass session variable from one page to next page in the dashboard.
Requirement :
In Presentation Part:
Prompt : Column1: Year
Column2: Quarter
I have to pass the Value selected in the dashboard prompt to the repository. To achieve this, I have stored the Year and Quarter Column value in 2 Request variables from the prompt.
Request Variable1 : VarYear stores Year Value selected
Request Variable2 : VarQuarter stores Quarter Value selected
In Repository Part:
1. I have created 02 session variables in repository with the same name as : VarYear and VarQuarter
2. Under the Intitialization Block of Both Variables I have written a dummy Query as
'SELECT PER_NAME_ENT_YEAR FROM W_DAY_D WHERE PER_NAME_ENT_QTR IS NOT
NULL'
3. Checked the Box to 'Enable any user to set the value' for both the session variables.
4. Used the session variable to pass as a filter under the content tab of the LTS of Revenue Measure as follows:
'"Oracle Data Warehouse".Catalog.dbo.Dim_W_DAY_D.PER_NAME_ENT_YEAR = VALUEOF(NQ_SESSION."VarYear") AND "Oracle Data Warehouse".Catalog.dbo.Dim_W_DAY_D.PER_NAME_ENT_QTR = VALUEOF(NQ_SESSION."VarQuarter")'
Resolution : The session variables from the prompt is passing properly to the RPD and returning the result as expected for the current page(Both Prompt and the Report are in same page where I used the measure Revenue which is getting filtered in the LTS on the basis of Quarter & Year under Content Tab).
Reuirement2 With Issue :
I have to navigate from one page to another on click of Revenue measure value. The target page also contain the same Revenue measure as in First page. But On navigating from one page to another page the session value is getting lost and passing the by default value coming from the Session Initialization block insted of the value selected in the prompt.
As per my understanding the session value should not be replaced untill a user log out from the application. But in my case for First page where I have both Promt and the Revenue measure the Prompt value is passing properly but When I am moving to second page where I have only the Revenue measure the session value which is already set early is replaced by Session IB query result.
Please suggest me if there is any resolution for my issue.
Thanks a Lot in advance.
:)I've had this issue myself and here is what i found. The only way I could get it to work was to have the Prompts that populate the Session Variables on the pages. In other words if I had the prompt on one page and then used guided navigation to go to another dashboard page I needed to have the same prompts located on that page for the session values to get passed into. Since in my case I didn't want the prompts to display or the User to know I had to add Dashboard prompts in order to captures the passed Session Variable values, I placed the dashboard prompts for my Session Variables in a separate section and then hid that section from the User. I hid the section by selecting Properties - Custom CSS Style Options (HTML Only) and then clicked on the check box for Use Custom CSS Style. In the text box enter display:none which will cause the section to be hidden from the User. The prompts will then exist on the dashboard page to receive the session values and the User will never know it is there.
Hopefully this helps.
Eric
http://www.BIConsultingGroup.com -
Retain session in java client , which invokes a dotnet webservice
Hello Forum,
I am invoking a dotnet webservice using a java client. But I am not able to maintain session in this java client. I googled this, I got many links for the above. But none of the solution was using pure sun api's. My need is to do the same only using sun api's. Please guide. Any help will be appreciated.
Best Regards,
Tejal KhatriApache HttpClient can do that.
-
How to reference session id from non-apex page
Hi,
I am looking to integrate an Apex application with the FreeFind site indexing service.
Here's how it works:
You create a form on the Apex page that posts the your search string to the FreeFind website:
<form style="margin:0px; margin-top:4px;" action="http://search.freefind.com/find.html" method="get" accept-charset="utf-8" target="_self">
<input type="hidden" name="si" value="70856809">
<input type="hidden" name="pid" value="r">
<input type="hidden" name="n" value="0">
<input type="hidden" name="_charset_" value="">
<input type="hidden" name="bcd" value="÷">
<input type="text" name="query" size="15">
<input type="submit" value="search">
</form>The search results are then rendered on a FreeFind web page. However, you can upload you own HTML template to use when rendering the search results. See the sample template below:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>::title::</title>
</head>
<body>
::content::
</body>
</html>What I would like to do is create a template that mimics the look and feel of my application, providing navigation to pages within my application.
My question is, how could a include the session id in the links in the template, in order to retain session context?
Thanks,
Andrew.Andrew,
Have you considered using Session ID 0? This was designed to assist in SEO for APEX pages. If each time a user hits an APEX page, a unique session ID is embedded in the URL, the search engines did not rank APEX pages well. Thus, if you put a "0" (zero) in the session ID, APEX will still work for public users, and it more SEO-friendly.
I have used it for my site for some time now: http://sumnertechnologies.com/apex/f?p=10000:1:0
Hope this helps!
Thanks,
- Scott -
http://spendolini.blogspot.com/
http://sumnertech.com/ -
Ok, i have a problem which is really annoying me and i have been stuck on for a while. I am developing a website for my brothers company and am really stuck for time for the launch date. I developed a website last year which worked fine and i am re using the code from that. I am setting a session variable "sessEmail" when the user logs in and want to retrieve it when they go to add a produt to their cart. Here is my code
String Email = request.getParameter("txtEmail");
String Password = request.getParameter("txtPassword");
session.setAttribute("sessEmail",Email);
Object o = session.getAttribute("sessEmail");
String s = o.toString();
out.print(s);
I am just printing out the "sessEmail" to make sure it is working. It works fine when i try and retrieve the session variable on the same page were i set it but on a seperate page it wont work. It is returning a null pointer exception because the session variable has no value. It is occuring when i try to convert an object to a string.
Any help would be much appreciated as i am stuck for time.
CheersOk the first question to be asked is why it is null?
The most obvious answer is that you have cookies disabled, and are not using URL rewriting.
To retain the session, the server issues a "Session Cookie" with your jsessionid in it. If you have cookies switched off on your browser, it won't retain the session.
To confirm this print out session.getId() on your pages. If it continually changes, you aren't keeping your session. If it remains the same, you HAVE got a session, and need to check why you are putting a null value there.
To retain session, you need to run every link/url that gets printed to your page through the method response.encodeURL() which will add on the session id manually if cookies are not supported.
Hope this helps,
evnafets -
AirBrowser - How to clear existing session value?
Hi,
We face the below mentioned problem. Would be great if someone could help us.
Due to problems with uploading the attachment here, please send a email to the following email-id ([email protected]) and I shall send the attachment in response.
WEBKit Browser is using existing session data. Browser retains session history and is a security concern.
* Steps to Reproduce:
1. Install AirBrowser.air and execute code.
2. First go to yahoomail.com and login to an email account.
3. In URL type Google.com
4. After the page gets loaded, click browser "Back". Yahoo email Session will still be retained.
* Actual Result:
Yahoo Login Session is maintained
* Expected Result:
Yahoo Login Session to be cleared. Or, Warning Page should be shown.
* Any Workarounds: None
Thanks in advance.After looking at your code, the behaviour you're experiencing is expected.
AIR uses the webkit browser and therefore when you open a web page (like in your example) you are essentially opening a page in a browser within your application. The web server defines a unique session ID for your visit (and stores cookies etc). When you goto Yahoo, then visit google, then go back to yahoo, the cookies or session continue to identify you and therefore yahoo automatically takes you to your mail or other yahoo specific page.
The last I checked, AIR cookies are operating system cookies. At present I think IE also stores it's cookies that way. So clearing IE's cookies should affect Adobe AIR as well. (This behaviour is not so well documented and it's one of the places I hope the docs improve upon.)
If your application was for a public internet terminal you would want to warn people to logout of their accounts before leaving the system. (However this kind of warning would be standard anyway I would hope.)
I hope that helps -
Hi,
I am having trouble in maintaining session in jsp frames. -
Here is sample code
parent.jsp
<HTML>
<HEAD>
<LINK rel=stylesheet type="text/css" href="defaults.css">
<TITLE>abc</TITLE>
<%
String checkAmount = "100.00";
session.setAttribute("checkAmount", checkAmount);
System.out.println("checkAmount in ppmain"+session.getAttribute("checkAmount"));
%>
<FRAMESET rows="235,*" frameborder="no" >
<FRAME NAME="pptop" SRC="top.jsp" frameborder=0 scrolling=no noresize >
<FRAME NAME="ppbottom" SRC="bottom.jsp" frameborder=0 scrolling=no marginwidth=0 marginheight=0 noresize>
</FRAMESET>
</HTML>
top.jsp -
<HTML>
<HEAD>
<LINK rel=stylesheet type="text/css" href="defaults.css">
<TITLE>top</TITLE>
<%
System.out.println("session in top "+session);
System.out.println("checkAmount in top "+session.getAttribute("checkAmount"));
%>
</HTML>
It is not able to retain session in the top.jsp ( in SOP for session I get different session ID in parent.jsp and top.jsp
This Works well in local but when gets deployed to WAS6 server troubles starts.
Any help is appreciated.
ThanksWhen you create URLs, you might want to try using JSTL to rewrite them:
<FRAME NAME="pptop"
SRC="<c:url value='top.jsp'/>"
frameborder=0
scrolling=no
noresize >
<FRAME NAME="ppbottom"
SRC="<c:url value='bottom.jsp'/>"
frameborder=0
scrolling=no
marginwidth=0
marginheight=0
noresize>Or you can use:
SRC='<%= response.encodeURL("top.jsp") %>' -
Regarding call transaction and session method???
HI All,
Cud u pls let me know
1. differences between call transaction and session???
2. Is it possible to schedule call transaction in background?? ( all are saying MODE N = background scheduling in call transaction.......but i dont think so)
3. Is it posible to handle multiple transactions in call transaction ? if so,how?
4. Is it posible to handle multiple transactions in session ? if so,how?
5. How can we see the log in session method????Hi ,
Check this documentation.
About Session method
In this method you transfer data from internal table to database table through sessions.
In this method, an ABAP/4 program reads the external data that is to be entered in the SAP System and stores the data in session. A session stores the actions that are required to enter your data using normal SAP transaction i.e., Data is transferred to session which in turn transfers data to database table.
Session is intermediate step between internal table and database table. Data along with its action is stored in session i.e., data for screen fields, to which screen it is passed, the program name behind it, and how the next screen is processed.
When the program has finished generating the session, you can run the session to execute the SAP transactions in it. You can either explicitly start and monitor a session or have the session run in the background processing system.
Unless session is processed, the data is not transferred to database table.
BDC_OPEN_GROUP
You create the session through program by BDC_OPEN_GROUP function.
Parameters to this function are:
User Name: User name
Group: Name of the session
Lock Date: The date on which you want to process the session.
Keep: This parameter is passed as X when you want to retain session after
processing it or to delete it after processing.
BDC_INSERT
This function creates the session & data is transferred to Session.
Parameters to this function are:
Tcode: Transaction Name
Dynprotab: BDC Data
BDC_CLOSE_GROUP
This function closes the BDC Group. No Parameters.
Some additional information for session processing
When the session is generated using the KEEP option within the BDC_OPEN_GROUP, the system always keeps the sessions in the queue, whether it has been processed successfully or not.
However, if the session is processed, you have to delete it manually. When session processing is completed successfully while KEEP option was not set, it will be removed automatically from the session queue. Log is not removed for that session.
If the batch-input session is terminated with errors, then it appears in the list of INCORRECT session and it can be processed again. To correct incorrect session, you can analyze the session. The Analysis function allows to determine which screen and value has produced the error. If you find small errors in data, you can correct them interactively, otherwise you need to modify batch input program, which has generated the session or many times even the data file.
CALL TRANSACTION
About CALL TRANSACTION
A technique similar to SESSION method, while batch input is a two-step procedure, Call Transaction does both steps online, one after the other. In this method, you call a transaction from your program by
Call transaction <tcode> using <BDCTAB>
Mode <A/N/E>
Update <S/A>
Messages into <MSGTAB>.
Parameter 1 is transaction code.
Parameter 2 is name of BDCTAB table.
Parameter 3 here you are specifying mode in which you execute transaction
A is all screen mode. All the screen of transaction are displayed.
N is no screen mode. No screen is displayed when you execute the transaction.
E is error screen. Only those screens are displayed wherein you have error record.
Parameter 4 here you are specifying update type by which database table is updated.
S is for Synchronous update in which if you change data of one table then all the related Tables gets updated. And sy-subrc is returned i.e., sy-subrc is returned for once and all.
A is for Asynchronous update. When you change data of one table, the sy-subrc is returned. And then updating of other affected tables takes place. So if system fails to update other tables, still sy-subrc returned is 0 (i.e., when first table gets updated).
Parameter 5 when you update database table, operation is either successful or unsuccessful or operation is successful with some warning. These messages are stored in internal table, which you specify along with MESSAGE statement. This internal table should be declared like BDCMSGCOLL, a structure available in ABAP/4. It contains the following fields:
1. Tcode: Transaction code
2. Dyname: Batch point module name
3. Dynumb: Batch input Dyn number
4. Msgtyp: Batch input message type (A/E/W/I/S)
5. Msgspra: Batch input Lang, id of message
6. Msgid: Message id
7. MsgvN: Message variables (N = 1 - 4)
For each entry, which is updated in database, table message is available in BDCMSGCOLL. As BDCMSGCOLL is structure, you need to declare a internal table which can contain multiple records (unlike structure).
Steps for CALL TRANSACTION method
1. Internal table for the data (structure similar to your local file)
2. BDCTAB like BDCDATA
3. UPLOAD or WS_UPLOAD function to upload the data from local file to itab. (Considering file is local file)
4. Loop at itab.
Populate BDCTAB table.
Call transaction <tcode> using <BDCTAB>
Mode <A/N/E>
Update <S/A>.
Refresh BDCTAB.
Endloop.
(To populate BDCTAB, You need to transfer each and every field)
The major differences between Session method and Call transaction are as follows:
SESSION METHOD CALL TRANSACTION
1. Data is not updated in database table unless Session is processed. Immediate updation in database table.
2. No sy-subrc is returned. Sy-subrc is returned.
3. Error log is created for error records. Errors need to be handled explicitly
4. Updation in database table is always synchronous Updation in database table can be synchronous Or Asynchronous.
Error Handling in CALL TRANSACTION
When Session Method updates the records in database table, error records are stored in the log file. In Call transaction there is no such log file available and error record is lost unless handled. Usually you need to give report of all the error records i.e., records which are not inserted or updated in the database table. This can be done by the following method:
Steps for the error handling in CALL TRANSACTION
1. Internal table for the data (structure similar to your local file)
2. BDCTAB like BDCDATA
3. Internal table BDCMSG like BDCMSGCOLL
4. Internal table similar to Ist internal table
(Third and fourth steps are for error handling)
5. UPLOAD or WS_UPLOAD function to upload the data from the local file to itab. (Considering file is local file)
6. Loop at itab.
Populate BDCTAB table.
Call transaction <tr.code> using <Bdctab>
Mode <A/N/E>
Update <S/A>
Messages <BDCMSG>.
Perform check.
Refresh BDCTAB.
Endloop.
7 Form check.
IF sy-subrc <> 0. (Call transaction returns the sy-subrc if updating is not successful).
Call function Format_message.
(This function is called to store the message given by system and to display it along with record)
Append itab2.
Display the record and message.
Check this program for session method using multiple transactions.
Have one BDC_OPEN_GROUP, multiple BDC_INSERT s and one BDC_CLOSE_GROUP.
You should have multiple BDC_INSERT s for multiple transactions.
call function BDC_OPENGROUP.
Build BDC data and cal lBDC_INSERT for transaction 1
Build BDC data and cal lBDC_INSERT for transaction 2
Build BDC data and cal lBDC_INSERT for transaction 3
call function BDC_CLOSE_GROUP.
Check out this sample program
REPORT ztest_report
NO STANDARD PAGE HEADING
LINE-SIZE 255
MESSAGE-ID ZRASH.
Internal Table Declarations *
*--Internal Table for Data Uploading.
DATA : BEGIN OF IT_FFCUST OCCURS 0,
KUNNR(10),
BUKRS(4),
KTOKD(4),
ANRED(15),
NAME1(35),
SORTL(10),
STRAS(35),
ORT01(35),
PSTLZ(10),
LAND1(3),
SPRAS(2),
AKONT(10),
END OF IT_FFCUST.
*--Internal Table to Store Error Records.
DATA : BEGIN OF IT_ERRCUST OCCURS 0,
KUNNR(10),
EMSG(255),
END OF IT_ERRCUST.
*--Internal Table to Store Successful Records.
DATA : BEGIN OF IT_SUCCUST OCCURS 0,
KUNNR(10),
SMSG(255),
END OF IT_SUCCUST.
*--Internal Table for Storing the BDC data.
DATA : IT_CUSTBDC LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
*--Internal Table for storing the messages.
DATA : IT_CUSTMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : V_FLAG1(1) VALUE ' ',
"Flag used for opening session.
V_TLINES LIKE SY-TABIX,
"For storing total records processed.
V_ELINES LIKE SY-TABIX,
"For storing the no of error records.
V_SLINES LIKE SY-TABIX.
"For storing the no of success records.
Selection screen *
SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETERS : V_FNAME LIKE RLGRAP-FILENAME,
V_SESNAM LIKE RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK B1.
Start-of-selection *
START-OF-SELECTION.
*-- Form to upload flatfile data into the internal table.
PERFORM FORM_UPLOADFF.
TOP-OF-PAGE *
TOP-OF-PAGE.
WRITE:/ 'Details of the error and success records for the transaction'
ULINE.
SKIP.
End of Selection *
END-OF-SELECTION.
*-- Form to Generate a BDC from the Uploaded Internal table
PERFORM FORM_BDCGENERATE.
*--To write the totals and the session name.
PERFORM FORM_WRITEOP.
*& Form form_uploadff
Form to upload flatfile data into the internal table.
FORM FORM_UPLOADFF .
*--Variable to change the type of the parameter file name.
DATA : LV_FILE TYPE STRING.
LV_FILE = V_FNAME.
*--Function to upload the flat file to the internal table.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = LV_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = IT_FFCUST
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC = 0.
*--Deleting the headings from the internal table.
DELETE IT_FFCUST INDEX 1.
*--Getting the total number of records uploaded.
DESCRIBE TABLE IT_FFCUST LINES V_TLINES.
ENDIF.
ENDFORM. " form_uploadff
*& Form Form_bdcgenerate
Form to Generate a BDC from the Uploaded Internal table
FORM FORM_BDCGENERATE .
*--Generating the BDC table for the fields of the internal table.
LOOP AT IT_FFCUST.
PERFORM POPULATEBDC USING :
'X' 'SAPMF02D' '0105',
' ' 'BDC_OKCODE' '/00' ,
' ' 'RF02D-KUNNR' IT_FFCUST-KUNNR,
' ' 'RF02D-BUKRS' IT_FFCUST-BUKRS,
' ' 'RF02D-KTOKD' IT_FFCUST-KTOKD,
'X' 'SAPMF02D' '0110' ,
' ' 'BDC_OKCODE' '/00',
' ' 'KNA1-ANRED' IT_FFCUST-ANRED,
' ' 'KNA1-NAME1' IT_FFCUST-NAME1,
' ' 'KNA1-SORTL' IT_FFCUST-SORTL,
' ' 'KNA1-STRAS' IT_FFCUST-STRAS,
' ' 'KNA1-ORT01' IT_FFCUST-ORT01,
' ' 'KNA1-PSTLZ' IT_FFCUST-PSTLZ,
' ' 'KNA1-LAND1' IT_FFCUST-LAND1,
' ' 'KNA1-SPRAS' IT_FFCUST-SPRAS,
'X' 'SAPMFO2D' '0120',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0125',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0130',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0340',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0360',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0210',
' ' 'KNB1-AKONT' IT_FFCUST-AKONT,
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0215',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0220',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0230',
' ' 'BDC_OKCODE' '=UPDA'.
*--Calling the transaction 'fd01'.
CALL TRANSACTION 'FD01' USING IT_CUSTBDC MODE 'N' UPDATE 'S'
MESSAGES INTO IT_CUSTMSG.
IF SY-SUBRC <> 0.
*--Populating the error records internal table.
IT_ERRCUST-KUNNR = IT_FFCUST-KUNNR.
APPEND IT_ERRCUST.
CLEAR IT_ERRCUST.
*--Opening a session if there is an error record.
IF V_FLAG1 = ' '.
PERFORM FORM_OPENSESSION.
V_FLAG1 = 'X'.
ENDIF.
*--Inserting the error records into already open session.
IF V_FLAG1 = 'X'.
PERFORM FORM_INSERT.
ENDIF.
*--Populating the Success records internal table.
ELSE.
IT_SUCCUST-KUNNR = IT_FFCUST-KUNNR.
APPEND IT_SUCCUST.
CLEAR IT_SUCCUST.
ENDIF.
*--Displaying the messages.
IF NOT IT_CUSTMSG[] IS INITIAL.
PERFORM FORM_FORMATMSG.
ENDIF.
*--Clearing the message and bdc tables.
CLEAR : IT_CUSTBDC[],IT_CUSTMSG[].
ENDLOOP.
*--Getting the total no of error records.
DESCRIBE TABLE IT_ERRCUST LINES V_ELINES.
*--Getting the total no of successful records.
DESCRIBE TABLE IT_SUCCUST LINES V_SLINES.
*--Closing the session only if it is open.
IF V_FLAG1 = 'X'.
PERFORM FORM_CLOSESESS.
ENDIF.
ENDFORM. " Form_bdcgenerate
*& Form populatebdc
FOrm to Populate the BDC table.
FORM POPULATEBDC USING VALUE(P_0178)
VALUE(P_0179)
VALUE(P_0180).
IF P_0178 = 'X'.
IT_CUSTBDC-PROGRAM = P_0179.
IT_CUSTBDC-DYNPRO = P_0180.
IT_CUSTBDC-DYNBEGIN = 'X'.
ELSE.
IT_CUSTBDC-FNAM = P_0179.
IT_CUSTBDC-FVAL = P_0180.
ENDIF.
APPEND IT_CUSTBDC.
CLEAR IT_CUSTBDC.
ENDFORM. " populatebdc
*& Form FORM_OPENSESSION
Form to Open a session.
FORM FORM_OPENSESSION .
*--Variable to convert the given session name into reqd type.
DATA : LV_SESNAM(12).
LV_SESNAM = V_SESNAM.
*--Opening a session.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = LV_SESNAM
HOLDDATE = '20040805'
KEEP = 'X'
USER = SY-UNAME
PROG = SY-CPROG
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
IF SY-SUBRC <> 0.
WRITE :/ 'Session not open'.
ENDIF.
ENDFORM. " FORM_OPENSESSION
*& Form FORM_INSERT
fORM TO INSERT ERROR RECOED INTO A SESSION.
FORM FORM_INSERT .
*--Inserting the record into session.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'FD01'
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
SIMUBATCH = ' '
CTUPARAMS = ' '
TABLES
DYNPROTAB = IT_CUSTBDC
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
IF SY-SUBRC <> 0.
WRITE :/ 'Unable to insert the record'.
ENDIF.
ENDFORM. " FORM_INSERT
*& Form FORM_CLOSESESS
Form to Close the Open Session.
FORM FORM_CLOSESESS .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.
ENDFORM. " FORM_CLOSESESS
*& Form FORM_FORMATMSG
Form to format messages.
FORM FORM_FORMATMSG .
*--Var to store the formatted msg.
DATA : LV_MSG(255).
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = SY-LANGU
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = LV_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE :/ LV_MSG.
ENDIF.
ULINE.
ENDFORM. " FORM_FORMATMSG
*& Form form_writeop
To write the totals and the session name.
FORM FORM_WRITEOP .
WRITE :/ 'Total Records Uploaded :',V_TLINES,
/ 'No of Error Records :',V_ELINES,
/ 'No of Success Records :',V_SLINES,
/ 'Name of the Session :',V_SESNAM.
ULINE.
ENDFORM. " form_writeop
Hope this resolves your query.
Reward all the helpful answers.
Regards -
Hi Friends,
In call transaction we can display both updated and error records separately in a report.
Like that in session method i want to capture and display in a separate report both error and updated records.
Please let me know if you have any ideas
Thanks and Regards
V.Raja sekaranhi,
Use the BDC_OPEN_GROUP function module to create a new session. Once you have created a session, then you can insert batch input data into it with BDC_INSERT.
You cannot re-open a session that already exists and has been closed. If you call BDC_OPEN_GROUP with the name of an existing session, then an additional session with the same name is created.
A batch input program may have only one session open at a time. Before opening a session, make sure that any sessions that the program closes any sessions that it previously had opened.
BDC_OPEN_GROUP takes the following EXPORTING parameters:
· CLIENT
Client in which the session is to be processed.
Default: If you don't provide a value for this parameter, the default is the client under which the batch input program runs when the session is created.
· GROUP
Name of the session that is to be created. May be up to 12 characters long.
Default: None. You must specify a session name.
· HOLDDATE
Lock date. The session is locked and may not be processed until after the date that you specify. Only a system administrator with the LOCK authorization for the authorization object Batch Input Authorizations can unlock and run a session before this date.
Format: YYYYMMDD (8 digits).
Default: No lock date, session can be processed immediately. A lock date is optional.
· KEEP
Retain session after successful processing. Set this option to the value X to have a session kept after it has been successfully processed. A session that is kept remains in the input/output queue until an administrator deletes it.
Sessions that contain errors in transactions are kept even if KEEP is not set.
Default: If not set, then sessions that are successfully processed are deleted. Only the batch input log is kept.
· USER
Authorizations user for background processing. This is the user name that is used for checking authorizations if a session is started in background processing. The user must be authorized for all of the transactions and functions that are to be executed in a session. Otherwise, transactions will be terminated with no authorization errors.
The user can be of type dialog or background. Dialog users are normal interactive users in the SAP system. Background users are user master records that are specially defined for providing authorizations for background processing jobs.
check this link
http://help.sap.com/saphelp_nw04/helpdata/en/fa/097126543b11d1898e0000e8322d00/frameset.htm
Regards,
pankaj -
Hi,
Recently, I have just upgraded from weblogic 6.0 to weblogic 6.1. The Windows
version is behaving strangely. Somehow, weblogic 6.1 is unable to retain session
information of incoming request.
ie.
1) client log in
2) client makes a request
If the client isn't logged in, then the client will not be allowed to make the
request. The login information is stored in cookie in http header.
My application seems to work fine in weblogic 6.0 and linux version of weblogic
6.1. Can you tell me what's wrong?
Thanks for your time.Hi,
Recently, I have just upgraded from weblogic 6.0 to weblogic 6.1. The Windows
version is behaving strangely. Somehow, weblogic 6.1 is unable to retain session
information of incoming request.
ie.
1) client log in
2) client makes a request
If the client isn't logged in, then the client will not be allowed to make the
request. The login information is stored in cookie in http header.
My application seems to work fine in weblogic 6.0 and linux version of weblogic
6.1. Can you tell me what's wrong?
Thanks for your time. -
Difference between Session method and Call transaction method
Hi,
Difference between Session method and Call transaction method in BDCHi,
SESSION method:
Is a standard procedure for transferring large amount of data into the R/3 system.
Data consistency is ensured because batch input uses all thje checks conducted on the normal screen.
It is a two step procedure:
1. Progarm: creates batch input session. This session is the data file that includes everything to begin the transaction.
2. Process session: Which then actually transfers the data to database table.
In this method an ABAP/4 program reads the external data that is to be entered in the SAP system and stores the data in a session.
A session stores the actions that are required to enter your data using normal SAP transactions i.e. data is transferred to session which inturn transfers data to database table. Session is an intermediate step between internal table and database table.
Data along with it's actions are stored in session. i.e. data for screen fields, to which screen it is passed, the program name behind it and how next screen is processed.
When the program has finished generating the session, u can run the session to execute the SAP transactions in it.
BDC_OPEN_GROUP
You create the session through program by BDC_OPEN_GROUP function.
1) User Name: User Name.
2) Group : Name of the session
3) Lock Date : The date when you want to process the session.
4) Keep : This parameter is passed as 'X' when you want to retain session even after processing it.
BDC_INSERT
Data is transferred to session by BDC_INSERT.
BDC_CLOSE_GROUP.
With this function the session will be closed.
CALL TRANSACTION method.
Syntax: call transaction <tr code> using <bdctab>
mode <A/N/E>
update <S/A>
messages into <internal table>.
<tr code> : transaction code
<bdctab> : Name of the BDC table
mode: mode in which you execute the transaction.
A : all screen mode ( all the screens of the transaction are displayed )
N : no screen mode ( no screen will be displayed when you execute the transaction )
E : error screen ( only those screens are displayed where in you have error record )
Update type:
S: synchronous update in which if you change data of one table then all the related tables gets updated and SY_SUBRC is returned for once and all.
A: asynchronous update in which if you change data of one table, the sy-subrc is returned and then updation of other affected tables takes place. So if system fails to update other tables still sy-subrc returned is zero.(that is when first table gets updated ).
messages: if you update database table, operation is either successful or unsuccessful. These messages are stored in internal table. This internal table structure is like BDCMSGCOLL.
TCODE: transaction code.
DYNAME: batch input module name.
DYNNUMB: batch input dyn no.
MSGTYP: batch input message type.
MSGSPRA: batch input language id of message.
MSGID: message id.
MSGV1 .MSGV5: message variables
For each entry which is updated in the database table message is available in BDCMSGCOLL.
Reward if useful
Regards
Srinu -
What is structure of BDC session?
Hi Experts,
What is structure of BDC session?
Thanks
~Sid
"Max points are assured"Hi,
If you want to write your own program, proceed as follows:
Generate the batch input session using function module BDC_OPEN_GROUP
The proceed as follows for each transaction that session contains:
In the BDCDATA structure, enter the value for all screens and fields that must be processed in the transaction.
Use BDC_INSERT to transfer the transaction and BDCDATA structure to the session.
Close the batch input session with BDC_CLOSE_GROUP
Start to process the generated session.
BDC_OPEN_GROUP
Use the BDC_OPEN_GROUP function module to create a new session. Once you have created a session, then you can insert batch input data into it with BDC_INSERT.
You cannot reopen a session that already exits and has been closed. If you call BDC_OPEN_GROUP with the name of an existing session, then an additional session with the same name is created.
A batch input program may have only one session open at a time. Before opening a session, make sure that any sessions that program closes any sessions that it previously had opened.
BDC_OPEN_GROUP takes the following EXPORTING parameters:
CLIENT
Client in which the session is to be processed. Default: If you dont provide a value for this parameter, the default is the client under which the bathc input program runs when the session is created.
GROUP
Name of the session that is to be created. May up to 12 characters long. Default: None. You must specify a session name.
HOLDDATE
Lock date. The session is locked and may not be processed until after the date that you specified. Only a system administrator with the LOCK authorization for the authorization object Batch Input Authorizations can unlock and run a session before this date.
KEEP
Retain session after successful processing. Set this option to the value X to have a session kept after it has been successfully processed. A session that is kept remains in the input/output queue until an administrator deleletes it. Sessions that contain errors in transactions are kept even if KEEP is not set. Default: If not set, then sessions that are successfully processed are deleted. Only the batch input log is kept.
USER
Authorizations user for background processing. This is the user name that is used for checking authorizations if a session is started in background processing. The user must be authorized for all of transactions and functions that are to be executed in a session. Otherwise, transactions will be terminated with no authorization errors. The user can be of type dialog or background. Dialog users are normal interactive users in the R/3 System. Background users are user master records that are specially defined for providing authorizations for background processing jobs.
BDC_INSERT
Use the BDC_INSERT function module to add a transaction to a batch input session. You specify the transaction that is to be started in the call to BDC_INSERT. You must provide a BDCDATA structure that contains all of the data required to process the transaction completely.
BDC_INSERT takes the following parameters:
TCODE
The code of the transaction that is to be run.
POST_LOCAL
Parameter to update data locally. If POST_LOCAL = X, data will be updated locally.
DYNPROTAB
The BDCDATA structure that contains the data that is to be processed by the transaction. DYNPROTAB is a table parameter in the function module.
BDC_CLOSE_GROUP
Use the BDC_CLOSE_GROUP function module to close a session after you have inserted all of your batch input data into it. Once a session is closed, it can be processed.
BDC_CLOSE_GROUP needs no parameters. It automatically closes the session that is currently open in your program. You must close a session before you can open another session from the same program.
BDCDATA Structure
IF you want to write data to a batch input session or to process the data using CALL TRANSACTION USING or CALL DIALOG, you must prepare an internal table <bdc_tab>. This internal table must be structured according to ABAP Dictionary structure BDCDATA. The internal table <bdc_tab> stores the data that is to be entered into R/3 System and the actions that are necessary to process data. You can think of the table as storing the script that the R/3 System is to follow in processing batch input data.
BDC table structure
FIELD TYPE DESCRIPTION
Program CHAR (8) Program name of transaction.
DynPro CHAR (4) Screen number of transaction.
DynBegin CHAR (1) Indicator for new screen.
Fnam CHAR (35) Name of database field from screen.
Fval CHAR (80) Value to submit to field.
Regards,
Omkar.
Message was edited by:
Omkaram Yanamala -
Not null validaton in tabular form --Apex3.2
Hi,
i am working with apex_3.2.
i am working on tabular form. I want to set validation on tabular form column , Column value cannot be null.How i can do this?
Thanks & Regards
Vedant.Vedant wrote:
Hi,
Thanks it is working. i Need some more help regarding this. I have set the validation on add row button. If i keep the particular field empty on which i have set the validation , and click on add row button, it clear to the complete record. value should not be clear when click on the add row button it just show the massage, Field (Active_FLG) )cannot be empty.
Thanks & Regards
VedantI am not clear; when do you trigger the validation? On submit? If yes, then it will not retain your session state values. What is the relationship between the ADD_ROW button and the validation?
FYI, if you wish to retain session state values in the tabular form, you should be writing manual tabular form using collections. You will get good amount of information on manual tabular forms and collections in this forum and outside(google).
BTW, if your question is answered, do not forget to mark the appropriate post as correct. It will help all of us in the forum.
Maybe you are looking for
-
HT201343 Apple TV disconnects when mirroring
i have an early 2011 macbook pro running Mountain Lion. When trying to watch videos on AppleTV via airplay mirroring, it keeps randomly dropping the connection. The video continues to play on the laptop, but not the ATV. must restart ATV to reconne
-
Creating URM Physical objects using Java
Hi, I am able to create electronic documents and folders using CIS (UCPM api's). I am looking for some help in creating Physical contents in Oracle URM programmatically. I would appreciate, if anybody could share the approach on getting this done(Cre
-
Wireless Keyboard FN Key Not Working
I have checked this box: I also tried the Firmware 1.1 update but I got a messege saying: "No Apple Aluminum Keyboards Found" and I paraphrase "Please connect the device or make sure it is turned on etc." I also tried the Firmware 2.0 update but got
-
Getting the most out of BB Talk
Hello all, I've just set up my BB Talk account and trying to work the way to get the most out of it. First question is that now l have plugged my cordess phone base station into it, with three handsets, why would l ever want to switch back to the lan
-
IPhone 3G won't turn on REGARDLESS
Ok, so I think it's dead. I traded my phone for the iPhone (stupid idea) and it WAS working, but it's not unlocked and the hold button is jammed it and won't work. SO, it won't turn on using the broke hold button, since it can't do anything. Holding