How to use offset in select query

Suppose i have data like ssonje     00000001 as a one field in database table . i have to segregate this two data. how should I do this.the first part is of 12 characters and the last is of 10 character long.

Hi Naveen,
I am again in trouble, Now the requirement were changed. I am sending you the code which i had implemented.
Now, the user enter username(ie UNAMED) and document id (ie. TEMPD) and the output should be doucment id, which has been search through database table RFDT , field SRTFD, this field contains both the username and the document id.
That means: suppose user enters UNAMED as SSONJE and TEMPD as 0000000030, then i want to fier the select query from RFDT on field SRTFD and get only the document id of that user which user enter on input field-UNAMED.
i had tried but result were not coming.
please go through the code.
data:uname type UF05A-UNAMD.
data:temp type UF05A-TEMPD.
TYPES: BEGIN OF TEITAB_RFDT,
       SRTFD TYPE RFDT-SRTFD,
       END OF TEITAB_RFDT.
DATA: ITAB_RFDT TYPE TABLE OF TEITAB_RFDT.
DATA: WA_RFDT TYPE TEITAB_RFDT.
DATA: STR(22) TYPE c.
SELECT-OPTIONS:UNAMED FOR uname,
TEMPD FOR TEMP.
UNAMED-option = 'CP'.
append UNAMED.
CONCATENATE UNAMED TEMPD INTO STR.
SELECT SRTFD FROM RFDT INTO CORRESPONDING FIELDS OF TABLE ITAB_RFDT WHERE SRTFD eq str.
LOOP AT ITAB_RFDT INTO WA_RFDT.
SPLIT WA_RFDT AT SPACE INTO STR1 STR2.
  WRITE: / STR1,STR2.
ENDLOOP.
Please mentioned what is the way to do this.
Thanks

Similar Messages

  • How to use offset for select-option parameter ?

    Hi experts
    could anybody please let me know how to use offset for select-option parameter. i can able to use offset for table fields, variabiles and all , but don't know how to use for parameters.
    following is my code
    SELECT-OPTIONS: s_prctr  FOR vbsegs-prctr OBLIGATORY.
    here "prctr"  length is 10.
    i'm using two tables  1. vbsegd-bupla
                                    2. vbsegs-prctr
    here prctr+6(4) = bupla.
    "Bupla" length is 4
    SELECT belnr gjahr bukrs bupla sgtxt buzei FROM vbsegd INTO CORRESPONDING FIELDS OF TABLE it_vbsegd FOR ALL ENTRIES IN it_vbkpf
                                                                 WHERE belnr = it_vbkpf-belnr
                                                                   AND gjahr = it_vbkpf-gjahr
                                                                   AND bukrs = it_vbkpf-bukrs
                                                                   AND bupla IN s_prctr.  
    the above statement is not working as prctr and bupla lenths are different. here i want to use offset.
    SELECT belnr gjahr bukrs prctr sgtxt buzei FROM vbsegs INTO CORRESPONDING FIELDS OF TABLE it_vbsegs FOR ALL ENTRIES IN it_vbkpf
                                                                WHERE belnr = it_vbkpf-belnr
                                                                  AND gjahr = it_vbkpf-gjahr
                                                                  AND bukrs = it_vbkpf-bukrs
                                                                  AND prctr IN s_prctr.
    this is working as prctr and s_prctr lengths are equal.
    could anybody please help me out in this.
    Thanks in advance.
    regards
    satish

    Below code will work for you.
    SELECT-OPTIONS: s_prctr  FOR vbsegs-prctr OBLIGATORY.
    RANGES: s_bupla FOR vbsegd-bupla.
    s_bupla[] = s_prctr[].
    DELETE ADJACENT DUPLICATES FROM s_bupla.
    SELECT belnr gjahr bukrs bupla sgtxt buzei FROM vbsegd INTO CORRESPONDING FIELDS OF TABLE it_vbsegd FOR ALL ENTRIES IN it_vbkpf
                                                                  WHERE belnr = it_vbkpf-belnr
                                                                    AND gjahr = it_vbkpf-gjahr
                                                                    AND bukrs = it_vbkpf-bukrs
                                                                    AND bupla IN s_bupla.

  • Query: how to use structure and selection and what's the difference between

    Query: how to use structure and selection and what's the difference between these two?
    Would be appreciated if some experts here give examples to demenstrate on how to use structure and selection in query and what's the difference between these two?
    Thanks in advance!

    Hi Kevin,
    1. Well by default all the KF that you include in your query go into a Key Figure Structure. You can additionally have another structure for defining how your chars are laid out. A common example is a Calmonth structure where you have selections for 12 months, quarers and YTD values. This would be a char structure with different selections (for each month, qtr etc)
    2. Yes, a selection with a KF is the same as restricting a KF. You can use am RKF is you have one on the left hand side, or if you need to do this locally in the query, right click the structure and choose New Selection, then proceed to choose your KF and reqd char values.
    Hope this helps...

  • How to use Key Date in query

    Imagine an invoice was created for a customer on the 1st of January 2008 for £1000
    On the 1st of Feb, he paid $300, owing $700
    On the 1st of Mar, he paid $450, owing $250
    On the 1st of Apr, he paid $250.
    If I run an AR report today the 10th of Aug, I would see he owes nothing. What I want to do is to run the report today based on the 2nd of March and see a debt of £250. I dont want to use the posting date in the selection criteria henceI think this is the case when you use a key date but I’m not sure how to use this in the query properties of BI7. What Characteristic do I need to specify as time dependant? Is there anything else I should consider?

    hi,
    Key Date setting is for the 'time dependent' master data.
    Lets say u have a Characteristic MATERIAL with a time dependent attribute MATERIAL GROUP as follows.
    MATERIAL FROM TO MATERIAL GROUP
    ABD 01/01/1995 12/31/2003 X
    ABD 01/01/2004 12/31/9999 Y
    Depending on what you have for the Keydate, the Material group is selected.
    If your key date is, ex, 06/12/2001 there material group is X. Or if key date is 02/15/2005, material group is Y.
    If you do not enter any value for keydate, system automatically assumes today' date.
    hope it helps..

  • How to use the same POWL query for multiple users

    Hello,
    I have defined a POWL query which executes properly. But if I map the same POWL query to 2 portal users and the 2 portal users try to access the same page simultaneously then it gives an error message to one of the users that
    "Query 'ABC' is already open in another session."
    where 'ABC' is the query name.
    Can you please tell me how to use the same POWL query for multiple users ?
    A fast reply would be highly appreciated.
    Thanks and Regards,
    Sandhya

    Batch processing usually involves using actions you have recorded.  In Action you can insert Path that can be used during processing documents.  Path have some size so you may want to only process document that have the same size.  Look in the Actions Palette fly-out menu for insert path.  It inserts|records the current document work path into the action being worked on and when the action is played it inserts the path into the document as the current work path..

  • How to use at-line selection in ALV

    Can someone help me about how to use at-line selection in an ALV

    u can try in user_command
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
             I_CALLBACK_PROGRAM = G_REPID
             IT_FIELDCAT = GT_FIELDCATALOG
             I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'
             I_CALLBACK_HTML_END_OF_LIST = G_HTML_END_OF_LIST
             I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
             I_GRID_SETTINGS = GS_SETTINGS
             IS_LAYOUT = GS_LAYOUT
             I_SAVE = G_SAVE
             IS_VARIANT = GS_VARIANT
             IT_EVENTS = GT_EVENTS[]
    *      I_SCREEN_START_COLUMN = 0 "Use coordinates for
    *      I_SCREEN_START_LINE = 0 "display as dialog box
    *      I_SCREEN_END_COLUMN = 0
    *      I_SCREEN_END_LINE = 0
        IMPORTING
             E_EXIT_CAUSED_BY_CALLER = G_EXIT_CAUSED_BY_CALLER
             ES_EXIT_CAUSED_BY_USER = GS_EXIT_CAUSED_BY_USER
        TABLES
             T_OUTTAB = I_REP
        EXCEPTIONS
             PROGRAM_ERROR = 1
             OTHERS = 2.
    FORM USER_COMMAND USING R_UCOMM TYPE SY-UCOMM
                            RS_SELFIELD TYPE SLIS_SELFIELD.
    CASE R_UCOMM.
        WHEN '&IC1'.
          CASE RS_SELFIELD-FIELDNAME.
            WHEN 'XXXXX'.
              READ TABLE I_xxx INTO V_xxx
                WITH KEY XXX = RS_SELFIELD-VALUE.
              IF SY-SUBRC = 0.
              ENDIF.
            WHEN OTHERS
          ENDCASE.
      ENDCASE.
    ENDFORM.

  • Offset in Select Query

    Hi,
    Can we use offset in select statement. I was trying to compare the year and month of MBEWH table with the LINV table. MBEWH has seperate fields for year and month but LINV table has a date field.
    TYPES:BEGIN OF TY_MBEWH,
            lfgja type lfgja,
            lfmon type lfmon,
          END OF TY_MBEWH.
    Data: T_MBEWH TYPE TABLE OF TY_MBEWH,
          WA_MBEWH TYPE TY_MBEWH.
    Select MBEWHLFGJA MBEWHLFMON
            INTO TABLE T_MBEWH FROM MBEWH INNER JOIN LINV
           ON MBEWHMATNR = LINVMATNR
           where MBEWHBWKEY = LINVWERKS
                 and  MBEWHLFGJA >= *LINVIDATU(4)*
                 and  MBEWH~LFMON > LINV.IDATU+4(2).
    When I execute the above code Iam getting "Field LINV~IDATU is unknown. It is neither in one of the specified tables nor defined by a DATA statement.
    Best Regards
    Suresh

    Hi Suresh,
      Try it this way:
    W_YEAR  = LINV-IDATU+0(4).
    W_MONTH = LINV-IDATU+4(2).
    Select MBEWH~LFGJA MBEWH~LFMON
    INTO TABLE T_MBEWH FROM MBEWH INNER JOIN LINV
    ON MBEWH~MATNR EQ LINV~MATNR
    where MBEWH~BWKEY EQ LINV~WERKS
    and MBEWH~LFGJA GE W_YEAR
    and MBEWH~LFMON GT W_MONTH.
    With luck,
    Pritam.

  • How to use Hierarchy Filter Selection?

    Hi, experts !
    Could anyone give me a detail for how to use hierarchy filter selection ?
    When i locate a Hier filter selection in the template and execute it, a false info
    accured while filtering data,and the IE inferred the hier node object was missing.
    Then i add another hier filter in the same template, and the secend runs well, however the first one didn't.
    At last, i hide the first one, but the second one can't either.
    Help me !!!
    Thx in advance!

    Thanks Toja !
    Sorry to reply so late !
    The error is line: 51. error:'document.HIERARCHY_MENU_1.NODEID' is null or is not the object.
    The code on line of 51 says:document.HIERARCHY_MENU_1.NODEID.value = i_node;
    Could you please give me some documents on the topic of Hierarchy Filter Selection ?

  • How can i use index in select query.. facing problem with the select query.

    Hi Friends,
    I am facing a serious problem in one of the select query. It is taking a lot of time to fetch data in Production Scenario.
    Here is the query:
      SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelat LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelatrprctr
        WHERE rldnr  = c_telstra_accounting
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          And rzzlstar in r_lstar                            
          AND rpmax  = c_max_period.
    There are 5 indices present for Table ZTFTELAT.
    Indices of ZTFTELAT:
      Name   Description                                               
      0        Primary key( RCLNT,RLDNR,RRCTY,RVERS,RYEAR,ROBJNR,SOBJNR,RTCUR,RUNIT,DRCRK,RPMAX)                                          
      005    Profit (RCLNT,RPRCTR)
      1        Ledger, company code, account (RLDNR,RBUKRS, RACCT)                                
      2        Ledger, company code, cost center (RLDNR, RBUKRS,RCNTR)                           
      3        Account, cost center (RACCT,RCNTR)                                        
      4        RCLNT/RLDNR/RRCTY/RVERS/RYEAR/RZZAUFNR                        
      Z01    Activity Type, Account (RZZLSTAR,RACCT)                                        
      Z02    RYEAR-RBUKRS- RZZZBER-RLDNR       
    Can anyone help me out why it is taking so much time and how we can reduce it ? and also tell me if I want to use index number 1 then how can I use?
    Thanks in advance.

    Hi Shiva,
    I am using two more select queries with the same manner ....
    here are the other two select query :
    ***************1************************
    SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelpt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelptrprctr
        WHERE rldnr  = c_telstra_projects
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar             
          AND rpmax  = c_max_period.
    and the second one is
    *************************2************************
      SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelnt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelntrprctr
        WHERE rldnr  = c_telstra_networks
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar                              
          AND rpmax  = c_max_period.
    for both the above table program is taking very less time .... although both the table used in above queries have similar amount of data. And i can not remove the APPENDING CORRESPONDING. because i have to append the data after fetching from the tables.  if i will not use it will delete all the data fetched earlier.
    Thanks on advanced......
    Sourabh

  • How to use the not exists query

    Hello,
    Using obiee 11g,
    i would like to know how to deal with not exists query in the obiee11g,
    the query is like this
    select count(a.col1),a.col2 from table1 a ,table2 b where a.col1=b.col1
    and not exists
    (select d.col1 from table3 d, table4 e
    where d.col1=e.col1 and d.col1=a.col1)
    group by a.col2
    there are 4 tables.
    table1,table2,table3,tabel4
    this is what i need in a report,these tables are used in othere places also,
    would prefer if its possible to do in for a report i.e.e analysis itself.
    If not possible then may be in rpd since if i change in rpd it may reflect every place
    and not in for a report itself.
    thanks

    Implement this in report itself can be a tricky and tedious job..But better to have it in RPD - Physical - Select Table type
    USE NOT IN in place of NOT Exist..You can simply use SELECT statement in SELECT TABLE TYPE
    Hope it clear

  • How to use property file - sql query define in property file

    Hi All,
    Anybody please tell me how to use property file.
    I have placed sql query in propery file and I have to access this in my file.
    well so far this is my code but don't know how to implement in the following ...
    pstmt = con.prepareStatement("select * from registration where username=?");
    instead of writting the query I want to use the property file.
    so far I have developed the following code...
    FileInputStream fis = new FileInputStream("querysql.property");
    Properties dbProp = new Properties();
    dbProp.load(fis);is the code correct... or is there another way to access property file
    Please help.
    please reply soon....
    Thanks

    Before answering, check if it's already been done here http://www.jguru.com/forums/view.jsp?EID=1304182

  • How to mention index in select query?

    Hi All,
       If I am using fields of two diffrent secondary index in a single select query on a table how I can mention that data should be picked according to first index used in the query?
    Regards
    Deepak

    Please search before asking basic questions.
    Thread locked.
    Rob

  • How to ignore zero in select query

    select * from EINA where  EINAMATNR = <b>yyyy</b> and EINALIFNR = <b>zzzz</b>
    In select query, how to ignore zero? for example, EINAMATNR = 0000000yyyy, EINALIFNR=000zzz
    Maybe I can use LIKE keyword in sql query. Any other way?
    Thanks.

    Use the following conversion routines to convert yyyy & zzzz  to remove the leading zeros and then pass it to your select query.
    For Matnr -> CONVERSION_EXIT_MATN1_INPUT
    For LIFNR ->CONVERSION_EXIT_alpha_input.
       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = yyyy
            IMPORTING
              output = t_lifnr.
          CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
            EXPORTING
              input  = zzzz
            IMPORTING
              output = t_matnr.
    select * from EINA where EINA~MATNR = t_matnr  and EINA~LIFNR = t_lifnr .

  • How to use wildcards in ABAP query where condition?

    Hi,
    Please tell me how to use wildcards in ABAP qurey where condition.
    e.g. select * from mara where matnr = * (wildcard we need to use.
    Thanks & Regards,
    Gaurav T

    Do you want to query asterix * ?
    select * from mara where matnr = '*'.  "then just put it in apstrophes
    or you want certain part of string be used as * ?
    select * from mara where matnr like '%*'  "then use % sign before it
    or maybe you want something like this
    select * from mara where matnr like '%1' . "then it will look for all materials having '1' inside it
    Regards
    Marcin

  • How to Use dyanamic table in query?

    Hi,
    can you please tell.in query -
    1] if we define a varibale and in that varibale we have to speacfy the dynamic table name can it's possible.
    2] I tried but it's not working
    3] Every year i have taken a backup table and from that backup table i feteched the data.But i want to do this programmatically
    e.g. Table name is pf_emp_pf_txn20122013 but this is "20122013" this dynamic .How we use in query that dyanamic table .
    Kindly Suggest,
    Regards,
    Sachin

    RHELSENSEI wrote:
    Your EXEC executes in a different context, therefore it is not aware of any variables that have been declared in your original context. You should be able to use a temp table instead of a table variable as shown in the simple demo below.
    create table #t (id int)
    declare @value nchar(1) set @value = N'1' 
    declare @sql nvarchar(max)
    set @sql = N'insert into #t (id) values (' + @value + N')'
    exec (@sql)
    select * from #t
    drop table #t
    Epic. Fail.
    SQL-Server syntax and features for an Oracle problem. Features that are not relevant at all to Oracle, but the very reason why SQL-Server is technically inferior to Oracle...
    Are you a professional idiot, or just a very gifted amateur?

Maybe you are looking for

  • Problem with footer in table style not applying paragraph style... or just me?

    I'm having a niggling problem making a table style with cell/paragraph styles for the header, body, and footer respectively. I want to make it as simple as possible for other users but one thing keeps tripping me up. I'll try and describe with screen

  • Custom search fields on BBPCF01

    Hi, I have some troubles in viewing custom search fields on transaction BBPCF01. I created a new custom Function group with a dynpro where I will place my custom fields. I created a new html template for this screen. Then i modified the BBP_CUF_BADI

  • Dynamic Routing Gateway and ASA

    Greetings, We have a requirement to configure a multisite gateway and have run into an issue. According to http://msdn.microsoft.com/en-us/library/azure/dn133793.aspx, dynamic routing gateways are not supported on the ASA platform. Does this simply m

  • Action Script and Codes

    Dear Flash Experts, I know we can place codes within "Actions", but where do we go to view the actual codes? You know behind the scene. Is there a way to do so. I can not believe Adobe would design a software program such as "Flash" and not allow the

  • Using cartweaver with dreamweaver cs3

    cartweaver seems like a decent out of the box ecommerce solution, but how is it while using dreamweaver. Is it easy to integrate the code into the existing pages? Is it a series of include files that require a hand coders touch to modify successfully