PROBLEM IN SELECT OPTION

Dear all, i want to display the document no,document status,date of document,document type and item details here input field is document number.tables are bkpf and bseg.i wrote the program and executed that program it causes runtime error.so please solve the problem.
REPORT  ZOPENSQL5.
*ENTER INPUT VALUE
DATA : V_BELNR TYPE BELNR_D.
SELECT-OPTIONS : K_BELNR FOR V_BELNR.
*CREATE USER DEFINED DATA TYPES
TYPES : BEGIN OF TY_BKPF,
        BELNR TYPE BELNR_D, "ACCOUNTING DOCUMENT NUMBER
        BSTAT TYPE BSTAT,   "DOCUMENT STATUS
        BLDAT TYPE BLDAT,   "DOCUMENY DATE
        BLART TYPE BLART,   "DOCUMENT TYPE
        END OF TY_BKPF.
TYPES : BEGIN OF TY_BSEG,
        BELNR TYPE BELNR_D, "ACCOUNT DOCUMENT NUMBER
        BUZEI TYPE BUZEI,   "ITEM DETAILS
        END OF TY_BSEG.
TYPES : BEGIN OF TY_FINAL,
        BELNR TYPE BELNR_D, "ACCOUNTING DOCUMENT NUMBER
        BSTAT TYPE BSTAT,   "DOCUMENT STATUS
        BLDAT TYPE BLDAT,   "DOCUMENY DATE
        BLART TYPE BLART,   "DOCUMENT TYPE
        BUZEI TYPE BUZEI,   "ITEM DETAILS
        END OF TY_FINAL.
*CREATE INTERNAL TABLES FOR ABOVE TABLES
DATA : IT_BKPF TYPE STANDARD TABLE OF TY_BKPF,
       IT_BSEG TYPE STANDARD TABLE OF TY_BSEG,
       IT_FINAL TYPE STANDARD TABLE OF TY_FINAL.
DATA : WA_BKPF TYPE TY_BKPF,
       WA_BSEG TYPE TY_BSEG,
       WA_FINAL TYPE TY_FINAL.
*MOVE DATA
SELECT BELNR
       BSTAT
       BLDAT
       BLART
       FROM BKPF
       INTO TABLE IT_BKPF
       WHERE BELNR IN K_BELNR.
IF NOT IT_BKPF IS INITIAL.
  SELECT BELNR
         BUZEI
         FROM BSEG
         INTO TABLE IT_BSEG
         FOR ALL ENTRIES IN IT_BKPF
         WHERE BELNR = IT_BKPF-BELNR.
ENDIF.
LOOP AT IT_BSEG INTO WA_BSEG.
  MOVE-CORRESPONDING : WA_BSEG TO WA_FINAL.
  READ TABLE IT_BKPF INTO WA_BKPF WITH KEY BELNR = WA_FINAL-BELNR.
  IF SY-SUBRC = 0.
    MOVE : WA_BKPF-BSTAT TO WA_FINAL-BSTAT,
           WA_BKPF-BLDAT TO WA_FINAL-BLDAT,
           WA_BKPF-BLART TO WA_FINAL-BLART.
  ENDIF.
  APPEND WA_FINAL TO IT_FINAL.
  CLEAR WA_FINAL.
ENDLOOP.
*DISPLAY THE DATA
ULINE (55).
WRITE :/1  SY-VLINE        ,
        2  'DOC NO'        ,
        14 SY-VLINE        ,
        16 'DOC STATUS'    ,
        26 SY-VLINE        ,
        28 'DATE OF DOC'   ,
        43 SY-VLINE        ,
        44 'DOC TYPE'      ,
        55 SY-VLINE        .
WRITE : /1 SY-VLINE.
ULINE (55).

You violated the most basic performance principles, please read here and only post again if there is still a problem.
Please Read before Posting in the Performance and Tuning Forum
Thread locked.
Thomas

Similar Messages

  • I have a problem in select-options

    hi frns,
             i am facing a big problem in select-options
    the requirement is such that
    i have 2 select-options
    one for matnr and the other for maktx
    so wen the clent select matnr with f4
    in the maktx the similar description should come by using f4
    pls help me out

    hi,
    TYPES DECLARATION
    types: begin of tp_marc,
            matnr type marc-matnr,
            werks type marc-werks,
          end of tp_marc.
    INTERNAL TABLE AND WORK AREA DECLARATION
    data: t_marc type standard table of tp_marc,
          wa_marc type tp_marc.
    data : dd like table of dselc with header line. "*--- IMPORTANT
    data : ft like table of dfies with header line.
    data : t_makt like table of makt with header line.
    parameters : matnr like makt-matnr .
    parameters : maktx like makt-maktx.
    at selection-screen output.
      loop at screen.
        if screen-name = 'MAKTX'.
          screen-input = 0.
          modify screen.
        endif.
      endloop.
    at selection-screen on value-request for matnr.
    SELECT matnr maktx  FROM makt INTO TABLE makt up to 500 rows.
      select *
       from makt
        up to 500 rows
      into table t_makt
      where spras = syst-langu.
      if sy-subrc <> 0.
        message 'INVALID MATERIAL NUMBER' type 'E'.
      endif.
    IMPORTANT
      refresh dd.
    dd-fldname = 'MATNR'.
    dd-dyfldname = 'MATNR'.
    append dd.
      dd-fldname = 'MAKTX'.
      dd-dyfldname = 'MAKTX'.
      append dd.
    *------- IMPORTANT
      refresh ft.
      ft-tabname = 'MAKT'.
      ft-fieldname = 'MATNR'.
      append ft.
      ft-tabname = 'MAKT'.
      ft-fieldname = 'MAKTX'.
      append ft.
      call function 'F4IF_INT_TABLE_VALUE_REQUEST'
      exporting
    ddic_structure = 'T001' "*----- IMPORTANT IF STANDARD STRUCT
      retfield = 'MATNR'
      dynpprog = sy-repid
      dynpnr = sy-dynnr
      dynprofield = 'MATNR'
      value_org = 'S'
      tables
      field_tab = ft "*---- IMPORTANT
      value_tab = t_makt
      dynpfld_mapping = dd "* IMPORTANT
      exceptions
      parameter_error = 1
      no_values_found = 2
      others = 3.
      start-of-selection.
      select matnr
             werks
             from marc
             into table t_marc
             where matnr = matnr.
      if sy-subrc <> 0.
        message :'no results IN MARC' type 'E'.
      endif.
      write: at 1(36) sy-uline.
      format intensified on color = 7.
      new-line.
      write :sy-vline,at 10 'MATERIAL NUMBER',at 29 sy-vline, at 30 'PLANT',sy-vline.
      new-line.
      write: at 1(36) sy-uline.
      format intensified off color = 4.
      loop at t_marc into wa_marc.
        new-line.
        write :sy-vline,at 10 wa_marc-matnr ,sy-vline, at 30 wa_marc-werks, at 36 sy-vline.
      endloop.
      new-line.
      write: at 1(36) sy-uline.
    reward points if useful.
    regards,
    Vinod Samuel.

  • Problem in select-options value request

    Hi All,
    I have one select-option s_opt for vendor description. I want to have value request for both s_opt-low and s_opt-high. For that i have to write the functonal module
    at selection-screen on value-request for s_opt-low. and at selection-screen on value-request for s_opt-high. for both or any other procedure.
    In s_opt using drop down menu user can enter vendor description up to 10 Char, lower or upper case acceptable, & Wild card .
    Can any one help with code for the above two problems.
    Assured points.
    With thanks in advance.
    Ashok

    Hi , check the code .
    Just populate the itab entries either with a select on lfa1 .
    here im populating with sy-index values .
    REPORT zforum12.
    tables : lfa1.
    select-options : so_lifnr FOR lfa1-lifnr.
    data: begin of itab_LIFNR occurs 0,
    lifnr like lfa1-lifnr,
    end of itab_LIFnr.
    DATA: ITAB_SELECTED_lifnr TYPE DDSHRETVAL OCCURS 0 WITH HEADER LINE.
    initialization.
    do 20 times.
    move sy-index to itab_lifnr.
    append itab_lifnr.
    enddo.
    at selection-screen on value-request for SO_LIFNR-LOW.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    RETFIELD = 'SO_LIFNR-LOW'
    VALUE_ORG = 'S'
    TABLES
    VALUE_TAB = itab_LIFNR
    return_tab = ITAB_SELECTED_LIFNR
    EXCEPTIONS
    PARAMETER_ERROR = 1
    NO_VALUES_FOUND = 2
    OTHERS = 3
    IF SY-SUBRC eq 0.
    READ TABLE ITAB_SELECTED_LIFNR INDEX 1.
    MOVE ITAB_SELECTED_LIFNR-FIELDVAL TO SO_LIFNR-LOW.
    ELSE.
    * MESSAGE ....
    ENDIF.
    at selection-screen on value-request for SO_LIFNR-HIGH.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    RETFIELD = 'SO_LIFNR-HIGH'
    VALUE_ORG = 'S'
    TABLES
    VALUE_TAB = itab_LIFNR
    return_tab = ITAB_SELECTED_LIFNR
    EXCEPTIONS
    PARAMETER_ERROR = 1
    NO_VALUES_FOUND = 2
    OTHERS = 3
    IF SY-SUBRC eq 0.
    READ TABLE ITAB_SELECTED_LIFNR INDEX 1.
    MOVE ITAB_SELECTED_LIFNR-FIELDVAL TO SO_LIFNR-HIGH.
    ELSE.
    * MESSAGE ....
    ENDIF.
    start-of-selection.
    write:/ SO_LIFnr-LOW, SO_LIFNR-HIGH.
    regards,
    vijay

  • Problem in Select Option Freely programmed F4 Help

    Hi All,
    I had a Component 'A'  where i used select option. I used Freely programmed search help for the select option field.
    If i click F4 in the select option field it will call one component in which i have one more select option in component B.
    In component B select option field if i manually entering value and search and click apply values button the values are comming in the select option field in component A.
    But if i pressing the F4 in Component B and search and click apply values the value are not comming in the Component 'A'.
    If i open again component B and closing it without any action the value is coming in component A.
    If i debugged and see the WDDOMODIFYVIEW of tHE WDR_SELECT_OPTION is not getting called for component A.In which it has Rendering delta method of CL_WDR_SELECT_OPTION.
    Any idea about this.
    Regards,
    Ganesh.

    hi Ganesh,
    i have read your post several time and i am still not able to get hold on your problem. Probably it is to do with your complex approach of nested select_option, i can not judge why you did this way. I would advice you to step back and see it for yourself
    1)if it is need to have nested select_option
    2)check component initialization and destroy
    2)check event subscriptions

  • Problem with select option in module pool

    Hello friends,
                           I have successfully created a select option in my module using sub-screen. My problem is the EXTENSION buttom in the select option. When i click on the EXTENSION button a proper pop-up appears but when i input some values or cancel this pop-up then the program gives the following dump.
    Error
    The attribute screen type with the values 'Normal Screen' and
    'Subscreen' determines the use of the screen. If a normal screen is used
    as subscreen or vice versa, an error occurs.
    The screen "ZRPMSEA" 0002 has, in this respect, an inappropriate screen type.
    Kindly Help

    HI,
    Go to the Screen Attributes and select the appropriate Radio Button
    1) Normal Screen " Whichever is required (in Which type of Screen you Want)
    2) Subscreen  " Check for the Correct type and Check the Radio Button Accordingly
    3) Modal Scree
    Cheerz
    Ram

  • Problem if Select-Option  is INITIAL.

    HI all,
    I have a question on how to handle to handle Select-Options.
    IF some_value IN S_value.
    Logic1.
    ELSE.
    Logic2.
    ENDIF.
    Problem here is when Select-Option S_value is Empty. It is true for all values in 'some_value'. Is there any easy way to handle it, WITHOUT explicitly checking if the Select-Option IS INITIAL or not, it make my code lot simpler.
    Thanks in Advance,
    Ravi.

    Hi,
    Why do you want to avoid checking whether select-option is initial. That is the simplest way to handle this.
    If you dont want that then my suggestion is use, describe table S_OPTION and get number of lines. You can check whether number of lines is zero or more than zero.
    Ex:
    data : l type i.
    describe table s_option lines l.
    if l = 0.
    else.
    endif.
    Still checking for initial is the best option.
    Regards,
    Ramesh.

  • I have problem in select options

    Hi All,
    i did one report, i have one one variable that is ranges:R_TRNTYP FOR J_1IEXCDTL-TRNTYP.
    R_TRNTYP contains values(10,11,12,20,21,30,31).when i give 10 then only 10 will be come but 10 ,11,20
    values are coming in out put .what can i do .give me suggitions.
    Thanks .

    Hi,
    If the value is present in the ranges it will take all of them.. You cannot control that.. Instead its better to use select options for proving range.. If you want the value like ' 10,11,12,15,16'.. in your output then while testing just add the value from 10-16 in the GREEN tab in ranges of select-option in the selection screen and enter the value '13,14' i.e. the one's which you dont want in the RED tab for either single/range value..
    Hope i am clear..

  • Facing Problem with Select-options input data......help me?

    I have a select-options on my selection screen. In the database table i have different four values for this. ex EEX01, EEX02, EEX03 and EEX04.
    their overall names are DE, HE, IT, TR respectively.
    Now the requirement is user will enter this data like DE to TR , i am now confused how do convert these value to the values that i have in table. Because i have to use this for extracting the data from database table.
    thanks in advance.

    hi,
    what is the table name for the case.
    and jsut list what are the fields .. we'll try to map the same and see if it works..
    if for the field there is a check table attached then conversion routine will take care of that .
    just check on the field of the domain  in the dbtable
    like matn1 for dataelement matnr and domain matnr in mara table.
    regards,
    vijay

  • Case Sensitive problem in Select Option for wild card search

    Hi,
         Can anyone please let me know how to make the wild card search in any select-option non case-sensitive. What I mean by this is for eg. we want to find out all the POs with short text containing the word  'process', what we do we populate a range with OPTION = 'CP' and LOW = 'process' and select EKPO with short text in this range. This select is however case-sensitive and POs with short text containing 'Process' is not retrieved. But my requirement is that this should be non case-sensitive and both the POs should be in the result set.

    Hi,
    Hope this helps you
    CS:
    You can select characters in operand2 for a direct comparison by adding the escape symbol "#" before the required characters. For these characters, upper/lower case is taken into account, wildcard characters and the escape symbol itself do not receive special treatment, and trailing blanks in operands of type c are not cut off.
    Covers Pattern: True, if the content of operand1 fits the pattern in operand2. Wildcard characters can be used for forming the operand pattern, where "" represents any character string, and "+" represents any character. Upper/lower case is not taken into account. If the comparison is true, sy-fdpos contains the offset of operand2 in operand1, whereby leading wildcard characters "" in operand2 are ignored if operand2 also contains other characters. If the comparison is false, sy-fdpos contains the length of operand1.
    Regards
    Krishna

  • Problem in select-options

    I am not able to see my view element container containing my select options in the webpage although it shows in my view.
    The code used by me in the doinit method is
    METHOD wddoinit .
      DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
      lo_cmp_usage =   wd_this->wd_cpuse_select_options( ).
      IF lo_cmp_usage->has_active_component( ) IS INITIAL.
        lo_cmp_usage->create_component( ).
      ENDIF.
      DATA lo_interfacecontroller TYPE REF TO iwci_wdr_select_options .
      lo_interfacecontroller =   wd_this->wd_cpifc_select_options( ).
        DATA lo_r_helper_class TYPE REF TO if_wd_select_options.
        lo_r_helper_class = lo_interfacecontroller->init_selection_screen(
      DATA lo_r_helperclass TYPE REF TO if_wd_select_options.
      lo_r_helperclass = lo_interfacecontroller->init_selection_screen(
      DATA lt_range TYPE REF TO data.
      CALL METHOD lo_r_helperclass->create_range_table
        EXPORTING
          i_typename     = 'VBELN'
        RECEIVING
          rt_range_table = lt_range.
    CALL METHOD lo_r_helperclass->set_global_options
    EXPORTING
        i_display_btn_cancel  = ABAP_FALSE
        i_display_btn_check   = ABAP_FALSE
       i_display_btn_reset   = ABAP_FALSE
        i_display_btn_execute = ABAP_FALSE.
      CALL METHOD lo_r_helperclass->add_selection_field
        EXPORTING
          i_id              = 'VBELN'
          it_result         = lt_range
          i_obligatory      = abap_true
          i_value_help_type = if_wd_value_help_handler=>co_prefix_none
          i_value_help_id   = 'VMVA'.
    ENDMETHOD.

    Have you embededd teh view of the select option's comp respective WIND*view inside the view container element.
    Edited by: Lekha on Dec 21, 2011 6:16 PM

  • Problem in select-option in module pool

    Hi,
    I have 4 fields in my module pool screen, all are select-option and i want to select the data
    on basis of these fields.
    but condition is that some fields can be blank.
    So i have use select query with 'in' option but it does not work when i leave some of the fields blank...
    please suggest wat to do.
    I will be obliged...

    check this..
    https://forums.sdn.sap.com/click.jspa?searchID=14672301&messageID=5880647
    I am involved in this topic, if you have any issues in understanding let me know..

  • Problem in Select-option in Module Pool Programming

    Hi,
    I'm making one module pool programming. In that, I've to make select-option. For that I'm using this command --
    1) In PBO --
    CALL SUBSCREEN sub INCLUDING 'YBOE_PRINT' '5100'.
    2) In PAI --
    CALL SUBSCREEN sub.
    But, Syntax Error is generated as below --
    "." or "ID.........FIELD" expected after "SUBSCREEN"
    Please suggest.
    Thanks.
    Kumar Saurav.

    Hi Ramchander,
    Thanks for replying. But, even if I changed Prog_Name with term 'repid', that same error regarding
    "." or "ID ... FIELD ..." expected after "SUBSCREEN"
    is coming up.
    I guess, there is any step missing.
    Lemme describe what I'm doing in points --
    1) I declared SELECTION-SCREEN with screen no --
    SELECTION-SCREEN BEGIN OF SCREEN 5100 AS SUBSCREEN.
          PARAMETERS : p_bukrs TYPE ekko-bukrs OBLIGATORY DEFAULT '1000'.
          SELECT-OPTIONS: kunnr FOR kna1-kunnr.
          select-options: gjahr for bsid-gjahr.
          select-options: bank for bsed-bank.
          select-options: budat for bsid-budat.
          SELECTION-SCREEN END OF SCREEN 5100.
    2) Then I made a call in PBO as given above.
    3) Finally, a call to that subscreen is made in PAI - again as given above.
    When I checked that, this gave the error.
    Are you looking any erroneous step ...?
    Please guide.
    Thanks.
    Kumar Saurav.

  • Strange problem with select options, problem in my code or standard bug?

    I have a selection screen with no intervals.
    In my select option When i give a range for example
    BT(Between) 1 to 3 and then if i  remove 3 (s-high) value and press enter the BT changes to EQ automatically which is correct.
    Suppose i select BT as my operator and just give 1 in S-low and keep S-high as blank.
    It behaves wiered and the data selected is not correct.  BT now should have changed to EQ but it doesnt happen.
    Same case occurs with NB ie not in between.
    Can experts please give there advice on this behaviour of selection screen

    wht u can do is.....
    u can keep these two input fields as two diff attributes....
    consider it as A , B
    then on various possibilities....fire select queries...
    for eg:
    if A & B not initial.
    then select data between A and B
    if A is not initial B is initial
    then select data = A
    and all possiblities to can think

  • Problem using select-options?

    Hi all,
    I am using select-options, in this 3 are selectoptions and 1 is normal.
    i am getting select-option value using..
    *cust code
      rt_KUNNR = wd_this->m_sel_opt->get_range_table_of_sel_field(
                                 i_id = 'KUNNR' ).
    but which method i ahve to use to get normal which is not of select-options.
    i am doing like this...
    *cust code
      rt_YEAR = wd_this->m_sel_opt->get_range_table_of_sel_field(
                                 i_id = 'GJAHR'
                                  ).  // I think this method is wrong place i used.
      assign rt_YEAR->* to <fs_GJAHR>.
      move <fs_GJAHR> to F_YEAR.
    *cust code
      rt_KUNNR = wd_this->m_sel_opt->get_range_table_of_sel_field(
                                 i_id = 'KUNNR' ).
      assign rt_KUNNR->* to <fs_kunnr>.
      clear S_KUNNR.
      loop at <fs_kunnr> into S_KUNNR.
        wa_kunnr-sign   = S_KUNNR-sign.
        wa_kunnr-option = S_KUNNR-option.
        wa_kunnr-low    = S_KUNNR-low.
        wa_kunnr-high   = S_KUNNR-high.
        append wa_kunnr to it_kunnr.
      endloop.
    But it is giving dump.. Field symbol has not yet been assigned.  at kunnr. but kunnar is select-option.
    Any helps...
    Thanks
    venkat.

    Hi Lekha
    thanks for your reply,
    i tried this...
    data : rt_YEAR TYPE REF TO data,
             <fs_gjahr> TYPE table,
             fs_year TYPE TABLE OF FYAC. // Fiscal year only year(4).
    call method wd_this->m_sel_opt->GET_SELECTION_FIELD(
                                 EXPORTING
                                 i_id = 'GJAHR'
                                 IMPORTING
                                 ET_RESULT =  rt_YEAR ).
      assign rt_YEAR->* to <fs_gjahr>.
      move <fs_gjahr> to fs_year.
    rt_year is still initial, and getting dum field symbol is not assigned. any helps???
    Thanks,
    Venkat.

  • Problem using SELECT-OPTIONS in an InfoSet with a field of data type UNIT.

    I have created a simple InfoSet that links MARA with MARM. In the 'Selections' section of the InfoSet I have a variable named 'ZMEINH' defined as
    Description: UOM
    Selection Text: UOM
    Format FOR: MARM-MEINH
               EXTRAS: DEFAULT 'PAC' OPTION EQ SIGN I.
    When I ran a query to allow selections on the MEINH field, instead of 'PAC' being the default, there was "***" showing in the UOM selection and if I attempted to execute the query it gave me a message that "Unit *** is not created in languague EN'.  If I overide the "***" and enter 'PAC', I get the list of records that I expect.
    I assume this is because MEINH has a data type of "UNIT".
    How can I do a conversion so I can define a default value 'PAC' for MARM-MEINH in the infoSet that will carry through to any queries I created.
    Thank you very much for any help.
    Richard Salisbury

    Thank you both for you help!
    In our T006 there actually is a PAC and not a PAK. The T006A had as DE-PAK though.
    I had this same type of language problem when trying to match an "order type". German is the "base" language in our system so maybe that means that raw data is stored with the German constant?
    Anyway, I changed it to PAK and it works. When under a time schedule, that is what counts.
    Thank you again for the quick response!
    Richard Salisbury

Maybe you are looking for

  • Blend Modes not working in CS6

    My blend modes aren't working. If I try to apply a blend mode, no effect.

  • Problem during o/p data save in XL sheet.

    Dear All, I have one query. When I execute my report in background and then save it in XL sheet.Then it is saving perfectly in XL sheet. But when I execute report in foreground and then try to save in XL sheet.Then some column miss match their data.

  • The printed page could not be ended

    One of our customers are running 8.8 PL06. When a user try to print multiple checks at once, they get The printed page could not be ended. If they print one at a time it works fine. I looked into forum and help but no luck. Is it a bug on this patch?

  • How to save Solo with the Song?

    Hi, When I activate solo on some tracks, save the song and open it again, solo is not active anymore, so that it blows off my speakers when I start playing and forget to activate solo again. How to save solo activation? Thanks for any help.

  • ClassNotFoundException for packaged bean

    I'm getting a ClassNotFoundException when trying to instantiate a packaged bean from a jsp file. When the class itself is placed in the WEB-INF\classes directory of the web module, it loads and runs without error. Here's the code I'm using: [Bean - C