How to retrieve the values from a table if they differ in Unit of Measure

How to retrieve the values from a table if they differ in Unit of Measure?

If no data is read
- Insure that you use internal code in SELECT statement, check via SE16 desactivating conversion exit on table T006A. ([ref|http://help.sap.com/saphelp_nw70/helpdata/en/2a/fa0122493111d182b70000e829fbfe/frameset.htm])
If no quanity in result internal table
- There is no adqntp field in the internal table, so no quantity is copied in itab ([ref|http://help.sap.com /abapdocu_70/en/ABAPINTO_CLAUSE.htm#&ABAP_ALTERNATIVE_1@1@]).
- - Remove the CORRESPONDING, so quantity will fill the first field adqntp1.  ([ref|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_WA.htm])
- - Then loop at the internal table and move the quantity when necessary to the 2 other fields.
* Fill the internal table
SELECT msehi adqntp
  INTO TABLE internal table
  FROM lipso2
  WHERE vbeln = wrk_doc1
    AND msehi IN ('KL','K15','MT').
* If required move the read quantity in the appropriate column.
LOOP AT internal_table ASSIGNING <fs>.
  CASE <fs>-msehi.
    WHEN 'K15'.
      <fs>-adqnt2 = <fs>-adqnt1.
      CLEAR <fs>-adqnt1.
    WHEN 'MT'.
      <fs>-adqnt3 = <fs>-adqnt1.
      CLEAR <fs>-adqnt1.
  ENDCASE.
ENDLOOP.
- You could also create another table with only fields msehi and adqntp and then collect ([ref|http://help.sap.com/abapdocu_70/en/ABAPCOLLECT.htm]) the data to another table.
Regards,
Raymond

Similar Messages

  • How to retrieve the values from PL/SQL table types.

    Hi Every one,
    I have the following procedure:
    DECLARE
    TYPE t1 IS TABLE OF emp%ROWTYPE
    INDEX BY BINARY_INTEGER;
    t t1;
    BEGIN
    SELECT *
    BULK COLLECT INTO t
    FROM emp;
    END;
    This procedure works perfectly fine to store the rows of employee in a table type. I am not able to retrieve the values from Pl/SQL table and display it using dbms_output.put_line command.
    Can anybody help me please!!!!!
    Thanks
    Ahmed.

    You mean, you can't add this
    for i in t.first..t.last loop
    dbms_output.put_line(t(i).empno||' '||t(i).ename||' '||t(i).job);
    end loop;or you can't add this
    set serveroutput onor maybe, you are working in third party application where dbms_output is not applicable at all?
    You see, not able like very similar it is not working - both are too vague...
    Best regards
    Maxim

  • How to retrieve 2 values from a table in a LOV

    Hi
    I'm pretty new to APEX. I try to retrieve two values from a table using a LOV. I have a table named DEBIT with then columns SITE, NAME and KEY
    I want to display NAME to the user in a list. When the user select an item from the list, I want to retrieve the data of the SITE and KEY column of this item in order to launch an SQL command based on this two values.
    How to retrieve thes two values whant the user chooses an item from the list ?
    I apologize for my english, being french.
    Regards.
    Christian

    Christian,
    From what I understood about your requirement, you want a 'select list with submit' which displays "NAME" and based on the value selected, you want to get the corresponding values for "SITE" and "KEY" from the table.
    <b>Step 1: Create a select list with submit, say P1_MYSELECT </b><br><br>
    Use something like this in the dynamic list of values for the select list: <br>
    SELECT NAME display_value, NAME return_value
    FROM DEBIT<br><br>
    <b>Step 2: Create a page process of type PL/SQL block. Also create 2 hidden items P1_KEY and P1_SITE. </b><br><br>
    In the PL/sQL, write something like:
    DECLARE
      v_key DEBIT.KEY%TYPE;
      v_site DEBIT.SITE%TYPE;
      CURSOR v_cur_myvals IS
              SELECT KEY, SITE
              FROM DEBIT
              WHERE NAME = :P1_MYSELECT;
    BEGIN
      OPEN v_cur_myvals;
      LOOP
              FETCH v_cur_myvals
              INTO  v_key,v_site;
              EXIT WHEN v_cur_myvals%NOTFOUND;
    :P1_KEY := v_key;   
    :P1_SITE := v_site; 
      END LOOP;
      CLOSE v_cur_myvals;
    END; <br><br>
    Then you can use these values for whatever purpose you need to.
    Hope this helps.

  • How to retrieve the values from a LinkedList

    Hello,
    I have just put this question in java programming forums by mistake...I think that it should be here ...
    I have created a LinkedList to store the results of a query to a database.
    These reasults are decimal numbers and then I want to sum all these numbers to be able to make the average.
    But when I try to retrieve the values of the Linked List I always receive an incopatible types error..
    Here is an extract of my code in a jsp page.
    LinkedList Average = new LinkedList();
    String Media = rst.getString(10);
    Average.add(Media);
    int Size = Average.size();
    double Sum = 0.0;
    for (int i=0; i<=Size; i++)
                    double Result = Average.get(i)     
                  Sum = Sum + Result;
    }If I try to retrieve the value of only one node from the list , I can just putting <%=Average.get(i)%>...but..how can I retrieve all the values (they are decimal numbers) to be able to add them?

    If you want to sum all the values, is there any reason you just don't retrieve the sum from the database rather than the list of values?
    anyway
    List average = new LinkedList();
    while (rst.next()){
      // retrieve the number:
      String mediaString = rst.getString(10);
      Double media = Double.valueOf(mediaString);
      // or maybe like this if it is a number in the database
      Double media = new Double(rst.getDouble(10));
      average.add(media);
    doubleSum = 0.0;
    for (Iterator it = average.iterator(); it.hasNext(); ){
      Double result= (Double) it.next();
      doubleSum += result.doubleValue();
    }

  • How to extract the values from WPBP table

    Hi experts,
    We are in preparation of a custom report.
    In the report we want to have a  value from WPBP table.
    We want to extract the value of Capacity utilization level from WPBP table.
    Could you please let me know the way to extract the value.
    Please advice.
    Regards,
    Sairam.

    Hi Sairam,
    Why do you try to get capacity utilization level from WBPB. Even if there is split in payroll capacity utilizatian level in WPBP shows the value in IT0008 basic pay.
    So instead you can get the required information from table PA0008 Field for capacity utilization level is BSGRD
    Regards;
    Okan

  • How to get the value from Advanced table

    Hi,
    In the Advanced table have 2 LOV fields, I need LOV field value dynamically in the controller to validate the save button, if iam not selected any value in lov save button will not allow to save the data. In the table i am using 'Add another row'. How to get the lov field value in the process form request??? and how to do this requirement
    Thanks
    Naresh

    1. You can specify required property on LOV field to "yes". For events where you wish to disable the client side validations, set the property disable client side validation to "true".
    2. If above behavior is not what you are looking for, then you need to handle in AM and not CO.
    a. Call an AM method from CO.
    b. In that AM method, get handle of VO.
    c. Iterate the VO Rows and check for your validation rules.
    -Prince
    http://www.princekapoor82.blogspot.com

  • How to retrieve the values from a Transient View Object

    Hi Experts,
    I am using Jdevelpoer11.1.1.5.0. I created one Transient view object with attributes EmpId,Salary.
    In Backing Bean i will create rows for that view object and display it in the form of <af:Table> like Empid, Salary and an Update Link.
    Now my problem is i want to update the salary of the particular EmpId. For Example if the EmpId is 100 and salary is 10000 now i want to increase the salary to 20000 and if i click on the update button; i want to retrieve the particular employee details in my backing bean. How can i acheive this?
    Thanks in advance.

    A better approach would be to programmatically populate rows in the <VO>Impl.java by overriding the executeQueryForCollection(0 as specified here -
    http://adfpractice-fedor.blogspot.in/2011/01/adf-bc-programmatically-populated-vo.html
    You can write the logic to update the salary in an AM method then on click of Update or in the getter of Salry field if logic is valid for all fields...

  • How to pass the values from internal table to field groups

    hi all,
    how can i pass the internal  table values to field groups?
    already field groups are holding some values.. INSERT STATEMENT IS NOT WORKING as it is ovewriting the existing values..
    Use full answers will be rewared.
    Thanks.
    Moderator message - duplicate post locked
    Edited by: Rob Burbank on Jun 23, 2009 9:51 AM

    Hi,
    You can use INSERT statement to put a work area of an Internal table in Field-group
    and use Extract to get info out of it.
    Hope it helps,
    Raj

  • How to retrieve the data from database table to the screens

    Hi all,
    I have created a transaction to save the costing details..but if the material code already exists then it should get the header and details of that material code onto the table cotrol of the screen..i'm getiing them into my itab but only the last record of that is visible for n times as there are n records...can anyone help me in this?

    Dear anil ,
      Please give condtion in u r code on line item wise so its taking all records correctly.
    Regards ,
    Nikhil narkhede.

  • How to retrieve the data from 3 tables

    lifnr,land1,banks,bankl,bvtyp,bankn,bkont,banka,ort01,swift from LFA1,LFBK,BNKA................
    please  anybody can tell immediately.........

    Hi Ramesh,
    DATA:BEGIN OF itab OCCURS 0,
    lifnr LIKE lfa1-lifnr,
    land1 LIKE lfa1-land1,
    banks LIKE lfbk-banks,
    bankl LIKE lfbk-bankl,
    bvtyp LIKE lfbk-bvtyp,
    bankn LIKE lfbk-bankn,
    bkont LIKE lfbk-bkont,
    END OF itab.
    DATA:BEGIN OF itab2 OCCURS 0,
    banka LIKE bnka-banka,
    ort01 LIKE bnka-ort01,
    swift LIKE bnka-swift,
    END OF itab2.
    SELECT alifnr aland1 bbanks bbankl bbvtyp bbankn b~bkont INTO TABLE itab
    FROM ( lfa1 AS a INNER JOIN lfbk AS b ON blifnr = alifnr ).
    select banka ort01 swift from BNKA
    into table itab2
    for all entries in itab
    where banks = itab-banks
      and bankl = itab-bankl.
    Regards
    - Gopi

  • Fetch the values from internal table inside an internal table (urgent!!)

    data : BEGIN OF PITB2_ZLINFO occurs 0,
             BEGDA LIKE SY-DATUM,
             ENDDA LIKE SY-DATUM,
             PABRJ(4) TYPE N,                       "Payroll Year
             PABRP(2) TYPE N,                       "Pay. Period
             ZL LIKE PC2BF OCCURS 0,
           END OF PITB2_ZLINFO.
    I have a internal table like this,
    How to Fetch the values from internal table inside an internal table.
    Kindly Help me on this..
    Regards,
    Ram.

    Hi,
    Try this....
    Loop at PITB2_ZLINF0.
    Loop at PITB2_ZLINF0-ZL.
    endloop.
    Endloop.
    Thanks...
    Preetham S

  • How to truncate the values from the table

    Hi All,
    I am working on an issue..where we are first deleting all the records from the table and then based on few conditions we are putting the records back in that table...when we tried to run this program along with few others those who are doing almost the same stuff we are having issues...we tried to schedule few jobs related to these programs only...but after a ceratin amount of time couple of jobs got canceled...I was talking to my basis guy and he said the problem is ratehr then truncating the records from the table we are deleting the records and it's taking lots and lots of space to execute...so we need to truncate the records from the table insted of deleting it...we are using the following the statement right now:
        DELETE FROM ZTUS_PG.
        COMMIT WORK.
    So can you please tell me how can we truncate the values from this table instead of just deleting them and what would be effect of this.
    Thanks,
    Rajeev Gupta

    I don't think basis is saying you should delete all the records from the table. They are saying remove the table and it's contents (a much faster thing to do). I'm not sure this the right thing to do, but you can have a look at:
    http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.sample.doc/doc/admin_scripts/s-truncate-db2.htm
    Something like:
    EXEC SQL.
      TRUNCATE TABLE ZTUS_PG REUSE STORAGE
    ENDEXEC.
    COMMIT WORK.                      "Empty table is committed here
    Rob
    Edited by: Rob Burbank on Dec 1, 2008 4:06 PM

  • How to get the values from the resultset???

    I have a problem with this code given below,
    i am executing an sql query which return a union of values from two tables.
    the problem here is how do i read the values from the resultset.
    here is the code....
    package com.webserver;
    import java.sql.*;
    public class UnionDemo{
    public static void main(String args[]){
    Connection connection =null;
    Statement statement =null;
    ResultSet rs =null;
    try{
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    connection = DriverManager.getConnection("jdbc:oracle:thin:@:1521:ORCL","scott","tiger");
    statement = con.createStatement();
    rs = statement.executeQuery("(select tablename from node where appid=432) union (select tablename from uomnode where appid=432)");
    ResultSetMetaData rsmd = rs.getMetaData();
    int numberOfColumns = rsmd.getColumnCount();
    while (rs.next()){
    System.out.println(rs.getString(1));
    // instead of rs.getString(1) I also used rs.getString("tablename") but of no success....
    }//end of while
    }catch(Exception exp){
    exp.printStackTrace();
    finally{
    try{
    if (rs!=null) rs.close();
    if (statement!=null) statement.close();
    if (con!=null) con.close();
    }catch(Exception exp1){
    exp1.printStackTrace();
    }//end of finally
    }//end of main
    }//end of class
    when i execute this program i get an oracle error ORA-01009
    which says (java.sql.SQLException: ORA-01009: missing mandatory parameter)
    can anyone help to retrieve the values from this resultset...
    thanx

    [cut]
    i am executing an sql query which return a union of
    values from two tables.
    the problem here is how do i read the values from the
    resultset.[cut]
    When the error occours?
    1) Executing query ?
    2) Retrieving the field from the resultSet ?
    3) ecc. ?
    BTW, first of all, try to execute the query removing the parenthesis
    of the two select statement. I know that there are some problem
    with the oracle jdbc driver about them.
    Hope it helps.

  • How to get the links from Master table

    Hi,
    I need to show url on the jsp page which should be taken from Backend "Master Table".
    say an example like some value CRM_IMAGE =  ZWEB CRMIMAGE.I need to show CRM_IMAGE as  Hyperlink on the product detail.jsp.
    Can anyone help me for this.
    Regards,
    Deepika
    Edited by: Ecom Dev on Dec 21, 2009 11:05 AM

    Hi Ecom,
    To retrieve value on product detail page you have to develop your custom code in which you have to create BO, BOM, BEI and BEO to access Your master table data from ISA page.
    You also need to create Custom RFC in which you pass porduct ID and retrieve related value from Master Table.
    You can find example in ISA tutorial how to get value from Back-end via JCO.
    eCommerce Developer
    Edited by: Ecommerce Developer on Dec 21, 2009 11:44 AM

  • How to retrieve the data from SAP-BAPI by using VB Code

    Hi ,
    I am new to BAPI.
    V have created an application in Visual Basic with the following fields
    EmpNo , EmpName, Addr1, Addr2, City and Phone (Only for Test)
    We have written the code for SAVING the data into SAP. Already we have
    constructed a table with the respective fields in SAP.
    For that we ourself created our own BAPI Structure / Function Group /
    Function Module/ Business Object - RELEASED related elements.
    1)Established the connection successfully.
    2)Stored the data into SAP Successfully and v r in need of
    3)HOW TO RETRIEVE THE DATA FROM SAP (USING GETLIST.....GETDETAIL....)
    Following is the code :
    'BAPI Structure  : ZBAPIEMP
    'Function Group  : ZBAPIEMP
    'Function Module : ZBAPI_EMP_CREATEFROMDATA
    'Business Object : ZBAPIEMP
    'Function Module : ZBAPI_EMP_GETLIST
    Dim bapictrl As Object
    Dim oconnection As Object
    Dim boEmp As Object
    Dim oZEmp_Header As Object
    Dim oImpStruct As Object
    Dim oExpStruct As Object
    Dim oreturn As Object
    Dim x As String
    Private Sub Form_Load()
    Set bapictrl = CreateObject("SAP.BAPI.1")
    Set oconnection = bapictrl.Connection
    oconnection.logon
    Set boEmp = bapictrl.GetSAPObject("ZBAPIEMP")
    Set oZEmp_Header = bapictrl.DimAs(boEmp, "CreateFromData", "EmployeeHeader")
    Set oImpStruct = bapictrl.DimAs(boEmp, "GetList", "EmployeeDispStruct")
    End Sub
    Private Sub cmdSave_Click()
        oZEmp_Header.Value("EMPNO") = txtEmpNo.Text
        oZEmp_Header.Value("EMPNAME") = txtEmpName.Text
        oZEmp_Header.Value("ADDR1") = txtAddr1.Text
        oZEmp_Header.Value("ADDR2") = txtAddr2.Text
        oZEmp_Header.Value("CITY") = txtCity.Text
        oZEmp_Header.Value("PHONE") = txtPhone.Text
        boEmp.CreateFromData EmployeeHeader:=oZEmp_Header, Return:=oreturn
        x = oreturn.Value("Message")
        If x = "" Then
            MsgBox "Transaction Completed!..."
        Else
            MsgBox x
        End If
    End Sub
    Private Sub cmdView_Click()
    End Sub
    COULD ANYBODY GUIDE ME, HOW TO RETRIEVE THE DATA FROM BAPI, FOR THE WRITTEN CODE.

    I didn't seen any other answers but here's how it's been done previously in our organization for a custom BAPI. In this example, we give material and language to return the part description. It's not specific to your project but may give you ideas..
    -Tim
    Option Compare Database
    Dim SAPLOGIN As Boolean
    Dim FunctionCtrl As Object
    Dim SapConnection As Object
    Sub SAPLOGOUT()
    On Error GoTo LogoutFehler
        SapConnection.logoff
        SAPLOGIN = False
    Exit Sub
    LogoutFehler:
        If Err.Number = 91 Then
            Exit Sub
        Else
            MsgBox Err.Description, vbCritical, "Fehler-Nr." & CStr(Err.Number) & " bei SAP-Logout"
        End If
    End Sub
    Function SAPLOG() As Boolean
    'Verbindungsobjekt setzen (Property von FunctionCtrl)
       Set FunctionCtrl = CreateObject("SAP.Functions")
       Set SapConnection = FunctionCtrl.Connection
    'Logon mit Initialwerten
       SapConnection.Client = "010"
       SapConnection.Language = "EN"
       SapConnection.System = "PR1"
       SapConnection.SystemNumber = "00"
       'SapConnection.Password = ""
       SapConnection.GroupName = "PR1"
       SapConnection.HostName = "168.9.25.120"
       SapConnection.MessageServer = "168.9.25.120"
         If SapConnection.Logon(0, False) <> True Then  'Logon mit Dialog
             Set SapConnection = Nothing
             DoCmd.Hourglass False
             MsgBox "No connection to SAP R/3 !"
             SAPLOGIN = False
             SAPLOG = False
             Exit Function
          End If
        SAPLOG = True
    End Function
    Function MatDescr(MatNr As String)
    Dim func1 As Object
    Dim row As Object, X As Integer, ErsteNr As String
    Dim DatensatzZähler As Long
    Dim RowField(1 To 50, 0 To 1) As String, RowLine As Long
        If Not SAPLOGIN Then
            If Not SAPLOG() Then
                MsgBox "No connection  to SAP !", 16
                SAPLOGOUT
                Exit Function
            End If
        End If
    ' Instanziieren des Function-Objektes
    Set func1 = FunctionCtrl.Add("Z_BAPI_READ_MAKT")
    ' Export-Paramter definieren
    func1.exports("MATNR") = MatNr
    func1.exports("SPRAS") = "EN"
    DoEvents
    If Not func1.call Then
        If func1.exception <> "" Then
            MsgBox "Communication Error with RFC " & func1.exception
        End If
        DoCmd.Hourglass False
        SAPLOGOUT
        Exit Function
    Else
      MatDescr = func1.imports("MAKTX")
    End If
    If MatDescr = "" Then
        MatDescr = "PART NO. NOT FOUND"
    End If
    End Function

Maybe you are looking for

  • Specify File Encoding(Japanese Characters) for UTL_FILE in Oracle 10g

    Hi All, I am creating a text file using the UTL_FILE package. The database is Oracle 10G and the charset of DB is UTF-8. The file is created on the DB Server machine itself which is a Windows 2003 machine with Japanese OS. Further, some tables contai

  • How to install ARD 3.6.1 Admin on Mavericks?

    A few years ago (pre-Apple App store) I received a digital download of ARD Admin 3.6.1 from Apple, as the DVD installer quit working on version 10.whatever. Fast forward to today, and I am trying to install 3.6.1 digitally on my shiny new Mac Pro (ca

  • Converting to Unicode

    Hello, we currently have a 9.2 database that is set up as Western European. We are upgrading to 10g and we now need to support unicode. I was planning on changing all the CHAR and VARCHAR2 data types to NCHAR and NVARCHAR2. I was also going to change

  • Log and transfer causes FCP to crash with long clips

    Hi. I am trying to import a few 2 hour+ clips using Log and Transfer from my Sony NX5. Once the destination clip has reached approx 60GB, FCP crashes every time. There is plenty of disk space left. I have tried trashing preferences and also changing

  • Can photoshop elements work with layers/on a Mac?

    Hi, I would like to purchase photoshop elements 11 if the program allows you to work in layers.  I use to have photoshop 7 but since I changed my computer to a Mac I need a program that is compatible with the Mac.  Is photoshop elements 11 compatible