How to upload large binary data to dB so it can be read by any app?

Hi everyone,
Short version: how do you upload binary data into a MySQL blob field in such a way that it can be read by any application?
Long version:
I've been struggling with the problem of putting files into database BLOB fields. (MySQL and Database Connectivity Toolkit).
I was initially building a query string and executing the query but was finding that certain binary characters were causing failures (end of string terminators, etc...) So, a working solution was to encode the binary string, and that worked fine, although bloated the dB a fair bit. I could decode in LabVIEW and then save the file as needed.
Now, the customer wants to be able to save the files using other apps, including the MySQL Query Browser, so an encoded file is no good.
I found using a parametrized query allows me to put the unencoded string into the dB, but it appends a 4-byte length at the front of the BLOB before it inserts it into the dB. Some apps ignore these 4-bytes (such as .pdf) but most do not.
A related thread on NI discussion forums: http://forums.ni.com/ni/board/message?boar...ssage.id=354361 has no solution, and my support ticket at NI has been ongoing without answer for a while.
Thanks,
Ben

The problem is the DCT. Using ADO it is fairly easy to insert binary data into a BLOB field. I have not tried it in MySQL, but it works fine in SQL Server, Oracle, Firebird and other free/open source databases I have tried. To get you started, see this thread.
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

Similar Messages

  • I want to add meta data descriptions of photos that can be read by any platform. Can I do this in iPhoto?

    I know I can add descriptions, but I can't seem to get them to follow when I copy files outside of iPhoto.

    To keep the metadata export the photos (file menu ==> export) checking the appripriate options during export
    LN

  • How to upload large file with http via post

    Hi guys,
    Does anybody know how to upload large file (>100 MB) use applet to servlet with http via post method? Thanks in advance.
    Regards,
    Mark.

    Hi SuckRatE
    Thanks for your reply. Could you give me some client side code to upload a large file. I use URL to connect to server. It throws out of memory exception. The part of client code is below:
    // connect to the servlet
    URL theServlet = new URL(servletLocation);
    URLConnection servletConnection = theServlet.openConnection();
    // inform the connection that we will send output and accept input
    servletConnection.setDoInput(true);
    servletConnection.setDoOutput(true);
    // Don't used a cached version of URL connection.
    servletConnection.setUseCaches (false);
    servletConnection.setDefaultUseCaches(false);
    // Specify the content type that we will send text data
    servletConnection.setRequestProperty("Content-Type",
    +"application/octet-stream");
    // send the user string to the servlet.
    OutputStream outStream = servletConnection.getOutputStream();
    FileInputStream filein = new FileInputStream(largeFile);
    //BufferedReader in = new BufferedReader(new InputStreamReader
    +(servletConnection.getInputStream()));
    //System.out.println("tempCurrent = "+in.readLine());
    byte abyte[] = new byte[2048];
    int cnt = 0;
    while((cnt = filein.read(abyte)) > 0)
    outStream.write(abyte, 0, cnt);
    filein.close();
    outStream.flush();
    outStream.close();
    Regards,
    Mark.

  • Errors and exceptions in writing large binary data on sockets!!! urgent

    hi
    I am trying to write large binary data in the form of byte arrays on sockets.
    Data is as large as 512KB(== 524288bytes) So i store the data (actually read from a file through FileInputStream ) and then write on the socket with lines like this
    DataOutputStream dos =
    new DataOutputStream(new BufferedOutputStream(sock.getOutputStream()));
    dos.write(b);
    /* suppose b is the arrayreference in which data is stored. sometimes i write with that offset + len function*/
    dos.flush();
    dos.close();
    sock.close();
    but the program is not stable: sometimes the whole 512KB is read on other side and sometimes less usually 64KB.
    The program is unthreaded.
    There is another problem : one side(reading or writing) sometimes gives error :
    java.net.SocketException: Software caused connection abort: socket write error
    please reply and reply soon and give ur suggestions
    thanks

    hi
    I am trying to write large binary data in theform
    of byte arrays on sockets.
    Data is as large as 512KB(== 524288bytes) So istore
    the data (actually read from a file through
    FileInputStream ) and then write on the socketwith
    lines like this
    DataOutputStream dos =
    new DataOutputStream(new
    BufferedOutputStream(sock.getOutputStream()));
    dos.write(b);
    /* suppose b is the arrayreference in which datais
    stored. sometimes i write with that offset + len
    function*/
    dos.flush();
    dos.close();
    sock.close();
    but the program is not stable: sometimes the whole
    512KB is read on other side and sometimes less
    usually 64KB.
    The program is unthreaded.
    There is another problem : one side(reading or
    writing) sometimes gives error :
    java.net.SocketException: Software caused
    connection abort: socket write error
    please reply and reply soon and give ursuggestions
    thanksUmm how are you reading the data on the other side?
    some of your code snippet might help. Your writing
    code seems ok. I've written a file transfer program
    in a similar fashion and have successfully testing on
    different platforms (AIX, AS400, Solaris, Windows,
    etc) without any problems and without needing to set
    the buffer sizes with files as large as 600MB and you
    said you're testing this on the loopback?
    Point here is you should never need to reset any of the default TCP options to get program correctness. The options are more for optimizations and fine tuning. If indeed you need to change the options to get your program to work, then you program wont be able to scale under different load.

  • How to upload the master data from legacy to SAP

    Hi Frends,
    how to upload the master data from legacy system to SAP System once the configuration is over.how to carry forward the open items of vendors and customers while uploading.who will upload functional consultantsor ABAPER.
    please clarify me
    Regards
    Sap Guru

    Hi ,
    use LSMW  or BDC for uploading Master & transaction data.
    This work is done by the Respective Functional team.
    Chandra

  • How to upload company code data related to Company Code BP01?

    How to upload company code data related to Company Code BP01 FOR CIN?

    Hi,
    First check whether all the pre-requisites are completed.
    I'm assuming you have installed the Best Practices Baseline package (for country IN). If you have succeeded in actvating the buildig blocks (as per your scope) using Solution Builder, you would have populated all the company code data related to Co. code BP01. Looks like some steps are missing.
    Please refer to the OSS note 1408706 in this regard. From there, you also can refer to the "Quick Guide to Implementing the SAP Best Practices Baseline Package V1.604 (DE), which is self-explanatory. 
    Let me know if this helps.

  • Why can't I buy any app ? Iv tried creating a new Appel account ect but it says the same thing everytime . Sorry your payment was declined . How can I sort this ? Please help

    Why can't I buy any app ? Iv tried creating a new Appel account ect but it says the same thing everytime . Sorry your payment was declined . How can I sort this ? Please help

    - Try another payment method.
    - Contact iTunes
    Apple - Support - iTunes - Contact Us
    - Create a NEW account using these instructions. Make sure you follow the instructions. Many do not and if you do not you will not get the None option. You must use an email address that you have not used with Apple before.
    Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card

  • Why can't I update any apps? When I hit update it gives me an old id. But in settings my new id is totally set and verified. How cam I make the change in App Store?

    Why can't I update any apps? When I hit update it gives me an old id. But in settings my new id is totally set and verified. How cam I make the change in App Store?

    App purchases are permanently tied to the ID with which they were purchased. They cannot be transferred to a new ID.
    You will have to enter the password for that ID or delete the apps and re-purchase them with the new one.
    ~Lyssa

  • My second hand ipad, recently bought from ebay, surfs the internet but a large black square locks the screen if you try to access any APP or apple product. MY apple ID seems fine, i re-set my password a few days ago and joined icloud etc. What can i do?

    Hello all. My secondhand ipad, recently bought from ebay, surfs the internet fine but a large black square locks the screen if I try to access any APP. What is the problem and what can i do about it please?

    Hello all. My secondhand ipad, recently bought from ebay, surfs the internet fine but a large black square locks the screen if I try to access any APP. What is the problem and what can i do about it please?

  • Employee Photo Upload through binary data

    Hi all,
    I know the Provision for Photo upload through OAAD Tcode, I know FM to upload the photos by giving path as input data. my requirement is I have picture in the form of binary data . i want to upload that into PA30. I have return the following code. No Error but image is not displayed in PA30.Can u Please correct me?
    tables: toav0, toaom, twfdb, toapa.
    data: key like ojint-key,
          object like ojint-name,
          object_id like toav0-object_id,
          archiv_id like toav0-archiv_id,
          arc_doc_id like toav0-arc_doc_id,
          ablagedatum like sapb-sapabldate,
          ar_date like toav0-ar_date,
          del_date like toav0-del_date,
          sap_object like toaom-sap_object,
          ar_object like toaom-ar_object,
          expiry_tim like toaom-expiry_tim,
          method like ojint-method,
          return like ojint-return,
          parameter like ojint-parameter.
    data:begin of i_toav0 occurs 1.
            include structure toav0.
    data: end of i_toav0.
    data: begin of i_toaom occurs 1.
            include structure toaom.
    data: end of i_toaom.
    data: begin of fields occurs 1.
            include structure ojfields.
    data: end of fields.
    DATA:     filename1  TYPE string.
    Data: i_name TYPE STXBITMAPS-TDNAME value 'TEST',
    *  archiv_id like toav0-archiv_id,
    i_id TYPE STXBITMAPS-TDID VALUE 'BMAP',
    i_btype TYPE STXBITMAPS-TDBTYPE VALUE 'BCOL',
    l_bds_bytecnt TYPE i,
    FLENGTH TYPE SAPB-LENGTH,
    l_bds_content TYPE TABLE OF bapiconten,
    OUTDOC     LIKE     TOADT ,
    wa_l_bds_content TYPE  bapiconten.
    *DATA : BINARY TYPE STANDARD TABLE OF TBL1024,
    data : BINARY TYPE STANDARD TABLE OF TBL1024 WITH HEADER LINE,
    ARCHIVOBJECT type standard table of docs,
    archiv_doc_id like toav0-arc_doc_id,
    wa_binary type TBL1024.
    data:  lw_ar_object like toaom-ar_object,
          lw_object_id like sapb-sapobjid,
          lw_sap_object like toaom-sap_object,
          lw_doc_type like toadd-doc_type,
          lw_path like sapb-sappfad,"toav0-arc_doc_id
    *      archiv_doc_id like toav0-arc_doc_id,
          doc_type like toadt-doc_class.
    constants:  c_sap_object type toaom-sap_object value 'PREL',
                c_ar_object type toaom-ar_object value 'HRICOLFOTO',
                c_doc_type type toaom-doc_type value 'JPG'.
    PARAMETERS: filename(150) TYPE c OBLIGATORY.                               "Name of the File where source as  txt format
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
      PERFORM getfile.
    start-of-selection.
      filename1 = filename.
    key = '010001380002'.
      lw_ar_object = c_ar_object.
    *  lw_object_id = w_pernr_pass.
      lw_sap_object = c_sap_object.
      lw_doc_type = c_doc_type.
    *  lw_path = it_data-file_nam.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename = filename1
          filetype = 'BIN'
        TABLES
          data_tab = archivobject.
    * Object to be archived
          select single * from toaom where ar_object = c_ar_object and sap_object = c_sap_object.
          if sy-subrc <> 0.
            raise UPLOAD_ERROR.
          else.
    * Authority check with Archive id
            archiv_id = toaom-archiv_id.
            perform authority_check_create(oaall)
            using archiv_id object space ar_object space
            changing sy-subrc.
            if sy-subrc ne 0.
              raise UPLOAD_ERROR.
            else.
              if sy-subrc <> 0.
                raise UPLOAD_ERROR.
                clear toav0.
              else." Transfer key for archiving
                toav0-object_id = key.
                if key eq space.
                  Raise FUNCTION_ERROR.
                  clear toav0.
                else.
                  perform create_archive_object_new  .
                endif.
              endif.
            endif.
          endif.
    form create_archive_object_new .
    CALL FUNCTION 'ARCHIV_CREATE_TABLE'
        EXPORTING
          AR_OBJECT                      = lw_ar_object
    *   DEL_DATE                       =
          OBJECT_ID                      = '010001380002'
          SAP_OBJECT                     =  lw_sap_object
    *   FLENGTH                        = '2328'
       DOC_TYPE                       = lw_doc_type
    *   DOCUMENT                       =
    *   MANDT                          = SY-MANDT
    * IMPORTING
    *   OUTDOC                         =
       TABLES
       ARCHIVOBJECT                   =  ARCHIVOBJECT
    *     BINARCHIVOBJECT                = binary
    * EXCEPTIONS
    *   ERROR_ARCHIV                   = 1
    *   ERROR_COMMUNICATIONTABLE       = 2
    *   ERROR_CONNECTIONTABLE          = 3
    *   ERROR_KERNEL                   = 4
    *   ERROR_PARAMETER                = 5
    *   ERROR_USER_EXIT                = 6
    *   ERROR_MANDANT                  = 7
    *   OTHERS                         = 8
      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 'ARCHIVOBJECT_CREATE_TABLE'
        EXPORTING
          archiv_id                = archiv_id
          document_type            = lw_doc_type
    *      length                   = '2328'
        IMPORTING
          archiv_doc_id            = i_toav0-arc_doc_id
        TABLES
          archivobject             = archivobject
    *      binarchivobject          = BINARY
        EXCEPTIONS
          error_kernel             = 1
          error_communicationtable = 2
          error_archiv             = 3.
           move i_toav0 to toav0.
        toav0-sap_object = lw_sap_object.
        toav0-object_id = key.
        move archiv_id to toav0-archiv_id.
        move i_toav0-arc_doc_id to toav0-arc_doc_id.
        toav0-ar_object = lw_ar_object.
        move lw_doc_type to toav0-reserve.
        move lw_doc_type to doc_type.
        commit work.
      call function 'ARCHIV_CONNECTION_INSERT'
          exporting
            archiv_id                   = toav0-archiv_id
            arc_doc_id                  = toav0-arc_doc_id
            ar_date                     = ar_date
            ar_object                   = toav0-ar_object
    *     DEL_DATE                    = ' '
    *     MANDANT                     = ' '
            object_id                   = '010001380002'
            sap_object                  = toav0-sap_object
            doc_type                    = doc_type
    *        barcode                     = barcode
          exceptions
            error_connectiontable       = 1
            others                      = 2
    endform.
    FORM getfile .
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          def_filename     = ' '
          def_path         = '*.*'
          mask             = ''
          mode             = 'O'
          title            = ' SELECTING FILE FOR SOURCE PROGRAM'
        IMPORTING
          filename         = filename
        EXCEPTIONS
          selection_cancel = 3
          selection_error  = 4.

    Hi all,
    I know the Provision for Photo upload through OAAD Tcode, I know FM to upload the photos by giving path as input data. my requirement is I have picture in the form of binary data . i want to upload that into PA30. I have return the following code. No Error but image is not displayed in PA30.Can u Please correct me?
    tables: toav0, toaom, twfdb, toapa.
    data: key like ojint-key,
          object like ojint-name,
          object_id like toav0-object_id,
          archiv_id like toav0-archiv_id,
          arc_doc_id like toav0-arc_doc_id,
          ablagedatum like sapb-sapabldate,
          ar_date like toav0-ar_date,
          del_date like toav0-del_date,
          sap_object like toaom-sap_object,
          ar_object like toaom-ar_object,
          expiry_tim like toaom-expiry_tim,
          method like ojint-method,
          return like ojint-return,
          parameter like ojint-parameter.
    data:begin of i_toav0 occurs 1.
            include structure toav0.
    data: end of i_toav0.
    data: begin of i_toaom occurs 1.
            include structure toaom.
    data: end of i_toaom.
    data: begin of fields occurs 1.
            include structure ojfields.
    data: end of fields.
    DATA:     filename1  TYPE string.
    Data: i_name TYPE STXBITMAPS-TDNAME value 'TEST',
    *  archiv_id like toav0-archiv_id,
    i_id TYPE STXBITMAPS-TDID VALUE 'BMAP',
    i_btype TYPE STXBITMAPS-TDBTYPE VALUE 'BCOL',
    l_bds_bytecnt TYPE i,
    FLENGTH TYPE SAPB-LENGTH,
    l_bds_content TYPE TABLE OF bapiconten,
    OUTDOC     LIKE     TOADT ,
    wa_l_bds_content TYPE  bapiconten.
    *DATA : BINARY TYPE STANDARD TABLE OF TBL1024,
    data : BINARY TYPE STANDARD TABLE OF TBL1024 WITH HEADER LINE,
    ARCHIVOBJECT type standard table of docs,
    archiv_doc_id like toav0-arc_doc_id,
    wa_binary type TBL1024.
    data:  lw_ar_object like toaom-ar_object,
          lw_object_id like sapb-sapobjid,
          lw_sap_object like toaom-sap_object,
          lw_doc_type like toadd-doc_type,
          lw_path like sapb-sappfad,"toav0-arc_doc_id
    *      archiv_doc_id like toav0-arc_doc_id,
          doc_type like toadt-doc_class.
    constants:  c_sap_object type toaom-sap_object value 'PREL',
                c_ar_object type toaom-ar_object value 'HRICOLFOTO',
                c_doc_type type toaom-doc_type value 'JPG'.
    PARAMETERS: filename(150) TYPE c OBLIGATORY.                               "Name of the File where source as  txt format
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
      PERFORM getfile.
    start-of-selection.
      filename1 = filename.
    key = '010001380002'.
      lw_ar_object = c_ar_object.
    *  lw_object_id = w_pernr_pass.
      lw_sap_object = c_sap_object.
      lw_doc_type = c_doc_type.
    *  lw_path = it_data-file_nam.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename = filename1
          filetype = 'BIN'
        TABLES
          data_tab = archivobject.
    * Object to be archived
          select single * from toaom where ar_object = c_ar_object and sap_object = c_sap_object.
          if sy-subrc <> 0.
            raise UPLOAD_ERROR.
          else.
    * Authority check with Archive id
            archiv_id = toaom-archiv_id.
            perform authority_check_create(oaall)
            using archiv_id object space ar_object space
            changing sy-subrc.
            if sy-subrc ne 0.
              raise UPLOAD_ERROR.
            else.
              if sy-subrc <> 0.
                raise UPLOAD_ERROR.
                clear toav0.
              else." Transfer key for archiving
                toav0-object_id = key.
                if key eq space.
                  Raise FUNCTION_ERROR.
                  clear toav0.
                else.
                  perform create_archive_object_new  .
                endif.
              endif.
            endif.
          endif.
    form create_archive_object_new .
    CALL FUNCTION 'ARCHIV_CREATE_TABLE'
        EXPORTING
          AR_OBJECT                      = lw_ar_object
    *   DEL_DATE                       =
          OBJECT_ID                      = '010001380002'
          SAP_OBJECT                     =  lw_sap_object
    *   FLENGTH                        = '2328'
       DOC_TYPE                       = lw_doc_type
    *   DOCUMENT                       =
    *   MANDT                          = SY-MANDT
    * IMPORTING
    *   OUTDOC                         =
       TABLES
       ARCHIVOBJECT                   =  ARCHIVOBJECT
    *     BINARCHIVOBJECT                = binary
    * EXCEPTIONS
    *   ERROR_ARCHIV                   = 1
    *   ERROR_COMMUNICATIONTABLE       = 2
    *   ERROR_CONNECTIONTABLE          = 3
    *   ERROR_KERNEL                   = 4
    *   ERROR_PARAMETER                = 5
    *   ERROR_USER_EXIT                = 6
    *   ERROR_MANDANT                  = 7
    *   OTHERS                         = 8
      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 'ARCHIVOBJECT_CREATE_TABLE'
        EXPORTING
          archiv_id                = archiv_id
          document_type            = lw_doc_type
    *      length                   = '2328'
        IMPORTING
          archiv_doc_id            = i_toav0-arc_doc_id
        TABLES
          archivobject             = archivobject
    *      binarchivobject          = BINARY
        EXCEPTIONS
          error_kernel             = 1
          error_communicationtable = 2
          error_archiv             = 3.
           move i_toav0 to toav0.
        toav0-sap_object = lw_sap_object.
        toav0-object_id = key.
        move archiv_id to toav0-archiv_id.
        move i_toav0-arc_doc_id to toav0-arc_doc_id.
        toav0-ar_object = lw_ar_object.
        move lw_doc_type to toav0-reserve.
        move lw_doc_type to doc_type.
        commit work.
      call function 'ARCHIV_CONNECTION_INSERT'
          exporting
            archiv_id                   = toav0-archiv_id
            arc_doc_id                  = toav0-arc_doc_id
            ar_date                     = ar_date
            ar_object                   = toav0-ar_object
    *     DEL_DATE                    = ' '
    *     MANDANT                     = ' '
            object_id                   = '010001380002'
            sap_object                  = toav0-sap_object
            doc_type                    = doc_type
    *        barcode                     = barcode
          exceptions
            error_connectiontable       = 1
            others                      = 2
    endform.
    FORM getfile .
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          def_filename     = ' '
          def_path         = '*.*'
          mask             = ''
          mode             = 'O'
          title            = ' SELECTING FILE FOR SOURCE PROGRAM'
        IMPORTING
          filename         = filename
        EXCEPTIONS
          selection_cancel = 3
          selection_error  = 4.

  • How to Upload an attendees data and assessment details

    Hi all.
    Upload an attndess data and assessment detials against a specific business event date...programatically......how this can be done......?
    Since i am new to HR module.....
    I will give you overview what should be done....
    1.  A business evet occurs (Call Handling Training) on 2007.11.05 and object type is (E) object type id : 00027727
    2.  A list of employees ( P or H ) is provided to be booked against. Once booked, the business event date is firmly booked.
    3.  A follow up action is then conducted on Business Event date. A competency rating is then captured for those who attended.
         Once this information is saved. It passes a qualification for those who attended to 0024 infotype(qualification detials)
    4. Then in the followup screen(PV15) go into an individual record in the qulification overitime and capture assessment detials in the notes section of the selected qualification....
    Please let me know how this can be done...
    Points will be rewarded......

    hi,
    this can be useful as well (but I am not sure if it is not same thing Roberto sent you)
    http://service.sap.com/bi -> SAPBW Infoindex -> DB Connect
    Regards,
    Andrzej

  • How to upload Bulk Customer Data from Excel or Notepad?

    Hi
    Could any body explain me how can we upload bulk customer master data into SAP system. How the LSMW functionality works for it. what are the prerequisites to upload the data into the system, and Could any body explain me the detailed procedure to upload Customer master data into the system.
    As well I request you to know what are the other functionality we use for uploading. What would be the difference between IDOC and BDC functionalities.
    your suggestions will be highly appreciated?
    Raghu Ram

    hi raghu,
    this is sample code of bdc,
    REPORT zbdc_cus_create_ctm NO STANDARD PAGE HEADING MESSAGE-ID zsmep.
    *& Request ID: ECCK900136
    *& Author : seshu
    *& Date : 20/03/2007
    *& This report Creates customer Master Details through BDC-Call transaction
    *& method and download error files to the presentation server.
    DATA: BEGIN OF t_tab OCCURS 0,
    kunnr TYPE kun16,
    bukrs TYPE bukrs,
    vkorg TYPE vkorg,
    vtweg TYPE vtweg,
    spart TYPE spart,
    ktokd TYPE ktokd,
    name1 TYPE name1_gp,
    sortl TYPE sortl,
    ort01 TYPE ort01_gp,
    land1 TYPE land1_gp,
    spras TYPE spras,
    pstlz TYPE pstlz,
    civve TYPE civve,
    akont TYPE akont,
    awahr TYPE awahr,
    waers TYPE waers_v02d,
    kzazu TYPE kzazu_d,
    antlf TYPE string.
    DATA: END OF t_tab.
    DATA: BEGIN OF t_tab1 OCCURS 0,
    kunnr TYPE kun16,
    bukrs TYPE bukrs,
    vkorg TYPE vkorg,
    vtweg TYPE vtweg,
    spart TYPE spart,
    ktokd TYPE ktokd,
    name1 TYPE name1_gp,
    sortl TYPE sortl,
    ort01 TYPE ort01_gp,
    land1 TYPE land1_gp,
    spras TYPE spras,
    pstlz TYPE pstlz,
    civve TYPE civve,
    akont TYPE akont,
    awahr TYPE awahr,
    waers TYPE waers_v02d,
    kzazu TYPE kzazu_d,
    antlf TYPE string.
    DATA: END OF t_tab1.
    DATA: BEGIN OF g_tab_create OCCURS 0,
    kunnr TYPE kunnr,
    messa TYPE string.
    DATA: END OF g_tab_create.
    DATA: BEGIN OF g_tab_error OCCURS 0,
    kunnr TYPE kunnr,
    messa TYPE string.
    DATA: END OF g_tab_error.
    DATA: g_tab TYPE TABLE OF string,
    g_wa TYPE string.
    *DATA: g_tab TYPE TABLE OF t_tab,
    g_wa LIKE LINE OF g_tab.
    DATA: g_tab1 TYPE TABLE OF string.
    *itab for mapping...
    DATA: BEGIN OF tab_map OCCURS 0.
    INCLUDE STRUCTURE bdcdata.
    DATA: END OF tab_map.
    *itab for error messages...
    DATA: BEGIN OF tab_error OCCURS 0.
    INCLUDE STRUCTURE bdcmsgcoll.
    DATA: END OF tab_error.
    DATA: BEGIN OF l_tab OCCURS 0,
    l_text TYPE string.
    DATA: END OF l_tab.
    *delcarations for blocked alv...
    TYPE-POOLS: slis.
    DATA: l_tab_fieldcatlog TYPE slis_t_fieldcat_alv,
    l_tab_fieldcatlog1 TYPE slis_t_fieldcat_alv,
    l_layout TYPE slis_layout_alv,
    l_events TYPE slis_t_event,
    l_events1 TYPE slis_t_event,
    l_wa_events LIKE LINE OF l_events,
    l_pos TYPE i,
    report TYPE sy-repid,
    path TYPE string,
    path1 TYPE string.
    End generated data section ***
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: file TYPE ibipparms-path OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS: file1 TYPE ibipparms-path.
    SELECTION-SCREEN END OF BLOCK b2.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
    CALL FUNCTION 'F4_FILENAME'
    IMPORTING
    file_name = file.
    MOVE file TO path.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR file1.
    CALL FUNCTION 'F4_FILENAME'
    IMPORTING
    file_name = file1.
    MOVE file1 TO path1.
    AT SELECTION-SCREEN .
    IF file EQ file1.
    MESSAGE e103(zsmep).
    EXIT.
    ENDIF.
    START-OF-SELECTION.
    *call transaction method...
    PERFORM call_ctm.
    *display the output in blocked alv...
    PERFORM disply_block_alv.
    *& Form call_ctm
    text
    FORM call_ctm.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = path
    filetype = 'ASC'
    HAS_FIELD_SEPARATOR = ' '
    HEADER_LENGTH = 0
    READ_BY_LINE = 'X'
    DAT_MODE = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    CHECK_BOM = ' '
    VIRUS_SCAN_PROFILE =
    NO_AUTH_CHECK = ' '
    IMPORTING
    FILELENGTH =
    HEADER =
    TABLES
    data_tab = g_tab
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    DATA: text TYPE TABLE OF string.
    LOOP AT g_tab INTO g_wa.
    SPLIT g_wa AT '|' INTO: t_tab-kunnr
    t_tab-bukrs
    t_tab-vkorg
    t_tab-vtweg
    t_tab-spart
    t_tab-ktokd
    t_tab-name1
    t_tab-sortl
    t_tab-ort01
    t_tab-land1
    t_tab-spras
    t_tab-pstlz
    t_tab-civve
    t_tab-akont
    t_tab-awahr
    t_tab-waers
    t_tab-kzazu
    t_tab-antlf,
    TABLE text.
    APPEND t_tab.
    CLEAR g_wa.
    ENDLOOP.
    LOOP AT t_tab.
    REFRESH tab_map.
    PERFORM sub USING 'SAPMF02D' '0100'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'RF02D-KTOKD'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '/00'.
    PERFORM sub1 USING 'RF02D-KUNNR'
    t_tab-kunnr.
    PERFORM sub1 USING 'RF02D-BUKRS'
    t_tab-bukrs.
    PERFORM sub1 USING 'RF02D-VKORG'
    t_tab-vkorg.
    PERFORM sub1 USING 'RF02D-VTWEG'
    t_tab-vtweg.
    PERFORM sub1 USING 'RF02D-SPART'
    t_tab-spart.
    PERFORM sub1 USING 'RF02D-KTOKD'
    t_tab-ktokd.
    PERFORM sub USING 'SAPMF02D' '0110'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'KNA1-SPRAS'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '/00'.
    PERFORM sub1 USING 'KNA1-NAME1'
    t_tab-name1.
    PERFORM sub1 USING 'KNA1-SORTL'
    t_tab-sortl.
    PERFORM sub1 USING 'KNA1-ORT01'
    t_tab-ort01.
    PERFORM sub1 USING 'KNA1-LAND1'
    t_tab-land1.
    PERFORM sub1 USING 'KNA1-SPRAS'
    t_tab-spras.
    PERFORM sub1 USING 'KNA1-PSTLZ'
    t_tab-pstlz.
    PERFORM sub USING 'SAPMF02D' '0120'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'KNA1-LIFNR'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '/00'.
    PERFORM sub USING 'SAPMF02D' '0125'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'KNA1-NIELS'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '/00'.
    PERFORM sub USING 'SAPMF02D' '0130'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'KNBK-BANKS(01)'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM sub USING 'SAPMF02D' '0340'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'RF02D-KUNNR'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM sub USING 'SAPMF02D' '0370'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'RF02D-KUNNR'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM sub1 USING 'KNA1-CIVVE'
    t_tab-civve.
    PERFORM sub USING 'SAPMF02D' '0360'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'KNVK-NAMEV(01)'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM sub USING 'SAPMF02D' '0210'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'KNB1-AKONT'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '/00'.
    PERFORM sub1 USING 'KNB1-AKONT'
    t_tab-akont.
    PERFORM sub USING 'SAPMF02D' '0215'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'KNB1-GUZTE'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '/00'.
    PERFORM sub USING 'SAPMF02D' '0220'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'KNB5-KNRMA'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '/00'.
    PERFORM sub USING 'SAPMF02D' '0230'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'KNB1-VRSNR'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '/00'.
    PERFORM sub USING 'SAPMF02D' '0310'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'KNVV-BZIRK'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '/00'.
    PERFORM sub1 USING 'KNVV-AWAHR'
    t_tab-awahr.
    PERFORM sub1 USING 'KNVV-WAERS'
    t_tab-waers.
    PERFORM sub USING 'SAPMF02D' '0315'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'KNVV-LPRIO'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '/00'.
    PERFORM sub1 USING 'KNVV-KZAZU'
    t_tab-kzazu.
    PERFORM sub1 USING 'KNVV-ANTLF'
    t_tab-antlf.
    PERFORM sub USING 'SAPMF02D' '0320'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'KNVV-PERFK'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '/00'.
    PERFORM sub USING 'SAPMF02D' '1350'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'RF02D-KUNNR'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM sub USING 'SAPMF02D' '0324'.
    PERFORM sub1 USING 'BDC_CURSOR'
    'KNVP-PARVW(01)'.
    PERFORM sub1 USING 'BDC_OKCODE'
    '=ENTR'.
    CALL TRANSACTION 'XD01' USING tab_map
    MODE 'N'
    UPDATE 'A'
    MESSAGES INTO tab_error.
    LOOP AT tab_error.
    DATA: l_message TYPE string.
    IF tab_error-msgtyp = 'I' OR tab_error-msgtyp = 'S'.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
    id = tab_error-msgid
    lang = 'EN'
    no = tab_error-msgnr
    v1 = tab_error-msgv1
    v2 = tab_error-msgv2
    v3 = tab_error-msgv3
    v4 = tab_error-msgv4
    IMPORTING
    msg = l_message
    EXCEPTIONS
    not_found = 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.
    MOVE: t_tab-kunnr TO g_tab_create-kunnr,
    l_message TO g_tab_create-messa.
    APPEND g_tab_create.
    ELSEIF
    tab_error-msgtyp = 'E'.
    MOVE-CORRESPONDING t_tab TO t_tab1.
    APPEND t_tab1.
    DATA: text1 TYPE string.
    CONCATENATE t_tab-kunnr
    t_tab-bukrs
    t_tab-vkorg
    t_tab-vtweg
    t_tab-spart
    t_tab-ktokd
    t_tab-name1
    t_tab-sortl
    t_tab-ort01
    t_tab-land1
    t_tab-spras
    t_tab-pstlz
    t_tab-civve
    t_tab-akont
    t_tab-awahr
    t_tab-waers
    t_tab-kzazu
    t_tab-antlf
    INTO text1 SEPARATED BY '|'.
    l_tab-l_text = text1 .
    APPEND l_tab.
    *error records downlaod to pc...
    PERFORM gui_downlaod.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
    id = tab_error-msgid
    lang = 'EN'
    no = tab_error-msgnr
    v1 = tab_error-msgv1
    v2 = tab_error-msgv2
    v3 = tab_error-msgv3
    v4 = tab_error-msgv4
    IMPORTING
    msg = l_message
    EXCEPTIONS
    not_found = 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.
    MOVE: t_tab-kunnr TO g_tab_error-kunnr,
    l_message TO g_tab_error-messa.
    APPEND g_tab_error.
    ENDIF.
    ENDLOOP.
    REFRESH tab_error.
    CLEAR l_message.
    ENDLOOP.
    ENDFORM. "call_ctm
    *& Form sub
    text
    -->A text
    -->B text
    FORM sub USING a b.
    CLEAR tab_map.
    tab_map-program = a.
    tab_map-dynpro = b.
    tab_map-dynbegin = 'X'.
    APPEND tab_map.
    ENDFORM. "FORM
    " sub
    *& Form sub1
    text
    -->P_0579 text
    -->P_0580 text
    FORM sub1 USING c d.
    CLEAR tab_map.
    tab_map-fnam = c.
    tab_map-fval = d.
    APPEND tab_map.
    ENDFORM. " sub1
    *END-OF-SELECTION.
    *& Form disply_block_alv
    text
    --> p1 text
    <-- p2 text
    FORM disply_block_alv .
    PERFORM fill_fieldcatlog.
    PERFORM fill_fieldcatlog1.
    PERFORM call_block_alv.
    ENDFORM. " disply_block_alv
    *& Form fill_fieldcatlog
    text
    --> p1 text
    <-- p2 text
    FORM fill_fieldcatlog .
    PERFORM build_catlog USING l_pos 'G_TAB_CREATE' 'KUNNR' '16' text-004.
    PERFORM build_catlog USING l_pos 'G_TAB_CREATE' 'MESSA' '90' text-005.
    ENDFORM. " fill_fieldcatlog
    *& Form BUILD_CATLOG
    text
    -->P_L_POS text
    -->P_0844 text
    -->P_0845 text
    -->P_0846 text
    -->P_TEXT_004 text
    FORM build_catlog USING u_pos TYPE any
    value(u_0844) TYPE any
    value(u_0845) TYPE any
    value(u_0846) TYPE any
    u_text TYPE any.
    DATA: l_wa_fieldcatlog TYPE slis_fieldcat_alv.
    ADD 1 TO u_pos.
    l_wa_fieldcatlog-col_pos = u_pos.
    l_wa_fieldcatlog-tabname = u_0844.
    l_wa_fieldcatlog-fieldname = u_0845.
    l_wa_fieldcatlog-outputlen = u_0846.
    l_wa_fieldcatlog-reptext_ddic = u_text.
    APPEND l_wa_fieldcatlog TO l_tab_fieldcatlog.
    ENDFORM. " BUILD_CATLOG
    *& Form fill_fieldcatlog1
    text
    --> p1 text
    <-- p2 text
    FORM fill_fieldcatlog1 .
    PERFORM build_catlog1 USING l_pos 'G_TAB_ERROR' 'KUNNR' '16' text-004.
    PERFORM build_catlog1 USING l_pos 'G_TAB_ERROR' 'MESSA' '90' text-005.
    ENDFORM. " fill_fieldcatlog1
    *& Form build_catlog1
    text
    -->P_L_POS text
    -->P_0913 text
    -->P_0914 text
    -->P_0915 text
    -->P_TEXT_004 text
    FORM build_catlog1 USING u_pos TYPE any
    value(u_0913) TYPE any
    value(u_0914) TYPE any
    value(u_0915) TYPE any
    u_text TYPE any.
    DATA: l_wa_fieldcatlog1 TYPE slis_fieldcat_alv.
    ADD 1 TO u_pos.
    l_wa_fieldcatlog1-col_pos = u_pos.
    l_wa_fieldcatlog1-tabname = u_0913.
    l_wa_fieldcatlog1-fieldname = u_0914.
    l_wa_fieldcatlog1-outputlen = u_0915.
    l_wa_fieldcatlog1-reptext_ddic = u_text.
    APPEND l_wa_fieldcatlog1 TO l_tab_fieldcatlog1.
    ENDFORM. " build_catlog1
    *& Form CALL_BLOCK_ALV
    text
    --> p1 text
    <-- p2 text
    FORM call_block_alv .
    report = sy-repid.
    CLEAR l_events.
    l_wa_events-name = slis_ev_top_of_page.
    l_wa_events-form = 'TOP_OF_PAGE'.
    APPEND l_wa_events TO l_events.
    CLEAR l_wa_events.
    l_wa_events-name = slis_ev_top_of_page.
    l_wa_events-form = 'ETOP_OF_PAGE'.
    APPEND l_wa_events TO l_events1.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
    EXPORTING
    i_callback_program = report
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    IT_EXCLUDING =
    IF g_tab_create[] IS INITIAL.
    MESSAGE s101(zsmep).
    EXIT.
    ELSE.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
    is_layout = l_layout
    it_fieldcat = l_tab_fieldcatlog
    i_tabname = 'G_TAB_CREATE'
    it_events = l_events
    IT_SORT =
    I_TEXT = ' '
    TABLES
    t_outtab = g_tab_create
    EXCEPTIONS
    PROGRAM_ERROR = 1
    MAXIMUM_OF_APPENDS_REACHED = 2
    OTHERS = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDIF.
    IF g_tab_error[] IS INITIAL.
    MESSAGE s102(zsmep).
    ELSE.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
    is_layout = l_layout
    it_fieldcat = l_tab_fieldcatlog1
    i_tabname = 'G_TAB_ERROR'
    it_events = l_events1
    IT_SORT =
    I_TEXT = ' '
    TABLES
    t_outtab = g_tab_error
    EXCEPTIONS
    PROGRAM_ERROR = 1
    MAXIMUM_OF_APPENDS_REACHED = 2
    OTHERS = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    IS_PRINT =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    EXCEPTIONS
    PROGRAM_ERROR = 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. " CALL_BLOCK_ALV
    *& Form top_of_page
    text
    --> p1 text
    <-- p2 text
    FORM top_of_page .
    WRITE: 'Created Records'.
    ENDFORM. " top_of_page
    *& Form ETOP_OF_PAGE
    text
    --> p1 text
    <-- p2 text
    FORM etop_of_page .
    WRITE: 'Error Records'.
    ENDFORM. " ETOP_OF_PAGE
    *& Form gui_downlaod
    text
    --> p1 text
    <-- p2 text
    FORM gui_downlaod .
    MOVE file1 TO path1.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE =
    filename = path1
    filetype = 'ASC'
    APPEND = ' '
    write_field_separator = '|'
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = ' '
    WRITE_LF = 'X'
    COL_SELECT = ' '
    COL_SELECT_MASK = ' '
    DAT_MODE = ' '
    CONFIRM_OVERWRITE = ' '
    NO_AUTH_CHECK = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    WRITE_BOM = ' '
    TRUNC_TRAILING_BLANKS_EOL = 'X'
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
    IMPORTING
    FILELENGTH =
    TABLES
    data_tab = l_tab
    FIELDNAMES =
    EXCEPTIONS
    FILE_WRITE_ERROR = 1
    NO_BATCH = 2
    GUI_REFUSE_FILETRANSFER = 3
    INVALID_TYPE = 4
    NO_AUTHORITY = 5
    UNKNOWN_ERROR = 6
    HEADER_NOT_ALLOWED = 7
    SEPARATOR_NOT_ALLOWED = 8
    FILESIZE_NOT_ALLOWED = 9
    HEADER_TOO_LONG = 10
    DP_ERROR_CREATE = 11
    DP_ERROR_SEND = 12
    DP_ERROR_WRITE = 13
    UNKNOWN_DP_ERROR = 14
    ACCESS_DENIED = 15
    DP_OUT_OF_MEMORY = 16
    DISK_FULL = 17
    DP_TIMEOUT = 18
    FILE_NOT_FOUND = 19
    DATAPROVIDER_EXCEPTION = 20
    CONTROL_FLUSH_ERROR = 21
    OTHERS = 22
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. " gui_downlaod 
    this is one of the bdc method to upload data from notepad to sap.
    regards,
    seshu.

  • How to upload the heirarchy data in BW system

    Hi All,
    I want to download & upload the hierachy data in BW. How can we do this, Please let me know.
    Thanks in advance.
    Regards,
    Vishal

    Hi Vishal,
    Pls use BW07 & BW10 Tcodes for generating the Hierarchy Data Source in R/3.
    If its a set of hierarchy you can use tcode BW07 to generate datasoucre, and for standard hierachies you must be having datasources already created.
    Now just replicate datasoucre in BW side, and in infopckage selection you can get newly created hierarchy. Select and schedule it, it will be loaded into BW.
    For External Hierarchy in BW , download to Flatfild and then upload.
    The useful link:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0403a990-0201-0010-38b3-e1fc442848cb
    material hierarchy data source
    and:
    How to create a hierarchy datasource in R/3
    **PLS assign points,if info is useful***
    Regards
    CSM Reddy

  • How to upload past results data in SAP

    Hello All SAP GURUS......
    Actually earlier there was using a separate system for result recording of inspection lot. Now as upgraded to SAP Client want all old result entries should enter in SAP.
    The hierarchy of result recording is:-
    Ist Level:-     There are too many operation in an inspection lot.
    IInd Level:-   There are too many sampling point in an operation.
    IIIrd Level:-   There are too many MIC in a sampling point.
    IVth Level:-  There are too many dates in a MIC.
    Vth Level:-   There are too many times in a date.
    Now we have all these things as past data e.g. Inspection lot, Operation no, Sampling point, Date, Time, MIC and result.
    Actually we are also using a program but is is taking huge time for uploading the entries as 10000 entries in 20 hrs
    Please guide how can we make it fast.

    Dear Fire Fighter,
    Please find the coding which I using and program logic:-
    REPORT  ZBAPI_QE51N_DATA_INSERT NO STANDARD PAGE HEADING.
    INITIALIZATION.
      TYPE-POOLS SLIS.
      DATA: BEGIN OF ichar_results OCCURS 0.
              INCLUDE STRUCTURE BAPI2045D2.
      DATA: END OF ichar_results.
      DATA: BEGIN OF isingle_results OCCURS 0.
              INCLUDE STRUCTURE BAPI2045D4.
      DATA: END OF isingle_results.
      DATA: BEGIN OF bapireturn2 OCCURS 0.
              INCLUDE STRUCTURE bapiret2.
      DATA: END OF bapireturn2.
        DATA: BEGIN OF RET OCCURS 0.
              INCLUDE STRUCTURE bapiret2.
      DATA: END OF RET.
      DATA: BEGIN OF INSPPOINTDATA OCCURS 0.
              INCLUDE STRUCTURE BAPI2045L4.
      DATA: END OF INSPPOINTDATA.
      DATA: BEGIN OF ireturntable OCCURS 0.
              INCLUDE STRUCTURE bapiret2.
      DATA: END OF ireturntable.
      DATA : IT_EXCEL TYPE STANDARD TABLE OF ALSMEX_TABLINE,
             WA_EXCEL TYPE ALSMEX_TABLINE.
      SELECTION-SCREEN BEGIN OF BLOCK BLOCK1 WITH FRAME TITLE TEXT-001.
      SELECTION-SCREEN BEGIN OF BLOCK BLOCK2 WITH FRAME.
      PARAMETERS : P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
       SELECTION-SCREEN END OF BLOCK BLOCK2.
      SELECTION-SCREEN END OF BLOCK BLOCK1.
      SELECTION-SCREEN BEGIN OF LINE.
      SELECTION-SCREEN COMMENT 1(83) text-002 MODIF ID COM.
      SELECTION-SCREEN END OF LINE.
        SELECTION-SCREEN BEGIN OF LINE.
      SELECTION-SCREEN COMMENT 1(80) text-005 MODIF ID COM.
       SELECTION-SCREEN END OF LINE.
      TYPES :
      begin of it_type,
             p_oprnum type BAPI2045D2-inspoper,
             lot_num type BAPI2045L2-INSPLOT,
             samp type BAPI2045D4-EXT_NO,
             date type char10,
             time type char10,
             c_code1 type QIBPMERKNR,
             char1 type BAPI2045D4-RES_VALUE,
       end of it_type.
      DATA : IT_ITAB TYPE STANDARD TABLE OF IT_TYPE,
             WA_ITAB TYPE IT_TYPE,
             IT_ITABM TYPE STANDARD TABLE OF IT_TYPE,
             WA_ITABM TYPE IT_TYPE,
             charv like WA_ITAB-char1,
             sign.
      DATA : IT_ITABv TYPE STANDARD TABLE OF IT_TYPE,
             WA_ITABv TYPE IT_TYPE.
      TYPES : BEGIN OF FTYPE.
      INCLUDE TYPE IT_TYPE.
      TYPES : MES_TYPE(1),
             MESSAGE TYPE STRING.
      TYPES: END OF FTYPE.
      DATA : IT_FTAB TYPE STANDARD TABLE OF FTYPE,
             WA_FTAB TYPE FTYPE,
             STR TYPE STRING,
             rc type sy-tabix..
      data : p_oprnum type BAPI2045D2-inspoper,
             lot_num type BAPI2045L2-INSPLOT,
             c_code type QIBPMERKNR,
             char type BAPI2045D4-RES_VALUE,
             samp type BAPI2045D4-EXT_NO.
      DATA ITCAT TYPE SLIS_T_FIELDCAT_ALV.
      DATA FCAT_WA TYPE SLIS_FIELDCAT_ALV.
    AT SELECTION-SCREEN output.
      LOOP AT SCREEN.
      IF SCREEN-group1 = 'COM'.
          SCREEN-INTENSIFIED = 1.
          MODIFY SCREEN.
          ENDIF.
      ENDLOOP.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE .
      PERFORM VALUE_HELP .
    start-of-selection.
          PERFORM GET_DATA1.
      perform update_records_in_qe01.
      PERFORM ERROR_LIST_ALV.
    FORM UPDATE_RECORDS_IN_QE01 .
      SORT IT_ITAB BY LOT_NUM P_OPRNUM SAMP date time c_code1.
      DELETE ADJACENT DUPLICATES FROM IT_ITAB
      COMPARING  LOT_NUM P_OPRNUM SAMP date time c_code1.
      IT_ITABM[] = IT_ITAB[].
      SORT IT_ITABM BY LOT_NUM P_OPRNUM date time.
      DELETE ADJACENT DUPLICATES FROM IT_ITABM
      COMPARING  LOT_NUM P_OPRNUM .
      DATA : NUM(2) TYPE C.
      FIELD-SYMBOLS : <FS1> TYPE ANY,
                      <FS2> TYPE ANY.
      LOOP AT IT_ITAB INTO WA_ITAB.
        refresh: isingle_results,
        INSPPOINTDATA.
          isingle_results-insplot = WA_ITAB-lot_num.
          isingle_results-inspoper = WA_ITAB-p_oprnum.
          isingle_results-inspchar = WA_ITAB-C_CODE1.
          isingle_results-res_no = '0001'.
          isingle_results-RES_VALUAT = 'A'.
          clear :sign, charv.
          charv = WA_ITAB-CHAR1 .
          CONDENSE charv NO-GAPS.
          IF CHARV(1) = '<' OR
             CHARV(1) = '>'.
            SIGN = CHARV(1).
            CLEAR CHARV(1).
          CONDENSE charv NO-GAPS.
          ENDIF.
          isingle_results-RES_ATTR = sign.
          isingle_results-res_value = charv.
          APPEND isingle_results.
        INSPPOINTDATA-INSPLOT  = WA_ITAB-lot_num.
        INSPPOINTDATA-INSPOPER  = WA_ITAB-p_oprnum.
        INSPPOINTDATA-USERC1  = WA_ITAB-samp.
        CONCATENATE WA_ITAB-date6(4)  WA_ITAB-date3(2)
        WA_ITAB-date(2) INto  INSPPOINTDATA-USERD1 .
        CONCATENATE WA_ITAB-time(2) WA_ITAB-time3(2) WA_ITAB-time6(2) INTO
        INSPPOINTDATA-USERT1 .
    append INSPPOINTDATA.
        MOVE-CORRESPONDING WA_ITAB TO WA_FTAB.
    lot_num = WA_ITAB-lot_num.
    p_oprnum = WA_ITAB-p_oprnum.
        CALL FUNCTION 'BAPI_INSPOPER_RECORDRESULTS' "DESTINATION DEST
           EXPORTING
        INSPLOT = lot_num
        INSPOPER = p_oprnum
        INSPPOINTDATA = INSPPOINTDATA
        IMPORTING
        RETURN = bapireturn2
        TABLES
        SINGLE_RESULTS = isingle_results
        returntable    = ireturntable.
        LOOP AT bapireturn2.
          WRITE :/ bapireturn2-TYPE,
                   bapireturn2-MESSAGE.
        ENDLOOP.
        READ TABLE ireturntable WITH KEY
        TYPE = 'E'.
        IF SY-SUBRC = 0.
          WA_FTAB-MES_TYPE = ireturntable-TYPE.
          WA_FTAB-MESSAGE = ireturntable-MESSAGE.
          CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK' "DESTINATION DEST
           IMPORTING
             RETURN        = RET.
        ELSE.
          rc = rc + 1.
          str = rc.
          CONCATENATE '::' str '=>'  'Records updated' into str.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'  "DESTINATION DEST
            EXPORTING
              WAIT   = 'X'
            IMPORTING
              RETURN = bapireturn2.
          WA_FTAB-MES_TYPE = 'S'.
          WA_FTAB-MESSAGE = 'Record successfully created'.
       CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
           PERCENTAGE       = rc
           TEXT             = str.
        ENDIF.
    append wa_ftab to it_ftab.
      ENDLOOP.
    ENDFORM.                    " UPDATE_RECORDS_IN_QE01
    FORM VALUE_HELP .
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          PROGRAM_NAME  = SYST-CPROG
          DYNPRO_NUMBER = SYST-DYNNR
          FIELD_NAME    = 'P_FILE'
        IMPORTING
          FILE_NAME     = P_FILE.
    ENDFORM.                    " VALUE_HELP
               " GET_DATA
    FORM ERROR_LIST_ALV .
    DATA : TITLE TYPE LVC_TITLE .
    CLEAR : STR.
    STR = RC.
    CONCATENATE 'Total : ' STR ' records updated' into str.
    TITLE = STR.
      PERFORM FCAT_FILL.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME                        = 'C:\lims_error_log.xls'
       WRITE_FIELD_SEPARATOR           = 'X'
      TABLES
        DATA_TAB                        = IT_FTAB
    IF SY-SUBRC <> 0.
    ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = SY-CPROG
       I_GRID_TITLE                      = TITLE
         IT_FIELDCAT                       = ITCAT
        TABLES
          T_OUTTAB                          = IT_FTAB
      IF SY-SUBRC <> 0.
      ENDIF.
    ENDFORM.                    " ERROR_LIST_ALV
    FORM FCAT_FILL .
    perform append_fcat using 'P_OPRNUM' 'Operation Number'.
    perform append_fcat using 'LOT_NUM' 'Lot Number'.
    perform append_fcat using 'SAMP' 'Sampling point'.
    perform append_fcat using 'DATE' 'Sampling Date'.
    perform append_fcat using 'TIME' 'Sampling Time'.
    perform append_fcat using 'C_CODE1' 'CODE 1'.
    perform append_fcat using 'CHAR1'  'Value 1'.
    perform append_fcat using 'MES_TYPE' 'Message Type'.
    perform append_fcat using 'MESSAGE' 'Messages'.
    ENDFORM.                    " FCAT_FILL
    FORM GET_DATA1 .
    data file type string.
    file = p_file.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
           PERCENTAGE       = 0
           TEXT             = TEXT-111.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = file
       HAS_FIELD_SEPARATOR           = 'X'
      TABLES
        DATA_TAB                      = it_itab
    IF SY-SUBRC <> 0.
    ENDIF.
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
           PERCENTAGE       = 0
           TEXT             = TEXT-112.
    ENDFORM.                    " GET_DATA1
    FORM APPEND_FCAT  USING    P_VAL1
                               P_VAL2.
    FCAT_WA-FIELDNAME = P_VAL1.
      FCAT_WA-SELTEXT_M = P_VAL2.
      APPEND FCAT_WA TO ITCAT.
      CLEAR FCAT_WA.
    ENDFORM.                    " APPEND_FCAT
    Please suggest.
    Edited by: vivekrastogi on Mar 16, 2011 5:30 AM

  • How do I import binary data files (with header info) into DIAdem?

    We have lots of data acquired by nCode datagate. Files are binary data with header info. How do I import this into DIAdem? Typical (short) file attached. Also of interest, can I stream data from Sony PC208/SIR1000 recorders?
    Attachments:
    Propshft.dac ‏4 KB

    I have successfully imported your file into DIAdem using the nCode file filter included with DIAdem. You might have to make that file filter known to DIAdem by following these steps (this assumes you have version 8 of DIAdem):
    1. Go to the 'Window' menu in DIAdem and select 'Close all'
    2. Go to the 'Settings' menu and select 'GPI-DLL Registration'
    3. Click the 'Add' button in the window and select the 'GfSnCode' DLL in the 'DIAdem/AddInfo' directory
    4. The program will prompt you to restart.
    5. After you have restarted DIAdem, go to the DATA icon, select 'File - Open' from the DATA menu and in the dialog that appears, choose 'nSoft Data File Format' in the 'Files of type:' field.
    6. Select your data file and load
    That's it.
    With regards to your Sony reco
    rder data, I would need to get my hands on an actual data file to try it out. In general, DIAdem can import ANY binary file format by creating a header in the 'File - Import via header' section in DATA. If you have lots of data files from the SONY recorder, a DLL can be created for that specific file format with the free DLL toolkit included with DIAdem.
    Leave me a message here if you have any additional questions.
    Otmar
    Otmar D. Foehner
    Business Development Manager
    DIAdem and Test Data Management
    National Instruments
    Austin, TX - USA
    "For an optimist the glass is half full, for a pessimist it's half empty, and for an engineer is twice bigger than necessary."

Maybe you are looking for

  • Wrong Work center picking up Time sheet

    Hi Scenario is as follows: Earlier Employee has HR assignment to one Work center 1 -WC1 Later, Employee was Assigned to Work center 2- WC2 Problem: When booking time sheet in CAT2 ,  for service order, WC1 was picking up, even though in Service order

  • Adobe Indesign local.storage html

    Hi all I'm developing a new extension with Extension Builder 3 for Indesign CC 2014 Does anyone knows were phisically is placed the html5 "local storage" file for Indesign CC 2014 extension, and wich can be it's name? Is there someting that can delet

  • Lost my histogram edit screen in Aperture

    For some strange reason I no longer have the ability to edit the historgram in any of my photos in aperture and I have no idea why. I can't seem to find any command on the menu that I may have inadvertently turned off. Can anyone help getting back th

  • Flash Plugin - Firefox - WebCam

    I have successfully installed the Flash plugin for Firefox. When I see a cam feed, I do get the 'Settings' popup. When I chose the Cam tab I do see the select drop down to choose a camera. However.... The current chosen option is my Hauppauge TV app.

  • Cancellation of Production Order confirmation (CO13) not generating TR/TO

    Hi, We are facing a typical issue in the PP-WM interface. When we create an order and confirm it (partial confirmation), the Goods movement happens (261 mvt type) as desired and the TO is created and confirmed in the background. But, when we try to r