‎2008 Aug 07 11:40 AM
hii gurus...
i need to modify script layout adding new fields without modifying driver program.
‎2008 Aug 07 11:48 AM
Hi!
Use the following method
/: DEFINE &symbol1& = 'mail'
/: DEFINE &symbol2& = 'SAP&symbol1&'
/: DEFINE &symbol1& = 'script'
&symbol2& -> SAPscriptRegards
Tamá
‎2008 Aug 07 11:48 AM
Hi Sunil,
Hope the below threads help you:
https://forums.sdn.sap.com/click.jspa?searchID=14946114&messageID=5610008
Have A Good Day
Chaitanya.
‎2008 Aug 07 11:50 AM
U can define the field in sapscript layout using define statement.
/: Define v_field = ' '
But if value for it needs to populate from a database table then u subroutine pool to define the logic inside a routine and call this routine from the layout itself like:
/:DEFINE &CUST& = '00000021'.
/:PERFORM GET_NAME IN PROGRAM Z_BC460_EX4_HF
/: USING &CUST&
/: CHANGING &NAME&
/:ENDPERFORM.
Dear &NAME&
The ABAP routine could be defined as follows:
IMPORTANT: The structure itcsy must be used for the parameters.
REPORT Z_HENRIKF_SCRIPT_FORM .
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.
You could also fill the ouput parameter table this way
READ TABLE out_par WITH KEY 'NAME1'.
out_par-value = l_name1.
MODIFY out_par INDEX sy-tabix.
endform.
Note that if you use more than one parameter you must use Using or Changing before every parameter !
/: PERFORM <form> IN PROGRAM <prog>
/: USING &INVAR1&
/: USING &INVAR2&
......
/: CHANGING &OUTVAR1&
/: CHANGING &OUTVAR2&
......
/: ENDPERFORM
‎2008 Aug 07 11:53 AM
only other choice you got is to do an external Perform.
in your script do following:
/: perform get_additional_data in program yexample.
/: using ¶meter1&
/: changing ¶meter2&
/: endperform
then in the program yexample code like this:
FORM get_additional_data TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
data: lv_pa1 type char20. "char20 is just an example
data: lv_pa2 type char40.
READ TABLE in_tab
WITH KEY name = 'parameter1'.
IF sy-subrc = 0.
lv_pa1 = in_tab-value.
ENDIF.
select single xxxxx
from xxxx
into lv_pa2
where xxxx = lv_pa1.
READ TABLE out_tab
WITH KEY name = 'VBDKR-VBELN'.
IF sy-subrc = 0.
out_tab-value = lv_pa2.
modify out_tab index sy-tabix.
ENDIF.
endform.
you can use LOTS of using and changing parameters not just one, this is just an very easy example to give you an idea.
Edited by: Florian Kemmer on Aug 7, 2008 12:53 PM
Edited by: Florian Kemmer on Aug 7, 2008 12:54 PM
‎2008 Aug 07 11:55 AM
use itcsy structure for this.
we have to declare form with parameters (internal tables) like structure itcsy .
one for input and other for output , in an external program.
call this form in the form editor like
perform <form name> in program name changing <variable>
endperform.
Edited by: sudheer b on Aug 7, 2008 1:08 PM
‎2008 Aug 07 12:13 PM
Hi
You can write a external Subroutine to fetch the extra data into the script program
see the following sample code
How to call a subroutine form SAPscripts
The Form :
/:PERFORM CDE_CENT IN PROGRAM ZKRPMM_PERFORM_Z1MEDRUCK
/:USING &EKKO-EBELN&
/:CHANGING &CDECENT&
/:ENDPERFORM
The report :
REPORT zkrpmm_perform_z1medruck .
DATA : BEGIN OF it_input_table OCCURS 10.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_input_table.
déclaration de la table output_table contenant les
variables exportées
DATA : BEGIN OF it_output_table OCCURS 0.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_output_table.
DATA : w_ebeln LIKE ekko-ebeln,
w_vbeln LIKE vbak-vbeln,
w_zcdffa LIKE vbak-zcdffa.
-
-
FORM CDE_CENT
*
-
-
FORM cde_cent TABLES input output.
it_input_table] = input[.
it_output_table] = output[.
READ TABLE it_input_table INDEX 1.
MOVE it_input_table-value TO w_ebeln.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_ebeln
IMPORTING
output = w_ebeln.
SELECT SINGLE zcdffa FROM ekko
INTO w_zcdffa
WHERE ebeln = w_ebeln.
it_output_table-name = 'CDECENT'.
MOVE w_zcdffa TO it_output_table-value.
MODIFY it_output_table INDEX 1.
output] = it_output_table[.
ENDFORM.
COPING SCRIPT
There are some Standard Sap Scripts in SAP. We cant directly execute them in scripts we have to use some T-codes and by giving some input to the required fields we can see the output printform.
I will show one example. There are some Standard Sap Scripts such as MEDRUCK which is a standard Sap Script for Purchase Order and RVINVOICE01 for billing and so on...
To see oupt of MEDRUCK go to T-code ME9F give purchase order number and execute select one number and click on dislplay messages button on application tool bar you can find the print form of MEDRUCK.
You cannot change the Standard Sap Scripts but you can use Standard Sap Scripts and Copy them to userdefined Script and can make changes to them and replace standard Sap Script with usedefind script.
Ex: Go to SE71,
on menu bar u find Utilities->copy from Client. click on it u ll find new screen showing
Form name:
Source Clinet:
Target Form:
give Form name as usedefined form name EX: ZFORM1
Source client as 000 and
Target form as MEDRUCK.
execute.
Now, the standard from MEDRUCK is copyied to your form ZFORM1.
NOW, go to SE71 and give form name as ZFORM1 and do some changes to the form such as adding logo any thing. save and Activate.
Now, you have done changes to the Form ZFORM1 and u have to replace your form with standard SAP Script.
Go to NACE Transaction.
on Applications select EF for purchase order and click Output types button on application tool bar.
now select NEU as output types dobule click on Processing Routines.
now click on Change option on application tool bar and on right side u find MEDRUCK in form place replace MEDRUCK with ZFORM1 and SAVE.
go back twice and now go to T-code ME9F give the purchase order number and execute and select one option and click on display messges button .
you will find the changes that you have done in ZFORM1. so we cant chage the standard Sap Scripts by copying the Standard Sap Scripts we can chage and replace with our forms
Refer
https://forums.sdn.sap.com/click.jspa?searchID=4089895&messageID=3239299
Regards
Mohammed