Application Development 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: 

how to fill internal table with selection screen field.

Former Member
0 Kudos

Hi all,

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

4 REPLIES 4

former_member555112
Active Contributor
0 Kudos

Hi,

By selection-screen field i assume that you either have a parameter or select-options.

Depending upon the values entered in the parameter or selection screen; get teh details from the corresponding table into an internal table.

To add entries explicitely into internal tables use APPEND or INSERT statement.

Do F1 on the statement to understand more.

Regards,

Ankur Parab

0 Kudos

no that detail is not coming from table.

i just fill selection screen manually.

how i can store that values in internal table.

0 Kudos

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

Former Member
0 Kudos

hii Vikas,

Plz Refer the following code, it will surely help as it suffice ur needs

REPORT  ZTEST NO STANDARD PAGE HEADING LINE-SIZE 50.
SELECTION-SCREEN  BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
  PARAMETER P1(20) TYPE C.
SELECTION-SCREEN END OF BLOCK B1.

DATA: BEGIN OF IT  OCCURS 10,
      NAME(20) TYPE C,
      END OF IT.

START-OF-SELECTION.
IT-NAME = P1. "this will assign Parameter value to field name of internal  Table
APPEND IT.      "Apeending this value from header to body
LOOP AT IT.   
WRITE IT-NAME.  "Printing the contents
ENDLOOP.

for any further querie,let me know plz,

Regards,

Apoorv

Edited by: Apoorv Sharma on Aug 1, 2009 12:23 PM

Edited by: Apoorv Sharma on Aug 1, 2009 12:24 PM