Handling sessions (identifying, mapping)

Hi.
I'm still new to handling sessions and users with javax.servlet.*
Two questions, one about identifying one other about mapping :
-how do you access the user login name ? The object HttpSession.getId() tells me nothing interesting, because this id changes everytime the user connects
-in a project where there are information about the user (say a UserAccount class) to be mapped to him, in what piece of code do you code the bind action? I'm using the FORM memory realm, from TOMCAT. Is it possible to bind objects to a user with this kind of authentication?
Thanks!

If you are using FORM based authentication then you can get the userid of the logged user using the following:
1.
String userid = request.getRemoteUser();OR
2.
java.security.Principal user = request.getUserPrincipal();
String userid = user.getName();
Where request is HttpServletRequest

Similar Messages

  • Does SQL Server 2008 R2 recognize only system-generated session identifiers,

    As part of the locking down of our system we are doing the Security Technical Implementation Guide (STIG) and one of the questions it asks is "The DBMS must recognize only system-generated session identifiers."
    I have looked at the STIG version for SQL Server 2012 and this is not a finding on it, since it supports the requirement and cannot be configured out of compliance.
    If anyone can help confirm that this is also the case with SQL Server 2008 R2 that would be very helpful.
    Thank you, Darren
    The discussion of it is:
    This requirement focuses on communications protection at the application session, versus network packet level. The intent of this control is to establish grounds for confidence at each end of a communications session in the ongoing identity of the other
    party and in the validity of the information being transmitted.
    Unique session IDs are the opposite of sequentially generated session IDs which can be easily guessed by an attacker. Unique session identifiers help to reduce predictability of said identifiers. 
    Unique session IDs address man-in-the-middle attacks including session hijacking or insertion of false information into a session. If the attacker is unable to identify or guess the session information related to pending application traffic, they will have
    more difficulty in hijacking the session or otherwise manipulating valid sessions.
    The DBMS must only recognize only system generated session identifiers. If an attacker was able to generate a session with a non-system generated session identifier and have it be recognized by the system, the attacker could potentially gain access to the
    system without passing through access controls designed to limit database sessions to authorized users.

    Hi Darren,
    From your description, do you mean the session_id from DMV sys.dm_exec_sessions? If so, the session_id(s) are all created and handled by SQL Server. When session_id <= 50 , it belongs to a system session, and when session_id > 50, it belongs to a user
    session.
    Below query could help you generate system sessions in SQL Server 2008 R2. Refer to :
    Explore the secrets of session- sys.dm_exec_sessions.
    SELECT
    S.SESSION_ID,
    S.STATUS,
    S.HOST_NAME,
    C.CLIENT_NET_ADDRESS,
    CASE WHEN S.LOGIN_NAME = S.ORIGINAL_LOGIN_NAME THEN S.LOGIN_NAME ELSE S.LOGIN_NAME + ' (' +S.ORIGINAL_LOGIN_NAME + ')' END AS LOGIN_NAME,
    S.PROGRAM_NAME,
    C.CONNECT_TIME, -- DIFFRENT BETWEEN CONNECT & LOGIN TIME IS TIME TAKEN BY PRELOGON ACTIVITIES
    S.LOGIN_TIME,
    CASE S.TRANSACTION_ISOLATION_LEVEL
    WHEN 0 THEN 'UNSPECIFIED'
    WHEN 1 THEN 'READUNCOMITTED'
    WHEN 2 THEN 'READCOMMITTED'
    WHEN 3 THEN 'REPEATABLE'
    WHEN 4 THEN 'SERIALIZABLE'
    WHEN 5 THEN 'SNAPSHOT'
    ELSE CAST(S.TRANSACTION_ISOLATION_LEVEL AS VARCHAR(32))
    END AS TRANSACTION_ISOLATION_LEVEL_NAME,S.LAST_SUCCESSFUL_LOGON, -- REQUIRES 'COMMON CRITERIA COMPLIANCE ENABLED' OPTION VIA SP_CONFIGURE.
    S.LAST_UNSUCCESSFUL_LOGON, -- REQUIRES 'COMMON CRITERIA COMPLIANCE ENABLED' OPTION VIA SP_CONFIGURE.
    S.UNSUCCESSFUL_LOGONS, --REQUIRES 'COMMON CRITERIA COMPLIANCE ENABLED' OPTION VIA SP_CONFIGURE.
    S.CPU_TIME AS CPU_TIME_MS,
    S.MEMORY_USAGE AS MEMORY_USAGE_PAGES,
    S.ROW_COUNT,
    S.PREV_ERROR,
    S.LAST_REQUEST_START_TIME,
    S.LAST_REQUEST_END_TIME,
    C.NET_TRANSPORT,
    C.PROTOCOL_TYPE,
    S.LANGUAGE,
    S.DATE_FORMAT,
    ST.TEXT AS QUERY_TEXT
    FROM
    SYS.DM_EXEC_SESSIONS S
    FULL OUTER JOIN SYS.DM_EXEC_CONNECTIONS C ON C.SESSION_ID = S.SESSION_ID
    CROSS APPLY SYS.DM_EXEC_SQL_TEXT(C.MOST_RECENT_SQL_HANDLE) ST
    WHERE
    S.SESSION_ID IS NULL
    OR S.SESSION_ID < = 50
    ORDER BY
    S.SESSION_ID
    Thanks,
    Lydia Zhang

  • Exception Handling in Message Mapping and Alert

    Hello,
    1. Pls let me know the concept of Exception Handling and Alerts.
    2. Pls provide some blogs for Exception Handling in Message Mapping.
    3.What are Alerts and how it help us in XI. Pls provide some blogs for Alert
    4.How are Alerts and Exception Handling can be related say for some scenario
    Regards

    Hi,
    Plz check out these blogs of Sravya on Error Handling:
    /people/sravya.talanki2/blog/2006/11/22/error-handling-framework-xiout-of-the-box-episode-1
    /people/sravya.talanki2/blog/2006/11/23/error-handling-framework-xiout-of-the-box-episode-2
    Also check this SAP Presentation:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9418d690-0201-0010-85bb-e9b2c1af895b
    /people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping
    Error Handling :
    http://help.sap.com/saphelp_nw04/helpdata/en/56/b46c3c8bb3d73ee10000000a114084/frameset.htm
    Alerts:
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--troubleshooting-guide
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--step-by-step
    http://help.sap.com/saphelp_nw04/helpdata/en/56/d5b54020c6792ae10000000a155106/content.htm
    BPM:
    /people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit
    Working with acknowledgements
    regards

  • Best way to handle session timeout

    Hello All,
    oracle 11g, Apex ver 3.1.2
    I am bit confused about the sessoin handling mecahnism for the users .
    Which is the best way to handle session for the users is it programatically or by DBA admin level.
    What are the pros and cons going DBA Level and Programmatica level.
    Before hand I got to have some information on hand for justification.
    thanks/kumar

    Hi,
    I've done a great deal of work with mobile accounts in Snow Leopard and I'm now having a "play" with Lion. To be honest you have to sit down and think about why you need mobile accounts.
    If your user only uses one computer then your safer having a local account backed up by a network Time Machine, this avoids the many many woes that the Servers FileSyncAgent brings to the table.
    If your users are going to be accessing multiple computers on the network and leaving the network then a mobile account is good for providing a uniform user experience and access to files etc. However, your users will have to make a choice as to whether they want their iPhoto libraries on one Local machine (backed up by Time Machine) or whether they want their library to be hosted on the server and not part of the Mobile Home Sync schedule (adding ~/Pictures to the excluded items on the home sync settings).
    With the latter, users will be able to access their iPhoto libraries on any computer when they are within the network (as it's accessed from the users server home folder).
    With the first option the user would have their iPhoto library on one computer (say the laptop they used the most) but then would not be able to access it from other computers they log on to.
    iPhoto libraries are a pain, and I'm working hard to come up with a workaround. If your users moved over to using Apeture then you could include the aperture library as part of the home sync thanks to Deeport (http://deepport.net/archives/os-x-portable-home-directories-and-syncing-flaw-wit h-bundles/)
    He does suggest that the same would work with IPhoto libraries - but it doesn't for a number of mysterious reasons regarding how the OS recognizes thie iPhoto bundle (it does so differently compared to Apeture).
    Hope this helps...

  • Handling sessions in Web Services

    Hi all,
    I am quite new to Web Services. I am facing problems in handling sessions in Web Services.
    I am using Apache Axis as SOAP engine. I have different Web Services like AuthenticationService, DataService and ReportService.
    The problem is in handling authentication. I need to authenticate only once using AuthenticationService and maintain the
    session for rest of the calls to different web services like DataService, ReportService.
    Has anyone faced similar situation?
    Please help.
    Thanks,
    Prashanth

    a bit unspecific, anyway, here a solution for a plain JAX-RPC implementation
    in a JAX-RPC client, use
    ((javax.xml.rpc.Stub)myProxy)._setProperty(javax.xml.rpc.Stub.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
    to let the client maintain session state
    in JAX-RPC server, implement ServiceLifecycle and call getHttpSession() on the servlet endpoint context
    Merten

  • Handling Session in jsp and bean scope

    i have problems with handling session in jsp
    I want to check on all jsp pages
    first thing is session is null
    i want to him to be redirected to first page
    and he should not be able to go ahead
    I tried
    if(session ==null)
    response.sendRedirect("Login.jsp");
    but this does not seem to work
    It is very crtical problem can any one answer
    this asap
    Also i wanted to know that
    I have bean which in turn calls static methods of another class which holds all DomainTable(database tables which do not change frequently)
    Information .
    This is bean is being implemented by me
    in seession scope in a jsp
    Do u guys think it would be goo idea to change
    scop of this bean as Application in jsp
    if so what would be advantages for same
    I would appericate if i could a quick reply on both
    question
    as i am time crunch
    arsh

    You will always get some value of session and your code wont work. At the end of your Login.jsp, you should create a sesssion and store attributes. Check for these attributes in session, rather than checking session==null.

  • Handle Session Timeout

    I am using JDeveloper 11.1.1.6.
    I am trying to gracefully handle session time outs in ADF. My application has been experiencing the 'canned' ADF session timeout popup when I am logged into my application and the session has timed out. That same popup is rendered even if I am sitting at my login page but haven't signed in.
    I have followed Frank Nimphius's guidance as explained in the following forum to have my application re-direct to the login page after session timeout. That works great thanks to his well detailed document.
    ADF Faces : session timeout best practice
    The concern I have now is if I am sitting at my login page and my session times out, the application stays at the login page. I now type my credentials and click log in. Because the application thinks my session is timed out, I am taken back to the login page. Ideally I wouldn't think the login page would hold a session. Do you have any guidance on how I can get around this.

    Hi,
    what about using programmatic login, in which case the login form is part of a public page (see http://www.oracle.com/technetwork/issue-archive/2012/12-jan/o12adf-1364748.html for an example you can download)
    Frank

  • Handle Session data with JAX-WS web services

    Is it posible to to handle session tracking with JAX-WS web services without implementing my own session logic.
    If posible how do we put values in to session and get them back.
    And also assuming that sessions are supported is it posible to share the same session between two web services on the same web application.

    Hello!
    Do you have any solution to your problem now? I also need to maintain a session bean between 2 webservices. If you solved this, can you please tell me how?
    Thanks a lot!

  • Context handling in message mapping  for an IDoc to File Scenario

    Hi,
    Can somebody help me with this issue. I have an Idoc to file scenario. heres my idoc structure. Its a custom Idoc
    Header (1..1)
    Detail (0..Unbounded)
             DependentDetail (0...Unbounded)              Note: This dependentdetail is a subelement of Detail
    Trailer(1...1)
    I  created my target structrure the same way as the Idoc structure.
    My output is a simple text file. I need the output in this format
    Header
    Detail1
       Dependentdetail1
       DependentDetail2
       DependentDetail3
    Detail2
       DependentDetail1
       Dependentdetail2
    Detail3
    Detail4
    Trailer
    Since the Detail and Dependent Detail records are unbounded .
    But right now i m getting my output like this:
    Header
    Detail1
    Detail2
    Detail3
    Detail4
    Trailer
    But the DependentDetail record in not showing up in the output file. I didnot do any context change in my mapping. So do I need to do any context handling??...If so can somebody explain me with this.
    Thanks,
    Adam
    Edited by: hymanroth on Apr 29, 2011 11:11 PM

    Thanks Kenneth foryour quick reply,
    Yes, I see the payload for Dependent detail in SXMB_MONI. So as you said earlier there's a problem with my content conversion.
    my content conversion is as follows:
    Header.fieldNames                             
    Header.fieldFixedLengths                
    Header.endSeparator                        
    Detail.fieldNames                               
    Detail.fieldFixedLengths                    
    Detail.endSeparator
    DependentDetail.fieldNames
    DependentDetail.fieldFixedLengths                   
    DependentDetail.endSeparator
    Trailer.fieldNames                             
    Trailer.fieldFixedLengths                
    Trailer.endSeparator  
    So As I told  earlier. With the above content conversion. I am not able to get the Dependent detail record in my output file. So If there is a change in my content conversion can u check it and tell me where I went wrong.
    Thanks,
    Harsh
    Edited by: hymanroth on May 2, 2011 7:03 PM

  • Exception Handling for Multi Mapping in bpm

    Hello,
    does anybody know a way of catching an error occured in a multi-mapping used in an integration process.
    It seems to me, that when i am using a multi-mapping in an integration process and an error occurs, the message cannot get back to the integration process. In smq2 I can see, that there is the following error:
    CX_MERGE_SPLIT
    Regards
    Günther

    The transformation-step is in an block with an exception branch and it is well configured.
    When I use a 1 to 1 mapping and an error in the mapping occurs, all is correct. The integration process jumps in to the exception branch and finishes  correct. But when use a multi mapping (1 to n; n to 1; n to m) and an error in the mapping occurs, then there is always an error in the bpe inbound queue.
    There must be some problem with the split-and-merge program. I think that the split-and-merge program handles the merging of n messages into 1. You can see this when you test a mapping in the integration builder designer. In a multi-mapping there you can see a xml-structure that envelopes the application messages, f. ex.:
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
       <ns0:Message1>
          <myMessage1>data</myMessage1>
       </ns0:Message1>
       <ns0:Message2>
          <myMessage2>data2</myMessage2>
       </ns0:Message2>
    </ns0:Messages>

  • BPM - Exception handling in multiline mapping

    Hi,
    I have in a BPM a block with processing mode ParForEach containing a transformation and then a send step.
    If the transformation (mapping) generates an exception for one of the lines of the multiline variable being processed, no subsequent lines are passed to the send step.
    I want the process to execute the mapping for each line and then send messages corresponding to lines without error. How can I do?
    Thank you
    Simona

    Hi Simona,
    I also feel that Michal had suggested the correct solution. Not sure why you are saying that the error gets propagated, if you have defined a proper Exception handling for the inner block.
    But regarding your design for "ParForEach", I am not sure whether you really need to carry out a transformation step for each Block instance, in which case you can keep the transformation step before the "ParForEach" block.
    Rgds
    R Chandrasekhar (RC)

  • How to handle session-timeout in producer-consumer(wsrp) environment.

    Hi
    We are using weblogic portal 9.2 in federated environment (wsrp) .
    We have one consumer Ear and some producer Ear .
    we want if session is time out ,then user should direct to some default page .
    For that we are firing event in Base Exception handler where we caught all exceptions.
    that event is listen by consumer side ,(when session time out producer raise event).
    event is fired , every thing looks fine but we are not able to redirect page from producer to consumer (which should not be happen )
    I think we are doing something wrong .
    Any suggestion/ guidance will help us lot
    thanks in advance

    Hello,
    Probably the easiest way for you to get the behaviour you want would be to put a event handler on a .portlet file (on the consumer) that lives on the page you want to activate if the producer session has timed out. For example:
    <netuix:handleCustomEvent event="eventNameComingFromProducer" eventLabel="sessionTimeoutPageActivation">
    <netuix:activatePage/>
    </netuix:handleCustomEvent>
    When your producer portlet sends an event "eventNameComingFromProducer" the portlet on the page you want to activate will pick it up and automatically activate the page.
    Kevin

  • Handling sessions in BDC

    Hi all,
             What do we code to create a new session in BDC Call transaction method.
             Let me explain the situation in brief.
        I have an issue where in i need to upload 5000 records. As per requirement i am supposed to upload only 1000 per session. Please let me know how to create new session dynamically and move the processed data to sessions. And also let me know how to handle the errors in those records after processing 500 records.
           I know that Message_format is the FM to know to errors but I need to handle them dynamically.
    Guess we need to go by session method to handle errors but how to do that dynamically.
    Thanks and Regards
    Amit.

    Hi Amit,
    Suppose all your records are in table infile.
    Keep a counter such that when each record in the table is processed, the counter is incremented.
    When 1000 records are processed, call the insert bdc function. Reset the function.
    Thus dynamically you create 5 sessions if there are five records.
    In the following table, I am creating bdc sessions for the transaction FBV1. It has two screens.
    1000 for the first screen(header details) and 3000 for all other records(line item details)
    LOOP AT infile.
        PERFORM create_bdc.
    ENDLOOP.
    IF abend_job = false.
        PERFORM format_scrn_0300_last.
        PERFORM insert_bdcdata.
      ENDIF.
    form create_bdc.
       sy-subrc = 0.
      IF new_bdc EQ true.
        PERFORM open_bdc.
        IF abend_job = true.
          EXIT.
        ENDIF.
      ENDIF.
      IF first_time = true.
        CLEAR ba_cnt_tab.
        PERFORM format_scrn_0100. /* to process first screen
        PERFORM format_break_fields.
      ELSEIF detail_rec_cnt = 999. /* When the number of records is 999 process the last record and insert the session
        PERFORM format_scrn_0300_last.
        PERFORM insert_bdcdata.
        IF abend_job = false.
          MOVE: true TO bdc_tab_created.
          PERFORM format_scrn_0100. /* Again call the header screen and put the header details.
          PERFORM format_break_fields.
        ENDIF.
      ELSE.
        PERFORM format_scrn_0300_detail. /* Processing of Details records otherwise.
        PERFORM format_break_fields.
      ENDIF.
      IF abend_job = false.
        IF first_time = true.
          MOVE: true          TO bdc_tab_created,
                false         TO first_time.
        ENDIF.
      ELSE.
        EXIT.
      ENDIF.
    ENDFORM.
    Format Break Fields
    FORM format_break_fields.
    This form format fields necessary for breaking logic and postions
    the BA_CNT_TAB at the Business Area being processed.
      MOVE: infile-cost_center   TO prev_cost_center,
            infile-business_area TO prev_business_area,
            infile-amount        TO prev_amount,
            infile-dollar_amt    TO prev_dollar_amt,
            infile-order+2(12)   TO prev_order,
            infile-wbs_element   TO prev_wbs_element,
            infile-text          TO prev_text,
            infile-due_on_date   TO prev_due_on_date.
      SHIFT prev_order LEFT DELETING LEADING space.
    ENDFORM.
    format screen 0100
    FORM format_scrn_0100.
    This form contains the logic to create screen 0100
      sy-subrc = 0.
      IF ba_cnt_tab-business_area NE infile-business_area.
    Position BA_CNT_TAB at business area currently processing.
        LOOP AT ba_cnt_tab.
          IF ba_cnt_tab-business_area = infile-business_area.
            EXIT.
          ENDIF.
        ENDLOOP.
      ENDIF.
      PERFORM dynpro_saplf040_0100 USING infile-post_key infile-accnt.
    ENDFORM.
    FORMAT SCREEN 0300 FOR LAST DETAIL
    FORM format_scrn_0300_last.
    This form formats the last detail screen 0300 and a phantom entry
    if needed.  Screen 0002 is also formatted for each 0300.
      ADD: prev_dollar_amt TO phantom_accum,
           1               TO detail_rec_cnt.
      IF prev_dollar_amt GT 0.
        ADD: prev_dollar_amt TO amt_debit_added.
      ELSE.
        ADD: prev_dollar_amt TO amt_credit_added.
      ENDIF.
      IF detail_rec_cnt LT ba_cnt_tab-rec_cnt.
        IF phantom_accum LT 0.
    Reverse posting key since being posted as an offset to the accumulated
    Amount.
          MOVE debit_pk TO posting_key.
          num_data = phantom_accum * -1.
        ELSE.
          MOVE credit_pk  TO posting_key.
          num_data = phantom_accum.
        ENDIF.
        PERFORM dynpro_saplf040_0300 USING prev_amount prev_text
          prev_due_on_date posting_key phantom_accnt.
        PERFORM dynpro_saplkacb_0002 USING prev_cost_center
          prev_business_area prev_order prev_wbs_element.
        MOVE num_data TO char_data.
        PERFORM dynpro_saplf040_0300 USING char_data '' '' '' ''.
        PERFORM bdc_value USING 'BDC_OKCODE' post.
        PERFORM dynpro_saplkacb_0002 USING ' ' prev_business_area ' ' ' '.
      ELSE.
        PERFORM dynpro_saplf040_0300 USING prev_amount prev_text
          prev_due_on_date '' ''.
        PERFORM bdc_value USING 'BDC_OKCODE' post.
        PERFORM dynpro_saplkacb_0002 USING prev_cost_center
          prev_business_area prev_order prev_wbs_element.
      ENDIF.
      CLEAR:       detail_rec_cnt,
                   phantom_accum.
    ENDFORM.
    FORMAT DETAIL FOR SCREEN 0300
    FORM format_scrn_0300_detail.
    This FORM formats screen 0300 for a detail record along with its
    screen 0002
      ADD: prev_dollar_amt TO phantom_accum.
      PERFORM dynpro_saplf040_0300 USING prev_amount prev_text
        prev_due_on_date infile-post_key infile-accnt.
      PERFORM dynpro_saplkacb_0002 USING prev_cost_center
        prev_business_area prev_order prev_wbs_element.
      IF prev_dollar_amt LT 0.
        ADD: prev_dollar_amt TO amt_credit_added.
      ELSE.
        ADD: prev_dollar_amt TO amt_debit_added.
      ENDIF.
      ADD: 1               TO detail_rec_cnt.
    ENDFORM.
    Dynpro for program SAPMF05A  Screen 0100
    FORM dynpro_saplf040_0100 USING post_key post_accnt.
    This FORM formats SCREEN 0100
    This PERFORM is done once for each screen.
      PERFORM bdc_dynpro USING 'SAPLF040' '0100'.
    This PERFORM is done as many times as there are fields to be
    populated for the screen being processed.
      PERFORM bdc_value  USING 'BKPF-BLDAT' header-doc_mdy.
      PERFORM bdc_value  USING 'BKPF-BUDAT' header-post_mdy.
      PERFORM bdc_value  USING 'BKPF-BLART' header-doc_type.
      PERFORM bdc_value  USING 'BKPF-BUKRS' header-company_code.
      PERFORM bdc_value  USING 'BKPF-MONAT' header-period.
      PERFORM bdc_value  USING 'BKPF-WAERS' header-currency.
      PERFORM bdc_value  USING 'BKPF-XBLNR' header-reference_doc.
      PERFORM bdc_value  USING 'BKPF-BKTXT' header-text.
    *Begin of change by Priya Vasudevan for including checkbox
    PERFORM BDC_VALUE  USING 'VBKPF-XBWAE' CONTROL.
    *End of change
      IF header-rate NE space.
        PERFORM bdc_value USING 'BKPF-KURSF' header-rate.
      ENDIF.
      IF header-translation_date NE space.
        PERFORM bdc_value USING 'BKPF-WWERT' header-translation_date.
      ENDIF.
      PERFORM bdc_value  USING 'RF05V-NEWBS' post_key.
      PERFORM bdc_value  USING 'RF05V-NEWKO' post_accnt.
    ENDFORM.
    Dynpro for program SAPLF040  Screen 0300
    FORM dynpro_saplf040_0300 USING amount text due_on_date
                                    post_key post_accnt.
    This FORM formats SCREEN 0300
    This PERFORM is done once for each screen.
      PERFORM bdc_dynpro USING 'SAPLF040' '0300'.
    This PERFORM is done as many times as there are fields to be
    populated for the screen being processed.
      PERFORM bdc_value  USING 'BSEG-WRBTR' amount.
    *Begin of change by Priya Vasudevan for addition of assign no and tax .
    PERFORM BDC_VALUE  USING 'BSEG-ZUONR' ASSIGNMENT_NUMBER.
    PERFORM BDC_VALUE  USING 'BKPF-XMWST' TAX_CALCULATE.
    *End of change
      PERFORM bdc_value  USING 'RF05V-NEWBS' post_key.
      PERFORM bdc_value  USING 'RF05V-NEWKO' post_accnt.
      IF due_on_date NE space.
        PERFORM bdc_value USING 'BSEG-ZFBDT' due_on_date.
      ENDIF.
      IF text NE space.
        PERFORM bdc_value USING 'BSEG-SGTXT' text.
      ENDIF.
    ENDFORM.
    Dynpro for program SAPLKACB  Screen 0002
    FORM dynpro_saplkacb_0002 USING cost_center business_area order wbs.
    This FORM formats SCREEN 0002 WHICH IS A POP-UP SCREEN
    THAT DOES NOT APPEAR DURING ON-LINE PROCESSING
    This PERFORM is done once for each screen.
      PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
    This PERFORM is done as many times as there are fields to be
    populated for the screen being processed.
      IF cost_center NE space.
        PERFORM bdc_value  USING 'COBL-KOSTL' cost_center.
      ENDIF.
      IF business_area NE space.
        PERFORM bdc_value  USING 'COBL-GSBER' business_area.
      ENDIF.
      IF order NE space.
        PERFORM bdc_value USING 'COBL-AUFNR' order.
      ENDIF.
      IF wbs NE space.
        PERFORM bdc_value USING 'COBL-PS_PSP_PNR'  wbs.
      ENDIF.
    ENDFORM.
    BDC Dynpro
    FORM bdc_dynpro USING pgm scrn.
    This FORM formats the transaction that tells the BDC which screen is
    to be populated.
      CLEAR bdc_tab.
      MOVE: pgm             TO bdc_tab-program,
            scrn            TO bdc_tab-dynpro,
            begin           TO bdc_tab-dynbegin.
      APPEND bdc_tab.
    ENDFORM.
    BDC Value
    FORM bdc_value USING field val.
    This FORM tells the BDC which field is to be populated and the value
    to use.
      CLEAR bdc_tab.
      MOVE: field           TO bdc_tab-fnam,
            val             TO bdc_tab-fval.
      APPEND bdc_tab.
    ENDFORM.
    FORM open_bdc.
    This routine opens the BDC data file
      sy-subrc = 0.
      CALL FUNCTION 'BDC_OPEN_GROUP'
           EXPORTING
                client              = sy-mandt
                group               = group_name
                keep                = 'X'
                user                = sy-uname
           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 NE 0.
        MOVE: true TO abend_job.
        CASE sy-subrc.
          WHEN 01.
            PERFORM process_msg USING '109' sy-mandt 'BDC OPEN' ''.
          WHEN 02.
            PERFORM process_msg USING '109' 'BDC OPEN' '' ''.
          WHEN 03.
            PERFORM process_msg USING '111' 'BDC OPEN' '' ''.
          WHEN 04.
            PERFORM process_msg USING '124' 'BDC OPEN' '' ''.
          WHEN 05.
            PERFORM process_msg USING '112' 'BDC OPEN' '' ''.
          WHEN 06.
            PERFORM process_msg USING '113' 'BDC OPEN' '' ''.
          WHEN 07.
            PERFORM process_msg USING '114' 'BDC OPEN' '' ''.
          WHEN 08.
            PERFORM process_msg USING '115' 'BDC OPEN' '' ''.
          WHEN 09.
            PERFORM process_msg USING '125' 'BDC OPEN' '' ''.
          WHEN 10.
            PERFORM process_msg USING '116' 'BDC OPEN' '' ''.
          WHEN 11.
            PERFORM process_msg USING '126' 'BDC OPEN' '' ''.
        ENDCASE.
      ELSE.
        MOVE: true TO bdc_openned,
              false TO new_bdc.
      ENDIF.
    ENDFORM.
    Insert BDC data
    FORM insert_bdcdata.
    This routine inserts a scenario into the BDC batch session.
    Add the actual value of the particular Transaction code relevant
    to the scenario being processed for the constant TRANS_CODE.
      sy-subrc = 0.
      CALL FUNCTION 'BDC_INSERT'
           EXPORTING
                tcode          = trans_code
           TABLES
                dynprotab      = bdc_tab
           EXCEPTIONS
                internal_error = 1
                not_open       = 2
                queue_error    = 3
                tcode_invalid  = 4
                OTHERS         = 5.
      IF sy-subrc NE 0.
        MOVE: true TO abend_job.
        CASE sy-subrc.
          WHEN 01.
            PERFORM process_msg USING '113' 'BDC INSERT' '' ''.
          WHEN 02.
            PERFORM process_msg USING '117' 'BDC INSERT' '' ''.
          WHEN 03.
            PERFORM process_msg USING '114' 'BDC INSERT' '' ''.
          WHEN 04.
            PERFORM process_msg USING '118' 'BDC INSERT' '' ''.
          WHEN 05.
            PERFORM process_msg USING '126' 'BDC INSERT' '' ''.
        ENDCASE.
      ELSE.
        bdc_trans_cnt = bdc_trans_cnt + 1.
      ENDIF.
    Initialize table after inserting the processed BDC Transactions
    for one scenario
      REFRESH bdc_tab.
    ENDFORM.
    End of Job Routine
    FORM eoj_routine.
      IF bdc_openned = true.
        PERFORM close_bdc.
        IF bdc_tab_created = true AND
           abend_job = false.
          TRANSLATE submit TO UPPER CASE.
          IF submit = 'X'.
            PERFORM submit_bdc_to_batch.
           ELSE.
            CLEAR : msg1, msg2, msg3.
            CONCATENATE 'Session' group_name INTO msg1 SEPARATED BY space.
            msg2 = 'has been created. '.
            msg3 = 'Please use SM35 to process the session.'.
            MESSAGE i150 WITH msg1 msg2 msg3   .
          ENDIF.
          IF abend_job = false.
            PERFORM update_date_control_file.
          ENDIF.
        ENDIF.
      ENDIF.
      IF abend_job = true.
        PERFORM abend_job.
        PERFORM alert_check.
      ELSE.
    These writes are an example of control totals that would be included
    on a control report.
        PERFORM: process_msg USING '174' total_recs '' 'NC',
                 process_msg USING '176' bdc_trans_cnt '' 'NC',
                 process_msg USING '148' tot_debit '' 'NC',
                 process_msg USING '149' tot_credit '' 'NC',
                 process_msg USING '173' interface_id '' ''.
       WRITE: /1 ' End of Job Run'.
        TRANSLATE temp_unix_name TO LOWER CASE.
        SHIFT full_fil_name UP TO temp_unix_name+0(9).
        SUBMIT zuxmv WITH filename EQ full_fil_name
                    WITH frompath EQ temp_unix_path
                    WITH to_path  EQ temp_arc_path
                    exporting list to memory
                     AND RETURN.
      ENDIF.
      SUBMIT zuxlp WITH filename = temp_log_name
                   WITH path     = temp_log_path
                   WITH printer  = temp_printer
                   exporting list to memory
                    AND RETURN.
      IF abend_job = true.
        IF execution = 'ONLINE'.
          PERFORM process_msg USING '100' in_trailer-interface_id '' ''.
          MESSAGE a100 WITH in_trailer-interface_id.
        ENDIF.
      ENDIF.
      CLOSE DATASET logfile.
    ENDFORM.
    Close BDC data
    FORM close_bdc.
    This routine closes the BDC batch session.
      sy-subrc = 0.
      CALL FUNCTION 'BDC_CLOSE_GROUP'
           EXCEPTIONS
                not_open    = 1
                queue_error = 2
                OTHERS      = 3.
      IF sy-subrc NE 0.
        MOVE: true TO abend_job.
        CASE sy-subrc.
          WHEN 01.
            PERFORM process_msg USING '117' 'BDC CLOSE' '' ''.
          WHEN 02.
            PERFORM process_msg USING '114' 'BDC CLOSE' '' ''.
          WHEN 03.
            PERFORM process_msg USING '126' 'BDC CLOSE' '' ''.
        ENDCASE.
      ENDIF.
    ENDFORM.
    Submit BDC to Batch
    FORM submit_bdc_to_batch.
    This FORM submits the completed BDC Table to Batch to be processed
    for all the transactions processed from the Interface input file.
    Changes made by sthomas on 11.16.2005
      SUBMIT rsbdcsub WITH mappe EQ group_name
                      with Z_VERARB EQ 'X'
    *Code inserted by sthomas on 16.11.2005
                      WITH fehler EQ ' '
                      EXPORTING LIST TO MEMORY
                      AND RETURN.
      WAIT UP TO 2 SECONDS.
      SELECT  * UP TO 1 ROWS INTO TABLE i_apqi
         FROM apqi
          WHERE groupid = group_name
          AND   credate <= sy-datum
          AND   cretime <= sy-uzeit
          ORDER BY cretime DESCENDING.
      READ TABLE i_apqi INDEX 1.
      clear : msg1, msg2, msg3.
      concatenate 'Session' group_name into msg1 SEPARATED BY SPACE.
      IF i_apqi-qstate = 'F'.
        msg2 = 'has been successfully processed'.
        MESSAGE i150 WITH msg1 msg2.
      ELSEIF i_apqi-qstate = 'E'.
         msg2 = 'has been processed with errors.'.
         msg3 = 'Please use SM35 to view the errors'.
        MESSAGE i150 WITH msg1 msg2 msg3 .
      ELSE.
        msg2 = 'has been transferred to the background for'.
        msg3 = 'processing. Please use SM35 to view the status'.
        MESSAGE i150 WITH msg1 msg2 msg3.
      ENDIF.
    End of code.
    End of change
    ENDFORM.
    Update date control file
    FORM update_date_control_file.
    This routine will update the Interface Date/Time Control File with
    the Date/Time Stamp of the current file just processed successfully.
    The parameter FILE_OPERATION indicates that the control file is to
    be updated with the new stamp and the status of the Interface/file
    will be set to 'C' for complete.
      CALL FUNCTION 'Z_PROCESS_INTERFACE_CTL_TABLE'
           EXPORTING
                file_id           = in_trailer-interface_id
                file_name         = in_trailer-file_name
                file_date         = in_trailer-date
                file_time         = in_trailer-time
                file_operation    = '2'
           EXCEPTIONS
                dup_file_error    = 1
                file_id_not_found = 2
                table_not_updated = 3
                OTHERS            = 4.
      IF sy-subrc NE 0.
        MOVE: true TO abend_job.
        CASE sy-subrc.
          WHEN 01.
            PERFORM process_msg USING '127' in_trailer-interface_id
              in_trailer-file_name 'OPERATION 2'.
          WHEN 02.
            PERFORM process_msg USING '128' in_trailer-interface_id
              in_trailer-file_name 'OPERATION 2'.
          WHEN 03.
            PERFORM process_msg USING '129' 'ZTAG' '' ''.
          WHEN 04.
            PERFORM process_msg USING '126' 'OPERATION 2' '' ''.
        ENDCASE.
      ENDIF.
    ENDFORM.
    Abend Job
    FORM abend_job.
    This form updates the Interface Date/Time Control File with a status
    of 'A' to indicate that this Interface has abended.  The Date/Time
    stamp on the Control file will not be updated with the date/time
    from the current file.  The parameter FILE_OPERATION OF '3' initiates
    this process.  Any time Operation '3' is used with the
    Date/Time Control File, the calling program must abend using an 'A'
    Message.  A generic abend message of 100 has been set up in the
    T100 table.
      CALL FUNCTION 'Z_PROCESS_INTERFACE_CTL_TABLE'
           EXPORTING
                file_id           = in_trailer-interface_id
                file_name         = in_trailer-file_name
                file_date         = in_trailer-date
                file_time         = in_trailer-time
                file_operation    = '3'
           EXCEPTIONS
                dup_file_error    = 1
                file_id_not_found = 2
                table_not_updated = 3
                OTHERS            = 4.
      IF sy-subrc NE 0.
        CASE sy-subrc.
          WHEN 01.
            PERFORM process_msg USING '127' in_trailer-interface_id
              in_trailer-file_name 'OPERATION 3'.
          WHEN 02.
            PERFORM process_msg USING '128' in_trailer-interface_id
              in_trailer-file_name 'OPERATION 3'.
          WHEN 03.
            PERFORM process_msg USING '129' 'ZTAG' 'OPERATION 3' ''.
          WHEN 04.
            PERFORM process_msg USING '126' 'OPERATION 3' '' ''.
        ENDCASE.
      ENDIF.
      PERFORM process_msg USING '100' in_trailer-interface_id '' ''.
    ENDFORM.
    INCLUDE zi000002.
    Feel free to ask any doubt in this logic.
    Regards,
    Susmitha

  • How to get a session identifier in Model project

    How can I get any web session context identifier in a ViewImpl class?

    Tee hee hee deadlock.
    Gho - there is no direct way to do so; perhaps you can explain the use case you are trying to achieve (for example, if you need the user name, there might be a quick and easy answer for you). The general answer is that you would pass in the information needed from the view layer (which does have access to the http session). If it's a bind variable you're trying to set, you can use an ExecuteWithParams binding in the view layer.
    For more information, please provide your use case, and we'll try to help.
    john

  • Context handling during message mapping

    Hi,
    I'm working on a mapping and it almost works. There is just 1 thing to solve. I use the fixvalues funtion with as input a field A in a segment of my Idoc. This function is used to map a field B in another segment. However as this segment has multiple occurences, I have problems with the context handling: the first timle works ok but then it fails (as the filed A is in another segment/context). How could I fix this?  I would like to avoid UDF as I don't know much java.
    Kind regards,
    Ulrich

    Hi Ulrich,
    <b>Mapping A_source-Fixvalue-B_target</b>
    In the above case What are the elements exist in A_Source same thing will be transfered to B_target . If it is not find any value in Fixvalue table then it will pass the default value. So provde the default value.
    If there is not element in context then it won't create b_target not at all for that context. So use the Mapwithdefault() nodefunction before passing the value B_target. so in that case it will generate the empty value instead of none.
    Warm Regards,
    Vijay

Maybe you are looking for

  • Using macbook as wireless router

    I am using macbook pro and i have set up network sharing (cable internet). The Macbook was being used as wireless router on my smartphones and ipad within home. Suddenly the I cant seem to connect my devices with the wi-fi connection, I tried rebooti

  • ORA-00439 error in Forms URGENT.... URGENT.....

    Hi, i have created a new procedure to import a file on the machine to the database BLOB object. the procedure ran succesfully in the SQL prompt. In the Oracle forms builder, I created a new button and on the WHEN_BUTTON_PRESSED PL/SQL logic, i pasted

  • Safe Imac operating temperatures.

    Hi, I've searched google and looked at some older posts but haven't really been able to find what im looking for. i was wondering if there is a list of what the min to max safe operating temps are for intel imacs (aluminum). i have a 3-4 yr old intel

  • No field values in ODS!

    Hi, we have four fields in ODS for which the data is empty! i checked in R/3 tables for the repective fields ! there is a data and there is no TR or UR written against these fields! How could i trace the missing data? Thanks, Ravi

  • Creation of Error Messages on Custom Applications

    Hi, We have a customized application on the Enterprise Portal. There may be a scenario when the Portal is up and running, but this application is down due to some reason. In such a scenario, what is required to be done to display a message such as "T