PLS-00497: cannot mix between single row and multi-row (BULK) in INTO list

Hi,
I have a requirement to send a table data through mail,
so am using execute statement after opening the connection and am using the following PLSQL code, which am failing to execute successfully.
My code goes like this.
    0            10            20           30           40            50
1  CREATE OR REPLACE PROCEDURE SEND_TABLE_DATA( FROMAD IN VARCHAR2,
2   TOAD IN VARCHAR2,
3   SUBJECT IN VARCHAR2,
4   MESSAGE IN VARCHAR2,
5   DOCID IN VARCHAR2,
6   DOCDT IN DATE,
7   PRODOAID IN NUMBER )
8   AS
9   BATCHNO  VARCHAR2(32767);
10  PCSBOX  NUMBER;
11  AMOUNT  NUMBER;
12  SMTPHOST VARCHAR2(255) := 'XXX.XXX.X.XXX' ;
13  A UTL_SMTP.CONNECTION ;
14  BEGIN
15  A :=UTL_SMTP.OPEN_CONNECTION(SMTPHOST,25);
16  UTL_SMTP.HELO(A,SMTPHOST);
17  UTL_SMTP.MAIL(A,FROMAD);
18  UTL_SMTP.RCPT(A,TOAD);
19  UTL_SMTP.OPEN_DATA(A);
20  UTL_SMTP.WRITE_DATA(A, CHR(13) ||CHR(13) || CHR(13) );
21  UTL_SMTP.WRITE_DATA (A,'Date: '|| TO_CHAR(SYSDATE,'DD/MM/YYYY HH24:MI:SS') || CHR(13) );
22  UTL_SMTP.WRITE_DATA(A,'From: '||FROMAD|| CHR(13) );
23  UTL_SMTP.WRITE_DATA(A, 'To: '||TOAD|| CHR(13) );
24  UTL_SMTP.WRITE_DATA(A, 'Subject: '|| SUBJECT || CHR(13) );
25  UTL_SMTP.WRITE_DATA(A,MESSAGE||DOCID||' Documented on '||DOCDT||CHR(13) );
26  UTL_SMTP.WRITE_DATA(A,CHR(13) || CHR(13) || CHR(13) );
27  UTL_SMTP.WRITE_DATA(A,'This is for your information'||CHR(13) );
28  UTL_SMTP.WRITE_DATA (A,' BATCHNO '|| ' -- '||' PCSBOX '||' -- '||' AMOUNT '||CHR(13) );
29  EXECUTE IMMEDIATE
30         'SELECT
31       A.BATCHNO,B.PCSBOX,B.AMOUNT
32        FROM
33      SCHEMA1.TABLEX A,SCHEMA2.TABLEY B
34        WHERE
35       A.BATCHID=B.BATCHNO AND B.PRODOAID='|| PRODOAID
36     BULK COLLECT INTO BATCHNO,PCSBOX,AMOUNT;
37  FOR indx IN 1..BATCHNO.COUNT
38   LOOP
39    UTL_SMTP.WRITE_DATA (A,BATCHNO(indx)|| ' -- '||PCSBOX(indx)||' -- '||AMOUNT(indx)||CHR(13) );
40   END LOOP;
41  UTL_SMTP.WRITE_DATA( A,CHR(13) || CHR(13) || CHR(13) );
42  UTL_SMTP.CLOSE_DATA(A);
43  UTL_SMTP.QUIT(A);
44  EXCEPTION
45  WHEN OTHERS THEN
46  UTL_SMTP.QUIT(A);
47  RAISE;
48  END;
49  /
SELECT * FROM USER_ERRORS
NAME                       TYPE             SEQUENCE    LINE         POSITION        TEXT                                                                                                             ATTRIBUTE                 MESSAGE_NUMBER
SEND_TABLE_DATA
PROCEDURE
3
37
1
PL/SQL: Statement ignored
ERROR
0
SEND_TABLE_DATA
PROCEDURE
2
37
24
PLS-00487: Invalid reference to variable 'BATCHNO'
ERROR
487
SEND_TABLE_DATA
PROCEDURE
1
36
25
PLS-00497: cannot mix between single row and multi-row (BULK) in INTO list
ERROR
497
Thanks In Advance
Regards
Pradeep.

> 29  EXECUTE IMMEDIATE
> 30         'SELECT
> 31       A.BATCHNO,B.PCSBOX,B.AMOUNT
> 32        FROM
> 33      SCHEMA1.TABLEX A,SCHEMA2.TABLEY B
> 34        WHERE
> 35       A.BATCHID=B.BATCHNO AND B.PRODOAID='|| PRODOAID
> 36     BULK COLLECT INTO BATCHNO,PCSBOX,AMOUNT;
The variables BATCHNO, PCSBOX and AMOUNT are defined as scalar variables. Check there definition
> 9   BATCHNO  VARCHAR2(32767);
> 10  PCSBOX  NUMBER;
> 11  AMOUNT  NUMBER;
You cannot use BULK COLLECT on scalar variables. The variables must be defined as a COLLECTION TYPE in order to perform bulk collect.

Similar Messages

  • How to do data migration between single node and multi node HANA systems ?

    Data migration between single node and multi node HANA systems ?
    What are limitations ?
    What should be the best practices ?

    Data migration between single node and multi node HANA systems ?
    What are limitations ?
    What should be the best practices ?

  • DIFFERENCE BETWEEN SINGLE LEVEL AND MULTI LEVEL COSTING

    Sir,'
    Please explain the difference between Single Level and Multi Level Costing in Detail
    thanking You

    While using material ledger, we can use the single level or multi-level price determination for valuation of inventory.
    Procurement processes are used in Product Cost Controlling to determine procurement costs and to present those costs. Purchase Order, for example, is single-level procurement and Production is multilevel procurement.
    Single-level material price determination calculates the periodic unit price for a material. The standard price and the cumulative single-level differences of the period are taken into account. Single-level material price determination takes into account the differences that arise directly when a material is procured.
    Multilevel price determination calculates the periodic unit price for a material. The standard price, the single-level differences cumulated in the period, the differences between planned and actual prices, as well as input material differences (multilevel differences) are all taken into account.
    Single-level material price determination  is a prerequisite for Multi-level price determination.

  • Disk Utilty - what is difference between single volume and single partition

    In Disk Utility I can, should I wish, format a drive by using Erase to create a single volume. Also in Disk Utility, I have the option to use Partition to create one (or more) partition.
    What is the difference between a volume and a single partition?
    What are their relative merits?
    In what circumstances would I want to create a single partition instead of a volume?
    Disk Utility also prompts me to name the volume or partition. From experience, what would you suggest as a suitable name and where is this information subsequently used?

    A "volume" or "partition" are the same thing. The subject of using partitions has been covered many times on the forums. Do some searching and you'll find quite a lot of information. Also try doing some Google searching.

  • How to differentiate between Single click and double click event in List

    I am facing a problem while using list in awt.
    I want to execute some code on single click and other on double click but when double click event occurs it also executes the single click code.
    because i have added both actionlistener and itemlistener on the list.
    How to sort out this problem.
    please help me out.
    Thanks buddies.

    Hello Meeraj_Kanaparthi
    Thanks for helping i m giving u the code i have tried.
    Plz help me on this...
    Thanks........
    import java.awt.*;
    import java.awt.event.*;
    class CheckList extends Frame implements MouseListener
         List l1;
         int x;
         int y;
         CheckList()
         setSize(500,500);
         setLayout(new FlowLayout());
         l1=new List(10);
         add(l1);
         l1.add("Item 1");l1.add("Item 2");l1.add("Item 3");l1.add("Item 4");l1.add("Item 5");
         x=6;
         y=0;
         l1.addMouseListener(this);
    //     l1.addItemListener(this);
         show();
         public void execute(int y)
         if(y==1)
         {System.out.println("3");
              l1.remove(l1.getSelectedIndex());
         if(y==2)
         {System.out.println("4");
              l1.add("item " + x);
              x++;
         public void mousePressed(MouseEvent e)
              System.out.println("Pressed");
         public void mouseReleased(MouseEvent e)
              System.out.println("Released");
         public void mouseEntered(MouseEvent e) {}
         public void mouseExited(MouseEvent e) {}
         public void mouseClicked(MouseEvent e)
         if (e.getClickCount()==1)
              System.out.println("1");
              y=1;
         if (e.getClickCount() == 2)
         {System.out.println("2");
              y=2;
              execute(y);
         public void actionPerformed(ActionEvent ae)
         public void itemStateChanged(ItemEvent it)
         public static void main(String ag[])
         new CheckList();
    }

  • Cannot switch between long headers and default headers

    I am having a problem switching between long headers and default headers. No matter what I choose under view-->message--> long headers / default headers, they always remain long. Any solution? It's driving me crazy.
    David

    What are your Preferences > Viewing > Show header detail settings?
    Does the problem persist if you restart Mail?

  • Single level and multi level price determination

    Hi,
    Regarding single level and multilevel price determination, how system is arriving the figure of some portion to single level and some portion to multilevel. Can any one clarify the concept.
    govind.

    Hi
    Find below my clarification.
    Multilevel price determination calculates the periodic unit price for a material. The standard price, the single-level differences cumulated in the period, the differences between planned and actual prices, as well as input material differences (multilevel differences) are all taken into account. The material price calculated in multilevel price determination can be used for inventory valuation.
    Follwing are Prerequisites\
    The material ledger is active.
    Actual costing is active.
    The price determination indicator in the material master is set to 3.
    The price control indicator in the material master is set to S.
    Single-level price determination has been performed.
    Following are the fartures
    A level is identified by a material and its associated procurement process. Multiple levels are the result of one material being used in another material. These multiple levels are reflected in the actual BOM that is created in the costing run in the step Determine Sequence.
    In multilevel production, both single-level and multilevel price differences exist. If one material is used in another material, and single-level price differences exist for the input material, this results in multilevel price differences. In this way, differences are rolled up from raw materials through semifinished products to finished products. This solves the problem of follow-up costs.
    The price calculated through price determination is updated as a periodic unit price (V price) in the Accounting 1 view of the material master record The price control indicator remains set to S. The standard price does not change.
    Regards
    Deepak

  • Cannot encode double & single quote " and ' using htmldb_util.url_encode()

    Hello,
    I'm using HTMLDB 1.5.0.00.33 on Oracle 9.2.0.6 database. The data(a sql query that populates the report page) that I want to pass as part of URL string contains special characters like #, $, % and quotes " or '. I'm using htmldb_util.url_encode() to encode the data and it works fine for special characters except for " & '. Can someone please help in this? Below sql query shows that.
    SQL>select htmldb_util.url_encode('A%"#') from dual;
    HTMLDB_UTIL.URL_ENCODE('A%"#')
    A%25"%23
    1 row selected.
    Thanks
    Shashin

    Shashin,
    You could try using the UTL_URL.Escape function with the escape_reserved_chars parameter set to TRUE. That should encode the reserved characters.
    See the documentation here: http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_url.htm#sthref15935
    If you want to call it from a SQL statement, you'll need to wrap it in a function like this:
    function MyURLEscape(URL varchar2) return varchar2 is
       Result varchar2(4000);
    begin
       Result := UTL_URL.Escape(URL, TRUE);
       return(Result);
    end MyURLEscape;

  • HT1349 Why bluetooth cannot connect between MacBook Pro and iPhone 3? If I need how?

    I'm trying to connect ipnone 3 and MACBook Pro through bluetooth for photo transfer...but unable to recongnise, please advise?

    "I tried enabling Bluetooth on my MacBook Pro and iPhone, thinking I could file transfer some photographs."
    This is not a feature of iphone.  Never has been.
    Other than tethering for internet, where provided by the carrier, you cannot connect to a computer/device/phone and do anything.
    Bluetooth is for handsfree telephone devices/headsets, stereo speakers/headsets, some keyboards, some peer to peer apps from the app store and tethering where provided by the carrier.

  • Comparision between single Plant and multiplant.

    I am doing practice for creation of one organization structure,
    At the starting i have one plant under which their are 3 storage location located in different cities.
    The Value of material is same in all cities, now i think define each storage location as plant, then what effect will get on the  
    business.
    Can anyone explain  me the advantages of multi -plant against single plant?
    which process is beneficiary for business process?
    Thanks;
    Baya Jo.

    Hi
    At the starting i have one plant under which their are 3 storage location located in different cities
    1 ) see first storage location never situated far way from plant its in different cities it should be plant or warehouse or depo
    If manufacturing activities happen there then it should be plant
    If its only for saleing purpose ,then it will depo ,or only storing purpose it will warehouse
    pupose of this ( if you have all three plants ,you get valuvation differntly for each plant )
    If you have single plant ,no mater but valuvation will be at single plant level,you cannt get valuvation per citied for you business for you material and releates things
    my suggestion consider it plant or depo if it in differnt cities
    Regards
    Kailas Ugale

  • Cannot connect between macbook pro and iMac via sharing

    In finder on desktop I can access my laptop as a registered user, but I can't access my Desktop form my Laptop as a registered user.  The password I use to install software dosn't work to change from guest to registered user.   Help

    Hi mike197373,
    Welcome to the Support Communities!
    The articles below may be able to help you with this issue.
    Click on the links to see more details and screenshots. 
    Mac Basics: File Sharing
    http://support.apple.com/kb/HT1549?viewlocale=en_US
    OS X: Changing or resetting an account password
    http://support.apple.com/kb/HT1274
    Cheers,
    - Judy

  • Getting Error Cannot coerce between type 50 and type 32

    declare
      soap_request varchar2(30000);
      resp XMLType;
      v_num varchar2(30);
      begin
      soap_request := '
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <SOAP-ENV:Body>
          <rpc:ZEB_spcCalculate_spcPriceResponse xmlns:rpc="http://siebel.com/asi/">
             <Currency>EUR</Currency>
             <Total_spcPrice>2700</Total_spcPrice>
          </rpc:ZEB_spcCalculate_spcPriceResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
        resp:= XMLType(soap_request);
        select resp.extract('/SOAP-ENV:Envelope/SOAP-ENV:Body/rpc:ZEB_spcCalculate_spcPriceResponse/Currency/text()','xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:rpc="http://siebel.com/asi/"') into v_num from dual;
        dbms_output.put_line(v_num);
        end;If I run the code it will give the error.
    But I Change the select statement to below it runs fine.
    select to_number(resp.extract('/SOAP-ENV:Envelope/SOAP-ENV:Body/rpc:ZEB_spcCalculate_spcPriceResponse/Total_spcPrice/text()','xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:rpc="http://siebel.com/asi/"')) into v_num from dual;What is wrong..
    Can someone pls tell.
    Thanks

    Here's the working version of your example
    declare
      soap_request varchar2(30000);
      resp XMLType;
      v_num varchar2(30);
      begin
      soap_request := '
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <SOAP-ENV:Body>
          <rpc:ZEB_spcCalculate_spcPriceResponse xmlns:rpc="http://siebel.com/asi/">
             <Currency>EUR</Currency>
             <Total_spcPrice>2700</Total_spcPrice>
          </rpc:ZEB_spcCalculate_spcPriceResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
        resp:= XMLType(soap_request);
        select resp.extract('/SOAP-ENV:Envelope/SOAP-ENV:Body/rpc:ZEB_spcCalculate_spcPriceResponse/Total_spcPrice/text()','xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rpc="http://siebel.com/asi/"').getNumberVal()
          into v_num
          from dual;
        dbms_output.put_line(v_num);
        end;Changes
    1) You only need to include namespaces that are referenced in the associated XPath so I removed two of them from your sample
    2) Your first sample used Currency which is a text value of "EUR", hence the error.
    3) I added .getNumberVal() to translate the Total_spcPrice into a Number.
    4) Look at my method 3 example in {message:id=2826611} for a way to parse this as an XMLType within the PL/SQL code. I also have an example at {message:id=3610259}

  • Outline of a drawing that is a mix between calligraphic brush and scatter brush

    Hello!
    Ok so, I made a drawing using a scatter brush and a calligraphic brush, it is all black, what I need now is to get the outline of the drawing as a whole! how do I do that? thank you!

    fefy,
    When I select two paths, one that has a calligraphic brush applied and one that has a scatter brush applied, and Object>Expand Appearance (remember to select the latter path itself rather than the scattered appearances), I get two groups:
    One group contains a closed path with the shape of the calligraphic brush and then a nostroke/nofill version of the original path.
    The other group contains individual objects that are (copies of) the object used for the scatter brush, with the same positions and shapes as in the unexpanded brushed path, and then a nostroke/nofill version of the original path.
    In other words, the same appearance, only expanded to individual objects
    What do you get?

  • LINKING BETWEEN FUNCTION MODULE AND INTERACTIVE NO. OF BASIC LIST

    Dear Mates,
    Iam preparing Z report for BOM display of FG and SFG materials.
    Iam displaying the Basic List using the MAST table. Here i double click on the material no.
    Here iam using the function module :CS_BOM_EXPL_MAT_V2 for fetching the data from STPOX structure ,here i want to link material no. which has been from basic list and the above said function module. 
    Can anybody provide the solution for the above said linking in ALV interactive report.
    Please treat it very urgent as this report is to be presented on high priority.
    Thanks in advance
    Subbu

    Hi
    use the Function module REUSE_ALV_POPUP_TO_SELECT.
    check the below example:
    REPORT ZSR_ALV_INTERACTIVE.
    TABLES : LFA1,EKKO,EKPO.
    SELECT-OPTIONS : VENDOR FOR LFA1-LIFNR.
    DATA : BEGIN OF ITAB OCCURS 0,
    LIFNR LIKE LFA1-LIFNR,
    NAME1 LIKE LFA1-NAME1,
    END OF ITAB.
    DATA : BEGIN OF JTAB OCCURS 0,
    EBELN LIKE EKKO-EBELN,
    AEDAT LIKE EKKO-AEDAT,
    END OF JTAB.
    DATA : BEGIN OF KTAB OCCURS 0,
    EBELP LIKE EKPO-EBELP,
    MATNR LIKE EKPO-MATNR,
    END OF KTAB.
    TYPE-POOLS : SLIS.
    DATA : REPID LIKE SY-REPID.
    DATA :LFA1_B TYPE SLIS_T_FIELDCAT_ALV,
    LFA1_W TYPE SLIS_FIELDCAT_ALV,
    EKKO_B TYPE SLIS_T_FIELDCAT_ALV,
    EKKO_W TYPE SLIS_FIELDCAT_ALV,
    EKPO_B TYPE SLIS_T_FIELDCAT_ALV,
    EKPO_W TYPE SLIS_FIELDCAT_ALV,
    EVENTS_B TYPE SLIS_T_EVENT,
    EVENTS_W TYPE SLIS_ALV_EVENT.
    PERFORM GET_VAL.
    REPID = SY-REPID.
    SELECT LIFNR NAME1 FROM LFA1 INTO TABLE ITAB WHERE LIFNR IN VENDOR.
    *perform val USING USER_COMMAND sel.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = REPID
    IT_FIELDCAT = LFA1_B
    IT_EVENTS = EVENTS_B
    TABLES
    T_OUTTAB = ITAB.
    *& Form GET_VAL
    text this is to put column headings
    FORM GET_VAL.
    LFA1_W-FIELDNAME = 'LIFNR'.
    LFA1_W-REF_TABNAME = 'LFA1'.
    LFA1_W-REF_FIELDNAME = 'LIFNR'.
    APPEND LFA1_W TO LFA1_B.
    LFA1_W-FIELDNAME = 'NAME1'.
    LFA1_W-REF_TABNAME = 'LFA1'.
    LFA1_W-REF_FIELDNAME = 'NAME1'.
    APPEND LFA1_W TO LFA1_B.
    EKKO_W-FIELDNAME = 'EBELN'.
    EKKO_W-REF_TABNAME = 'EKKO'.
    EKKO_W-REF_FIELDNAME = 'EBELN'.
    APPEND EKKO_W TO EKKO_B.
    EKKO_W-FIELDNAME = 'AEDAT'.
    EKKO_W-REF_TABNAME = 'EKKO'.
    EKKO_W-REF_FIELDNAME = 'AEDAT'.
    APPEND EKKO_W TO EKKO_B.
    EKPO_W-FIELDNAME = 'EBELP'.
    EKPO_W-REF_TABNAME = 'EKPO'.
    EKPO_W-REF_FIELDNAME = 'EBELP'.
    APPEND EKPO_W TO EKPO_B.
    EKPO_W-FIELDNAME = 'MATNR'.
    EKPO_W-REF_TABNAME = 'EKPO'.
    EKPO_W-REF_FIELDNAME = 'MATNR'.
    APPEND EKPO_W TO EKPO_B.
    EVENTS_W-NAME = 'USER_COMMAND'.
    EVENTS_W-FORM = 'VAL'.
    APPEND EVENTS_W TO EVENTS_B.
    ENDFORM. "GET_VAL
    *& Form VAL
    text
    -->USER_COMMANtext
    -->SEL text for retrieving data
    FORM VAL USING USER_COMMAND LIKE SY-UCOMM SEL TYPE SLIS_SELFIELD.
    DATA : VEN(10) TYPE N,
    PO(10) TYPE N.
    DATA : MAT(10) TYPE C.
    IF SEL-FIELDNAME = 'LIFNR'.
    VEN = SEL-VALUE.
    SELECT EBELN AEDAT FROM EKKO INTO TABLE JTAB WHERE LIFNR = VEN.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = REPID
    I_STRUCTURE_NAME = EKKO_B
    IT_FIELDCAT = EKKO_B
    IT_EVENTS = EVENTS_B
    TABLES
    T_OUTTAB = JTAB.
    ENDIF.
    IF SEL-FIELDNAME = 'EBELN'.
    PO = SEL-VALUE.
    SELECT EBELP MATNR FROM EKPO INTO TABLE KTAB WHERE EBELN = PO.
    CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
    EXPORTING
    I_TITLE = 'ITEM DETAILS'
    I_TABNAME = 'EKPO'
    IT_FIELDCAT = EKPO_B
    I_CALLBACK_PROGRAM = REPID
    IMPORTING
    ES_SELFIELD = SEL
    TABLES
    T_OUTTAB = KTAB.
    ENDIF.
    logic to select a record
    IF SEL-FIELDNAME = 'MATNR'.
    MAT = SEL-VALUE.
    SET PARAMETER ID 'MAT' FIELD MAT.
    CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
    ENDIF.
    ENDFORM. "VAL
    check my example:
    REPORT ZSR_ALV_INTERACTIVE.
    TABLES : LFA1,EKKO,EKPO.
    SELECT-OPTIONS : VENDOR FOR LFA1-LIFNR.
    DATA : BEGIN OF ITAB OCCURS 0,
    LIFNR LIKE LFA1-LIFNR,
    NAME1 LIKE LFA1-NAME1,
    END OF ITAB.
    DATA : BEGIN OF JTAB OCCURS 0,
    EBELN LIKE EKKO-EBELN,
    AEDAT LIKE EKKO-AEDAT,
    END OF JTAB.
    DATA : BEGIN OF KTAB OCCURS 0,
    EBELP LIKE EKPO-EBELP,
    MATNR LIKE EKPO-MATNR,
    END OF KTAB.
    TYPE-POOLS : SLIS.
    DATA : REPID LIKE SY-REPID.
    DATA :LFA1_B TYPE SLIS_T_FIELDCAT_ALV,
    LFA1_W TYPE SLIS_FIELDCAT_ALV,
    EKKO_B TYPE SLIS_T_FIELDCAT_ALV,
    EKKO_W TYPE SLIS_FIELDCAT_ALV,
    EKPO_B TYPE SLIS_T_FIELDCAT_ALV,
    EKPO_W TYPE SLIS_FIELDCAT_ALV,
    EVENTS_B TYPE SLIS_T_EVENT,
    EVENTS_W TYPE SLIS_ALV_EVENT.
    PERFORM GET_VAL.
    REPID = SY-REPID.
    SELECT LIFNR NAME1 FROM LFA1 INTO TABLE ITAB WHERE LIFNR IN VENDOR.
    *perform val USING USER_COMMAND sel.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = REPID
    IT_FIELDCAT = LFA1_B
    IT_EVENTS = EVENTS_B
    TABLES
    T_OUTTAB = ITAB.
    *& Form GET_VAL
    text this is to put column headings
    FORM GET_VAL.
    LFA1_W-FIELDNAME = 'LIFNR'.
    LFA1_W-REF_TABNAME = 'LFA1'.
    LFA1_W-REF_FIELDNAME = 'LIFNR'.
    APPEND LFA1_W TO LFA1_B.
    LFA1_W-FIELDNAME = 'NAME1'.
    LFA1_W-REF_TABNAME = 'LFA1'.
    LFA1_W-REF_FIELDNAME = 'NAME1'.
    APPEND LFA1_W TO LFA1_B.
    EKKO_W-FIELDNAME = 'EBELN'.
    EKKO_W-REF_TABNAME = 'EKKO'.
    EKKO_W-REF_FIELDNAME = 'EBELN'.
    APPEND EKKO_W TO EKKO_B.
    EKKO_W-FIELDNAME = 'AEDAT'.
    EKKO_W-REF_TABNAME = 'EKKO'.
    EKKO_W-REF_FIELDNAME = 'AEDAT'.
    APPEND EKKO_W TO EKKO_B.
    EKPO_W-FIELDNAME = 'EBELP'.
    EKPO_W-REF_TABNAME = 'EKPO'.
    EKPO_W-REF_FIELDNAME = 'EBELP'.
    APPEND EKPO_W TO EKPO_B.
    EKPO_W-FIELDNAME = 'MATNR'.
    EKPO_W-REF_TABNAME = 'EKPO'.
    EKPO_W-REF_FIELDNAME = 'MATNR'.
    APPEND EKPO_W TO EKPO_B.
    EVENTS_W-NAME = 'USER_COMMAND'.
    EVENTS_W-FORM = 'VAL'.
    APPEND EVENTS_W TO EVENTS_B.
    ENDFORM. "GET_VAL
    *& Form VAL
    text
    -->USER_COMMANtext
    -->SEL text for retrieving data
    FORM VAL USING USER_COMMAND LIKE SY-UCOMM SEL TYPE SLIS_SELFIELD.
    DATA : VEN(10) TYPE N,
    PO(10) TYPE N.
    DATA : MAT(10) TYPE C.
    IF SEL-FIELDNAME = 'LIFNR'.
    VEN = SEL-VALUE.
    SELECT EBELN AEDAT FROM EKKO INTO TABLE JTAB WHERE LIFNR = VEN.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = REPID
    I_STRUCTURE_NAME = EKKO_B
    IT_FIELDCAT = EKKO_B
    IT_EVENTS = EVENTS_B
    TABLES
    T_OUTTAB = JTAB.
    ENDIF.
    IF SEL-FIELDNAME = 'EBELN'.
    PO = SEL-VALUE.
    SELECT EBELP MATNR FROM EKPO INTO TABLE KTAB WHERE EBELN = PO.
    CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
    EXPORTING
    I_TITLE = 'ITEM DETAILS'
    I_TABNAME = 'EKPO'
    IT_FIELDCAT = EKPO_B
    I_CALLBACK_PROGRAM = REPID
    IMPORTING
    ES_SELFIELD = SEL
    TABLES
    T_OUTTAB = KTAB.
    ENDIF.
    logic to select a record
    IF SEL-FIELDNAME = 'MATNR'.
    MAT = SEL-VALUE.
    SET PARAMETER ID 'MAT' FIELD MAT.
    CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
    ENDIF.
    ENDFORM. "VAL

  • How to fix "cannot convert between unicode and non-unicode string data types" :/

    Environment: SQL Server 2008 R2
    Introduction:Staging_table is a table where data is being stored from source file. Individual and ind_subject_scores are destination tables.
    Purpose: To load the data from a source file .csv while SSIS define table  fields with 50 varchar, I can still transfer the data to the entity table/ destination and keeping the table definition.
    I'm getting validation error "Cannot convert between a unicode and a non-unicode string data types" for all the columns.
    Please help

    Hi ,
    NVARCHAR = DT_WSTR
    VARCHAR = DT_STR
    Try below links:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/ed1caf36-7a62-44c8-9b67-127cb4a7b747/error-on-package-can-not-convert-from-unicode-to-non-unicode-string-type?forum=sqlintegrationservices
    http://social.msdn.microsoft.com/Forums/en-US/eb0d1519-4be3-427d-bd30-ae4004ea9e8d/data-conversion-error-how-to-fix-this
    http://technet.microsoft.com/en-us/library/aa337316(v=sql.105).aspx
    http://social.technet.microsoft.com/wiki/contents/articles/19612.ssis-import-excel-to-table-cannot-convert-between-unicode-and-non-unicode-string-data-types.aspx
    sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.

Maybe you are looking for