on 08-04-2011 1:54 PM
Hello
Is it possible to add the following code to a SAPscript Form or does it have to be done in the driver program?
SELECT SINGLE *
INTO wa_adrc
FROM adrc
WHERE addrnumber = REGUH-ZADNR.
I know in Smartforms you can use Program Lines to insert code within the form, just wanted to know if can do same thing in SAPscript ?
Thanks
Gary
Thanks Ernesto
I did the following like you suggeted and it works.
FORM getaddr TABLES in_par STRUCTURE itcsy out_par STRUCTURE itcsy.
break spgmr18.
READ TABLE out_par WITH KEY 'REGUH-ZNME1'.
CHECK sy-subrc = 0.
out_par-value = 'GARY'.
MODIFY out_par INDEX sy-tabix.
ENDFORM. "getaddr
But not reuturning value 'GARY' (®UH-ZNME1&) to SAPscript:
PERFORM GETADDR IN PROGRAM ZCHECK_CODE
USING ®UH-ZADNR&
CHANGING ®UH-ZNME1&
ENDPERFORM
ADDRESS PARAGRAPH ZD
TITLE ®UH-ZANRE&
NAME ®UH-ZNME1&, ®UH-ZNME2&, ®UH-ZNME3&, ®UH-ZNME4&
STREET ®UH-ZSTRA&
POBOX ®UH-ZPFAC& CODE ®UH-ZPST2&
POSTCODE ®UH-ZPSTL&
REGION ®UH-ZREGI&
CITY ®UH-ZORT1&, ®UH-ZORT2&
COUNTRY ®UH-ZLAND&
FROMCOUNTRY &T001-LAND1&
ENDADDRESS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gary,
You are using REGUH structure and I am not sure if you can change the values on this structre (I guess you can). Try using other variables like this:
/: DEFINE &MY_VAR&
/: PERFORM GETADDR IN PROGRAM ZCHECK_CODE
/: USING ®UH-ZADNR&
/: CHANGING &MY_VAR&
/: ENDPERFORM
And your code:
FORM getaddr TABLES in_par STRUCTURE itcsy out_par STRUCTURE itcsy.
break spgmr18.
READ TABLE out_par WITH KEY 'MY_VAR'.
CHECK sy-subrc = 0.
out_par-value = 'GARY'.
MODIFY out_par INDEX sy-tabix.
ENDFORM. "getaddr
Ernesto
Thanks for all the posts greatly appreciated. I created the following code in my SAPscript :
PERFORM GETADDR IN PROGRAM ZCHECK_CODE
USING ®UH-ZADNR&
CHANGING ®UH-ZNME1&
ENDPERFORM
I am having some issues on getting the code to work. Getting the following error:
Program "ZCHECK_CODE" is type I and therefore cannot be generated.
ZCHECK_CODE is an Include Program, code is below:
&----
*& Include ZCHECK_CODE
&----
FORM getaddr USING zadnr
CHANGING znme1.
znme1 = 'Test for Gary'.
ENDFORM. "getaddr
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create a ZInude program e.g zxxxx
then inside of that program create a sub routen
e.g
form select using var1 type ITCSY changing car2 type structure ITCSY.
your select querey
and pass the result in changing variable
endform.
use following statement in SAP script
/: PERFORM <form> IN PROGRAM <prog>
/: USING &INVAR1&
/: CHANGING &INVAR2&
/: ENDPERFORM
Thanks & Regards,
Srini.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gary,
You can add code into an include with the line:
/: DEFINE &FIELD1&
/: PERFORM 'FORM' IN PROGRAM 'ZYYYYYY'
/: USING ®UH-ZADNR&
/: CHANGING &FIELD1&
/: ENDPERFORM
Regards,
Ernesto.
Edited by: Ernesto Caballero on Aug 4, 2011 3:09 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.