‎2006 Sep 04 7:05 AM
HI ALL ,
CAN ANYONE HELP ME WITH SAP-SCRIPT FORM AND PERFORM SYNTAX. THAT IS WHEN U NEED TO ADD A FIELD TO AN EXISTING SAPSCRIPT, BY USING AN EXTERNAL SUBROUTINE.
i NEED THE SYNTAX BOTH FOR PERFORM AND ENDPERFORM STATEMENT AND ALSO THE FORM STSEMENT. ANOTHER TRHING IS IF CAN LET ME KNOW HOW TO USE DEFINE STATEMENT IN SAPSCRIPT. WHATS ITS USE AND IS IT RELATED TO THE QUERY ABOVE.
else,
U PLZ LET ME KNOW ANY HELPFUL LINKS TO GO THROUGH.
THANLS IN ADVANCE,
ANUPMA.
‎2006 Sep 04 7:07 AM
Hi Anupma,
Check this link
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.
Cheers
VJ
‎2006 Sep 04 7:12 AM
check this link about FORM and PERFORM.
about DEFINE.
lets say your intension is to go print a line only once. for that we use a flag V_FLAG.
/: DEFINE &v_flag& = space
/: if &V_FLAG& = ''
/* first time this comes inside here i am passing X.
/: DEFINE V_FLAG = 'X'
WRITE SOME THING
/: ENDIF
regards
Srikanth
Message was edited by: Srikanth Kidambi
‎2006 Sep 04 7:16 AM
Hi anupma,
1. while calling subroutines from sapscripts,
there is a special technique,
which has got its own limitations.
2.
FORM abc
TABLES
in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
ENDFORM.
3. The perform in se38 program should be of the
above format only.
4. We cannot pass internal tables.
5. Rather we need to pass
VARIABLE NAME
VARIABLE VALUE
(see the structure of itcsy in se11)
6. In this form, we have to read
the internal table in_tab
to capture the variable name and its value.
7. Similary, to return the values,
we have to put one record (for each variable)
in out_tab.
regards,
amit m.