‎2005 Sep 21 6:58 PM
Hello,
I have a ABAP print programm. In this program the sapscript-form ist capable of reading the data of the table SADR (Addressdata). But this table is not defined in the print program. Can I also read data which is not directly declared in the printprogram, for example from the calling program? How can I identify the data, that I can read when it is not defind in the printprogramm? Thanks.
Regards, Lars.
‎2005 Sep 21 7:12 PM
How can I identify the data, that I can read when it is not defind in the printprogramm?
SAPSCRIPT will not show an error ( while activating ) even if the data used in it is not in Print Program. However you may not see the data when you print. While printing also you may not encounter an error ( such as data not defined ).
You can check for data being used but not defined in main program with FORM -> CHECK TEXT ( Male sure Symbol Chk is turned on here ). Any undefined data you will see an error here.
Apart for program data , system symbols , sapscript symbols can be used directly in sapscript . No need to define them.
Cheers
‎2005 Sep 21 7:03 PM
The values in which you want to print in the SAPScript form must be global variables of the print program.
You can, however, use a PERFORM statement inside the SAPscript.
You define fields in a SAPSCRipt using DEFINE. Then you call a FORM in Program. The the form you get the data and pass it back thru the FORM interface.
Regards,
Rich Heilman
‎2005 Sep 21 7:14 PM
Here is an example of a sapscript doing a perform. It is sending the sales order number and getting the telephone number of the partner back.
Sapscript code.
DEFINE &TEL_NUMBER& = &SPACE&
PERFORM 'TELEPHONE' IN PROGRAM 'ZCUSTOM_PROGRAM'
USING &VBELN&.
CHANGING &TEL_NUMBER&
ENDPERFORM
ABAP Program code.
FORM TELEPHONE TABLES CO_SYM_USING STRUCTURE ITCSY
CO_SET_SYMBOLS STRUCTURE ITCSY.
CLEAR: WK_VBELN,
TEL_NUMBER.
READ TABLE CO_SYM_USING WITH KEY NAME = 'VBELN'.
CHECK SY-SUBRC EQ 0.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = CO_SYM_USING-VALUE
IMPORTING
OUTPUT = WK_VBELN
EXCEPTIONS
OTHERS = 1.
CHECK SY-SUBRC EQ 0.
*Sales Document: Partner
data: xvbpa
SELECT SINGLE FROM VBPA
INTO xvbpa
WHERE VBELN = WK_VBELN
AND POSNR = '000000'
AND PARVW = 'WE'.
*Addresses (central address admin.)
SELECT SINGLE TEL_NUMBER FROM ADRC
INTO (TEL_NUMBER)
WHERE ADDRNUMBER = xvbpa-adrnr.
* transfer variable &TEL_NUMBER&
READ TABLE CO_SET_SYMBOLS INDEX 1.
CO_SET_SYMBOLS-VALUE = TEL_NUMBER.
MODIFY CO_SET_SYMBOLS INDEX 1.
ENDFORM. "TELEPHONERegards,
Rich Heilman
‎2005 Sep 21 7:07 PM
Yes lars, you can do it calling a program from your SAPScript. Here is an example:
SapScript
/:DEFINE &CUST& = '00000021'.
/:PERFORM GET_NAME IN PROGRAM ZTEST
/: USING &CUST&
/: CHANGING &NAME&
/:ENDPERFORM.
REPORT ZTEST
TABLES scustom.
FORM get_name tables in_tab structure itcsy out_tab structure itcsy.
read table in_tab index 1.
select single * from scustom
where id = in_tab-value.
if sy-subrc = 0.
read table out_tab index 1.
move scustom-name to out_tab-value.
modify out_tab index sy-tabix.
else.
read table out_tab index 1.
move 'No name' to out_tab-value.
modify out_tab index sy-tabix.
endif.
.............
But there should be a field in your print program which can be used to fetch the data from a different table which is not defined in your print program.
Hope this is helpful.
‎2005 Sep 21 7:12 PM
How can I identify the data, that I can read when it is not defind in the printprogramm?
SAPSCRIPT will not show an error ( while activating ) even if the data used in it is not in Print Program. However you may not see the data when you print. While printing also you may not encounter an error ( such as data not defined ).
You can check for data being used but not defined in main program with FORM -> CHECK TEXT ( Male sure Symbol Chk is turned on here ). Any undefined data you will see an error here.
Apart for program data , system symbols , sapscript symbols can be used directly in sapscript . No need to define them.
Cheers