Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamic Screen Paramater Generation

Former Member
0 Likes
727

Is it possible to generate parameters for a screen on the fly??

im trying to create a generic program that can adapt selection option parameters depending on a database table.

ie if the user asks to search for an item in a table, they will be provided with a dialog containing dynamic parameters for each field in the table.

tried this using field symbols but the compiler will not let me.

ie:

for all fields in table

parameters: <pname> type <ptype>.

is it possible to generate code for a form and call it at runtime??

6 REPLIES 6
Read only

Former Member
0 Likes
690

You should look at the code of SE16.

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

0 Likes
690

Yeah ive had a look through, but if possible i would like to do it without generating a whole program and running it at runtime.

Ive got all the table info etc, just needing to output parameters for them dynamically on a screen.

It would be ideal if i could just generate a function or form within my report.

Thanks for suggestions

James

Message was edited by: James Pirie

Read only

oliver
Active Contributor
0 Likes
690

Hi James,

i would think that this is possible because SAP is doing something similar e.g. in their transactions SE11 and SE16. Maybe you dare to look into this and get some tipps and hints on how to do that.

I think they will probably read the metainformation from the ddic/table using DESCRIBE and build from that a selection screen.

Hope that helps!

Regards,

Oliver

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
690

Yes, it is. But the statements are not released for customer use and they will not be supported by SAP. If you would like an example program, email me at my email address on my business card. Here is another way of doing it using a POPup.



report zrich_0001 .

data: ivals type table of sval with header line.

data: x_matnr type mara-matnr,
      x_vbeln type vbak-vbeln,
      x_edatu type vbep-edatu.

start-of-selection.


  ivals-tabname = 'MARA'.
  ivals-fieldname = 'MATNR'.
  append ivals.

  ivals-tabname = 'VBAK'.
  ivals-fieldname = 'VBELN'.
  append ivals.

  ivals-tabname = 'VBEP'.
  ivals-fieldname = 'EDATU'.
  append ivals.

  call function 'POPUP_GET_VALUES'
    exporting
*   NO_VALUE_CHECK        = ' '
      popup_title           = 'Enter Values'
*   START_COLUMN          = '5'
*   START_ROW             = '5'
* IMPORTING
*   RETURNCODE            =
    tables
      fields                = ivals
   exceptions
     error_in_fields       = 1
     others                = 2
            .

  read table ivals with key fieldname = 'MATNR'.
  if sy-subrc  = 0.
    x_matnr = ivals-value.
  endif.

  read table ivals with key fieldname = 'VBELN'.
  if sy-subrc  = 0.
    x_vbeln = ivals-value.
  endif.

  read table ivals with key fieldname = 'EDATU'.
  if sy-subrc  = 0.
    x_edatu = ivals-value.
  endif.

  write:/ x_matnr, x_vbeln, x_edatu.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
690

hi James,

You can use the FM 'DDIF_NAMETAB_GET' to get the fields of a table given. Try calling this FM in ur initialization and set the fields to ur parameters.

Theja

Read only

0 Likes
690

Thanks for response, but i know how to get all the meta information for tables, its just simply displaying paramters for a table on a screen.

Im trying to do exactly what se16 does but on a less mental scale.

Thanks rich I will email you my email addy. By the way nice cabinets!!!