Report with Selection screen

I have a stupid report.
In the initialization event I have put that
initialization.
set pf-status '123'.
But in the start of selection/at user-command
sy-ucomm is empty ... any idea is welcome
REWARD PROMISED
Message was edited by: STEPHAN KAMINSKI

SELECTION-SCREEN PUSHBUTTON fmt name USER-COMMAND ucom.
SELECTION-SCREEN FUNCTION KEY <Number>. "This is for displaying in Application Toolbar.
Check the following help documentation..
SELECTION-SCREEN PUSHBUTTON fmt name USER-COMMAND ucom.
Addition: MODIF ID modid.
Effect
Generates a pushbutton on the selection screen. When you define the button, you also define a user command ucom (no inverted commas), up to 20 characters long, which is triggered when the user pushes the button. The rest of the syntax is the same as for SELECTION-SCREEN COMMENT
You can define the name name either statically or at runtime (see also the BEGIN OF BLOCK, COMMENT and SELECTION-SCREEN BEGIN OF SCREEN variants).
When you define a pushbutton, you must always specify a format fmt.
By specifying a Modif ID, you can assign the pushbutton to a modification group.
Notes
The best way of reacting to the pushbutton is in the AT SELECTION-SCREEN event, or, for pushbuttons in the selection include, in the PAI routine (with FNAME = '*' and MARK = SPACE) in the database program SAPDBldb. The field SSCRFIELDS-UCOMM contains the user command ucom. (You need to declare the SSCRFIELDS table using the TABLES statement).
You can create your own pushbuttons in the application toolbar using the FUNCTION KEY n addition.
Within the selectoin include : Additions FOR NODE node ,FOR TABLE dbtab und ID id.
Example
TABLES SSCRFIELDS.
SELECTION-SCREEN PUSHBUTTON /10(20) CHARLY USER-COMMAND ABCD.
INITIALIZATION.
MOVE 'My text' TO CHARLY.
AT SELECTION-SCREEN.
IF SSCRFIELDS-UCOMM = 'ABCD'.
ENDIF.
A pushbutton appears on the selection screen with the text 'My text'. In the AT SELECTION-SCREEN event, the field SSCRFIELDS-UCOMM has the contents ABCD after the button has been pushed.

Similar Messages

  • Call a report with selection screen as subscreen.

    Hi all,
    i need to Submit And Return a Report having some parameters and Select options, from a Function Module.
    all i want that the Selection Scrren of Report should appeared as Subscreeen, so that Calling Screen sould be visible in Background.
    Is this Possible , if yes then How ?
    thanks in advance,
    Nitin

    Running new report means opening new internal session. This can't be embeded within the current internal session where your function group (function module specifically) runs. So there is no such a way which you could run a report inside a subscreen area.
    If you however want only selection screen of the report to be embeded inside your subscreen area (not run) you can use
    "report Z_SUBSCREEN_REPORT
    SELECTION-SCREEN BEGIN OF SCREEN 0200 as SUBSCREEN.
      PARAMETERS pa type c.
    SELECTION-SCREEN end of SCREEN 0200.
    "main screen's flow logic in function group with subscreen area
    PROCESS BEFORE OUTPUT.
      call SUBSCREEN area INCLUDING 'Z_SUBSCREEN_REPORT '0200'.
    Regards
    Marcin

  • How to create a report with selection screen that can run in background

    Sorry to ask these basic questions but I am knew to ABAP Programming.
    To keep it simply, I am attempting to create a report that has a simple parameter driven selections screen with one field.  That field takes in a folder path from the user.  The user executes the report.  The report creates a simply BDC that goes into SE16, gathers data from a table, and exports the results to a text file using the folder path provided.  I created a variant for the folder path field in the selection screen hoping to use it while executing the report in the background.  The report is not exporting the file as it did when run in the foreground for some reason.
    I am wondering what event is triggered when a report is executed in the background.  In the foreground (or when I execute the program via SE38->Execute->With Variant) the user needs to execute the program by hitting the execute button once the variant has populated the folder path field.  It works then, so I am trying to get the same to work in the background.  I am thinking I didn't put the program together correctly to accommodate the running in the background.  How can you create a report that can accept user input via variant into a selection screen and then run in the background?
    Please, any information would be greatly appreciated.
    Thanks you all for reading this!!!

    Ok, finally I understand what you're doing. Initially you lost me with the SE16 reference...
    Not sure what you're trying to achieve overall, but apart from the fact that you cannot export/download a file to a user's PC via background job (unless you have a mapped network share on the server or something like an FTP server on the user's PC, but both are pretty hypothetical scenarios and unlikely to occur).
    Also, the BDC approach to get data via SE16 is pretty awkward. Note that SE16 is guarded by some authorization checks and often users won't have access in production (which might not matter if you intend to always run your program in background via dedicated batch user). However, I have no clue why you wouldn't want to use [open SQL|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_READING.htm] to read the data. You could then save it on the application server or if you really have to get it to the user you can consider e-mailing the file (extracts should be compressed before sending). For the latter you'll find plenty of references here, basically it's the [business communication services|http://help.sap.com/saphelp_nw2004s/helpdata/en/2d/1c5d3aebba4c38e10000000a114084/frameset.htm] that you'd need to look at.

  • Background processing for ABAP report with selection screen

    Hi ABAP Gurus,
    I m facing a strange problem in scheduling a background job for my report with a selection screen. I have a variant for the report.
    I scheduled a job, but it seems to be not doing anything though all the system resources are available. The job overview shows "Acive" for the job. The job is neither stopping anything, it is just sitting there In SM50, the status shows "On Hold".
    Any ideas/comments on the problem and how this can be overcome?
    Qucik replies and solutions will be highly appreciated as this is a crucial part for a go-live project.
    Thanks in advance.
    Shivani.

    Yes. My report has a selection-screen which requires user input. But I have created  a variant for the report and trying to run it in background using this variant. But facing this problem.
    Strange thing is, instead of the usual SM36/SM37 option where we schedule and monitor background jobs, this option does not work for my report.
    But I tried through SE38, and from my selection screen I selected "Schedule background job" and "run immediately" option, and this works. Though I still use SM37 to monitor this background job.
    I have never faced such a situation before.
    Any hints/tips why this happens and how this can be overcome in the future?
    Thanks in advance.
    Shivani.

  • Pop-up in a report with selection screen

    Hi all,
    I need to display a pop-up as an input component for a report as it is executed.
    The controlling area has to entered inthe pop-up.The pop-up is same as the one in Transaction code CO99.
    How do i do this for report? Its not a module pool development.
    Pls help with your ideas.
    Thanks,
    stock

    Use this code for this purpose. 
    Write this subroutine where u want the popup.
    PERFORM POPUP USING ST CHANGING ST.
    Write the following code in the subroutine of pop up.
    FORM POPUP USING P_INVST CHANGING P_VALUE.
    DATA: FIELDS LIKE SVAL OCCURS 0 WITH HEADER LINE.
      DATA : TITLE(40).
      REFRESH : FIELDS. CLEAR ANS.
      P_VALUE = P_INVST.
      FIELDS-TABNAME = 'TKA01'. FIELDS-FIELDNAME = 'KOKRS'.
      FIELDS-VALUE = P_VALUE.
        APPEND FIELDS.
    heading of the title box
    TITLE = 'Please give the controlling area'
    function to get the pop up
      CALL FUNCTION 'POPUP_GET_VALUES'
           EXPORTING
                POPUP_TITLE = TITLE
           IMPORTING
                RETURNCODE  = ans
           TABLES
                FIELDS      = fields.
      if ans = 'A'.
      else.
        read table fields index 1.
        P_VALUE = FIELDS-VALUE.
      endif.
    ST = P_VALUE.
    ENDFORM.                    " POPUP

  • Prob in Submit Report via Selection screen.

    Hi,
    I have to submit a report via selection screen.
    The report name is detemined at run time.
    This i am able to handle easily as we can use SUBMIT (V_PROG)...
                                   WHERE V_PROG contains the name of the report that i get at runtime...
    Now the issue :::::::
    I have to also populate a select-options on the called report on submit.
    usually this is done by :
                                                SUBMIT (V_PROG)
                                                name of select-option in itab...
    However in my case the name of the <name of select-option> is also detemined at runtime say PNPPERNR.
    Now if i use any variable / field symbol for the name of the select - option (like for the called program), it does not work (the called report does not have the values i populate in ITAB for the particular select-option)
    I have also tried Macro but cant find solution...
    ANY IDEAS ??

    Hi Anuj,
    When you are getting the report name in runtime, you can also get the report selection screen information during runtime.
    Now how are you going to decide which values you will move to which selection screen variables of which report? If you have a way to determine this, then here is a program that works on that assumption.
    REPORT ztest1 .
    DATA: i_seltab          TYPE TABLE OF rsparams WITH HEADER LINE,
          i_selections_info TYPE TABLE OF selinfo WITH HEADER LINE.
    DATA: v_report LIKE sy-repid,
          v_matnr  LIKE mara-matnr.
    PARAMETERS: p_rep1 RADIOBUTTON GROUP rad DEFAULT 'X',
                p_rep2 RADIOBUTTON GROUP rad.
    SELECT-OPTIONS: s_matnr FOR v_matnr.
    START-OF-SELECTION.
      IF p_rep1 = 'X'.
    *-- some criteria to determine the name of the report
        v_report = 'ZTEST2'.
      ELSE.
        v_report = 'ZTEST4'.
      ENDIF.
    *-- get the parameters for the report
      CALL FUNCTION 'RS_SELECTIONS_DESCRIPTION'
           EXPORTING
                report              = v_report
           TABLES
                selections_info     = i_selections_info
           EXCEPTIONS
                no_selections       = 1
                report_not_existent = 2
                subroutine_pool     = 3
                OTHERS              = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      LOOP AT i_selections_info WHERE name = 'S_MATNR'.
    *-- some criteria based on which, move the values from this program
    *   to the called program
        CLEAR i_seltab.
        i_seltab-selname = i_selections_info-name.
        i_seltab-kind    = i_selections_info-kind.
        i_seltab-sign    = 'I'.
        i_seltab-option  = 'EQ'.
        i_seltab-low     = s_matnr-low.
        i_seltab-high    = s_matnr-high.
        APPEND i_seltab.
      ENDLOOP.
      IF NOT i_seltab[] IS INITIAL.
        SUBMIT (v_report) VIA SELECTION-SCREEN
                WITH SELECTION-TABLE i_seltab .
      ENDIF.
    If this works for you, please reward and close the post.
    Regards,
    Srinivas

  • Run alv report without selection screen in background

    Hello Every body,
    i programmed a ALV Report without selection screen, and i want to create a job for this alv report.
    Any help?
    Thank u.
    Ouail.

    Hi Steve,
    Can you tell me where i have to put your code?
    this is my abap code:
    START-OF-SELECTION.
       p_filref = '\\SAPSERVER\f\SAFT\ivat\FI_Extract_1000_20140709_102346_910.XML'.
       PERFORM copy_from_xml_to_itab TABLES it_ref_file
                                     ref_xml_data
                                     USING p_filref.
    **Begin Extraction File
       SUBMIT ZZ_FI_IVAT_EXTRACTOR
       WITH p_bukrs EQ '1000'
       WITH p_gjahr EQ '1998'
       WITH filepath EQ '\\SAPSERVER\f\SAFT\iVAT_Extractie\'
       WITH cldata eq space
       AND RETURN.
       DATA: FILE_TABLE  TYPE TABLE OF SDOKPATH,
       DIR_TABLE  TYPE TABLE OF SDOKPATH.
       CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
         EXPORTING
           DIRECTORY  = '\\SAPSERVER\f\SAFT\iVAT_Extractie\'
           FILTER     = '*.*'
         TABLES
           FILE_TABLE = FILE_TABLE
           DIR_TABLE  = DIR_TABLE
         EXCEPTIONS
           CNTL_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.
       "get file name
       LOOP AT FILE_TABLE INTO p_filref.
       ENDLOOP.
       CONCATENATE '\\SAPSERVER\f\SAFT\iVAT_Extractie\' p_filref INTO path.
       PERFORM copy_from_xml_to_itab TABLES t_ext_file
                                     ext_xml_data
                                     USING path.
       PERFORM fill_xml_tab_in .
       perform build_fieldcatalog.
       PERFORM compare_data_ref_ext.
       PERFORM send_email.
       perform display_alv_report.
       PERFORM delete_extraction_file.
    in the perform copy_from_xml_to_itab TABLES it_ref_file......, i use this code:
       CREATE OBJECT gcl_xml.
    *Upload XML File
       CALL METHOD gcl_xml->import_from_file
         EXPORTING
           filename = p_filref
         RECEIVING
           retcode  = gv_subrc.
       IF gv_subrc = 0.
         CALL METHOD gcl_xml->render_2_xstring
           IMPORTING
             retcode = gv_subrc
             stream  = gv_xml_string
             size    = gv_size.
         IF gv_subrc = 0.
           REFRESH gt_xml_data[].
    * Convert XML to internal table
           CALL FUNCTION 'SMUM_XML_PARSE'
             EXPORTING
               xml_input = gv_xml_string
             TABLES
               xml_table = gt_xml_data
               return    = gt_return.
         ENDIF.
       ENDIF.

  • Submit program with selection screen parameters - getting blank values

    Hi, I'm submitting a program with selection screen parameters. when I pass '000' (I_TPLSCN  )value for Planning Scenario and when this goes to selection screen then I don't see value for Planning scenario as '000'(I_TPLSCN  ) but the value is blank in selection screen. I'm using the below code for this.
    SUBMIT RMCPAMRP WITH MATNR_GL EQ I_MATNR   SIGN 'I'
                      WITH WERKS_GL EQ I_WERKS   SIGN 'I'
                      WITH PLSCN    EQ I_TPLSCN  SIGN 'I'
        via selection-screen        AND RETURN.
    Could anyone please help me how to display value '000' rather than blanks.
    thanks in advance.

    If I_MATNR, I_TPLSCN and I_WERKS are variable then try with
    SUBMIT rmcpamrp
      WITH matnr_gl = i_matnr
      WITH plscn    = i_tplscn
      WITH werks_gl = i_werks
      via selection-screen       
       AND RETURN .
    If I_MATNR, I_TPLSCN and I_WERKS are of type range then try  with
    SUBMIT rmcpamrp
      WITH matnr_gl IN i_matnr
      WITH plscn    IN i_tplscn
      WITH werks_gl IN i_werks
    via selection-screen       
       AND RETURN
    Edited by: Pawan Kesari on Dec 24, 2009 3:33 PM

  • Report Painter selection screen field modfication?

    Hi Buddies,
    I want to modify the report painter selection screen.
    There is one field manadatory on the selection screen . I want to make it as optional.
    Please let me know if any one knows.
    Waiting for your response..
    Regards,
    Vijay

    Hello sir,
    Some one did the code. Now iam modifying this report painter selection screen.
    I would like to know where the field definition will take place in report painter.
    Regards,
    Vijnay

  • How to fill internal table with selection screen field.

    Hi all,
    i am new to sap . pls tell me how to fill internal table with selection screen field.

    Hi,
    Please see the example below:-
    I have used both select-options and parameter on the selection-screen.
    Understand the same.
    * type declaration
    TYPES: BEGIN OF t_matnr,
            matnr TYPE matnr,
           END OF t_matnr,
           BEGIN OF t_vbeln,
             vbeln TYPE vbeln,
           END OF t_vbeln.
    * internal table declaration
    DATA : it_mara  TYPE STANDARD TABLE OF t_matnr,
           it_vbeln TYPE STANDARD TABLE OF t_vbeln.
    * workarea declaration
    DATA : wa_mara  TYPE t_matnr,
           wa_vbeln TYPE t_vbeln.
    * selection-screen field
    SELECTION-SCREEN: BEGIN OF BLOCK b1.
    PARAMETERS : p_matnr TYPE matnr.
    SELECT-OPTIONS : s_vbeln FOR wa_vbeln-vbeln.
    SELECTION-SCREEN: END OF BLOCK b1.
    START-OF-SELECTION.
    * I am adding parameter value to my internal table
      wa_mara-matnr = p_matnr.
      APPEND wa_mara TO it_mara.
    * I am adding select-options value to an internal table
      LOOP AT s_vbeln.
        wa_vbeln-vbeln =  s_vbeln-low.
        APPEND  wa_vbeln TO  it_vbeln.
      ENDLOOP.
    Regards,
    Ankur Parab

  • How to create tcode for modulepool program with selection screen?

    hi,
       How to create tcode for modulepool program with selection screen?
    thanks,
    sagar

    Hi,
    We need to goto SE80.
    In our program we right click on object name and goto create
    -> transaction. Enter the module pool program and screen number and save and activate.
    Or by SE93 also we can create a transaction code for our program.
    Hope ths helps.
    plz reward if useful.
    thanks,
    dhanashri..
    Edited by: Dhanashri Pawar on Jul 22, 2008 8:29 AM

  • BEx Report Performance with selection-screen input

    Hello Gurus,
    My Bex report is working fine when the report had run with out PLANT filter in the selection-screen but when report had run with plant in the selection-screen , report running for forever.
    Please let me know what I need to do improve the performance.
    Saleem.

    Hi Saleem, Just a few thoughts;
    1. Check the M-table in RSD1 for 0PLANT. In Table View edit any blank or null values. Run the same restrictions you apply in the query at Info provider level > Display Data. If there's any lapse; you can judge where exactly the problem lies.
    2. If you are using Infocube & that your master is >20% fact; you can declare the Info object as 'Line Item Dimension'.
    3. Create Variants. Esp. if you are running the query for same set of data. Try Variable Preselection: You can restrict both the values + varaiables in the filter level. When you execute the values will be visibly pre-selected in selection screen.
    4. As discussed in previous messages, running a SQL trace using RSRT may prove useful.

  • Portal Activity Report with Selection criteria

    Hi All,
    I have created an iview using 'Portal Activity Report' template, added the iview to page and page is added to the role which is created for this report. Also, users were assigned to the new role. When users go to portal and see this report, they are seeing the final output of this report along with the 'Download Report' option.
    My requirement is to give selection screen option (Type of report and Reporting period) to users. So that users will change the selection criteria and run the report as per their need. Please advice me on how to do this.
    Thanks in advance.
    Swapna.

    swapna,
    you can do this by creating a webdynpro application for accessing the database tables, the list of data base tables is in this [help |http://help.sap.com/saphelp_nw04/helpdata/en/48/6aa9429b930b31e10000000a1550b0/frameset.htm]document and use web dynpro application to connect to that tables. Check this thread  for[ dynpro and database tables  |dynpro and database tables;
    regards
    Mahesh

  • Problem with SUBMIT report [ WITH SELECTION-TABLE ] or [ IN range ]

    Hello Everybody,
    I am trying to call transaction F.80 for mass reversal of FI documents by using SUBMIT sentence and its parameters like this:
      LOOP AT i_zfi013 INTO wa_zfi013.
        PERFORM llena_params USING 'BR_BELNR' 'S' 'I' 'EQ' wa_zfi013-num_doc ''.
    range_line-sign   = 'I'.
    range_line-option = 'EQ'.
    range_line-low    = wa_zfi013-num_doc.
    APPEND range_line TO range_tab.
    endloop.
    Line: -
          SUBMIT sapf080
            WITH br_bukrs-low = p_bukrs
            WITH SELECTION-TABLE it_params  [ same  problem with -  WITH BR_BELNR IN range_tab]
            WITH br_gjahr-low = p_an1
            WITH stogrd = '05'
            WITH testlauf = ''
            AND RETURN.
    My problem is that  when the report is executed the BR_BELNR only delete one document of the all the inputs in the selection criteria from the loop. if I add the statement [ VIA SELECTION-SCREEN] in the SUBMIT if open the multiple selection criteria in the screen I can check that all the documents are set in it from the ABAP code in the loop from it I just need to push F8 to copy them and run the program processing all the documents normally .
    Can some one help me with this? is there a way to execute the transaction BY the SUBMIT with the multiple selection criteria for the Document Number working well?
    Thank for you time and help.

    This is my code:
      TYPES: BEGIN OF T_ZFI013,
              BUKRS     TYPE BUKRS,
              GJAHR     TYPE GJAHR,
              MONAT     TYPE MONAT,
              ANLN1     TYPE ANLN1,
              ANLN2     TYPE ANLN2,
              NUM_DOC     TYPE BELNR_D,
              DATE     TYPE DATUM,
              TIME  TYPE UZEIT,
              USER     TYPE SYUNAME,
             END OF T_ZFI013.
       DATA: I_ZFI013  TYPE STANDARD TABLE OF T_ZFI013,
             WA_ZFI013 TYPE T_ZFI013,
      DATA: br_belnr       TYPE BELNR_D,
            rspar_tab  TYPE TABLE OF rsparams,
            rspar_line LIKE LINE OF rspar_tab,
            range_tab  LIKE RANGE OF br_belnr,
            range_line LIKE LINE OF range_tab."range_tab.
      LOOP AT i_zfi013 INTO wa_zfi013.
        range_line-sign   = 'I'.
        range_line-option = 'EQ'.
        range_line-low    = wa_zfi013-num_doc.
        APPEND range_line TO range_tab.
      ENDLOOP.
      SUBMIT sapf080
        WITH br_bukrs-low = p_bukrs
        WITH br_belnr IN range_tab
        WITH br_gjahr-low = p_an1
        WITH stogrd = '05'
        WITH testlauf = ''.
    This is the RANGE_TAB table before submit:
    1     I     EQ     1001xxxxxx
    2     I     EQ     1002xxxxxx
    3     I     EQ     1003xxxxxx
    4     I     EQ     1004xxxxxx
    5     I     EQ     1005xxxxxx
    6     I     EQ     1006xxxxxx
    7     I     EQ     1007xxxxxx
    8     I     EQ     1008xxxxxx
    I think this wont work for some reason so I will start to do this by a BDC.
    Many thanks for your help.

  • JOB_SUBMIT   with Selection Screen Value

    I have a requirement :
    with other select-options and parameters, i have two radio button, Foreground and Background:
    when Background radio button will be selected program should be scheduled as a background job.
    How i will pass selection screen value in JOB_SUBMIT ??
    Cheers.
    Srikanta

    Hi ,
    Try This
    *& Report  ZMMVB_PG_SL_CHANGE_BDC
    REPORT  zmmvb_pg_sl_change_bdc.
    TABLES : mara,t133a,marc.
    DATA i_t133a LIKE t133a OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF itab OCCURS 0,
            matnr LIKE marc-matnr,
            werks LIKE marc-werks,
            ekgrp LIKE marc-ekgrp,
           END OF itab.
    DATA : BEGIN OF itab1 OCCURS 0,
             matnr LIKE marc-matnr,
             werks LIKE marc-werks,
             dispo LIKE marc-dispo,
    END OF itab1.
    DATA : fname LIKE ibipparms-path ,
           ename TYPE string,
           mode.
    DATA: BEGIN OF it_t133a OCCURS   0,
            bilds LIKE t133a-bilds,
            pstat LIKE t133a-pstat,
            guifu LIKE t133a-guifu,
            auswg LIKE t133a-auswg,
          END OF it_t133a.
    DATA:  ctr TYPE i,
           ctr_s(2) TYPE n,
           wrk(35),
           ch(1),
           viewno(2) TYPE n,
           guifu LIKE t133a-guifu.
    DATA: BEGIN OF it_views OCCURS 30.
            INCLUDE STRUCTURE mbildtab.   " Selection Views
    DATA: END OF it_views.
    DATA bdc_data LIKE bdcdata OCCURS 0 WITH HEADER LINE.
    SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-000.
    PARAMETERS : ek RADIOBUTTON GROUP rg1 ,
                 sl RADIOBUTTON GROUP rg1
    SELECTION-SCREEN END OF BLOCK b.
    SELECTION-SCREEN BEGIN OF BLOCK c WITH FRAME TITLE text-001.
    PARAMETERS : fg RADIOBUTTON GROUP rg2 DEFAULT 'X',
                 bg RADIOBUTTON GROUP rg2.
    SELECTION-SCREEN END OF BLOCK c.
    START-OF-SELECTION.
      IF fg = 'X'.
        mode = 'A'.
      ELSEIF bg = 'X'.
        mode = 'E'.
      ENDIF.
      IF ek = 'X'.
        guifu = 'SP09'.
        PERFORM bdc_ekgrp_change.
      ELSEIF sl = 'X'.
        guifu = 'SP12'.
        PERFORM bdc_mrpcontroller_change.
      ENDIF.
    *&      Form  BDC_EKGRP_CHANGE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM bdc_ekgrp_change .
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = sy-repid
          dynpro_number = sy-dynnr
          field_name    = ' '
        IMPORTING
          file_name     = fname.
      IF NOT ( fname IS INITIAL ) .
        ename = fname .
      ENDIF.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = ename
          filetype                = 'DAT'
        TABLES
          data_tab                = itab
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF itab[] IS NOT INITIAL.
        LOOP AT itab.
          REFRESH bdc_data.
          IF itab-matnr NA sy-abcde AND itab-matnr NA '/*-_.'.
            UNPACK itab-matnr TO itab-matnr.
          ELSE.
            TRANSLATE itab-matnr TO UPPER CASE.
          ENDIF.
          SELECT SINGLE * FROM mara WHERE matnr = itab-matnr.
          IF sy-subrc NE 0.
            CONTINUE.
          ENDIF.
          PERFORM view_routine.
          PERFORM bdc_dynpro      USING 'SAPLMGMM' '0060'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'RMMG1-MATNR'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM bdc_field       USING 'RMMG1-MATNR'
                                        itab-matnr.
          CONCATENATE 'MSICHTAUSW-DYTXT(' viewno ')' INTO wrk.
          CONDENSE wrk NO-GAPS.
          PERFORM bdc_dynpro      USING 'SAPLMGMM' '0070'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                          wrk.   "'MSICHTAUSW-DYTXT(08)'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=ENTR'.
          CONCATENATE 'MSICHTAUSW-KZSEL(' viewno ')' INTO wrk.
          CONDENSE wrk NO-GAPS.
          PERFORM bdc_field       USING   wrk  "'MSICHTAUSW-KZSEL(08)'
                                          'X'.
          PERFORM bdc_dynpro      USING 'SAPLMGMM' '0080'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'RMMG1-WERKS'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=ENTR'.
          PERFORM bdc_field       USING 'RMMG1-WERKS'
                                        itab-werks.
          PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=BU'.
    *  PERFORM bdc_field       USING 'MAKT-MAKTX'
    *                                '"HEX BOLT M16X1.5X100,B8.8,BP"'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'MARC-EKGRP'.
    *  PERFORM bdc_field       USING 'MARA-MEINS'
    *                                'NOS'.
          PERFORM bdc_field       USING 'MARC-EKGRP'
                                        itab-ekgrp.
    *  PERFORM bdc_field       USING 'MARA-MATKL'
    *                                '1702'.
    *  PERFORM bdc_field       USING 'MARC-USEQU'
    *                                '3'.
    *  PERFORM bdc_field       USING 'MARC-KORDB'
    *                                'X'.
          CALL TRANSACTION 'MM02' USING bdc_data MODE mode UPDATE 'S'.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " BDC_EKGRP_CHANGE
    *&      Form  BDC_MRPCONTROLLER_CHANGE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM bdc_mrpcontroller_change .
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = sy-repid
          dynpro_number = sy-dynnr
          field_name    = ' '
        IMPORTING
          file_name     = fname.
      IF NOT ( fname IS INITIAL ) .
        ename = fname .
      ENDIF.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = ename
          filetype                = 'DAT'
        TABLES
          data_tab                = itab1
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF itab1[] IS NOT INITIAL.
        LOOP AT itab1.
          REFRESH bdc_data.
          IF itab1-matnr NA sy-abcde AND itab1-matnr NA '/*-_.'.
            UNPACK itab1-matnr TO itab1-matnr.
          ELSE.
            TRANSLATE itab1-matnr TO UPPER CASE.
          ENDIF.
          SELECT SINGLE * FROM mara WHERE matnr = itab1-matnr.
          IF sy-subrc NE 0.
            CONTINUE.
          ENDIF.
          PERFORM view_routine.
          PERFORM bdc_dynpro      USING 'SAPLMGMM' '0060'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'RMMG1-MATNR'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM bdc_field       USING 'RMMG1-MATNR'
                                        itab1-matnr.
          CONCATENATE 'MSICHTAUSW-DYTXT(' viewno ')' INTO wrk.
          CONDENSE wrk NO-GAPS.
          PERFORM bdc_dynpro      USING 'SAPLMGMM' '0070'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                           wrk.         "'MSICHTAUSW-DYTXT(11)'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=ENTR'.
          CONCATENATE 'MSICHTAUSW-KZSEL(' viewno ')' INTO wrk.
          CONDENSE wrk NO-GAPS.
          PERFORM bdc_field       USING   wrk          "'MSICHTAUSW-KZSEL(11)'
                                        'X'.
          PERFORM bdc_dynpro      USING 'SAPLMGMM' '0080'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'RMMG1-WERKS'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=ENTR'.
          PERFORM bdc_field       USING 'RMMG1-WERKS'
                                        itab1-werks.
          PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=BU'.
    *      PERFORM bdc_field       USING 'MAKT-MAKTX'
    *                                    '"HEX BOLT M16X1.5X100,B8.8,BP"'.
    *      PERFORM bdc_field       USING 'MARA-MEINS'
    *                                    'NOS'.
    *      PERFORM bdc_field       USING 'MARC-DISGR'
    *                                    '701'.
    *      PERFORM bdc_field       USING 'MARC-EKGRP'
    *                                    'A00'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'MARC-DISPO'.
    *      PERFORM bdc_field       USING 'MARC-DISMM'
    *                                    'PD'.
          PERFORM bdc_field       USING 'MARC-DISPO'
                                        itab1-dispo.
    *      PERFORM bdc_field       USING 'MARC-DISLS'
    *                                    'MB'.
          CALL TRANSACTION 'MM02' USING bdc_data MODE mode UPDATE 'S'.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " BDC_MRPCONTROLLER_CHANGE
    *&      Form  bdc_dynpro
    *       text
    *      -->PROGRAM    text
    *      -->DYNPRO     text
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdc_data.
      bdc_data-program  = program.
      bdc_data-dynpro   = dynpro.
      bdc_data-dynbegin = 'X'.
      APPEND bdc_data.
    ENDFORM.                        "BDC_DYNPRO
    *        Insert field                                                  *
    FORM bdc_field USING fnam fval.
      CLEAR bdc_data.
      bdc_data-fnam = fnam.
      bdc_data-fval = fval.
      APPEND bdc_data.
    ENDFORM.                    "BDC_FIELD
    *&      Form  VIEW_ROUTINE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM view_routine .
      CLEAR viewno.
      SELECT * FROM t133a INTO CORRESPONDING FIELDS OF TABLE i_t133a
                    WHERE bilds = '21' AND guifu LIKE 'SP%'  .
      LOOP AT i_t133a .
        ch = i_t133a-pstat.
        IF mara-vpsta NA ch .
          DELETE i_t133a     .
          CONTINUE .
        ENDIF .
      ENDLOOP.
      SORT i_t133a BY guifu ASCENDING .
      LOOP AT i_t133a .
        viewno = viewno + 1 .
        IF i_t133a-guifu = guifu .
          EXIT .
        ENDIF .
      ENDLOOP .
    ENDFORM.                    " VIEW_ROUTINE
    Regards,

Maybe you are looking for