Change SY-UNAME

i need to change the user name before calling a function module which releases an invoice frompayment block.
actually scenario is a user will release the blocked invoice using the bapi BAPI_INCOMINGINVOICE_RELEASE.
But he has no authorization to release the invoice.
So can i change the user name just before calling the function module so that the new user id will be used for authorizatio- check.
i have tried to do this.but the user name being reset to the current user in each step of execution.
is there any way to chagne the user for security check?

I don't consider those to be "hacks" in my book
They are just bad design approaches:
In the first case, you will loose the audit trail to the caller.
In the second case you will be forced to grant authority to the end user to open a step in another user's context. That will open another backdoor for them as well in SM37 etc...
> PS: If the real problem is just that you cannot grant the authorization on a certain function module as it is used in different standard applications so the authorization for your program would result in to powerful authorizations in sap standard transactions, the I would copy the function module and use it. This Z fm could be authorized bypassing this problem.
A better option with less coding involved, would be to use SU24. This way you keep the audit trail and isolate the transaction as being an exception to the standard checks for one specific object. An auditor might wonder why a user can release a PO when they don't have one of the required objects, but they will easily find it if they know where to look.
It is also easy to do this in a secure way, such that you can document it for the auditor and give it to them upfront to understand. A good auditor should understand and appreciate that.
If you achieve this programmatically with tricks, you will have a tough time... (as will the auditor).
I have done many audits and also hunted down some dodgey coding in my time. The idea should not be to run away from the auditors, but rather expect that they know what they are talking about and make your design compliant with their and your client's control requirements.
This should be the approach regardless of whether or not you can change sy-uname as a developer.
The original question might also have been: "Can I pass a backdated authority-check against a user who once had the authorizations way back when?" Same thing... bad idea...
Cheers,
Julius

Similar Messages

  • Is it possible to change the UNAME using the FM 'HR_INFOTYPE_OPERATION'..??

    Hi folks,
    I'm trying to bring an infotype record from a SAP Server 'A' to a SAP Server 'B'. The users want an 'Z' application to do it.
    I thought to use the HR_INFOTYPE_OPERATION to INS (insert) or MOD (modify) the record, getting the data from A and put it on B.
    The problem is that the users want to continue keeping the UNAME and AEDTM as in the original record. It means, do not change the record. For Example:
    CURRENT SCENARIO
    SERVER A                       
    UNAME: USER_A        
    AEDTM: July 03, 2010
    SERVER B: Data inserted or modified using the FM 'HR_INFOTYPE_OPERATION'
    UNAME: USER_B
    AEDTM: Jan 24, 2012
    WANTED SCENARIO
    SERVER A                       
    UNAME: USER_A        
    AEDTM: July 03, 2010
    SERVER B: Data inserted or modified using the FM 'HR_INFOTYPE_OPERATION'
    UNAME: USER_A
    AEDTM: July 03, 2010
    Does anybody know if it is possible using the FM 'HR_INFOTYPE_OPERATION'...?
    or
    Does anybody know what's the best way to do that?
    Thanks and best regards friends...

    The issue is fixed after changing the cable connected with e1000g3.

  • How to change sy=uname value in selection screen?

    Hi,
    In selection screen i declared a default file path like this..
    C:\Documents and Settings\User Name\Vendor\'.
    when it displays the path in selection screen, I want to replace that user name with SY-UNAME FIELD.
    Can any one let me know where i can change this..
    Thanks for ur time.

    If you are trying to set the the folder for the "windows" user, you can try this instead.
    I doubt that the SAP user id is always the same as the local user folder on the frontend.
    report zrich_0001.
    data: dir type string.
    parameters: p_file type localfile.
    initialization.
      call method cl_gui_frontend_services=>get_desktop_directory
        changing
          desktop_directory    = dir.
      call method cl_gui_cfw=>flush.
      translate dir to upper case.
      replace 'DESKTOP' with 'Vendor' into dir.
      p_file = dir.
    Regards,
    Rich Heilman

  • AEDTM no change to the new date when delimit done

    Hai,
    I have a question and would like to know whether it is a std SAP behavior or not? Where the delimit function (example delimit infotype 0014) is changing to new change date at field AEDTM? It's the same date which the record was created earlier or not? At field AEDTM it's look like the new changing date is not appear and its hard for user to define when was the action has been delimited.
    For info report S_AHR_61016380 - Logged Changes in Infotype Data, still not able to meet our user needs.
    Is there any notes or patch that need to be apply to address this problem?

    Hi Marini,
    As of release 4.0A the logic is that if the CONTENT of an infotype          
    record is changed the new UNAME and AEDTM are stored in the record.         
    If only the validity range of an infotype record changes by copying, or     
    by the delimit functionality the former UNAME (and AEDTM) stays.                                                                               
    That means: If the function delimit is used, or if for an infotype with     
    time constraint 1 or 2 a new record is created which delimits a former      
    record for the delimited record the former values of UNAME and AEDTM        
    are still stored and not updated.                                                                               
    The fields "changed by" (UNAME) and "changed on" (AEDTM) are only           
    updated, when a field other then 'end date' (ENNDA) has been changed.                                                                               
    To further clarify, if you use transaction PA30 and the function            
    'Change', the fields UNAME and AEDTM will be updated.  It is with         
    the function 'Delimit' that only the end date of the infotype               
    will change.                                                                               
    If you want to store the information when and by whom an infotype has       
    been changed, you can activate the infotype change documents which is       
    designed for the tracking of changes on infotype records.                                                                               
    The IMG Path is: Pers Mngt > Pers Admin > Tools > Revision > Set up         
    Change Document.                                                                               
    Some further explanation is provided in note 333493.                        
    However if you want the old functionality back, please have a look at       
    the other note I attached, 353788.                                                                               
    An important issue to keep in mind when you implement the changes of        
    this note 353788, is that these source corrections will NOT be taken up     
    in SAP standard and also not be delivered by HR Support Package.            
    Regards,
    Ana

  • Change User Function Name

    Hi all,
    I'm trying to create menus & responsibilities using data loader so that I don't need to recreate it manually but data loader crashed because some of the user function name are the same.
    For example, open Sysadmin -> Application -> Menu -> AP_PAYMENTS_ENTRY_GUI12 in Vision. In Seq. 3 we have Payments menu with AP_APXPAWKB_CHECK_MENU submenu and Payments functions. Tried to search in Functions LOV and we'll get some User Function Name equal to Payments but different Function Name.
    I'd tried to change some User Function Name and all the menus that directed to it changed too, the referential integrity worked I think :P but I want to ask whether it will caused any trouble if I changed it in Test & Production environment?
    Thx.

    I don't consider those to be "hacks" in my book
    They are just bad design approaches:
    In the first case, you will loose the audit trail to the caller.
    In the second case you will be forced to grant authority to the end user to open a step in another user's context. That will open another backdoor for them as well in SM37 etc...
    > PS: If the real problem is just that you cannot grant the authorization on a certain function module as it is used in different standard applications so the authorization for your program would result in to powerful authorizations in sap standard transactions, the I would copy the function module and use it. This Z fm could be authorized bypassing this problem.
    A better option with less coding involved, would be to use SU24. This way you keep the audit trail and isolate the transaction as being an exception to the standard checks for one specific object. An auditor might wonder why a user can release a PO when they don't have one of the required objects, but they will easily find it if they know where to look.
    It is also easy to do this in a secure way, such that you can document it for the auditor and give it to them upfront to understand. A good auditor should understand and appreciate that.
    If you achieve this programmatically with tricks, you will have a tough time... (as will the auditor).
    I have done many audits and also hunted down some dodgey coding in my time. The idea should not be to run away from the auditors, but rather expect that they know what they are talking about and make your design compliant with their and your client's control requirements.
    This should be the approach regardless of whether or not you can change sy-uname as a developer.
    The original question might also have been: "Can I pass a backdated authority-check against a user who once had the authorizations way back when?" Same thing... bad idea...
    Cheers,
    Julius

  • CHANGE USERNAME AT Runtime (Is it possible)          URGENT!!!!!!!!!!!!!!!!

    I want to change sy-uname at run time in ZPROGRAM .
    i.e is it possible in any way as i have to use vk11 in that program and all userid don't have that Authorisation. Hence before running that BDc can i change (HARDCODE SY_UNAME to a username with that authority)
    Please treat as urgent.

    First, no this is not possible.  If you change the sy-uname, the next line of executable code would change it back, so it doesn't work.  Also, think about what you are suggesting.  This is a HUGE security issue if the system allowed you to do this,  you might as well, not have any security at all. 
    So short anwer is no, but you could create a background job within your program and submit this job under another user id.  THis would be the only way.
    Regards,
    Rich HEilman

  • Invalid_jobdata when submitting job with rfc user

    Hi,
    I've created a function module in the erp system to remotly trigger a report program by a bw prossess chain.
    When running in the forground it works fine, but the runtime is so long that I want it as a background job.
    So I call job_open, job_submit, job_close in the function module. When I test the function module in the erp system with my dev user it opens a new job, adds a step and release correctly. It also runs fine if I intercept it in the debugger and change sy-uname to aleremote (the standard rfc user).
    It does not work when it's acctually called rfc from the bw system. The job is opened, but job_submit throws invalid_jobdata.
    Could this have anything to do with rfc or the executing user (which is of type SYSTEM)?

    I've caught the execption so there is no dump, but I'm unable to determine why the function module job_submit gives invalid_jobdata only when the executing user is the aleremote user and only when the call originated (the call to my module) from a remote system (the module job_submit is called locally thru my module). Authorization for the user is sap_all, but I was woundering maybe the user type system could be a problem?

  • Report to find the actual retro date of payroll

    Hi experts!
    You know, every month user changes lot of data in Infotypes involving retro payroll. And SAP provide change log info type to check who changed, edited or deleted & when & from old value to new value: RPUAUD00 transaction S_AHR_61016380.
    However with this report, we must manually check it. So it will take such long time for checking & verifying. Thus my concern is maybe there is a standard report provide all these information in another way, it's much more easier for us to check. I mean: when I choose PF9999, & infotype 14, 8 in Sep-11: report will show:
    with IT8: it will list all change: who changed, when changing occurred, from value A to value B, the period of record: assuming pf is increased salary Basic: 1000 -> 1500 since 15-Sep & HRA allowance (1005): 300->350: since 1-Aug in Sep-11.
    PF999
    Wage Type 1000: old value 1000, new value 1500; user AAA changed on 14-Sep. Start date of change: 15-Sep
    Wage Type 1005 old value 300, new value 500; user BBB changed on 10-Sep, start date of change: 1-Aug.
    If the report is available, it really helps all of us alot. If anyone know, please share. I am really appreciated.
    Regards!
    Woody.

    Hi Woody,
    You can easily create such a report yourself via Ad Hoc Query.  Every infotype has a start date (BEGDA), end date (ENDDA), changed by (UNAME) and changed on (AEDTM).  If these are not in your infosets, they can easily be added.  You can enter these as selection and output fields along with the wage type amounts and other data fields.  This may not pick up all retros, however, as other infotypes such as IT0001-Organizational Assignment, 0007-Planned Working Time, etc. will also create retros if changed in the past.  You can create queries for these infotypes if you want. 
    If interested in individuals as to whether they had a retro calculation - report H99_DISPLAY_PAYRESULT will show all retros if an individual had more than one entry for a pay period.  This report is viewed individual by individual.
    Paul

  • Agent determination problem

    I have a workflow that has been in production for almost a year.  We are in the middle of integration testing for another rollout and I'm getting agent determination errors in this workflow.  There are three steps involved.  The first two use the exact same rule.  The first of these two works fine.  When it tries to run the rule again for the second step, it gets no agent found.  If I test the rule it works.  If I restart the workflow, it works.  When it moves on to the third work item using a different rule, it errors out no agent found.  When I test this rule, it works.  When I restart at this step, it also works.
    This is a new integration client that was copied from production.  I've performed the standard workflow customization like I always do.  I've run several other workflows and only notice the agent determination problems in this one.  The workflow hasn't changed in months although there have been some user security changes...I'm not sure how that could really affect the agent determination during the creation of work items. 
    One thing that might be important...userA created the first workitem and the agent determination resolves to userB.  When userB executes the first work item and completes, the second work item should also resolve to userB using the exact same rule.  This fails.  I restarted it using my account and it resolves to userB.  UserB executes work item #2 and work item #3 should resolve to userC but the agent determation fails again.  I don't know whether the work item agent is "used" to perform the creation of the next workitem or not but this is the only difference between the first two work items and one works while the other does not.
    It's almost like userA can perform the agent determination but userB cannot.  I can't manually execute the agent determination as userB so I ran se37 as myself in debug and changed SYST-UNAME to userB and it worked fine and returned userB as the agent.  That would seem to eliminate security as an issue with the agent determination.

    Hi,
    Are you absolutely sure that it is not an authorisation issue? Can you give SAP_ALL (and the possible structural authorisations) to all the users that are involved in the process? (I don't think that changing sy-uname in debug mode to another user really is a correct way to try to prove whether this is an authorisation issue.)
    The agent determination of the following step is executed by the previous WF agent, if there is no background steps between. So if the previous agent doesn't have enought authorisations, the agent determination will fail.
    Regards,
    Karri

  • HR ABAP table

    Hi all!!!
    Actually in transaction PP01,
    for OBJECT TYPE: Business Event type.
    I m unable to find out the Transparent table which stores the description.
    I tried to search in infotypes but failed...
    Can someone suggest the name of the transparent table which stores the description for the same.
    Thanks and Regards,
    Sudipto.

    T777O contains object type Description
    T777V contains relationship Text
    The description of the object ID is stored in hrp1000 itself, in the field STEXT
    MANDT     MANDT     CLNT     3     0     Client
    PLVAR     PLVAR     CHAR     2     0     Plan Version
    OTYPE     OTYPE     CHAR     2     0     Object Type
    OBJID     HROBJID     NUMC     8     0     Object ID
    ISTAT     ISTAT_D     CHAR     1     0     Planning Status
    BEGDA     BEGDATUM     DATS     8     0     Start Date
    ENDDA     ENDDATUM     DATS     8     0     End Date
    LANGU     LANGU     LANG     1     0     Language Key
    SEQNR     SEQNR     NUMC     3     0     Number of Infotype Record With Same Key
    OTJID     OTJID     CHAR     10     0     Concatenation of Object Type and Object ID
    INFTY     INFOTYP     CHAR     4     0     Infotype
    .INCLUDE     HRIADMIN     STRU     0     0     Infotype Administration Data
    AEDTM     AEDTM     DATS     8     0     Changed On
    UNAME     USRNAME     CHAR     12     0     User Name
    REASN     REASN     CHAR     2     0     Reason
    HISTO     HISTO     CHAR     1     0     Historical Record Flag
    ITXNR     ITXNR     NUMC     8     0     Text Module for Infotype
    .INCLUDE     HRI1000     STRU     0     0     Infotype 1000 Fields
    SHORT     SHORT_D     CHAR     12     0     Object Abbreviation
    STEXT     STEXT     CHAR     40     0     Object Name
    GDATE     GDATE     DATS     8     0     Delimitation date
    MC_SHORT     HR_MCSHORT     CHAR     12     0     Object Abbreviation
    MC_STEXT     HR_MCSTEXT     CHAR     40     0     Name
    MC_SEARK     HR_MCSEARK     CHAR     52     0     Search Term

  • To find the list of the users for a paritcular program

    Hi,
    How to find list of the user for a paritcular program and the last time used for that progam.
    plz help me out....
    Advance thnks....

    You can find this in TRDIR table, field names are
    Last changed by --> UNAM
    Last Changed On --> UDAT
    and
    Try transaction STAD to find the last execution of a program

  • Disable URL-Mangling in BSP Runtime

    Hi Experts,
    we decided to provide some web applications für mobile devices. Currently (and maybe never) WD ABAP does not support mobile devices. Therefore we are looking for alternatives.
    There are a lot of threads in the net where other people discussed the same topic and several decided to use BSP. We wanted to use BSP and jQueryMobile but we noticed that there are some problems because of URL-Mangling / rewriting.
    Do you have any idea if it is possible to disable URL-Mangling without modification? We already thought about an own request handler in TA SICF but in this case we also need an own CL_BSP_RUNTIME (to disable the coding in method on_check_rewrite). However this is difficult because some standard BSP runtime classes (RUNTIME, NAVIGATION...) are marked as final, so it isn't possible to inherit from them and we don't want to copy / redevelop all relevant classes.
    Furthermore there are other disadvantages like:
    - many redirects (problematical with low-bandwidth connections)
    - client cookie handling is more difficult
    Do you have any idea?
    Kind regards
    Danny

    Hello!
    I've done quite a lot of BSP development together with and without javascript frameworks like jQuery. It's possible to create a scenario without URL mangling if you set the system architecture in a specific way. I could speak a lot about this setup as it works really well! Here is a quick guide to get started:
    Step 1:
    The BSP runtime isn't really used at all. Create a BSP application but only store MIME objects in it. The MIME objects isn't URL mangled! The drawback is of course you can't do server side ABAP in your HTML documents. On the positive side, any Web Developer can create the HTML and javascript without ABAP programming skills. SAP functions as a static web server with all the benefits of the ICM cache and transport system.
    Step 2:
    Add an external alias in SICF for the BSP application. Like pointing "/myapp" to "/sap/bsp/sap/zmyapp_v001". The external alias is configured with a service account (without any authorizations) with authentication set to "Required with Logon Data". All fields should be specified (Client, User and Language). Now, any anonymous user can request the HTML files without interfering with logon data.
    You don't need an external alias, but they come in handy to have nice-looking URLs; the possibility to change their target when you have multiple versions at the same time; and you can create multiple alias for the same application with different logon data. Like "/myapp/english" if you want. Or "/myapp/client800". Or "/myapp/latest", "/myapp/version1" etc.
    Step 3:
    Create a custom HTTP handler for your business data and assign it to a node in SICF. For example "/customers/orders/get" or whatever you find appropriate for your app. Since you now have your own handler, the BSP runtime isn't involved and no URL mangling exists.
    The handler returns data in a suitable format for Web Developers (read: JSON).
    Protect this node with security that matches the flexibility required from the frontend. I usually set another service account for this service and handle authorization myself; returning HTTP status codes like 403, 200 to the Web Developer (but not 401 as it's quite difficult to handle in AJAX scenarios). In it's most simple form you can provide username and password as form fields and perform a user switch in the handler for every request, effectively changing SY-UNAME in the handler ensuring that the correct user context is used.
    Best regards,
    Mikael Gurenius
    SAP Solution Architect (Mobility)
    PS: MIME objects are of course served with URL Mangling if referenced relative to the BSP application. You can avoid this (for example for the Apple icons) by always linking your MIME objects from the root. Get the application path using code or type manually. Like
      <link rel="apple-touch-icon-precomposed"
    sizes="57x57"
    href="<%= lv_path %>/icon_57x57.png" /> where lv_path is "/myapp/images" or "/sap/bc/bsp/myapp/images". If you do this, you can have URL Mangling (and do ABAP development) in your BSP pages but still have "clean" URLs for MIME objects.

  • Table PA0015

    am working on HR Payroll module.am fetching data from table PA0015.i want to know if we add new records in table.. how can we recgonize ?is there any status field?
    what is start date and end date?

    Hi Vijay,
    In PA0015 table, there are two fields namely Changed on(AEDTM) and Changed by(UNAME) which actually shows the recently stored record.
    In PA30 the most recent record will be displayed first.
    Rgds,
    Balaji

  • Not a mission critical question:

    This isnt a matte that is affecting my work, but it would be great to know why its happening (my supervisor cant explain it either)
    This goes back to another thread, with regard to autoconfig.
    Our system has a db tier with, oracle user ORADBDEV
    On the tier we have two users:
    applmgr APPCLDEV
    oracle user APPDBDEV
    Running autoconfig for APPCLDEV went fine.
    Running for APPDBDEV did not. It completed, but some paths are still not correct.
    For exmaple : echo $SCRIPT_TOP returns /oradbi3/oracle/devcomn/admin/scripts/DEV_**cl (it should be /DEV_**db)
    Before running autoconfig I changed the uname -S to ***db. ALso changed it in smit hostname.
    Its just annoying that now I have to remember that certain paths are not configured correctly. I was very careful in selecting the correct paths when running the adcfgclone.pl also.
    Like I say, its not mission critical, just a pain in the rump.
    Thanks.

    Running for APPDBDEV did not. It completed, but some paths are still not correct.
    For exmaple : echo $SCRIPT_TOP returns /oradbi3/oracle/devcomn/admin/scripts/DEV_**cl (it should be /DEV_**db)Dan,
    As APPDBDEV user is the owner of the database tier files, did you source the database env file (NOT the application env file) before running AutoConfig?

  • Change sales orders from report

    Hi there,
    My report shows grid_display,
    column1 is chechbox,
    column2 is Sales Order number,
    column3 is Sales Order description. here user has to check required sales Orders and press pushbutton in appl tool bar, all these Sales Orders(i.e. checked by user) have to be opend in changemode automatically one after another, where user can change accordingly. can anybody pls sugest logic for this.
    thanks in advance.
    Zakir.

    used bapi .
    pass those data to bapi.
    **&#12288;Program ID &#65306;
    **&#12288;Program Desc &#65306;              
    **&#12288;Process Overview &#65306;          SD
    **&#12288;Created By &#65306;                P.KARTHIKEYAN
    REPORT  ZBAPI_SALESORDER_CHANGE LINE-SIZE 132 MESSAGE-ID ZMMBAPI .
           Internal table definition                                     *
    *****<<<< BAPI Sales Order>>>>>>>>>>>>>>>>>>>>>>>
    DATA: GT_SALESDOCUMENT LIKE  BAPIVBELN-VBELN,
    ******<<<<Communication Fields: SD Order Header>>>
          GT_ORDER_HEADER_IN  LIKE BAPISDH1,
    ******<<<<<Checkbox List: SD Order Header>>>>>>>>>
          GT_ORDER_HEADER_INX LIKE BAPISDH1X,
    *****<<<Return Parameter>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
         GT_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE,
    *******<<<<<<<Communication Fields: Sales and Distribution Document Item>>
         GT_ORDER_ITEM_IN LIKE BAPISDITM OCCURS 0 WITH HEADER LINE,
    *******<<<<<<<Communication Fields: Sales and Distribution Document Item>>
         GT_ORDER_ITEM_INX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE,
    *******<<<<<<<<Communication Fields for Maintaining Conditions in the Order
         GT_CONDITIONS_IN LIKE BAPICOND OCCURS 0 WITH HEADER LINE,
    *******<<<<<<<<Communication Fields for Maintaining Conditions in the Order
         GT_CONDITIONS_INX LIKE BAPICONDX OCCURS 0 WITH HEADER LINE.
       FLAT FLIE Internal table definition                                     *
    DATA: BEGIN OF GT_FT_SALES OCCURS 0,
          SALESDOCUMENT(10), "SALESDOCUMENT
          SALES_ORG(4) , "Sales Organization
          DISTR_CHAN(2), "Sales Organization
          DIVISION(2) ,  " DIVISION
          PURCH_NO_C(35)  , "Customer purchase order number
          SALES_DIST(6) , "Sales district
          INCOTERMS1(3)  ,                                      "INCOTERMS1
          PMNTTRMS(4)  , "Terms of payment key
          ITM_NUMBER(6) ,   "Sales Document Item
          PO_ITM_NO(6)  ,   "Item Number of the Underlying Purchase Order
          MATERIAL(18), "Material Number
    END OF GT_FT_SALES,
    MSG(240) TYPE  C,  " Return Message
    E_REC(8) TYPE C,    " Error Records Counter
    REC_NO(8) TYPE C, " Records Number Indicator
    S_REC(8) TYPE C,   " Successful Records Counter
    T_REC(8) TYPE C,   " Total Records Counter
    ERR_ORDER(10) TYPE C.  " Order Number Indicator
    selection block for EXCEL UPLOAD FILE>>>>>>>>>>>>>>>>>>>>>>>>
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
    PARAMETERS FILE TYPE  IBIPPARMS-PATH OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B1.
    *<<<<AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE .>>>>>>>>>>>>
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE .
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          PROGRAM_NAME  = SYST-CPROG
          DYNPRO_NUMBER = SYST-DYNNR
        IMPORTING
          FILE_NAME     = FILE.
    **<<<<<<<<<<<<<<<<<START-OF-SELECTION.>>>>>>>>>>>>>>>>>>>>>>>>>>>
    START-OF-SELECTION.
      CALL FUNCTION 'WS_UPLOAD'                                 "#EC *
        EXPORTING
          FILENAME                = FILE
          FILETYPE                = 'DAT'
        TABLES
          DATA_TAB                =  GT_FT_SALES
        EXCEPTIONS
          CONVERSION_ERROR        = 1
          FILE_OPEN_ERROR         = 2
          FILE_READ_ERROR         = 3
          INVALID_TYPE            = 4
          NO_BATCH                = 5
          UNKNOWN_ERROR           = 6
          INVALID_TABLE_WIDTH     = 7
          GUI_REFUSE_FILETRANSFER = 8
          CUSTOMER_ERROR          = 9
          NO_AUTHORITY            = 10
          OTHERS                  = 11.
      IF  SY-SUBRC <> 0  .
        MESSAGE E000.
      ENDIF.
      SKIP 3.
      FORMAT COLOR COL_HEADING INVERSE ON.
      WRITE 40 TEXT-001.
      FORMAT COLOR COL_HEADING INVERSE OFF.
      SKIP 1.
      FORMAT COLOR COL_NEGATIVE INVERSE ON.
      WRITE :/ TEXT-002, 13 SY-MANDT , 104 TEXT-003, 111 SY-UNAME,
                / TEXT-004, 13 SY-DATUM , 104 TEXT-005, 111 SY-UZEIT.
      FORMAT COLOR COL_NEGATIVE INVERSE OFF.
      SKIP 3.
      LOOP AT GT_FT_SALES.
        PERFORM UPLOAD_FILE.
      ENDLOOP.
      T_REC = E_REC + S_REC.
      SKIP 3.
      FORMAT COLOR COL_TOTAL INVERSE ON.
      WRITE: /38 TEXT-007, T_REC.
      FORMAT COLOR COL_TOTAL INVERSE OFF.
      FORMAT COLOR COL_NEGATIVE INVERSE ON.
      WRITE: /38 TEXT-008, E_REC.
      FORMAT COLOR COL_NEGATIVE INVERSE OFF.
      FORMAT COLOR COL_TOTAL INVERSE ON.
      WRITE: /38 TEXT-009, S_REC.
      FORMAT COLOR COL_TOTAL INVERSE OFF.
    *&      Form  UPLOAD_FILE
          text
    -->  p1        text
    <--  p2        text
    FORM UPLOAD_FILE .
    ********<<<< BAPI Sales Order>>>>>>>>>>>>>>>>>>>>>>>
      GT_SALESDOCUMENT = GT_FT_SALES-SALESDOCUMENT . " '0000000233' "Order Number
    ******<<<<Communication Fields: SD Order Header>>>
      GT_ORDER_HEADER_IN-SALES_ORG = GT_FT_SALES-SALES_ORG .   "'0001' "Sales Organization
      GT_ORDER_HEADER_IN-DISTR_CHAN = GT_FT_SALES-DISTR_CHAN . "Distribution Channel
      GT_ORDER_HEADER_IN-DIVISION = GT_FT_SALES-DIVISION .    "Division
      GT_ORDER_HEADER_IN-PURCH_NO_C = GT_FT_SALES-PURCH_NO_C . "Customer purchase order number
      GT_ORDER_HEADER_IN-SALES_DIST = GT_FT_SALES-SALES_DIST . " Sales district
      GT_ORDER_HEADER_IN-INCOTERMS1 = GT_FT_SALES-INCOTERMS1 . "Incoterms (part 1)
      GT_ORDER_HEADER_IN-PMNTTRMS = GT_FT_SALES-PMNTTRMS .      "Terms of payment key
    ******<<<<Communication Fields: SD Order Header FLAG>>>
      GT_ORDER_HEADER_INX-UPDATEFLAG = 'U'.
      GT_ORDER_HEADER_INX-SALES_ORG = 'X'. "Sales Organization
      GT_ORDER_HEADER_INX-DISTR_CHAN = 'X'. "Distribution Channel
      GT_ORDER_HEADER_INX-DIVISION = 'X'. "Division
      GT_ORDER_HEADER_INX-PURCH_NO_C = 'X' ."Customer purchase order number
      GT_ORDER_HEADER_INX-SALES_DIST = 'X'. " Sales district
      GT_ORDER_HEADER_INX-INCOTERMS1 = 'X'."Incoterms (part 1)
      GT_ORDER_HEADER_INX-PMNTTRMS = 'X'. "Terms of payment key
    *******<<<<<<<Communication Fields: Sales and Distribution Document Item>>
      GT_ORDER_ITEM_IN-ITM_NUMBER = GT_FT_SALES-ITM_NUMBER . "'000010' "Sales Document Item
      GT_ORDER_ITEM_IN-PO_ITM_NO   = GT_FT_SALES-PO_ITM_NO .  "'PO-129' "Item Number of the Underlying Purchase Order
      GT_ORDER_ITEM_IN-MATERIAL  = GT_FT_SALES-MATERIAL . "'M-24' "Material Number
      APPEND GT_ORDER_ITEM_IN.
    *******<<<<<<<Communication Fields: Sales and Distribution Document Item>>
      GT_ORDER_ITEM_INX-UPDATEFLAG  = 'U'.
      GT_ORDER_ITEM_INX-ITM_NUMBER = '000010'. "Sales Document Item
      GT_ORDER_ITEM_INX-PO_ITM_NO   = 'X'.  "Item Number of the Underlying Purchase Order
      GT_ORDER_ITEM_INX-MATERIAL  = 'X'. "Material Number
      APPEND GT_ORDER_ITEM_INX.
    *******<<<<<<<<Communication Fields for Maintaining Conditions in the Order>>>>
      GT_CONDITIONS_IN-ITM_NUMBER = GT_FT_SALES-ITM_NUMBER . "'000010'  "Condition item number
      APPEND GT_CONDITIONS_IN.
    *******<<<<<<<<Communication Fields for Maintaining Conditions in the Order FLAG>>>
      GT_CONDITIONS_INX-ITM_NUMBER = '000010' ."Condition item number
      APPEND GT_CONDITIONS_INX.
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          SALESDOCUMENT    = GT_SALESDOCUMENT
          ORDER_HEADER_IN  = GT_ORDER_HEADER_IN
          ORDER_HEADER_INX = GT_ORDER_HEADER_INX
        TABLES
          RETURN           = GT_RETURN
          ORDER_ITEM_IN    = GT_ORDER_ITEM_IN
          ORDER_ITEM_INX   = GT_ORDER_ITEM_INX
          CONDITIONS_IN    = GT_CONDITIONS_IN
          CONDITIONS_INX   = GT_CONDITIONS_INX.
      IF GT_RETURN-TYPE EQ 'E'.
        ERR_ORDER = GT_RETURN-MESSAGE_V1.
        READ TABLE GT_RETURN WITH KEY ID = 'V1'.
        E_REC = E_REC + 1.
        CONCATENATE TEXT-006 ERR_ORDER ':' GT_RETURN-MESSAGE INTO MSG SEPARATED BY SPACE .
        CONDENSE MSG.
        FORMAT COLOR COL_NEGATIVE INVERSE ON.
        WRITE / MSG  .
        FORMAT COLOR COL_NEGATIVE INVERSE OFF.
      ELSEIF GT_RETURN-TYPE EQ 'S'.
        S_REC = S_REC + 1.
        FORMAT COLOR COL_POSITIVE INVERSE ON.
        WRITE / GT_RETURN-MESSAGE .
        FORMAT COLOR COL_POSITIVE INVERSE OFF.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            WAIT   = 'X'
          IMPORTING
            RETURN = GT_RETURN.
      ENDIF.
    ENDFORM.                    " UPLOAD_FILE

Maybe you are looking for

  • Materialized view on a Partitioned Table (Data through Exchange Partition)

    Hello, We have a scenario to create a MV on a Partitioned Table which get data through Exchange Partition strategy. Obviously, with exchange partition snap shot logs are not updated and FAST refreshes are not possible. Also, this partitioned table be

  • Group by on date field with time difference of up to 1 minute

    Hi, I need to do a group by on a date field and some other fields, but want to include in the same group rows that are identical but may have a difference of up to a minute in the date field. group by trunc(datefield,'MI') wouldn't work in cases like

  • FB SECURITY WARNING - Please help!

    After i managed different accounts on Facebook, Safari listed  all webpages as text  and images  in vertical order. on top of every web page  the message: SECURITY WARNING: Please treat the URL above as you would your password and do not share it wit

  • Logic 7.2.3 crashing on startup

    This is really strange. I'm using Logic Pro 7.2.3 on my G4 and all the basic stuff like having the hardware key in, having installed no new plugins since it was working last, repairing the permissions etc. has been checked. But it doesn't even get to

  • Error using XMLType.transform() parammap argument

    Hello; I've hit a snag trying to pass top-level XSLT parameter via XMLType.transform's parammap argument. Whenever I run the code sample at the end of this message on 9.2.0.1.0, I get the following error: ORA-00600: internal error code, arguments: [K