Skip to Content
avatar image
Former Member

Logic needed

i have selection as

SELECT-OPTIONS: S_BUDAT FOR MKPF-BUDAT OBLIGATORY .

SELECT-OPTIONS: S_BKTXT FOR MKPF-BKTXT.

my select query is

SELECT MBLNR MJAHR XBLNR BKTXT

INTO (ITAB_NEW-MBLNR,ITAB_NEW-MJAHR,ITAB_NEW-XBLNR,

ITAB_NEW-BKTXT)

FROM MKPF

WHERE VGART = 'WE'

AND BLART = 'WE'

AND BUDAT IN S_BUDAT

AND BKTXT = S_BKTXT

AND TCODE2 = 'MIGO_GR'.

SELECT EBELN LIFNR MATNR DMBTR ZEILE WERKS INTO

(ITAB_NEW-EBELN,ITAB_NEW-LIFNR,ITAB_NEW-MATNR,

ITAB_NEW-DMBTR,ITAB_NEW-ZEILE,ITAB_NEW-WERKS)

FROM MSEG

WHERE MJAHR = ITAB_NEW-MJAHR

AND MBLNR = ITAB_NEW-MBLNR

AND WERKS IN S_WERKS

AND BWART = '101'

AND KZZUG = ''.

IF SY-SUBRC = 0.

APPEND ITAB_NEW.

ENDIF.

ENDSELECT.

ENDSELECT.

My query is

header text (BKTXT) user is entering data as 47-1233/120808

47-form no./date

i wish if user enter 1233 in selection screen my query should run.Please guide how to control this.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • avatar image
    Former Member
    Sep 03, 2008 at 12:23 PM

    Hi

    Split your text firat at - then at /

    Aditya

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 03, 2008 at 12:24 PM

    There are two options :

    1. To ask user to enter 1233 on the screen to fetch

    records which contains the string. This should be

    right approach.

    2. Logic Change in the Program

    -> You can add a * before and after the string entered

    by user on the screen before the select statement.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 03, 2008 at 12:24 PM

    use pattern in the where clause for BKTXT .

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 03, 2008 at 12:26 PM

    Hi...

    If your text format is same like this always...

    > 47-****/120808

    Then Modify the s_bktxt internal table with that entry, by conatenating s_bktxt with offsets.

    Thanks,

    Naveen.I

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Use like this,

      Concatenate '*-' lv_formno '/*' into lv_condition.

      where lv_formno is what your user enters, now pass lv_condition in the where condition.

      This will work for sure...

      Regards

      Karthik D

  • Sep 03, 2008 at 12:50 PM

    Hi.. Abhut...

    Its working...

    tables: dbtable.
    
    data: itab like dbtable 0 with header line.
    data:var(5).
    data: code(5).
    
    select-options: s_ecode for var.          <---giving 123
    
      concatenate s_ecode-low '45' into code.
    
      loop at s_ecode.
        s_ecode-low = code.
        modify s_ecode.
      endloop.
    
      select * from dbtable into corresponding fields of table itab 
                 where zemp_code in s_ecode.   <---checking for 12345
     
      loop at itab.
        write:/ itab-zemp_code,
               itab-zcomp_code.
      endloop.

    Here s_ecode is the selection screen element.

    And we sholud give number like 12345 ( contains 5 digits )

    But here you can enter just 123 in selection screen.

    Program will add 45 to 123 and makes it as 12345, And check the entries for that input.

    Try your logic in similer way.

    Thanks,

    Naveen.I

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 03, 2008 at 01:14 PM

    Hello

    Little modified your program:

    SELECT-OPTIONS: S_BUDAT FOR MKPF-BUDAT OBLIGATORY . 
    * SELECT-OPTIONS: S_BKTXT FOR MKPF-BKTXT. " remove this
    PARAMETERS: P_BKTXT LIKE MKPF-BKTXT. " add this
    
    my select query is
    
    SELECT MBLNR MJAHR XBLNR BKTXT
    INTO (ITAB_NEW-MBLNR,ITAB_NEW-MJAHR,ITAB_NEW-XBLNR,
    ITAB_NEW-BKTXT)
    FROM MKPF
    WHERE VGART = 'WE'
    AND BLART = 'WE'
    AND BUDAT IN S_BUDAT
    * AND BKTXT = S_BKTXT " remove this
    AND TCODE2 = 'MIGO_GR'.
    
    SELECT EBELN LIFNR MATNR DMBTR ZEILE WERKS INTO
    (ITAB_NEW-EBELN,ITAB_NEW-LIFNR,ITAB_NEW-MATNR,
    ITAB_NEW-DMBTR,ITAB_NEW-ZEILE,ITAB_NEW-WERKS)
    FROM MSEG
    WHERE MJAHR = ITAB_NEW-MJAHR
    AND MBLNR = ITAB_NEW-MBLNR
    AND WERKS IN S_WERKS
    AND BWART = '101'
    AND KZZUG = ''.
    IF SY-SUBRC = 0.
      IF NOT P_BKTXT IS INITIAL.
        SEARCH ITAB_NEW-BKTXT FOR P_BKTXT.
        IF SY-SUBRC = 0.
          APPEND ITAB_NEW.
        ENDIF.
      ELSE.
        APPEND ITAB_NEW.
      ENDIF.
    ENDIF.
    ENDSELECT.
    ENDSELECT.
    

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 03, 2008 at 02:00 PM

    Hi.

    Please see our rules of engagement why every posting has to have a meaningfull subject. Please search before posting here.

    Best regards,

    Jan Stallkamp

    Add comment
    10|10000 characters needed characters exceeded