Getting 401 Unauthorized error when accessing Resource History in OIM11gR2

Hi,
I am receiving the following error (In the Resource Histroy Popup window) when I tried to access the Resource History for completing a User provisioning (DB Resource using Oracle DB connector).
I have setup OIM 11g R2 on Windows 2008 Server Enterprise R2 with Oracle DB 11g R2
Error 401--Unauthorized
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.2 401 Unauthorized
The request requires user authentication. The response MUST include a WWW-Authenticate header field (section 14.46) containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization header field (section 14.8). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user SHOULD be presented the entity that was given in the response, since that entity MAY include relevant diagnostic information. HTTP access authentication is explained in section 11.
I have read in other forum links that we need to configure the Authorization policies from OES APM console.
I have setup the APM console, but I am not sure how to configure this related to my scenario
I couldn't figure out what policies to be configured for my requirement under Application---->OIM----->oimdomain----->Authorization policies in APM console.
I request experts to help on this as I am completely stuck here.
Thanks,
Madhu

Hi user9212679,
I am able to resolve the issue by reconfiguring the Domain properly with my FQDN of my VM.
Earlier I was using my IP Address instead of FQDN and but the OIM is taking the FQDN of the machine and throwing 401 Unauthorized error.
But I appreciate you help as it gave me clue of what could be wrong.
Thanks,
Madhu

Similar Messages

  • (401) unauthorized error when accessing web service....

    Hello people! Can someone could possibly help me out. I'm try to consume a web service in .net technology. This was supposedly working already but lately I'm already given a (401) unauthorized error when consuming the web services. Here the code that was working couple of days ago....
    package samples;
    import org.apache.axis.client.Call;
    import org.apache.axis.client.Service;
    import org.apache.axis.encoding.XMLType;
    import javax.xml.namespace.QName;
    public class LogIn
         private String url = "http://www-cebu/apps/webservices/fscservice.asmx?wsdl";
         private String action="FSC Services/LogIn";
         private String result="";
         private String username="";
         private String password="";
         private String domain="";
         public LogIn(String username, String password,String domain)
              this.username = username;
              this.password = password;
              this.domain = domain;
              try
                   Service service = new Service();
                   Call call = (Call)service.createCall();
                   call.setTargetEndpointAddress(new java.net.URL(url));
                   call.setOperationName(new QName("FSC Services/LogIn","LogIn"));
                   call.addParameter("username",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
                   call.addParameter("password",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
                   call.addParameter("domain",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
                   call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
                   call.setUseSOAPAction(true);
                   call.setSOAPActionURI(action);
                   result = (String)call.invoke(new Object[] {username,password,domain});
              catch (Exception e)
                   System.err.println(e.toString());
         public String getResult()
              return result;     
         public static void main(String [] args)
                   LogIn test = new LogIn("username","password","domain");     
                   System.out.println(test.getResult());
    }

    1. Use iFrame to show you report from Resporting Services in your Web App.
    Or :
    2. Use Report Viewer in your Web App if you use .NET, and use this code to pass your parameters :
    ReportViewer1.ServerReport.Credential = new System.Network.NetworkCredential(“your name”, “your password”, “your domain”);

  • 401 Unauthorized Error when accessing a task from REST API which contains Role or Privilege in Access Control definition

    Hi Team,
    As of IDM 7.2 SP8 patch2, when we use Enterprise role or Privilege in the access control definition of a task, accessing this task from UI5 i.e REST API is giving unauthorized error even though user is already having the required role or privilege.
    But the task is working fine if we use fixed user ID or keeping blank value in allowed users field.
    Attached the current access control definition of the task we configured & the error message info for reference
    Regards,
    Venkata Bavirisetty

    Hi Ralitsa,
    Thanks for your response and sorry for late reply.
    The XXXX in role is not used as a wild card. the name itself is in that format. I have searched the role and then selected from search list.
    Let me know if you need any clarifications?
    Refards,
    Venkata Bavirisetty

  • 401 Unauthorized Error When calling a SharePoint REST web service from SharePoint 2013 Workflow

    We have our Workflow Manger installed on the same server as our SharePoint 2013 WFE development environment. When creating a SharePoint 2013 Workflow all Calls to a SharePoint 2013 REST web service results in a 401 Unauthorized error.
    As an example I created a simple workflow that should return a JSON result. The REST Url returns the results in the browser without error.
    Set Variable:webServiceUrl to https://<hostnamedsitecollection>/_vti_bin/client.svc/web/lists/getbytitle('ISR%20Approvers')/Items?$select=Title&$filter=Title%20eq%20%27General%27
    then Build{...} Dictionary (Output to Variable:requestHeaders)
    then Call [%Variable:webServiceUrl%] HTTP web service with request (ResponseContent to Variable:responseContent |ResponseHeaders to responseHeaders | ResponseStatusCode to Variable:responseCode)
    The RequestHeader is set to the requestHeaders variable though the web service call properties
    then Log Variable:responseCode to the workflow history list
    After manually running the workflow in SharePoint on a list item in the ISR Approvers list it Logs "Unauthorized" in the Workflow History Log. It does this with every SharePoint REST web service call that I have tried through the workflow.
    It doesn't have anything to do with the Workflow Manger being installed on the same machine as the SharePoint WFE does it?
    Thank You for any insight

    Hi,
    According to your post, my understanding is that you had 401 Unauthorized Error when calling a SharePoint REST web service from SharePoint 2013 Workflow.
    Please make sure you use the ‘Call HTTP Web Service’ correctly.
    You can enter the URL into the brower to check whether it is correctly.
    You need to
    create the Request header requestHeaders
    using a Dictionary:
    Accept : application/json;odata=verbose
    Content-Type : application/json;odata=verbose
    To associate the
    requestHeaders variable, select the Call action
    property, set the RequestHeaders property to
    requestHeaders.
    Please refer to the following articles:
    Working with Web Services in SharePoint 2013 Workflows using SharePoint Designer 2013
    Calling the SharePoint 2013 Rest API from a SharePoint Designer
    Workflow
    In addtion, you need to make sure you install the workflow manager correctly.
    More information:
    Install and configure workflow for SharePoint Server 2013
    Known Issues in Workflow Manager 1.0
    Troubleshooting Workflow Manager 1.0 Management and Execution
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • I get a 404 error when accessing my website which is supported by Apple.  The message says that the server can't find my page.  My browser is Safari.  How can I fix this when it just stopped working today?

    I get a 404 error when accessing my website which is supported by Apple.  The message says that the server can't find my page.  My browser is Safari.  How can I fix the problem when it failed just today?

    If you uploaded to MobileMe, it's no longer available. Apple's closed MobileMe and stopped offering web hosting.
    (116252)

  • I get a 404 error when accessing my website which is supported by Apple.  The message says that the server can't find my page.  My browser is Safari.  How can I fix this?

    I get a 404 error when accessing my website which is supported by Apple.  The message says that the server can't find my page.  My browser is Safari.  How can I fix this?

    If you uploaded to MobileMe, it's no longer available. Apple's closed MobileMe and stopped offering web hosting.
    (116252)

  • OnPremise: Sharepoint Hosted App gives 401 unauthorized error while accessing UserProfile Rest Service

    Hi All,
    I have SharePoint hosted app deployed on On-Premise using(F5) which reads User Profile data consumes WCF(Hosted on same server) through REST API to insert data in to SQL DB(Different server).
    SharePoint hosted app was working as expected and suddenly it started asking for credential and not login(any user) to the application landing page.
    Checked SharePoint Logs, IIS Logs and Windows log but did not get any clue.
    WCF is accessible, User Profile access is also happening but not sure what changes done on server or infra level which causing this issue.
    I have an On-Premise Environment for SharePoint 2013. where we have created SharePoint hosted app which calls "http:///_api/SP.UserProfiles.PeopleManager/GetMyProperties" to get current user's data. but this gives me 401 unauthorized error.
    Notes:
    I had given read permission to user profile and full control to sitecollection in appmanifest. If I run this app on Office 365 developer site it works fine, but on premise environment it give 401 error.
    On premise environment when I deploy this app 3 times it prompt for  credential and finally gives the following error
    Error message after login 3 times:
    {"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access
    denied. You do not have permission to perform this action or access this resource."}}}
    -Lovekush Kumar 

    Add your site (http://*.app.contoso.com) to your local intranet sites in IE. 
    "app.contoso.com" is app domain.
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • 401 Unauthorized Error when Registering Workflow Manager

    I have installed the workflow manager successfully. However, when I try to run Register-SPWorkflowService I get a 401 Unauthorized error. I am running SharePoint 2013 Management Shell as administrator.
    When I use internet explorer to browse to https://FQDNofServer:12290 I get prompted for my password 3 times and then get the Not Authorized Error here as well. I have tried this from the local host as well as remote machines with the same result therefore,
    I don't think I need to disable loopback check.
    My user is a member of the Workflow AdminGroup as well as a local admin, farm administrator and I also added my account as an administrator for the Workflow Service Application in Central Administration. I also tried giving the workflow service account full
    read on the web application.
    I cannot find anything in the ULS logs or windows event viewer logs when the login fails. Any help would be appreciated.
    Thank You.

    Hi,
    Glad to hear that you solve this issue, thanks for your sharing.
    Thanks,
    Linda Li                
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

  • 10.4.2 401 Unauthorized error when i secured my project

    Hi ,
    I secured my application with authentication and authorization with default login page and error page.
    After i assigned users for an application role and doing grants for all the webpages and taskflows needed.. i am unable to login successfully into app.
    i get
    Error 401--Unauthorized
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    10.4.2 401 Unauthorized
    The request requires user authentication. The response MUST include a WWW-Authenticate header field (section 14.46) containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization header field (section 14.8). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user SHOULD be presented the entity that was given in the response, since that entity MAY include relevant diagnostic information. HTTP access authentication is explained in section 11.
    Any1 please let me know y this issue arises..
    Prabas

    did u grant permission for the taskflow and the page in jazn-data.xml file?

  • B1WS - (401)Unauthorized Error while accessing Webservice from JAVA

    Hi,
    While accessing B1WS getting the following error.
    Please help us to resolve the error
    {http://xml.apache.org/axis/}HttpErrorCode:401
    (401)Unauthorized
        at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    Here is the Code :
    public class Test {
    //     public static final java.lang.String _dst_MSSQL2008 = "dst_MSSQL2008";
         public static final LoginDatabaseType dst_MSSQL2008 = new LoginDatabaseType("dst_MSSQL2008");
         public static final LoginLanguage ln_English = new LoginLanguage("ln_English");
        public static void main(String[] arg) throws ServiceException, IOException
            LoginServiceSoapStub login = (LoginServiceSoapStub) new LoginServiceLocator().getLoginServiceSoap(new URL("http://10.10.5.115/sapb1web/WebReferences/LoginService.wsdl"));
        try {
            login.login("ESPL-LAP-048", "INDIAHEAD", dst_MSSQL2008,"manager", "12345", ln_English, "ESPL-LAP-048:30000");
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            System.out.println("Error "+e.getMessage());
    Thanks
    Ravi Shankar

    Hi,
    Not sure this is right forum to post. You may try post in SDK forum to get quick response.
    Thanks & Regards,
    Nagarajan

  • 401 Unauthorized error when calling a webservice

    Have ColdFusion 11 installed, I have created a hello web service and I am trying to call it.  Each time I try to call the web service I get an error 401 Unauthorized.  I am not sure if I need to configure something more on the ColdFusion server, IIS or something else.
    <cfcomponent displayname="Hello">
    <cffunction name="helloWorld" returntype="string" access="remote">
         <cfreturn "Hello World!">
        </cffunction>
    </cfcomponent>
    <cfinvoke
      webservice="http://MyServer/Hello.cfc?wsdl"
      method="helloWorld"
      returnvariable="ws" refreshwsdl="yes">
    </cfinvoke>
    <cfdump var="#ws#">

    It appears that you have inadvertently enforced HTTP authentication. If so, you will have to include the attributes, username="your_username" and password="your_password" in the cfinvoke tag.

  • Termination error when accessing resource tab in project template

    Hi,
    i am getting error when i am trying do resource in the project template. i have structured the project structure in the template. and i am trying to add roles for the project template but it is showing termination error when i click on "resource tab" in the template. 
    anybody can help on this error?
    thanks,
    Prabu
    i have serached for notes but it didnt help.
    fyi,  below are the error message i am getting,
    Error while processing your query
    What has happened?
    The URL call http://cmcw08v701.us.fit:8000/sap/bc/webdynpro/sap/CPROJECTS_FPM was terminated because of an error.
    Note
    The following error occurred in system CMD : Line types of an internal table and a work area not compatible.
    The error occurred on application server cmcw08v701_CMD_00 and in work process 8 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: RETRIEVE of program CL_DPR_API_APPLICATION_OBJECT=CP
    Method: IF_DPR_PROVIDER_ACCESS~RETRIEVE of program CL_DPR_API_APPLICATION_OBJECT=CP
    Method: RETRIEVE of program CL_DPR_API_BUSINESS_OBJECT====CP
    Method: IF_DPR_PROVIDER_ACCESS~RETRIEVE of program CL_DPR_API_BUSINESS_OBJECT====CP
    Method: IF_DPR_CORE_SERVICE_PROVIDER~RETRIEVE of program CL_DPR_API_CPROJECTS_CSP======CP
    Method: IF_DPR_CORE_SERVICE_ACCESSOR~RETRIEVE of program CL_DPR_API_CORE_SERVICE_MNGR==CP
    Method: HANDLEDEFAULT of program /1BCWDY/0O2TQEJ08RJE3X97BQID==CP
    Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/0O2TQEJ08RJE3X97BQID==CP
    Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_IF_VIEW=====CP
    Method: NAVIGATE of program CL_WDR_CLIENT_APPLICATION=====CP
    What can I do?
    If the termination type is RABAX_STATE, you will find more information on the cause of termination in system CMD in transaction ST22.
    If the termination type is ABORT_MESSAGE_STATE, you will find more information on the cause of termination on the application server cmcw08v701_CMD_00 in transaction SM21.
    If the termination type is ERROR_MESSAGE_STATE, you can search for further information in the trace file for the work process 8 in transaction ST11 on the application server. cmcw08v701_CMD_00 . You may also need to analyze the trace files of other work processes.
    If you do not yet have a user ID, contact your system adminmistrator.
    Error Code: ICF-IE-http -c: 120 -u: PTHANGARAJ -l: E -s: CMD -i: cmcw08v701_CMD_00 -w: 8 -d: 20110918 -t: 002509 -v: RABAX_STATE -e: OBJECTS_WA_NOT_COMPATIBLE -X: 005056B8017E1ED0B8B7AF786703B697_005056B8017E1ED0B8B7AF77EFCBF697_1 -x: 7BBDE1E038C3F1239697005056B8017E
    HTTP 500 - Internal Server Error
    Your SAP Internet Communication Framework Team
    Line types of an internal table and a work area not compatible

    Hi Prabu,
    Just do a quick check if there is any custom implementation in Project management side. This may occur most probably due to not defining the navigations properly or if any modifications in the Define Navigation part of SPRO. Raising a ticket to your BASIS team might help some time to resolve this. Last option is OSS notes.
    Regards,
    Karthik

  • Getting a java error when accessing the /nwa url

    Hi.
    We've recently updated our netweaver portal and application server from SPS19 to SPS21.
    Now we receive an error message when try to open the url http://<server>/nwa. After entering the credentials we get
      500   Internal Server Error
      SAP J2EE Engine/7.00
      Application error occurred during request processing.
      Details:   java.lang.NoSuchMethodError: com/sap/security/core/util/imp/LogonUtils.decryptURL(Ljava/lang/String;)Ljava/lang/String;
    Exception id: [000D600ADD7B003400000283000D007A000484CF7CDC6E88]
    Any suggestions?
    Thanks.
    Ralph.

    Hi.
    The installation worked without any problems. No error messages during the update process.
    The default trace gives
    application [logon] Processing HTTP request to servlet [LogonServlet] finished with error. The error is: java.lang.NoSuchMethodError: com/sap/security/core/util/imp/LogonUtils.decryptURL(Ljava/lang/String;)Ljava/lang/String;
    at com.sap.security.core.logonadmin.ServletAccessToLogic.sendRedirect(ServletAccessToLogic.java:242)
    at com.sap.security.core.sapmimp.logon.SAPMLogonLogic.doLogon(SAPMLogonLogic.java:916)
    at com.sap.security.core.sapmimp.logon.SAPMLogonLogic.uidPasswordLogon(SAPMLogonLogic.java:578)
    at com.sap.security.core.sapmimp.logon.SAPMLogonLogic.executeRequest(SAPMLogonLogic.java:158)
    at com.sap.security.core.sapmimp.logon.SAPMLogonServlet.doPost(SAPMLogonServlet.java:60)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
    at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
    at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
    at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
    at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(AccessController.java:219)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
    Any suggestions on this?
    Thanks.
    Ralph.

  • I am getting the sec_error_bad_der error when accessing a site. This was working fine but now comes up with this error. Chrome and IE work Fine but Firefox show

    I using IBM Flex hardware and firefox is the recommended browser. I cannot access one of the IO modules in the chassis I get the error sec_error_bad_der and problem loading page. Other IO modules are fine and it works in IE and Chrome I have uninstalled and reinstalled the browser. Please can you assist.

    I had to look that one up: [http://pic.dhe.ibm.com/infocenter/flexsys/information/index.jsp?topic=%2Fcom.ibm.acc.8721.doc%2Fio_modules.html]
    That error normally refers to an ssl cert error. Does the cert for that particular node use ssl3? [http://pic.dhe.ibm.com/infocenter/flexsys/information/index.jsp?topic=%2Fcom.ibm.acc.8731.doc%2Ftroubleshooting_mobile_system_management_app.html] or is it different from the others?
    Manage the stored cert from the Pafe Info (right click) Security > View Certificate.

  • Getting run time error when accessing the file from frontend server using F4.....?

    Category               ABAP Programming Error
    Runtime Errors         CONVT_NO_NUMBER
    Except.                CX_SY_CONVERSION_NO_NUMBER
    ABAP Program           ZMM_MIGO_GOODS_ISSUE
    Application Component  Not assigned
    Date and Time          26.05.2014 14:28:30
    Short Text
         "C:\Users\SAP\Desktop\MIGO\MIGO.xlsx" cannot be interpreted as a number
    What happened?
         Error in the ABAP Application Program
         The current ABAP program "ZMM_MIGO_GOODS_ISSUE" had to be terminated because
          it has
         come across a statement that unfortunately cannot be executed.
    Error analysis
         An exception has occurred which is explained in more detail below. The
         exception is assigned to class 'CX_SY_CONVERSION_NO_NUMBER' and was not caught
          in procedure
         "%_SEL_SCREEN_P_FNAME_V" "(FORM)", nor was it propagated by a RAISING clause.
         Since the caller of the procedure could not have anticipated this

    HI CHIRUI,
    I have changed and tried but still i a getting the same thing..
    otherwise please check this i am using some class method i am not getting short dump,but excel file is not getting uploaded.
    REPORT ZMM_MIGO_GOODS_ISSUE NO STANDARD PAGE HEADING.
    DATA : BEGIN OF IT_DATA OCCURS 0,
             ID(10),
             BLDAT(10),                             " Document Date
             BUDAT(10),                             " Posting Date
             REF_DOC_NO(16),                        " Material Slip No
             DEL_NOTE(16),                          " delivery note
             MATNR TYPE MSEG-MATNR,                 " Material Number
             ERFMG(13) TYPE C,                      " Quantity
             BWART TYPE RM07M-BWARTWA,              " Movement Type
             SOBKZ(1),                              " Special Stock
             WERKS TYPE RM07M-WERKS,                " Plant
             LGORT TYPE RM07M-LGORT,                " Storage Location
             PS_POSID TYPE PS_POSID,                " WBS Element
             COST_CENTER TYPE KOSTL,                " cost center
             ORDER TYPE AUFNR,                      " order number
             SERNR TYPE RIPW0-SERNR,                " Serial Number
            END OF IT_DATA,
            BEGIN OF IT_HEAD OCCURS 0,
              ID(10),
              BLDAT(10),                            " Document Date
              BUDAT(10),                            " Posting Date
              REF_DOC_NO(16),                       " Reference document number
              "HEADER_TXT(25),                       " Header Text
              BWART TYPE RM07M-BWARTWA,             " Movement Type
            END OF IT_HEAD,
            BEGIN OF IT_ITEM OCCURS 0,
              ID(10),
              "ID1(10),
              WERKS TYPE RM07M-WERKS,               " Plant
              LGORT TYPE RM07M-LGORT,               " Storage Location
              VAL_TYPE TYPE BWTAR_D,
              MATNR TYPE MSEG-MATNR,                " Material Number
              ERFMG(13) TYPE C,                     " Quantity
              CHARG TYPE MSEG-CHARG,                " Batch
              BWTAR TYPE BWTAR_D,
              PS_POSID TYPE PS_POSID,                 " WBS Element
              ERFME TYPE MSEG-ERFME,                  " Unit
              COST_CENTER TYPE KOSTL,                " cost center
              ORDER TYPE AUFNR,                      " order number
              CUSTOMER TYPE EKUNN,                    " Account Number of Customer
              SERNR TYPE RIPW0-SERNR,                 " Serial Number
              AMOUNT_LC TYPE BAPI_EXBWR,
              SOBKZ(1),
            END OF IT_ITEM,
              HEADER   LIKE BAPI2017_GM_HEAD_01,
              CODE     LIKE BAPI2017_GM_CODE,
              ITEMS    LIKE BAPI2017_GM_ITEM_CREATE OCCURS 0 WITH HEADER LINE,
              SERIAL   LIKE BAPI2017_GM_SERIALNUMBER OCCURS 0 WITH HEADER LINE,
              RETURN   LIKE BAPI2017_GM_HEAD_RET,
              RET      LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE,
              TESTRUN  LIKE BAPI2017_GM_GEN-TESTRUN,
              IT_TAB   TYPE FILETABLE,
              GD_SUBRC TYPE I,
              L_FILE   TYPE RLGRAP-FILENAME,
              IT_RAW   TYPE TRUXS_T_TEXT_DATA,
              COUNT(2) TYPE N,
              TEXT_C(30).
    DATA: DATA     LIKE TABLE OF IT_ITEM WITH HEADER LINE.
    DATA: IT_TEMP  LIKE TABLE OF IT_ITEM WITH HEADER LINE.
    DATA: IT_TEMP1 LIKE TABLE OF IT_ITEM WITH HEADER LINE.
    DATA: IT_ITEM1 LIKE TABLE OF IT_ITEM WITH HEADER LINE.
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETERS : P_FILE TYPE RLGRAP-FILENAME.
    *             p_test AS CHECKBOX.
    SELECTION-SCREEN: END OF BLOCK B1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
       CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
         EXPORTING
           WINDOW_TITLE = 'SELECT FILE'
         CHANGING
           FILE_TABLE   = IT_TAB
           RC           = GD_SUBRC.
       READ TABLE IT_TAB INTO P_FILE INDEX 1.
    START-OF-SELECTION.
       PERFORM GET_EXCEL_DATA.
       PERFORM GET_HEADER_ITEM.
       PERFORM UPDATE_DATA.
    *&      Form  GET_EXCEL_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM GET_EXCEL_DATA .
       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
         EXPORTING
           INPUT  = P_FILE
         IMPORTING
           OUTPUT = L_FILE.
       CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
         EXPORTING
           I_LINE_HEADER        = 'X'
           I_TAB_RAW_DATA       = IT_RAW
           I_FILENAME           = L_FILE
         TABLES
           I_TAB_CONVERTED_DATA = IT_DATA
         EXCEPTIONS
           CONVERSION_FAILED    = 1
           OTHERS               = 2.
       IF SY-SUBRC <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF.
    ENDFORM. " GET_EXCEL_DATA
    *&      Form  GET_HEADER_ITEM
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM GET_HEADER_ITEM .
       DATA : FLAG(1).
       LOOP AT IT_DATA.
         CLEAR FLAG.
         IF IT_DATA-ID IS NOT INITIAL.
           AT NEW ID.
             FLAG = 'X'.
           ENDAT.
         ENDIF.
         IF FLAG = 'X'.
           MOVE-CORRESPONDING IT_DATA TO IT_HEAD.
           APPEND IT_HEAD.
         ENDIF.
         MOVE-CORRESPONDING IT_DATA TO IT_ITEM.
         APPEND IT_ITEM.
       ENDLOOP.
       DATA[] = IT_ITEM[].
       IT_TEMP[] = IT_ITEM[].
       IT_TEMP1[] = IT_ITEM[].
    ENDFORM. " GET_HEADER_ITEM
    *&      Form  UPDATE_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM UPDATE_DATA .
       DATA : COUNT1(10),
              L_QTY TYPE I,
              DAT(10).
       CONCATENATE SY-DATUM+6(2) '.' SY-DATUM+4(2) '.' SY-DATUM(4) INTO DAT.
       LOOP AT IT_HEAD.
         ON CHANGE OF IT_HEAD-ID.
           CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
             EXPORTING
               DATE_EXTERNAL       = IT_HEAD-BUDAT
               ACCEPT_INITIAL_DATE = 'X'
             IMPORTING
               DATE_INTERNAL       = HEADER-PSTNG_DATE.
           IF SY-SUBRC <> 0.
             MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
           ENDIF.
           CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
             EXPORTING
               DATE_EXTERNAL       = IT_HEAD-BLDAT
               ACCEPT_INITIAL_DATE = 'X'
             IMPORTING
               DATE_INTERNAL       = HEADER-DOC_DATE.
           IF SY-SUBRC <> 0.
             MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
           ENDIF.
           MOVE : '2'                TO HEADER-VER_GR_GI_SLIP,
                  'X'                TO HEADER-VER_GR_GI_SLIPX.
    *      IF r1 EQ 'X'.
           MOVE '05' TO CODE-GM_CODE.
           HEADER-REF_DOC_NO = IT_HEAD-REF_DOC_NO.
           "HEADER-HEADER_TXT = IT_HEAD-HEADER_TXT.
    *      ELSEIF r2 EQ 'X'.
    *        MOVE '04' TO code-gm_code.
    *      ELSEIF r3 EQ 'X'.
    *        MOVE '04' TO code-gm_code.
    *      ENDIF.
    *      IF p_test = 'X'.
    *        MOVE 'X' TO testrun.
    *      ENDIF.
         ENDON.
         IT_ITEM1[] = IT_ITEM[].
    *delete it_item[] where werks = '' and id = it_head-id.
         DELETE ADJACENT DUPLICATES FROM IT_ITEM COMPARING ID MATNR.
         LOOP AT IT_ITEM WHERE ID = IT_HEAD-ID.
    *      ON CHANGE OF it_item-id1.
           COUNT1 = COUNT1 + 1.
           CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
               INPUT  = IT_ITEM-MATNR
             IMPORTING
               OUTPUT = ITEMS-MATERIAL.
           MOVE : IT_ITEM-WERKS TO ITEMS-PLANT,
                  IT_ITEM-LGORT TO ITEMS-STGE_LOC,
    *             it_item-lgort1 TO items-move_stloc,
                  IT_ITEM-CHARG TO ITEMS-BATCH,
    *            IT_ITEM-VAL_TYPE TO ITEMS-VAL_TYPE,
                  'FRESH' TO ITEMS-VAL_TYPE,
                  IT_HEAD-BWART TO ITEMS-MOVE_TYPE,
                  IT_ITEM-SOBKZ TO ITEMS-SPEC_STOCK,
                  IT_ITEM-ERFMG TO ITEMS-ENTRY_QNT,
                  IT_ITEM-ERFMG TO ITEMS-ENTRY_QNT,
    *            it_item-erfme TO items-entry_uom,
    *            it_item-sgtxt TO items-item_text,
    *            it_item-exbwr TO items-amount_lc,
                  IT_ITEM-PS_POSID TO ITEMS-WBS_ELEM,
                  IT_ITEM-PS_POSID TO ITEMS-VAL_WBS_ELEM,
                  "IT_ITEM-CUSTOMER TO ITEMS-CUSTOMER,
                  IT_ITEM-ERFMG TO L_QTY,
                  IT_ITEM-AMOUNT_LC TO ITEMS-AMOUNT_LC,
                  IT_ITEM-COST_CENTER TO ITEMS-COSTCENTER,
                  IT_ITEM-ORDER TO ITEMS-ORDERID.
    *             items-SPEC_MVMT = 'R'.
           CALL FUNCTION 'CONVERSION_EXIT_ABPSN_INPUT'
             EXPORTING
               INPUT  = ITEMS-WBS_ELEM
             IMPORTING
               OUTPUT = ITEMS-WBS_ELEM.
           CALL FUNCTION 'CONVERSION_EXIT_ABPSN_INPUT'
             EXPORTING
               INPUT  = ITEMS-VAL_WBS_ELEM
             IMPORTING
               OUTPUT = ITEMS-VAL_WBS_ELEM.
    *      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    *        EXPORTING
    *          input  = it_item-lifnr
    *        IMPORTING
    *          output = items-vendor.
           APPEND ITEMS.
    *      ENDON.
         ENDLOOP.
         DELETE ADJACENT DUPLICATES FROM IT_TEMP COMPARING ID MATNR.
         DELETE IT_TEMP1 WHERE ID <> IT_HEAD-ID.
         DELETE IT_TEMP WHERE ID <> IT_HEAD-ID.
         DATA: MAT_ITM TYPE MBLPO,
               SERNP TYPE SERAIL.
         MAT_ITM = '0001'.
         LOOP AT IT_TEMP.
           SELECT SINGLE SERNP FROM MARC INTO SERNP WHERE MATNR = IT_TEMP-MATNR.
           IF SERNP IS NOT INITIAL.
             LOOP AT IT_TEMP1 WHERE ID = IT_TEMP-ID AND MATNR = IT_TEMP-MATNR.
    *    MOVE : it_item1-id TO serial-matdoc_itm,
    *     MOVE : mat_itm TO serial-matdoc_itm,
               SERIAL-MATDOC_ITM = MAT_ITM .
               SERIAL-SERIALNO   = IT_TEMP1-SERNR.
               APPEND SERIAL.
               CLEAR IT_ITEM1.
             ENDLOOP.
             MAT_ITM = MAT_ITM + 1.
           ENDIF.
           CLEAR IT_TEMP.
         ENDLOOP.
         CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
           EXPORTING
             GOODSMVT_HEADER       = HEADER
             GOODSMVT_CODE         = CODE
             TESTRUN               = TESTRUN
    *       GOODSMVT_REF_EWM      =
           IMPORTING
             GOODSMVT_HEADRET      = RETURN
    *       MATERIALDOCUMENT      =
    *       MATDOCUMENTYEAR       =
           TABLES
             GOODSMVT_ITEM         = ITEMS
             GOODSMVT_SERIALNUMBER = SERIAL
             RETURN                = RET
    *       GOODSMVT_SERV_PART_DATA =
    *       EXTENSIONIN           =
         CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
             WAIT = 'X'
    *   IMPORTING
    *       RETURN        =
         IF NOT RETURN IS INITIAL.
           WRITE :/ 'Material Document Number Generated: ' ,RETURN-MAT_DOC,RETURN-DOC_YEAR.
         ELSE.
           LOOP AT RET.
             WRITE : RET-TYPE,    RET-MESSAGE.
    *      log-index = sy-index.
    *      log-matnr = header-material.
    *      log-message = ret1-message.
    *      APPEND log.
           ENDLOOP.
         ENDIF.
         REFRESH : ITEMS,RET.
         CLEAR : HEADER,RETURN.
         CLEAR: TESTRUN  ,
                RETURN,
                ITEMS[],
                SERIAL[],
                RET[],
                HEADER,
                IT_TEMP[] ,
                IT_TEMP1[].
         IT_TEMP[] = DATA[].
         IT_TEMP1[] = DATA[].
       ENDLOOP.
    ENDFORM. " UPDATE_DATA
    Regards,
    Suresh bheema

Maybe you are looking for

  • Copy mode of payment from customer master data to sales order,

    Hi Gurus, Hope all is fine. I have a small doubt. If we want to transfer the mode of payment from customer master data to sales order, do we have to use Exit- MV45AFZZ. Can't we transfer the data without the exit?

  • System Prefs. problem. Application problems. Need advice.

    The problems I am having: 1) Mail will not open. It hangs, shows beach ball and stays that way. All you see is the menu-bar. Force quit will not work. Only hard reset. Activity Monitor shows the app sucking up 87-95% of processor. 2) System preferenc

  • Why wont attach to email work?

    why wont attach to email work?

  • Edit Ruler Bug in CC 2014?

    I created area type object and then edited the tab ruler by changing the "second" line indent. When I attempted to reset the indent to "0" the setting would not change. I also tried resetting it numerically, same result. Finally, AI CC 2014 crashed (

  • Pacman error with "/usr/share/man exists in filesystem"

    I'm installing archlinux. Follwing beginners guide, I'm now installing some booting packages, dosfools,efibootmgr, grub. Install Boot loader But every time I type pacman -S grub it makes error error: failed to commit transaction (conflicting files) g