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

retrieve dara from application server to internal table based on selection

Former Member
0 Likes
731

Hi experts,

I have to retrieve the data from application server to internal table

On the basis of selection screen fields.

For ex :

S_ebeln for ekpo-ebeln.

S_matnr for ekpo-matnr.

Here I want to take the data from application server to internal table where

Ebeln in s_ebeln and matnr in s_matnr range

Thanks

Sureshkumar D

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
658

Hi,

Following are the steps:

OPEN DATASET ....

TRANSFER into ITAB....

CLOSE DATASET

Loop at itab where ebeln in s_ebeln and matnr in s_matnr.

append itab to i_final.

endloop.

I_FINAL will have the required data

Hi experts,

I have to retrieve the data from application server to internal table

On the basis of selection screen fields.

For ex :

S_ebeln for ekpo-ebeln.

S_matnr for ekpo-matnr.

Here I want to take the data from application server to internal table where

Ebeln in s_ebeln and matnr in s_matnr range

Thanks

Sureshkumar D

3 REPLIES 3
Read only

Former Member
0 Likes
659

Hi,

Following are the steps:

OPEN DATASET ....

TRANSFER into ITAB....

CLOSE DATASET

Loop at itab where ebeln in s_ebeln and matnr in s_matnr.

append itab to i_final.

endloop.

I_FINAL will have the required data

Read only

Former Member
0 Likes
658

Hi,

You need to get all the data from the application server into an internal table, then you can delete the data where the data is not equal to the selection screen values,

Here is the example Program


DATA: BEGIN OF i_tab OCCURS 0,        
           text(100),     
         END OF i_tab,      
gv_dataset1(30) VALUE ’/temp/testfile.txt’.

OPEN DATASET gv_dataset1 FOR INPUT IN TEXT MODE.  
 DO.     
IF SY-SUBRC <> 0.    
   EXIT.     
ENDIF.    
 READ DATASET gv_dataset1 INTO i_tab.     
APPEND i_tab.     
CLEAR i_tab.  
 ENDDO. 
" Here loop the internal table then delete the records which are not equal to the Selection screen vlaues
CLOSE DATASET gv_dataset1.

Regards

Sudheer

Read only

former_member404244
Active Contributor
0 Likes
658

Hi,

First get all the data into an internal table

OPEN DATASET <datasetname>FOR INPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc NE 0.

  • File not found

MESSAGE e139.

ELSE.

  • Read each line from the dataset and append to an internal table.

DO.

*-- Read dataset and pass it to an internal table.

READ DATASET <datasetname>INTO lwa_input.

IF sy-subrc = 0.

APPEND lwa_input TO i_input1.

CLEAR lwa_input.

ELSE.

EXIT.

ENDIF.

ENDDO.

*-- Close Dataset .

CLOSE DATASET p_lv_dsn.

ENDIF.

Now all the data u will get in the internal table i_input1.

Loop at i_input1 into lwa_input1 where ebeln in s_ebeln and matnr in s_matnr..

append lwa_input1 to i_final.

clear lwa_input1.

endloop.

Regards,

Nagaraj