ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> ERP CRM >> SAP >> SAPScript
 
 


 

 
 Basis interview questions  Basis Interview Questions (812)
 ABAP interview questions  ABAP Interview Questions (2426)
 SAPScript interview questions  SAPScript Interview Questions (127)
 SD interview questions  SD Interview Questions (1950)
 MM interview questions  MM Interview Questions (352)
 QM interview questions  QM Interview Questions (8)
 PP interview questions  PP Interview Questions (136)
 PM interview questions  PM Interview Questions (21)
 PS interview questions  PS Interview Questions (20)
 FI CO interview questions  FI CO Interview Questions (1648)
 HR interview questions  HR Interview Questions (434)
 SAP CRM interview questions  SAP CRM Interview Questions (262)
 SRM interview questions  SRM Interview Questions (11)
 APO interview questions  APO Interview Questions (18)
 Business Warehouse interview questions  Business Warehouse Interview Questions (622)
 Business Workflow interview questions  Business Workflow Interview Questions (9)
 SAP Security interview questions  SAP Security Interview Questions (332)
 SAP Interfaces interview questions  SAP Interfaces Interview Questions (4)
 Netweaver interview questions  Netweaver Interview Questions (144)
 SAP ALE IDocs interview questions  SAP ALE IDocs Interview Questions (47)
 SAP B1 interview questions  SAP B1 Interview Questions (57)
 SAP AllOther interview questions  SAP AllOther Interview Questions (92)
Question
HOw to Call Subroutine in 
Sap Script?
 Question Submitted By :: SAPScript
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
The example defines a subroutine FORM CALLED_FROM_SAPSCRIPT
in the ABAP ZDEMO_SAPSCRIPT_PERFORM . This subroutine is
called from the SapScript form when the respective element

/E PERFORM_ABAP
is executed. The syntax of the call is like

/: PERFORM CALLED_FROM_SAPSCRIPT IN PROGRAM zsapscriptexits
/: USING &invar1&
/: USING &invar2&
...
/: CHANGING &outvar1&
/: CHANGING &outvar2&
...
/: ENDPERFORM

The subroutine must be defined in the ABAP/4 report as
follows:

FORM form TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
...
ENDFORM.
 
Is This Answer Correct ?    13 Yes 3 No
K.nagalakshmi
 
Answer
# 2
Calling ABAP Subroutines: PERFORM


You can use the PERFORM command to call an ABAP subroutine
(form) from
any program, subject to the normal ABAP runtime
authorization
checking. You can use such calls to subroutines for
carrying out
calculations, for obtaining data from the database that is
needed at
display or print time, for formatting data, and so on.

PERFORM commands, like all control commands, are executed
when a
document is formatted for display or printing.
Communication between a
subroutine that you call and the document is by way of
symbols whose
values are set in the subroutine.

The system does not execute the PERFORM command within
SAPscript
replace modules, such as TEXT_SYMBOL_REPLACE or
TEXT_INCLUDE_REPLACE.
The replace modules can only replace symbol values or
resolve include
texts, but not interpret SAPscript control commands.

Syntax in a form window:

/: PERFORM <form> IN PROGRAM <prog>
/: USING &INVAR1&
/: USING &INVAR2&
......
/: CHANGING &OUTVAR1&
/: CHANGING &OUTVAR2&
......
/: ENDPERFORM

INVAR1 and INVAR2 are variable symbols and may be of any of
the four
SAPscript symbol types.

OUTVAR1 and OUTVAR2 are local text symbols and must
therefore be
character strings.

The ABAP subroutine called via the command line stated
above must be
defined in the ABAP report prog as follows:

FORM <form> TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
...
ENDFORM.

The values of the SAPscript symbols passed with /: USING...
are now
stored in the internal table IN_TAB . Note that the system
passes the
values as character string to the subroutine, since the
field Feld
VALUE in structure ITCSY has the domain TDSYMVALUE (CHAR
80). See the
example below on how to access the variables.

The internal table OUT_TAB contains names and values of the
CHANGING
parameters in the PERFORM statement. These parameters are
local text
symbols, that is, character fields. See the example below
on how to
return the variables within the subroutine.

From within a SAPscript form, a subroutine GET_BARCODE in
the ABAP
program QCJPERFO is called. Then the simple barcode
contained there
('First page', 'Next page', 'Last page') is printed as
local variable
symbol.

Definition in the SAPscript form:

/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
/: USING &PAGE&
/: USING &NEXTPAGE&
/: CHANGING &BARCODE&
/: ENDPERFORM
/
/ &BARCODE&

Coding of the calling ABAP program:

REPORT QCJPERFO.

FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.

DATA: PAGNUM LIKE SY-TABIX, "page number

NEXTPAGE LIKE SY-TABIX. "number of next page

READ TABLE IN_PAR WITH KEY 'PAGE'.
CHECK SY-SUBRC = 0.
PAGNUM = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'NEXTPAGE'.
CHECK SY-SUBRC = 0.
NEXTPAGE = IN_PAR-VALUE.

READ TABLE OUT_PAR WITH KEY 'BARCODE'.
CHECK SY-SUBRC = 0.
IF PAGNUM = 1.
OUT_PAR-VALUE = '|'. "First page

ELSE.
OUT_PAR-VALUE = '||'. "Next page

ENDIF.

IF NEXTPAGE = 0.
OUT_PAR-VALUE+2 = 'L'. "Flag: last page
ENDIF.

MODIFY OUT_PAR INDEX SY-TABIX.

ENDFORM.
 
Is This Answer Correct ?    12 Yes 4 No
K.nagalakshmi
 
 
 

 
 
 
Other SAPScript Interview Questions
 
  Question Asked @ Answers
 
what is the table name that will contain all the script form names and print program names ?   1
Is it possible to create 2 layouts in single script.   3
Can i Have Some Realtime Examples on Scripts ? Satyam 1
I receive 5 orders from customer. Irrespective of Value or quantity, first 3 orders get discount. From 4th order onwards no discount. How to do this? NTT-Data 1
Difference between call Screen and Set Screen ?   2
what is sap ? can i learn sap from home ? future of sap and freshers salary and experience salary ? carrer scope for sap and please tell me indepth details of company listings in chennai ? Thermax 2
I want to add multiple boxes in the particular window of the script.Is it possible?If yes, than how ? IBM 1
3. In ABAP/4 programs how do u access data present in presentation server and on an application server. Bando 4
What is The Diff Between RFC & FM ? Urjent. Cap-Gemini 4
what is MANUE field in NAST table? what is its purpose? what for it is used in SAPScript? How can we use that field in our own driver program? & Where Standard Driver programs reside? what is the tcode & path for finding the standard driver programs?   2
wat are the labels?do we use them in sapscripts/smartforms? TCS 2
How to insert field in standard script ..?   4
 
For more SAPScript Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com