REUSE_ALV_GRID_DISPLAY with editable field -- Recuperate new value

Hi everybody,
I try to explain my problem. I created an ALV grid with the function REUSE_ALV_GRID_DISPLAY and an internal table.
The user can change the value of one field and can save it. Indeed, in debbug mode, I can see in the internal table the new value entered by the user. So I can do all the actions with the launch of a routine.
But the user can forger to save his change. So, when he clicks on "Back" I want to propose him to save. THE PROBLEM : in debbug mode, when the routine is launched, the internal table does't have the new value..
So have you got an idea to recuperate the new value?
Thank you very much in advance.
Best regards.

I had the same problem and solved it: I used SET_TABLE_FOR_FIRST_DISPLAY.
The MT_OUTPUT tab has the ALV data and the column in here must be modifed. Steps:
data: p_grid  type ref to lcl_gui_alv_grid.
Step 1. Create a sub class for LCL_GUI_ALV_GRID_DEFINITION.
*       class lcl_gui_alv_grid  definitio
CLASS lcl_gui_alv_grid DEFINITION
        INHERITING FROM cl_gui_alv_grid.
  PUBLIC SECTION.
    METHODS: update_outtab
               IMPORTING i_good_cells TYPE lvc_t_modi.
**             check_changed_data.
ENDCLASS.                    "lcl_gui_alv_grid  DEFINITIO
Step2
Use event data_changed_finished of LCL_EVENT_RECEIVER
*       CLASS lcl_event_receiver DEFINITION
CLASS lcl_event_receiver DEFINITION.
  PUBLIC SECTION.
    METHODS:
      handle_data_changed
         FOR EVENT data_changed OF cl_gui_alv_grid
             IMPORTING er_data_changed,
      handle_data_change_finished    "****<----------
         FOR EVENT data_changed_finished OF cl_gui_alv_grid
             IMPORTING e_modified et_good_cells,
      handle_double_click
         FOR EVENT double_click OF cl_gui_alv_grid
             IMPORTING e_row e_column,
      handle_after_refresh
         FOR EVENT after_refresh OF cl_gui_alv_grid.
*Implementation
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_data_change_finished.
    DATA: lt_goodcells TYPE lvc_t_modi.
    CHECK NOT e_modified IS INITIAL AND NOT et_good_cells IS INITIAL.
    lt_goodcells[] = et_good_cells[].
    CALL METHOD p_grid->update_outtab
      EXPORTING
        i_good_cells = lt_goodcells.
    CALL METHOD p_grid->refresh_table_display.
  ENDMETHOD.                    "data_changed_finished
*-- ALV data updated in class implementation below
CLASS lcl_gui_alv_grid IMPLEMENTATION.
  METHOD update_outtab.
    FIELD-SYMBOLS: <tab1> TYPE STANDARD TABLE,
                   <good> TYPE lvc_s_modi,
                   <fs1> TYPE ANY,
                   <fs2> TYPE ANY.
    DATA: ls_alv TYPE type_alv,
          fldabgru(32) TYPE c VALUE '<TAB1>-ABGRU_NEW',
          fldbezei(32) TYPE c VALUE '<TAB1>-BEZEI_NEW',
          lv_bezei TYPE bezei40.
    ASSIGN mt_outtab->* TO <tab1>.  "ALV display table
    LOOP AT i_good_cells ASSIGNING <good>.
      READ TABLE <tab1> INTO ls_alv INDEX <good>-row_id.
      IF sy-subrc EQ 0.
        SELECT SINGLE bezei INTO ls_alv-bezei_new
          FROM tvagt
          WHERE spras = sy-langu
            AND abgru = ls_alv-abgru_new.
        IF sy-subrc EQ 0.
          MODIFY <tab1> FROM ls_alv INDEX <good>-row_id.
        ENDIF.
      ENDIF.
    ENDLOOP.
  ENDMETHOD.                    "update_outtab

Similar Messages

  • REUSE_ALV_GRID_DISPLAY with editable field -- Get the short text

    Hi everybody,
    I would like to know if you can resolve the following problem:
    I have an editable column in my ALV grid with a match code. When the user choise the value in the range, this value is displayed in the grid. But I would like to display the short text and not the fix value like actually.
    Have you got an idea?
    Thank you in advance.
    Best regards,
    Robin

    You could add another column for the text and change it's contents when the editable field changes.

  • 2 Classic Reports with edit fields on the same page

    Hi All, need your help.
    I am trying to have 2 classic reports on one page with edit fields like date, list values, text
    I have noticed that the element indexes are the same f01_0001 have both first elements from both reports.
    This is making my code go crazy.
    Also i have a problem with Date Picker, if i select it as a column type for a first element in second report the icon shows up in the first report.
    I think this is because of indexing, but... Classic Date Picker put the icon on second report but when i select the date, the values is populated to first column in first report
    Does anyone have a solution for this problem! (for example change the indexing for second report)
    DB is 11.2g
    Apex is 4.2.0.00.27
    Thank you,
    Andrei
    Edited by: aracila on Feb 20, 2013 9:03 AM

    Are these tabular forms, ie updteable.
    If so, you can only have one per page
    Gus

  • Bursting PDF with editable fields

    I have been successful in generating PDF output from a PDF template that contains editable fields. When I open the PDF using Adobe Professional, everthing functions as normal. However, when I burst the PDFs the final output PDFs are no longer editable. They contain the correct data, but everything is locked down. Has anyone attempted this with success? If so, can you point me to some possible pitfalls? I'd hate to have to run a single request for each output.
    Thanks,
    Jamie

    Very easy to create. I have not been able to get them to burst with editable fields. Please note that it is not editable with Adobe Reader, unless it is first extended with Adobe Professional or Adobe LiveCycle Reader Extensions. Depending on your config settings you may have to make some changes to allow the fields to remain editable.

  • Save VO with Edited fields But as a New Record, Old one should not change

    Hi All,
    I have set of VOs, those are connected by View links, in such a way One VO comes under Another up to 7 level,
    Like
    level----1
    2
    3
    4
    5....
    And My requirement is if I made any of the Operations,( Insert/update/Delete) on any of the VO's(Records of the VO) that comes in this flow, I have to save it as a new record with the Edited Fields , new Id and new revision number, Also I have to keep the original one unchanged.
    that is After updating the record I should have the old one as a Library and New one as the active record.
    Please help....

    Hi Timo,
    The JDev I am using is Studio Edition Version 11.1.1.2.0 and Build JDEVADF_11.1.1.2.0_GENERIC_091029.2229.5536
    And the Relationships between the VO's are *:* When I change a record of level 3, I need to copy all the other 6 levels along with the updated one.
    The revision Number is in the Top VO, which will increment but all the other record will remains the same other than Id and updated fields.
    That is , there should be a new set of records with the same data with updated fields, and the old set remain the same, which can be used as a Library for reference.
    Thanks & Regards,
    Ranjith C

  • To capture the selected rows along with edited field contents in alv report

    Dear All,
             I do have requirement where, in alv report output one field is editable and need to save the content of the edited field along with the selected rows.
             For example If there are 10 records displayed in the alv output with 20 fields.
    Out of this 20 fields one field (say XYZ) is editable. Also i have already created a new pushbutton (say ABC) on alv output. Now in the alv output if we maintain some value in the field (XYZ ) for the 2nd and 4th record and select this two records, and when clicked on the pushbutton (ABC) it has to update the DB table.
          I am using the Func Module  'REUSE_ALV_GRID_DISPLAY'. 
          Your early reply with sample code would be appreciated.
    Thanks in Advance.

    HI Naveen ,
    There is an import parameter "i_callback_program" in the function module,
    plz pass the program name to it.
    Capture the command by passing a field of type sy-ucomm to "I_CALLBACK_USER_COMMAND ".  Check the returned command and
    and program a functionality as desired.
    u can try the event double_click or at line selection. there u can use READLINE command to c if the line has been selected.
    In case it is , process the code segment.
    Regards
    Pankaj

  • Create a Procedural ALV Report with editable fields and save the changes

    Hi,
    I am new to ABAP. I have created a Procedural ALV Report with 3 fields. I want to make 2 fields editable. When executed, if the fields are modified, I want to save the changes. All this I want to do without using OO concepts. Please help . Also, I checked out the forum and also the examples
    BCALV_TEST_GRID_EDIT_01
    BCALV_TEST_GRID_EDIT_02
    BCALV_TEST_GRID_EDIT_04_FORMS
    BCALV_TEST_GRID_EDITABLE
    BCALV_EDIT_01
    BCALV_EDIT_02
    BCALV_EDIT_03
    BCALV_EDIT_04
    BCALV_EDIT_05
    BCALV_EDIT_06
    BCALV_EDIT_07
    BCALV_EDIT_08
    BCALV_FULLSCREEN_GRID_EDIT
    But all these are using OO Concepts.
    Please help.
    Regards,
    Smruthi

    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
      line_color(4) TYPE c,     "Used to store row color attributes
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE slis_layout_alv,
          gd_repid     LIKE sy-repid.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
    fieldcatalog-edit             = 'X'
      fieldcatalog-col_pos     = 5.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    FORM build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
      gd_layout-info_fieldname =      'LINE_COLOR'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    FORM display_alv_report.
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program      = gd_repid
                i_callback_pf_status_set = 'STATUS'
                i_callback_top_of_page   = 'TOP-OF-PAGE'
               i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
               IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
               is_variant              = z_template
           TABLES
                t_outtab                = it_ekko
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      DATA: ld_color(1) TYPE c.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekko.
      LOOP AT it_ekko INTO wa_ekko.
        ld_color = ld_color + 1.
        IF ld_color = 8.
          ld_color = 1.
        ENDIF.
        CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
        MODIFY it_ekko FROM wa_ekko.
      ENDLOOP.
    ENDFORM.                    " DATA_RETRIEVAL
          FORM top-of-page                                              *
    FORM top-of-page.
      WRITE:/ 'This is First Line of the Page'.
    ENDFORM.
          FORM status                                                   *
    FORM status USING rt_extab TYPE slis_t_extab.  .
      SET PF-STATUS 'ALV'.
    ENDFORM.
          FORM USER_COMMAND                                          *
    -->  RF_UCOMM                                                      *
    -->  RS                                                            *
    FORM user_command USING rf_ucomm LIKE sy-ucomm
                             rs TYPE slis_selfield.            
      DATA ref1 TYPE REF TO cl_gui_alv_grid.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = ref1.
      CALL METHOD ref1->check_changed_data.
      CASE rf_ucomm.
    when 'SAVE'.
    get all the modified entries and store them in an internal table and udpate them in to the required transaction or your custom table.
    endcase.
    endform.
    ENDFORM.
    here u need to 2 performs for PF status and USER_COMMAND in the ALV parameters.
    create a custom PF status and create push buttons and assign your ok codes in your PF status.
    if the field has to be edited in the ALV then pass EDIT = 'X' for that field in the fieldcatlog preparation.
    Hope this will help you.
    Regards,
    phani.

  • Editable field gives wrong value in report.

    Hi,
    I have report with some editable fields. I am using apex_item for one editable select list. I gave functionality to update row by providing go button. when user clicks on go button, I sends page by using javascript dosubmit which updates values in table through update process. everything works fine but sometimes i am not able to read particular value in row. for example...
    Rownum---------select_list--------- button---------- comment(editable)-not used apex_item
    1------------------------ 'abc'---------------- GO----------------------------- new
    2------------------------- null---------------- GO--------------------------- closed
    3 ------------------------'xyz'---------------- GO--------------------------- reopen
    I used apex_item for select list but status is made editable by selecting "text area" from tabular form element of column.
    when I press GO button on row third by selecting xyz it takes null value of 2nd row. same if I select something in 2nd row. i.e. instead of null if I selects 'mno' in 2nd row it takes select list value as 'mno' for third row. I observed this by writing javascript code which alerts me value of variable f01,f02.....
    Please if anybody can help me. I want to know why this happens?

    You might have better luck asking in the Oracle Application Express (APEX).

  • ALV grid with editable fields

    Dear Colleagues,
    I develop an ALV grid with OO standard methods. Before the first display of the table I define the editable fields. It works fine.
    I have a problem : if the table is empty and I press the standard icons "Append a line" or "Insert a line", the new line don't have the defined editable characteristics.for fields. Is there a standard method which I have forgotten ?
    Thanks a lot and kind regards
    Peter

    vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_delete_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_append_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_insert_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_cut.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_undo.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
    * Displaying the output in ALV Grid
        vs_layout_grid-no_rowmark = 'X'.
        vs_layout_grid-zebra      = 'X'.
        vs_layout_grid-cwidth_opt = 'X'.
        vs_layout_grid-edit       = 'X'.
        vs_layout_grid-ctab_fname = 'CT'.
        vs_layout_grid-stylefname = 'CELLTAB'.
        CALL METHOD v_grid->set_table_for_first_display
          EXPORTING
            i_save                        = 'X'
            is_layout                     = vs_layout_grid
            it_toolbar_excluding          = i_toolbar_excluding[]
          CHANGING
            it_outtab                     = itab[]
            it_fieldcatalog               = it_fieldcat[]
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc NE 0.
          MESSAGE 'ALV Grid display unsuccessful' TYPE 'I'.
          STOP.
        ENDIF.                             " IF sy-subrc NE 0
      ELSE.                                " IF w_custom_container...
    * Refresh the container if it already exists
        CALL METHOD v_grid->refresh_table_display
          EXCEPTIONS
            finished = 1
            OTHERS   = 2.
        IF sy-subrc NE 0.
          MESSAGE 'Refreshing the container is not successful' TYPE 'I'.
          STOP.
        ENDIF.                            

  • ALV edit not capturing new value

    Hi
    In my alv i have made one field as editable..when i edit the field and click save button the control comes to below code. 
    CALL METHOD gro_grid->get_selected_rows
        IMPORTING
          et_index_rows = gwa_selected_rows.
    *Through the index capturing the values of selected rows
      LOOP AT gwa_selected_rows INTO gv_selected_rows.
        READ TABLE git_data INTO gwa_data INDEX gv_selected_rows-index.
    here git_data is the internal table given to alv grid...i nthe above read stmt..gwa_data gives the value in field as old one..its not capturing the new value..how to solve this ..pls help

    Hi,
    Use event data_changed.
    When 'SAVE' is pressed, call check_changed_data( ) which will trigger event data_changed.
    Inside handler method copy the modified cells to table.
    *PAI
    When 'SAVE'.
    g_o_grid->check_changed_data( ).  " It triggers event 'data_changed'.
    LOOP AT g_t_modcells INTO g_r_modcells.   " Loop at modified cells table
    READ TABLE git_data INTO gwa_data INDEX g_r_modcells-row_id .      " <---- Ur code
    ENDLOOP.
    clear: g_t_modcells[],g_t_modcell[].
    *Declare data for handler method.
    Data:  g_t_modcells type lvc_t_modi,
              g_t_modcell type lvc_t_modi.
    *Declare handler method for event 'data_changed'.
    METHODS: data_changed FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING er_data_changed.
    *Handler method implementation
      METHOD data_changed.
        IF er_data_changed->mt_good_cells[] IS NOT INITIAL.
          g_t_modcell[] = er_data_changed->mt_good_cells[].
          APPEND LINES OF g_t_modcell TO g_t_modcells.  " Modified cells are copied to table g_t_modcells[]
        ENDIF.
      ENDMETHOD.
    Thanks,

  • Generate PDF FORM with editable fields

    Hi,
    my requirement is to create a document wich has a number of fields which users can fill in. By default, these fields need to be filled in with the data from the database, but editable by the user, the rest of the document has to be non-editable. I'm looking to PDF Forms for this, but am open to other suggestions. I can't get the output to show such fields. Is it even possible?
    Spiffo

    HI,
    I have no clear at all how we define a editable field in the template.
    Besides, we need Adobe Writer to see this editable fields from the PDF generated?
    Thanks in advance.
    S.

  • Export to PDF with editable fields...

    Does anyone know if you can export to a PDF and keep editable fields? I have a 10 page form which was created in Pages but now needs to be turned into a PDF users can fill out I was hoping there may be an easy way to do this?

    You might take a look at PDFpen, especially the "Pro" version. But I think you might need the full version of Acrobat to create fillable forms.

  • Smart Forms with editable fields and signature field provided by Webdynpro ABAP

    Hi,
    i've created an interactive smart form.. Everything fine. The preview of the adobe livecycle designer looks excellent, every field is editable, the signaturefield is signable...
    But when i try to test my form using transaction SE80 i'll get a pdf without any signable field, without any editable textfield and so on
    I've used the standard printer ZPDF1 for that purpose. (PDF1)
    Every value provided by the interface is displayed correctly in the pdf , but no field offers the possibility to change values anymore the pdf looks like a real printed document.
    I want to build a webdynpro application where the user gets a pdf in the last step, where he or she is able to edit single values in the prefilled PDF and afterwards to sign this document with his/her digital certificate...
    hope you could help me
    kind regards
    christian

    solved by myself.
    You have to install and configure the reader rights credentials mentioned in note 736902

  • Searching Web Apps with Data Source fields containing multiple values

    I have a Web App with a field allowing multiple values to be entered similar to the checkbox list. I need to restrict allowed values to a large, finite list of values currently stored in another Web App as the data source. I can't apply the Data Source field type as that only allows single value selection. I also need to be able to use the Web App Search form to search for items containing 1 OR more values in this field (the search functionality of a checklist field type). Here's what I've tried for field types:
    Text (string) or Text (multiline) field type - By saving a list of comma separated values (the same way that checkbox list outputs) to a text input or textarea, the search logic only searches for exact string (including commas) and doesn't parse the individual values.
    List (checkbox list) field type - This allows me to search multiple values using OR logic, but the web app will only store values that have been entered as options in the actual web app field setup. I tried using a checkbox list with minimal or empty options hoping that whatever values I sent over in a comma separated string value would still get stored, but because the values came from my Web App data source and not the list of options stored with the field, they were not saved.
    Has anyone found a way to do this?
    My other question is about how I might use a similar multi-value field as described above but return search results containing items with ALL selected values for that field (AND logic).
    Can anyone enlighten me to the inner workings of BC web app search logic?

    Thanks Robert.
    You'll need to create your own interface to the webapp database for those kind of data operations
    by this, are you speaking of the internal BC database which stores web app schema data? That would be great if it were possible to update that programmatically because I need to use the List (Checkbox List) field type (for the search functionality), but I need to supply the checkbox options from a web app rather than by manually updating the list entered in the Fields view of the web app settings (shown below).
    I'm curious if anyone else has tried this?
    Again, my reason for needing to use the List (Checkbox List) field type is that the page which processes searches knows to expect a comma separated list for this field type and then appears to be parsing out the individual values for searching out web app items with 1 or more matching values. You're right that text fields (string and multiline) just check for 'string contains' matches, and this would be ok if I was only ever needing to search just one value at a time. Here's an example of what I might do:
    Web App item field value (as recorded against the List (Checkbox List) field type:
    8294877,8294878
    Web App Search value (for this same field):
    8294879,8294877,8294885
    The search would return this web app item because the field contains 2 (1 or more) individual values even though they were entered into the search field in a different order. If this web app item were just a Text (string or multiline) field, the searched value is not a substring of the web app item's stored value, so it would not find a match. Hence the need to use Checkbox List field type.
    The web app will have thousands if not 10s of thousands of records, so dumping them all into one big array or object and searching on the front-end won't be practical (though it works great on smaller datasets).

  • REUSE_ALV_GRID_DISPLAY - get edited data

    Hi,
    I am using REUSE_ALV_GRID_DISPLAY where some fields I set to input/edit. The whole GRID is not set to edit mode. Additionaly I add a button in the toolbar so the control comes via user command event. My question now is how can I get the actual content of my edited fields if the user pushes the new button?
    Thanks Achim

    Hi,
    I am giving you a sample code of ALV  with editable fields at the output.At the output when user selects some records and pushes a button on the application toolbar it takes the edited records and calls smartform and pass the records to the smart form.
    REPORT  ZMSTR0022.
    CONSTANTS: C_FORM_NAME TYPE TDSFNAME VALUE 'ZMST_PER_APPL'.
    TABLES :ZMST_PERMIT.
    TYPE-POOLS: SLIS.
    TYPE-POOLS :VRM.                           "Value Request Manager
    TYPES:BEGIN OF STRU_ZMST_PERMIT,
         CHECKBOX(1) TYPE C,                    " Checkbox
         ZPIDNUM TYPE ZMST_PERMIT-ZPIDNUM,   " Permit ID No.
         ZARBDSC TYPE ZMST_PERMIT-ZARBDSC,   " Arabic description
         ZENGDSC TYPE ZMST_PERMIT-ZENGDSC,   " English description
         ZENQUAN TYPE ZMST_PERMIT-ZENQUAN,   " Qty in English
         ZARQUAN TYPE ZMST_PERMIT-ZARQUAN,   " Qty in Arabic
         ZENUOM  TYPE ZMST_PERMIT-ZENUOM,    " UoM
         ZTARIFF TYPE  ZMST_PERMIT-ZTARIFF,  " Tariff No
         ZARRPRT TYPE ZMST_PERMIT-ZARRPRT,   " Port code
         ZPRT_NAME(60) TYPE C,               " Port name in Arabic
         ZPERNUM TYPE ZMST_PERMIT-ZPERNUM,   " Reference No
         ZEFFDT  TYPE ZMST_PERMIT-ZEFFDT,    " Valid from
         ZEXPDT  TYPE ZMST_PERMIT-ZEXPDT,    " Valid to
         ZARB_DT(15) TYPE C,                 " Arabic Date of letter
         ZNAME_AUTH(50) TYPE C,              " Name of Authority
         ZPERM_MIN(50) TYPE C,               " Permit Ministry
         END OF STRU_ZMST_PERMIT.
    TYPES:BEGIN OF STRU_PERMIT,
          ZPIDNUM TYPE ZMST_PERMIT-ZPIDNUM,  " Permit ID No.
          ZENGDSC TYPE ZMST_PERMIT-ZENGDSC,  " English description
          ZARBDSC TYPE ZMST_PERMIT-ZARBDSC,  " Arabic description
          ZTARIFF TYPE  ZMST_PERMIT-ZTARIFF, " Tariff No
          ZPERNUM TYPE ZMST_PERMIT-ZPERNUM,  " Reference No
          ZARRPRT TYPE ZMST_PERMIT-ZARRPRT,  " Port code
          ZEFFDT  TYPE ZMST_PERMIT-ZEFFDT,   " Valid from
          ZEXPDT  TYPE ZMST_PERMIT-ZEXPDT,   " Valid to
          END OF STRU_PERMIT.
    TYPES: BEGIN OF STRU_FORM_PERMIT,
           ZARBDSC TYPE ZMST_PERMIT-ZARBDSC,   " Arabic description
           ZENGDSC TYPE ZMST_PERMIT-ZENGDSC,   " English description
           ZENQUAN TYPE ZMST_PERMIT-ZENQUAN,   " Qty in English
           ZARQUAN TYPE ZMST_PERMIT-ZARQUAN,   " Qty in Arabic
           ZENUOM  TYPE ZMST_PERMIT-ZENUOM,    " UoM
           ZTARIFF TYPE  ZMST_PERMIT-ZTARIFF,  " Tariff No
           ZPRT_NAME(60) TYPE C,               " Port name in Arabic
           END OF STRU_FORM_PERMIT.
    DATA: IT_PERMIT TYPE TABLE OF STRU_PERMIT.
    DATA: IT_ZMST_PERMIT TYPE TABLE OF STRU_ZMST_PERMIT,
          WA_ZMST_PERMIT LIKE LINE OF IT_ZMST_PERMIT,
          IT_FORM_PERMIT TYPE TABLE OF STRU_FORM_PERMIT,
          WA_FORM_PERMIT LIKE LINE OF IT_FORM_PERMIT.
    DATA: WA_LAYOUT   TYPE SLIS_LAYOUT_ALV,
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
          IT_FIELDCAT TYPE TABLE OF SLIS_FIELDCAT_ALV.
    DATA: W_FORM TYPE RS38L_FNAM.
    DATA: W_NAME_AUTH(50),
          W_ZARBDT(15),
          W_ZENGDT(10),
         W_ZPRT_NAME(70).
    DATA: W_PARAM TYPE SSFCTRLOP.
    DATA:W_NAME1 TYPE DFIES-FIELDNAME,
          W_NAME2 TYPE HELP_INFO-DYNPROFLD .
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-023.
    SELECT-OPTIONS:S_PIDNUM FOR ZMST_PERMIT-ZPIDNUM ,
                   S_ENGDSC FOR ZMST_PERMIT-ZENGDSC NO INTERVALS LOWER CASE,
                   S_ARBDSC FOR ZMST_PERMIT-ZARBDSC NO INTERVALS LOWER CASE,
                   S_TARIFF FOR ZMST_PERMIT-ZTARIFF NO INTERVALS,
                   S_PERNUM FOR ZMST_PERMIT-ZPERNUM NO INTERVALS,
                   S_ARRPRT FOR ZMST_PERMIT-ZARRPRT NO INTERVALS MATCHCODE OBJECT ZMST_PORTS.
    PARAMETER:P_PERTYP(2) TYPE C AS LISTBOX VISIBLE LENGTH 20.
    SELECTION-SCREEN END OF BLOCK B1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_PIDNUM-LOW.
      W_NAME2 = 'S_PIDNUM-LOW'.
      W_NAME1 = 'ZPIDNUM'.
      PERFORM F4_HELP USING W_NAME1 W_NAME2 .         "calling subroutine to provide desired F4 help
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_PIDNUM-HIGH.
      W_NAME2 = 'S_PIDNUM-HIGH'.
      W_NAME1 = 'ZPIDNUM'.
      PERFORM F4_HELP USING W_NAME1 W_NAME2 .         "calling subroutine to provide desired F4 help
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_ENGDSC-LOW.
      W_NAME2 = 'S_ENGDSC'.
      W_NAME1 = 'ZENGDSC'.
      PERFORM F4_HELP USING W_NAME1 W_NAME2 .         "calling subroutine to provide desired F4 help
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_ARBDSC-LOW.
      W_NAME2 = 'S_ARBDSC'.
      W_NAME1 = 'ZARBDSC'.
      PERFORM F4_HELP USING W_NAME1 W_NAME2 .         "calling subroutine to provide desired F4 help
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_TARIFF-LOW.
      W_NAME2 = 'S_TARIFF'.
      W_NAME1 = 'ZTARIFF'.
      PERFORM F4_HELP USING W_NAME1 W_NAME2 .         "calling subroutine to provide desired F4 help
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_PERNUM-LOW.
      W_NAME2 = 'S_PERNUM'.
      W_NAME1 = 'ZPERNUM'.
      PERFORM F4_HELP USING W_NAME1 W_NAME2 .         "calling subroutine to provide desired F4 help
    AT SELECTION-SCREEN.
      IF SY-UCOMM = 'ONLI'.
        PERFORM CHECK_INPUT.                            "calling subroutine to check inputs on selection screen
      ENDIF.
    INITIALIZATION.
      PERFORM VAL_PERTYP.
    START-OF-SELECTION.
      PERFORM FILL_FIELDCAT.                          "calling subroutine for filling fieldcatalog
    If Permit ministry is blank then fetch data from ZMST_PERMIT otherwise from ZMST_PERMITHI--
      IF P_PERTYP IS INITIAL.
        PERFORM FETCH_PERMIT.                         "calling subroutine to fetch data from ZMST_PERMIT
      ELSE.
        PERFORM FETCH_PERMITHI.                       "calling subroutine to fetch data from ZMST_PERMITHI
      ENDIF.
    END-OF-SELECTION.
    *&      Form  fill_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM FILL_FIELDCAT .
    -passing the parameters of layout--
      WA_LAYOUT-ZEBRA = 'X'.
      WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
      WA_LAYOUT-BOX_FIELDNAME = 'CHECKBOX'.
      WA_LAYOUT-BOX_TABNAME = 'IT_ZMST_PERMIT'.
    -Passing the parameters of fieldcatalog--
      WA_FIELDCAT-FIELDNAME = 'ZPIDNUM'.
      WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
      WA_FIELDCAT-SELTEXT_M = TEXT-001.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'ZARBDSC'.
      WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
      WA_FIELDCAT-SELTEXT_M = TEXT-002.
      WA_FIELDCAT-EDIT = 'X'.
      WA_FIELDCAT-LOWERCASE = 'X'.
      WA_FIELDCAT-OUTPUTLEN = 120.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'ZENGDSC'.
      WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
      WA_FIELDCAT-SELTEXT_M = TEXT-003.
      WA_FIELDCAT-EDIT = 'X'.
      WA_FIELDCAT-LOWERCASE = 'X'.
      WA_FIELDCAT-OUTPUTLEN = 120.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'ZENQUAN'.
      WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
      WA_FIELDCAT-SELTEXT_M = TEXT-004.
      WA_FIELDCAT-EDIT = 'X'.
      WA_FIELDCAT-LOWERCASE = 'X'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'ZARQUAN'.
      WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
      WA_FIELDCAT-SELTEXT_M = TEXT-005.
      WA_FIELDCAT-EDIT = 'X'.
      WA_FIELDCAT-LOWERCASE = 'X'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'ZENUOM'.
      WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
      WA_FIELDCAT-SELTEXT_M = TEXT-006.
      WA_FIELDCAT-EDIT = 'X'.
      WA_FIELDCAT-LOWERCASE = 'X'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'ZTARIFF'.
      WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
      WA_FIELDCAT-SELTEXT_M = TEXT-007.
      WA_FIELDCAT-EDIT = 'X'.
      WA_FIELDCAT-OUTPUTLEN = 15.
      WA_FIELDCAT-LOWERCASE = 'X'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'ZARB_DT'.
      WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
      WA_FIELDCAT-SELTEXT_L = TEXT-013.
      WA_FIELDCAT-EDIT = 'X'.
      WA_FIELDCAT-LOWERCASE = 'X'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'ZNAME_AUTH'.
      WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
      WA_FIELDCAT-SELTEXT_M = TEXT-014.
      WA_FIELDCAT-EDIT = 'X'.
      WA_FIELDCAT-OUTPUTLEN = 50.
      WA_FIELDCAT-LOWERCASE = 'X'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'ZPRT_NAME'.
      WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
      WA_FIELDCAT-SELTEXT_M = TEXT-009.
      WA_FIELDCAT-EDIT = 'X'.
      WA_FIELDCAT-OUTPUTLEN = 60.
      WA_FIELDCAT-LOWERCASE = 'X'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'ZARRPRT'.
      WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
      WA_FIELDCAT-SELTEXT_M = TEXT-008.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'ZPERNUM'.
      WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
      WA_FIELDCAT-SELTEXT_M = TEXT-010.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'ZEFFDT'.
      WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
      WA_FIELDCAT-SELTEXT_M = TEXT-011.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'ZEXPDT'.
      WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
      WA_FIELDCAT-SELTEXT_M = TEXT-012.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-FIELDNAME = 'ZPERM_MIN'.
      WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
      WA_FIELDCAT-SELTEXT_M = TEXT-019.
      WA_FIELDCAT-OUTPUTLEN = 50.
      WA_FIELDCAT-LOWERCASE = 'X'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    " fill_fieldcat
    *&      Form  alv_disp
          text
    -->  p1        text
    <--  p2        text
    FORM ALV_DISP .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = 'ZMSTR0022'
          I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
          I_GRID_TITLE             = TEXT-015
          IS_LAYOUT                = WA_LAYOUT
          IT_FIELDCAT              = IT_FIELDCAT
          I_SAVE                   = 'A'
        TABLES
          T_OUTTAB                 = IT_ZMST_PERMIT
        EXCEPTIONS
          PROGRAM_ERROR            = 1
          OTHERS                   = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " alv_disp
    *&      Form  PF_STATUS
          text
      This subroutine sets the GUI status
    FORM PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'ZSTANDARD_FULLSCREEN'.
    ENDFORM.                    "PF_STATUS
    *&      Form  USER_COMMAND
    FORM USER_COMMAND USING R_UCOMM TYPE SY-UCOMM  RS_SELFIELD TYPE SLIS_SELFIELD.
    *For Printing Smartform
      IF R_UCOMM = 'PRT'.
        CLEAR WA_FORM_PERMIT.
        REFRESH IT_FORM_PERMIT.
        LOOP AT IT_ZMST_PERMIT INTO WA_ZMST_PERMIT WHERE CHECKBOX = 'X'.
          MOVE-CORRESPONDING WA_ZMST_PERMIT TO WA_FORM_PERMIT.
          APPEND WA_FORM_PERMIT TO IT_FORM_PERMIT .
    *Check for First occurence of Name of authority
          IF WA_ZMST_PERMIT-ZNAME_AUTH NE SPACE.
            IF W_NAME_AUTH = ' '.
              W_NAME_AUTH = WA_ZMST_PERMIT-ZNAME_AUTH.
            ENDIF.
          ENDIF.
    *Check for First occurence of Arabic date
          IF WA_ZMST_PERMIT-ZARB_DT NE SPACE.
            IF W_ZARBDT = ' '.
              W_ZARBDT = WA_ZMST_PERMIT-ZARB_DT.
            ENDIF.
          ENDIF.
          IF WA_ZMST_PERMIT-ZPRT_NAME NE SPACE.
            IF W_ZPRT_NAME = ' '.
              MOVE WA_ZMST_PERMIT-ZPRT_NAME TO W_ZPRT_NAME.
              CONDENSE W_ZPRT_NAME.
            ENDIF.
          ENDIF.
          CLEAR : WA_FORM_PERMIT, WA_ZMST_PERMIT.
        ENDLOOP.
        CONCATENATE SY-DATUM0(4) '/' SY-DATUM4(2) '/' SY-DATUM+6(2) INTO W_ZENGDT.
    *Printing    Subroutine
        IF NOT IT_FORM_PERMIT[] IS INITIAL.
          PERFORM PRINT_FORM.
        ELSE.
          MESSAGE TEXT-018 TYPE 'I'.
        ENDIF.
      ENDIF.
    ENDFORM.                    "user_command
    *&      Form  F4_HELP
          text
    -->  p1        text
    <--  p2        text
    FORM F4_HELP USING: W_VAR TYPE DFIES-FIELDNAME
                        W_VAR1 TYPE HELP_INFO-DYNPROFLD .
    Fetching data from zmst_permit for F4 help on PERMIT ID No.--
      IF IT_PERMIT[] IS INITIAL.
        SELECT ZPIDNUM
               ZENGDSC
               ZARBDSC
               ZTARIFF
               ZPERNUM
               ZARRPRT
               ZEFFDT
               ZEXPDT
               FROM ZMST_PERMIT INTO CORRESPONDING FIELDS OF TABLE IT_PERMIT.
      ENDIF.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          RETFIELD        = W_NAME1 " 'ZPIDNUM'
          DYNPPROG        = 'ZMSTR0022'
          DYNPNR          = SY-DYNNR
          DYNPROFIELD     = W_NAME2 "'S_PIDNUM'
          VALUE_ORG       = 'S'
        TABLES
          VALUE_TAB       = IT_PERMIT
        EXCEPTIONS
          PARAMETER_ERROR = 1
          NO_VALUES_FOUND = 2
          OTHERS          = 3.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                                                    " F4_HELP
    *&      Form  check_input
          text
    -->  p1        text
    <--  p2        text
    FORM CHECK_INPUT .
      IF S_PIDNUM[] IS INITIAL AND
         S_ENGDSC[] IS INITIAL AND
         S_ARBDSC[] IS INITIAL AND
         S_TARIFF[] IS INITIAL AND
         S_PERNUM[] IS INITIAL AND
         S_ARRPRT[] IS INITIAL .
        MESSAGE TEXT-016 TYPE 'E'.
        LEAVE TO TRANSACTION 'ZMSTR022'.
      ENDIF.
    ENDFORM.                    " check_input
    *&      Form  print_form
          text
    -->  p1        text
    <--  p2        text
    FORM PRINT_FORM .
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          FORMNAME           = C_FORM_NAME
        IMPORTING
          FM_NAME            = W_FORM
        EXCEPTIONS
          NO_FORM            = 1
          NO_FUNCTION_MODULE = 2
          OTHERS             = 3.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      W_PARAM-LANGU ='AR'.
      CALL FUNCTION W_FORM
        EXPORTING
          CONTROL_PARAMETERS = W_PARAM
          W_NAME_AUTH        = W_NAME_AUTH
          W_ZARBDT           = W_ZARBDT
          W_ZENGDT           = W_ZENGDT
          W_ZPRT_NAME        = W_ZPRT_NAME
        TABLES
          IT_FORM_PERMIT     = IT_FORM_PERMIT
        EXCEPTIONS
          FORMATTING_ERROR   = 1
          INTERNAL_ERROR     = 2
          SEND_ERROR         = 3
          USER_CANCELED      = 4
          OTHERS             = 5.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " print_form
    *&      Form  fetch_Permit
          text
    -->  p1        text
    <--  p2        text
    FORM FETCH_PERMIT .
    -Fetching data from zmst_permit based on the inputs on selection screen--
      SELECT
           ZPIDNUM
           ZARBDSC
           ZENGDSC
           ZENQUAN
           ZARQUAN
           ZENUOM
           ZTARIFF
           ZARRPRT
           ZPERNUM
           ZEFFDT
           ZEXPDT
           FROM ZMST_PERMIT INTO CORRESPONDING FIELDS OF TABLE IT_ZMST_PERMIT
           WHERE ZPIDNUM IN S_PIDNUM
           AND   ZENGDSC IN S_ENGDSC
           AND   ZARBDSC IN S_ARBDSC
           AND   ZTARIFF IN S_TARIFF
           AND   ZPERNUM IN S_PERNUM
           AND   ZARRPRT IN S_ARRPRT.
      IF SY-SUBRC <> 0.
        MESSAGE TEXT-017 TYPE 'I'.
        LEAVE TO TRANSACTION 'ZMSTR022'.
      ELSE.
        LOOP AT IT_ZMST_PERMIT INTO WA_ZMST_PERMIT.
          WA_ZMST_PERMIT-ZPERM_MIN = TEXT-020.
          MODIFY IT_ZMST_PERMIT INDEX SY-TABIX FROM WA_ZMST_PERMIT TRANSPORTING ZPERM_MIN .
        ENDLOOP.
        PERFORM ALV_DISP.        " calling subroutine for ALV display
      ENDIF.
    ENDFORM.                    " fetch_Permit
    *&      Form  fetch_permithi
          text
    -->  p1        text
    <--  p2        text
    FORM FETCH_PERMITHI .
    -Fetching data from zmst_permit based on the inputs on selection screen--
      SELECT
           ZPIDNUM
           ZARBDSC
           ZENGDSC
           ZENQUAN
           ZARQUAN
           ZENUOM
           ZTARIFF
           ZARRPRT
           ZPERNUM
           ZEFFDT
           ZEXPDT
           FROM ZMST_PERMITHI INTO CORRESPONDING FIELDS OF TABLE IT_ZMST_PERMIT
           WHERE ZPIDNUM IN S_PIDNUM
           AND   ZENGDSC IN S_ENGDSC
           AND   ZARBDSC IN S_ARBDSC
           AND   ZTARIFF IN S_TARIFF
           AND   ZPERNUM IN S_PERNUM
           AND   ZARRPRT IN S_ARRPRT
           AND  ZPERTYP  = P_PERTYP.
      IF SY-SUBRC <> 0.
        MESSAGE TEXT-017 TYPE 'I'.
        LEAVE TO TRANSACTION 'ZMSTR022'.
      ELSE.
        LOOP AT IT_ZMST_PERMIT INTO WA_ZMST_PERMIT.
          CASE P_PERTYP.
            WHEN 'I'.
              WA_ZMST_PERMIT-ZPERM_MIN = TEXT-021.
              MODIFY IT_ZMST_PERMIT INDEX SY-TABIX FROM WA_ZMST_PERMIT TRANSPORTING ZPERM_MIN .
            WHEN 'H'.
              WA_ZMST_PERMIT-ZPERM_MIN = TEXT-022.
              MODIFY IT_ZMST_PERMIT INDEX SY-TABIX FROM WA_ZMST_PERMIT TRANSPORTING ZPERM_MIN .
          ENDCASE.
        ENDLOOP.
        PERFORM ALV_DISP.        " calling subroutine for ALV display
      ENDIF.
    ENDFORM.                    " fetch_permithi
    *&      Form  val_PERTYP
          text
    -->  p1        text
    <--  p2        text
    FORM VAL_PERTYP .
      DATA: W_NAME TYPE VRM_ID,
            IT_LIST TYPE VRM_VALUES,
            WA_VALUE LIKE LINE OF IT_LIST.
      WA_VALUE-KEY = ' '.
      WA_VALUE-TEXT = TEXT-020.
      APPEND WA_VALUE TO IT_LIST.
      CLEAR WA_VALUE.
      WA_VALUE-KEY = 'I'.
      WA_VALUE-TEXT = TEXT-021.
      APPEND WA_VALUE TO IT_LIST.
      CLEAR WA_VALUE.
      WA_VALUE-KEY = 'H'.
      WA_VALUE-TEXT = TEXT-022.
      APPEND WA_VALUE TO IT_LIST.
      CLEAR WA_VALUE.
      W_NAME = 'P_PERTYP'.
      P_PERTYP = ' '.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          ID              = W_NAME
          VALUES          = IT_LIST
        EXCEPTIONS
          ID_ILLEGAL_NAME = 1
          OTHERS          = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " val_PERTYP
    I hope this will helpp you.
    Help children of U.N World Food Program by rewarding  points and encourage others to answer your queries.

Maybe you are looking for