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: 

sap script

Former Member
0 Kudos

Hi,

how can we pass tables in sap script for subroutines?

Thanks,

Anubhuti

5 REPLIES 5

Former Member
0 Kudos

In the sapscript editor, put this piece of code

/: PERFORM <subroutine> IN PROGRAM <program>

/: USING &variable name&

/: ENDPERFORM

In the program

form <subroutine> tables ft_invar structure itcsy

ft_outvar structure itcsy.

The input (ft_invar) and output (ft_outvar) data can be accessed and modified using these structures. Just two columns are there, one is the name which can contain say VBRK-VBELN and the value column will contain the value say '1000000022'.

endform.

You can even use field symbols in case if the the subroutine is withing the calling print program to access and change the data.

Hope this helps.

Regards,

Satya

former_member188685
Active Contributor
0 Kudos

Hi,

you cannot pass tables , but you can pass variables..

/: PERFORM GET_SUM IN PROGRAM ZSUM
/: USING &SUM&
/: ENDPERFORM


REPORT  zget_master         .        
            .
FORM get_sum TABLES in_tab STRUCTURE itcsy out_tab STRUCTURE itcsy.
  CLEAR v_sum.
...
 
endform.

Regards

vijay

Former Member
0 Kudos

hi,

A sample code of how to use performs in sap scripts.

In script program,

/:PERFORM GET_SBGRP_STEXT IN PROGRAM ZSDSCRIPT

/:USING &GV_MATNR&

/:CHANGING &GV_STEXT&

/:TABLES INPUT_TABLE

/: OUTPUT_TABLE

/:ENDPERFORM

In program ZSDSCRIPT,

form get_sbgrp_stext tables intab structure itcsy

outab structure itcsy.

DATA: LV_MATNR LIKE MARA-MATNR,

LV_TEXT(3) TYPE C VALUE 'ABC'.

clear intab.

read table intab with key name = 'GV_MATNR'.

if sy-subrc = 0.

lv_MATNR = intab-value.

ENDIF.

CLEAR OUTTAB.

READ TABLE OUTAB WITH KEY NAME = 'GV_STEXT'.

IF SY-SUBRC = 0.

OUTAB-VALUE = LV_TEXT.

modify outab index sy-tabix.

ENDIF.

endform.

Regards,

Sailaja.

0 Kudos

Thanks Sailaja it solved my problem:)

0 Kudos

Hi Sailaja

Iam Kalyanaram, MM Functional Consultant. one of the SDN user, When i was going through a Search for ABAP Query. I saw your Pdf Dcoument, which gives me a reall feel. My congrats to you.

But to be more honest with you, i am zero in Progaming. U have mentioned that Functional consultant can get the reports without doing any ABAP Coding (I am really afraid of coding). Which gives me a real shot in the arm. I am having a MS Acess Query knowledge, there also we used to run match/Select/Append/Update query. More over there is no friends in ABAP Circle.

We are an Engineerig and Cosntruction industry. Perahaps, i am may badly in need of generating a MM related Reports. I Please request you to help me in this regards. U r having any documents with screen shot for ABAP Query other than this.

Also u gave one example in that document. "requirement which needs invoices whose value is greater than 1000 and order reason free of charge" but for other than this PR, RFQ, Price comparison, Maintain quotation, PO, GR, GI, Stock reports. etc.

can u please help me in this regards. I will be really very much thankful to u a lot.

Thanks in advance,

Thanks and Regards

kalyan