cancel
Showing results for 
Search instead for 
Did you mean: 

How can we make a call to the Data base in the SAP Scripts?

Former Member
0 Kudos

Hi All,

How we make a call to the data base in scripts?

I think we can use the PERFORM statement to achieve the above functionality.

Pls correct me if i am wrong?

Regards

Abhilash.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Valter,

Thanks for the reply.

Regards.

Abhilash

valter_oliveira
Active Contributor
0 Kudos

Hi again.

Reward helpfull ideas.

Regards.

Valter Oliveira.

naimesh_patel
Active Contributor
0 Kudos

Yes you can use the command PERFORM ... ENDPREFORM to achieve this.

Pass the selection fields by USING addition

and receive the fields by CHANGING addition

Check this:

http://help.sap.com/saphelp_40b/helpdata/en/d1/803279454211d189710000e8322d00/content.htm

Regards,

Naimesh Patel

valter_oliveira
Active Contributor
0 Kudos

Hello.

If you want to access database in the script itself (not in print program) yes, you can use PERFORM statement.

In your script, use:

/: PERFORM F_FORM IN PROGRAM ZRFIRFS05

/: USING &VAR1&

/: CHANGING &VAR2&

/: ENDPERFORM

Then, create a program ZPROG (ZRFIRFS05 in my case) with a structure like this one:


REPORT ZRFIRFS05 .

FORM f_form TABLES in_par STRUCTURE itcsy out_par STRUCTURE itcsy.

  DATA: l_data1(10).

  READ TABLE in_par WITH KEY name = 'VAR1'.
  CHECK sy-subrc = 0.
  l_data1 = in_par-value.

*  SELECT .... "YOUR SELECT TO DATABASE

  READ TABLE out_par WITH KEY name = 'VAR2'.
  CHECK sy-subrc = 0.
  out_par-value = l_data3.

  MODIFY out_par INDEX sy-tabix.

ENDFORM.

Regards.

Valter Oliveira.