Dynamic fields creation on selection screen

Good evening everybody!
I've got the following problem for solving:
Imagine the following situation:
on the selection-screen there are some input fields in one line and a button after them. By pressing that button (e.g. it's name is "Add line") the same fields should be duplicated so many times as many times that button pressed. By pressing another button (e.g. it's name is "Delete line") one last line should be deleted. The mechanism is similar to adding lines in a screen table. What is the solution of this problem?
So: by pressing an "Add line" button on a screen identical fields should be created on the same selection-screen and deleted by pressing "Delete line".
Thanks in advance!

Here's a way to do it.
DEFINE aline.
  selection-screen: begin of line.
  parameters: inp&1(5) type c modif id l&1.
  selection-screen position 15.
  parameters: inp10&1(5) type c modif id l&1.
  selection-screen pushbutton 25(5) pb_&1 user-command add
     modif id a&1.
  selection-screen pushbutton 31(5) pb_10&1 user-command del
     modif id d&1.
  selection-screen end   of line.
END-OF-DEFINITION.
TABLES: sscrfields.
DATA:
  max_lines         TYPE i VALUE 20,
  fldname(60)       TYPE c,
  lines(2)          TYPE n VALUE 1,
  cnt(2)            TYPE n VALUE 1.
FIELD-SYMBOLS:
  <fld>     TYPE ANY.
aline 01.
aline 02.
aline 03.
aline 04.
aline 05.
aline 06.
aline 07.
aline 08.
aline 09.
aline 10.
aline 11.
aline 12.
aline 13.
aline 14.
aline 15.
aline 16.
aline 17.
aline 18.
aline 19.
aline 20.
*---------------------------------------------------- Push Button
AT SELECTION-SCREEN.
  CASE sscrfields-ucomm.
    WHEN 'ADD'.
      CHECK lines LT max_lines.
      lines = lines + 1.
    WHEN 'DEL'.
      CHECK lines GT 1.
      lines = lines - 1.
  ENDCASE.
AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF screen-group1 CP 'A*'.
      IF screen-group1+1(2) NE lines.
        screen-active = 0.
      ELSE.
        IF lines LT max_lines.
          screen-active = 1.
        ELSE.
          screen-active = 0.
        ENDIF.
      ENDIF.
    ENDIF.
    IF screen-group1 CP 'D*'.
      IF screen-group1+1(2) NE lines.
        screen-active = 0.
      ELSE.
        IF lines = 1.
          screen-active = 0.
        ELSE.
          screen-active = 1.
        ENDIF.
      ENDIF.
    ENDIF.
    IF screen-group1 CP 'L*'.
      IF screen-group1+1(2) GT lines.
        screen-active = 0.
      ELSE.
        screen-active = 1.
      ENDIF.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.
INITIALIZATION.
  cnt = 1.
  WHILE cnt LE max_lines.
    CONCATENATE 'PB_' cnt INTO fldname.
    ASSIGN (fldname) TO <fld>.
    <fld> = 'Add'.
    CONCATENATE 'PB_10' cnt INTO fldname.
    ASSIGN (fldname) TO <fld>.
    <fld> = 'Del'.
    cnt = cnt + 1.
  ENDWHILE.
Edited by: Paul Chapman on Jul 1, 2008 1:06 PM

Similar Messages

  • Adding field in the selection-screen of a zprogram

    hi gurus,
    i have to add field in the selection-screen of oppurtunities. in database i have a field salesvalues, some of oppurtunity guids have this field value. first i need to add in selection-screen in this alv report. and fetch the data from ztable into required field . if the input fields of the salesvalues field id filled, then filter the global  guids(from global table which had the guid values already) with this guids related to salesvalues. and if one single guid mathes to 2 values of salesvalues then concatenate 2 values with comma and display in single field. if select-options are blank then fetch all opportunity guids which have salesvalues. pls give solution.

    Hi Srini,
    Thanks for your Reply
    I have kept 01 against the field BSEG-AUGDT and selected the preselect check box also.
    But still that field is not visible in the dynamic selection screen.
    Thanks
    Ajay.D

  • How to display the dynamic text in the selection screen

    Hi All,
    I want to display the dynamic text in the selection screen .... ( I searched in forums , didnt get the any answer fot this sort of qustion ).....
    EX: If i have the date of today 31st  it has to show message like " today date is 31 like some thing "  when i execute the report .
    Could any one face this sort of requirment, Please let me know.
    Thanks in advance.
    Reagrds,
    Bharani

    Where would you like this dynamic text being displayed? As an "message" or in some parameter field?
    If first
    parameters date type d.
    data: text type string.
    at selection-screen.
       concatenate 'Today is' date into text.
       message text type 'I'.
    If second
    parameters pa_text type c length 50.
    at selection-screen on date.
      if date is not initial.
        concatenate 'Today is' date into  pa_text.
      enidf.
    at selection-screen output.
       "show it as read only
       loop at screen.
        if screen-name = 'PA_TEXT'.
               screen-input = abap_false.
              modify screen.
        endif.
       endloop.
    Regards
    Marcin

  • Dynamic Parameters in the Selection screen

    Hi,
    I want to have a pair of Parameters (Source & Target Field) in the Selection Screen. Is it possible to create more pairs of Parameters by click of a Button or something else?
    Sinan

    hi,
    Dynamic generation of selection-screen is bit confusing.
    I have a sample program which takes an integer as an input. After giving input, click on the button on selection screen. You can make a similar logic in your case also.
    Create a program with name 'Z_13317_DYN_CHKBOX' and paste the following code in it. Also make ensure that an include with name 'Z_13317_DYN_INCL' is not existing earlier because this program will be overwritten each and everytime.
    Suppose, if you have given 3 as input and if you have clicked the button, then 3 checkboxes will be generated on your selection screen.
    REPORT  Z_13317_DYN_CHKBOX.
    types :begin of t_itab1,
            line(72),
           end of t_itab1.
    data: incl type table of t_itab1 with header line.
    parameters: p_tab type i,
                p_frst type c no-display.
    selection-screen begin of line.
    selection-screen: pushbutton 2(20) but1 user-command cli1.
    selection-screen end of line.
    include z_13317_dyn_incl if found.
    initialization.
    at selection-screen output.
      if p_frst = ' '.
        p_frst = 'X'.
        perform crt_dyn_incl.
      endif.
    at selection-screen.
      case sy-ucomm.
        when 'CLI1'.
        perform crt_dyn_incl.
      endcase.
    *&      Form  crt_dyn_incl
    *       text
    form crt_dyn_incl .
      perform populate_incl.
      perform del_incl.
      insert report 'Z_13317_DYN_INCL' from incl.
      commit work.
      submit z_13317_dyn_chkbox via selection-screen with p_frst = p_frst.
    endform.                    " crt_dyn_incl
    *&      Form  del_incl
    *       text
    form del_incl .
      call function 'RS_DELETE_PROGRAM'
        exporting
         program                          = 'Z_13317_DYN_INCL'
         suppress_checks                  = 'X'
         suppress_popup                   = 'X'
         with_cua                         = ' '
         with_documentation               = ' '
         with_dynpro                      = 'X'
         with_includes                    = ' '
         with_textpool                    = ' '
         with_variants                    = ' '
      if sy-subrc <> 0.
      endif.
    endform.                    " del_incl
    *&      Form  populate_incl
    *       text
    form populate_incl .
      data: v_cnt type n.
      do p_tab times.
        v_cnt = v_cnt + 1.
        incl-line = 'parameters: '.
        concatenate incl-line 'p_chk' v_cnt into incl-line.
        concatenate incl-line 'as checkbox.' into incl-line separated by space.
        append incl.
        clear incl.
      enddo.
    endform.                    " populate_incl
    Regards
    Sailaja.

  • Dynamic field on the output screen

    Hi All,
    I have a requirement to create the dynamic field on the output screen.
    In the basic list I am displaying the production order details like
    check box, production order , materials, quantity, etc.
    If I select the particular check box , the quantity pertaining to that check box line as to display on the dynamic field. If I select more than one check box, then the cummilative quantity of all the production orders has to display on the dynamic field.
    Thanks in advance.
    Ramesh.

    hi,
      you can define a dinamic fields depending on selection of check box.
      Go through the below code. I think it may help you.
    PARAMETERS:
      P_CB1 AS CHECKBOX,
      P_CB2 AS CHECKBOX,
      P_A TYPE I MODIF ID XXX DEFAULT ' ',
      P_B TYPE I MODIF ID YYY DEFAULT ' '.
    DATA:
      W_C1,
      W_C2.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF SCREEN-GROUP1 = 'XXX'.
          SCREEN-ACTIVE = 0.
          MODIFY SCREEN.
        ELSEIF SCREEN-GROUP1 = 'YYY'.
          SCREEN-ACTIVE = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
      IF P_CB1 EQ 'X'.
        LOOP AT SCREEN.
          IF SCREEN-GROUP1 = 'XXX'.
            SCREEN-ACTIVE = 1.
            SCREEN-INPUT  = 1.
            SCREEN-OUTPUT = 1.
            SCREEN-INVISIBLE = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
      IF P_CB2 EQ 'X'.
        LOOP AT SCREEN.
          IF SCREEN-GROUP1 = 'YYY'.
            SCREEN-ACTIVE = 1.
            SCREEN-INPUT  = 1.
            SCREEN-OUTPUT = 1.
            SCREEN-INVISIBLE = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.

  • Name of the field on teh Selection Screen

    We execute a report program and we get a Selection Screen .
    The requirement is can we  catch the field names of the fields on the selection screen.(We can get the field name by pressing F1 and looking into the Technical Information)...But how can we fetch the value of the field name dynamically.
    Any information/Pointers in that direction will be very helpful.

    Hi,
    This is a part of code from SAP standard code to get the technical field info. Probably you can explore on this ...
    DATA epss TYPE REF TO CL_EPSS_GENERIC.
    DATA w_appl        TYPE epssappl.
    DATA l_info_object TYPE sdokobject.
    DATA l_infodoc     TYPE epssdoc.
    CALL METHOD epss->give_applications
    EXPORTING
    applid  = 'EPSSHTML'
    IMPORTING
    control = w_appl-ref.
    CALL METHOD w_appl-ref->('GIVE_ACTUAL_DOCUMENT_INFO')
    IMPORTING
    infodoc = l_infodoc.
    Here the l_infodoc contains the techical field info.
    Regards,
    Wenceslaus.

  • Get input for 100 dynamic fields in a single screen

    Hi all
    I got one requirement wherein i need to accept input for around 100 dynamic fields in a single screen. screen can scroll down if possible.
    Can anyone tell me whether it is possible. if yes please let me have the sample code.
    Thanks
    Ravindra Suvarna

    Ravi,
    Probably a TAB STRIP might help you.
    Seggregate your 100 fields logically, say 5 groups.
    Have a TAB STRIP CONTROL, with 5 tab strips and place 20 fields in each of the tabs. Each tab strip will have a sub screen.
    Regards,
    Ravi
    Note : Please mark the helpful answers.

  • How to Add a new fields in the selection screen of LDB.

    Hi All,
    I want to add a new fields in the selection screen of LDB & then i need to select the data for that fields.
    So could you please tell me for that where i need to add the code for selecting the data.
    Thanks
    Roli

    Hi
    welcome to SDN forum
    If you are designing your own LDB with your own tables you can define tree structure and then the selection screen for the tables
    if you wants to modify the std LDB of SAp means take the access key and to modify that code
    if you add the extra field you have to modify the where conditions in the code also
    see the doc
    A logical database is a special ABAP/4 program which combines the contents of certain database tables. You can link a logical database to an ABAP/4 report program as an attribute. The logical database then supplies the report program with a set of hierarchically structured table lines which can be taken from different database tables.
    LDB offers an easy-to-use selection screens. You can modify the pre-generated selection screen to your needs. It offers check functions to check whether user input is complete, correct, and plausible. It offers reasonable data selections. It contains central authorization checks for data base accesses. Enhancements such as improved performance immediately apply to all report programs that use the logical database.
    Less coding s required to retrieve data compared to normal internel tables.
    Tables used LDB are in hierarchial structure.
    Mainly we used LDBs in HR Abap Programming.
    Where all tables are highly inter related so LDBs can optimize the performance there.
    Check this Document. All abt LDB's
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=%2flibrary%2fabap%2fabap-code-samples%2fldb+browser.doc
    GO THROUGH LINKS -
    http://www.sap-basis-abap.com/saptab.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9bfa35c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm
    /people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
    Re: **LDB**
    www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_Logical_Database_FAQ.html
    www.sap-img.com/abap/abap-interview-question.htm
    www.sap-img.com/abap/quick-note-on-design-of-secondary-database-indexes-and-logical-databases.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9bb935c111d1829f0000e829fbfe/content.htm
    Gothru the blog which provides info on LDB's:
    /people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
    Sample code
    TABLES: SPFLI,
    SFLIGHT,
    SBOOK,
    SCARR.
    START-OF-SELECTION.
    GET SPFLI.
    WRITE:/ ’SPFLI: ’, SPFLI-CARRID, SPFLI-CONNID,
    SPFLI-AIRPFROM, SPFLI-AIRPTO.
    GET SFLIGHT.
    WRITE:/ ’ SFLIGHT: ’, SFLIGHT-CARRID, SFLIGHT-CONNID, SFLIGHT-FLDATE.
    GET SBOOK.
    WRITE:/ ’ SBOOK: ’, SBOOK-CARRID, SBOOK-CONNID,
    SBOOK-FLDATE, SBOOK-BOOKID.
    GET SFLIGHT LATE.
    WRITE:/ ’ GET SFLIGHT LATE: ’, SFLIGHT-FLDATE.
    Regards
    anji

  • Functional area(FKBER( field in the selection screen))

    Hi,
       I have a requirement to add functional area field in the selection screen for a report painter report. This report using library 1VK and table 'CCSS'. I added functional area field in the general data selection . After the execution of report with functional area field filled with value. report not giving any output. do i need to maintain any setting to achieve?
    Regards,
    Palani

    Hi,
    How you have filled the values?
    It is 16 CHAR long.

  • Functional area(FKBER field in the selection screen of the report painter))

    Hi,
    I have a requirement to add functional area field in the selection screen for a report painter report. This report using library 1VK and table 'CCSS'. I added functional area field in the general data selection . After the execution of report with functional area field filled with value. report not giving any output. do i need to maintain any setting to achieve?
    Regards,
    Palani

    1. Call GR22 and click "Characteristics".
    2. Check FKBER and assign a position number to it.
    3. Save and close the library.
    4. Call your report in GRR2 and you should now see FKBER as an available characteristic.
    5. Use it in the General Data Selection or as a Lead Column, as per requirement.
    Or,
    1. Call GR21 and create a custom library. Provide a name and description and also provide a library you can copy from (scan for the best-fit library).
    2. Now follow the steps 2 through 5 above to achieve your result.
    Hope this helps.
    Cheers.

  • I need below fields at my selection screen.From which table we can find the

    Sales Org > only one selection field
    Division > only one selection field
    Channel > from u2013 to fields
    Sales Office Channel > from u2013 to fields
    Sales Rep Channel > from u2013 to fields
    User ID of the CSR Channel > from u2013 to fields
    Customer Channel > from u2013 to fields
    Material Channel > from u2013 to fields
    Date: Channel > from u2013 to fields
    I need these fields at my selection screen.From which tables I find these things.I need this logic also.

    I need help

  • I have mapped the fields on the selection-screen  to the BDC on transaction

    I have mapped the fields on the selection-screen  to the BDC on transaction F110.
    When I am selecting a particular any value in select-option on the selection screen, it is giving some default value and the value given by me,for example:
    Payment methods:C
    but in BDC recording for F110 Payment methods:IEQC when the programs is running in foreground mode.
    how can I rectify it?

    This is because payment methods may be a table and what you see IEQC is actually, I for include, EQ for equal and C as your payment method. This is standard structure for ranges or select-options. You can use variable-low which will give you only C.

  • Hiding and Unhiding Fields On The Selection Screen

    Hi Guys/Dolls
    I've managed to grey out and hide some fields on a selection screen within the AT SELECTION-SCREEN OUTPUT section but don't know how to re-instate them.
    basically on initial entry of the screen some fields are hidden but once I enter some pre-requisite data I need to display them but in a greyed out manner.
    I've done the first bit but don't know how to do the 2nd bit i.e re-display the fields.
    Any help would be appreciated.
    Many thanks in advance.
    Raj
    My code is as follows:-
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION POS_LOW.
    PARAMETERS: begcalsh LIKE t549q-begda MODIF ID pe4.
    SELECTION-SCREEN COMMENT (1) text-199 FOR FIELD endcalsh
    MODIF ID pe4.
    PARAMETERS: endcalsh LIKE t549q-endda MODIF ID pe4.
    SELECTION-SCREEN POSITION POS_HIGH.
    PARAMETERS: begrefsh LIKE t549q-begda MODIF ID pe5.
    SELECTION-SCREEN COMMENT (1) text-199 FOR FIELD endrefsh
    MODIF ID pe5.
    PARAMETERS: endrefsh LIKE t549q-endda MODIF ID pe5.
    SELECTION-SCREEN END OF LINE.
    AT SELECTION-SCREEN OUTPUT.
    * Grey out the parameters.
      PERFORM params_grey_in_out USING 'false' 'PE4'.
      PERFORM params_grey_in_out USING 'false' 'PE5'.
    * Hide the parameters.
      PERFORM params_show_hide USING 'false' 'PE4'.
      PERFORM params_show_hide USING 'false' 'PE5'.
    AT SELECTION-SCREEN.
      PERFORM params_show_hide USING 'true' 'PE4'.
      PERFORM params_show_hide USING 'true' 'PE5'.
    *&      Form  params_grey_in_out
    FORM params_grey_in_out USING value(iv_triggering_param)
                                     value(iv_screen_group).
    *this form activates fields with MODIF ID = IV_SCREEN_GROUP
    *if IV_TRIGGERING_PARAM eq TRUE and greys them out otherwise.
      DATA lx_input LIKE screen-input.
      IF iv_triggering_param EQ 'true'.
        lx_input = 1.
      ELSE.
        lx_input = 0.
      ENDIF.
      LOOP AT SCREEN.
        IF screen-group1 EQ iv_screen_group.
          screen-input = lx_input.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " params_grey_in_out
    *&      Form  params_show_hide
    FORM params_show_hide USING value(iv_triggering_param)
                                     value(iv_screen_group).
    *this form displays fields with MODIF ID = IV_SCREEN_GROUP
    *if IV_TRIGGERING_PARAM eq TRUE and hides them otherwise.
      DATA lx_active LIKE screen-active. "(1) type n.
      DATA lx_invisible LIKE screen-active. "(1) type n.
      IF iv_triggering_param EQ 'true'.
        lx_active = 1.
        lx_invisible = 0.
      ELSE.
        lx_active = 0.
        lx_invisible = 1.
      ENDIF.
      LOOP AT SCREEN.
        IF screen-group1 EQ iv_screen_group.
          screen-invisible = lx_invisible.
          screen-active = lx_active.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " params_show_hide

    hi u use this logic
       LOOP AT SCREEN.
          IF screen-group1 = 'GR3'.
            screen-active = 1.
            screen-input = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ELSE.
        LOOP AT SCREEN.
          IF screen-group1 = 'GR2'.
            screen-invisible = 0.
            screen-input = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.

  • Currency field on a selection screen of type 'DMBTR'.

    Hello ABAPers,
          Could you please tell me how to do it?
           I have a currency field on a selection screen of type 'DMBTR'.
           When i input and press the enter key ,i want the value to be displayed in the following style.
              1. CURRENCY     EQ    'JPY'
                    EX:
                          Value before pressing EnterKey =   123456 
                          Value after pressing   EnterKey =    123,456
                      i.c  the value should be displayed without decimal point
            2. CURRENCY      NE    'JPY'
                    EX:
                          Value before pressing EnterKey =   123456 
                          Value after pressing   EnterKey =    123,456.00
                      i.c  the value should be displayed with decimal point
          Note:The above trick has already been done on a standard dynpro screen of Tr.Code FB60 and Field 'Amount'.
    <removed_by_moderator>
    Thanks and Regards,
    Mohan
    Edited by: Govindasamy Mohan on Oct 8, 2009 6:22 PM
    Edited by: Julius Bussche on Oct 9, 2009 1:36 PM

    Hi ABAP Lover,
       Thanks a lot for your reply.
       I had the same idea as yours like using data type 'P'.
      But, the problem is  that there is only one currency field on the screen .There is also a field of 'Company Code'.
    Both fields are mandatory .
    Hence,the requirement is  to convert the  currency value to the currency of the company code which is input .
    The conversion  should yield the following output on the screen after pressing the enter button.
    1. When currency EQ  'JPY' ,  the value should be displayed without decimal point
      2.When currency NE  'JPY' ,  the value should be displayed with decimal point
    I am very sorry for not explaining you clearly in my first posting.
    Thanks and Regards,
    Mohan

  • Maintaing a default value for a particular field in the selection screen

    Hi all,
    How to maintain a default value for a particular field in the Selection Screen of a Standard report
    Regards
    Ajay

    >
    ajay babu wrote:
    > Hi all,
    >
    > How to maintain a default value for a particular field in the Selection Screen of a Standard report
    >
    > Regards
    > Ajay
    Create a variant for your standard program and assign this variant to the field 'Start with variant' while creating transaction code for the standard program in the transaction 'SE93'.
    Regards
    Rajesh.

Maybe you are looking for

  • I want to call External Java class from the PL/SQL

    Hi, I am using Oracle Apps R11i (11.5.7), I wanted to call external Java class from the PL/SQL. This external Java class is residing in another application server. How do I do this. I know one way. Develop C routine in Oracle Apps to call external ja

  • Error logging in as sysdba - "insufficient privileges"

    Hi, I have AS10.1.2.0.2 installed on my linux box. i have infrastructure as well as midtier both installed in the same machine on different oracle homes. after installing everything worked fine and brought down the system just to test it. and upon re

  • Can't restore iPhone 4S running iOS 7.0.3 via iTunes?

    In the summary screen for my iPhone in iTunes, there is no option given to restore the iPhone to its factory settings.  Also, under "back ups," I am able to back up the information on my phone to my computer, but the "restore back up" option is graye

  • Get an IPortalComponentRequest  in an AbstractCollectionRenderer

    Hi, We have developed a custom collection renderer based on AbstractCollectionRenderer and we need to get the request. In EP5 we have found this solution: PortalServletRequestWrapper stubRequest = (PortalServletRequestWrapper) this.getProxy().getDyna

  • Z10 struggles to switch on

    I struggle to get my Z10 to turn on and eventually when I get it on and try use it, it crashes again