‎2007 May 30 6:37 AM
HOW TO ALIGN FIELD VALUES INTO CORRESPONDING FIELD NAME IN SAP SCRIPT.
‎2007 May 31 4:46 AM
Hi,
Your question is not very clear...
if your question is how to assign the values of program variables to SAP Script Variables then read further
All the variables of the program (Along with the values at the time of the call of the SAP Script) are automatically available in the SAP Script
Typically one should use the same names as in the program.
If you still want to use different names you can try to do this the SAP Script
/: PERFORM (some form name) in Program (Z Program name)
USING program variable 1
program variable 2
program variable 3
CHANGING
SAP Script Variable1
SAP Script Variable2
SAP Script Variable3
/: END PERFORM
in then Z program form routine do the assignment
SAP Script Variable1 = program variable 1.
Its absoloutely a waste of time following this approach
its easier & better to simply use the program variables directly.
Regards,
Gaurav
‎2007 Aug 03 11:11 AM
: PERFORM SUM IN PROGRAM ZPROGRAM
/: USING &VAR1&
/: USING &VAR2&
/: CHANGING &RESULT&
/: ENDPERFORM
In the program(ZPROGRAM), we need to write the form ....
FORM SUM TABLES INTAB STRUCTURE ITCSY
OUTTAB STRUCTURE ITCSY.
data: field1 type i,
field2 type i,
result type i.
TO read the values from the ITAB you have to use this logic.
READ TABLE INTAB WITH KEY NAME = 'VAR1'.
IF SY-SUBRC = 0.
FIELD1 = INTAB-VALUE.
ENDIF.
READ TABLE INTAB WITH KEY NAME = 'VAR2'.
IF SY-SUBRC = 0.
FIELD2 = ITAB-VALUE.
ENDIF.
RESULT = V_FIELD1 + V_FIELD2.
READ TABLE OUTTAB INDEX 1.
IF SY-SUBRC = 0.
OTAB-VALUE = RESULT.
MODIFY OUTTAB INDEX 1 .
ENDIF.
ENDFORM.
BUT THIS IS NOT WORKING.PLS HELP....
‎2007 May 31 4:49 AM
Hi,
we use the same variable in script as we declare in the program
say if we declare a variable v_num1 in program we will use &v_num1& to display this value.
if we want to use some other variable name we use 'DEFINE'
/: DEFINE v_num2 = &v_num1&.
Regards,
Vidya.
‎2007 May 31 6:09 AM
Hi Dhamodharan,
As ABAPers we need not bother about mapping values from print program to script, we just need to ensure we use same variable name in both print program and script and populate the variable in the print program. Mapping the value to script is taken care of by SAP.
<u><b>Print program:</b></u>
DATA gv_count TYPE i.
gv_count = 5.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ELEM'
WINDOW = 'MAIN'
FUNCTION =
TYPE = .
<u><b>SAP Script.</b></u>/E elem
&gv_count&
Award points if useful.
‎2007 Jun 01 10:12 AM
Hi Dhamodharan,
Kindly close the thread If Your question has been answered.
Also Kindly reward points to all helpful answers.
Regards,
Gaurav
‎2007 Jun 01 10:21 AM
Hi dhamodharan,
U can use driver program variables directly in sapscript between &&.
or if u want another method means use below one.
CALL FUNCTION 'TEXT_SYMBOL_SETVALUE'
EXPORTING
name = '&ATWRT&'
value = v_atwrt.Reward if helpful.
Thanks,
Suma.
‎2007 Aug 03 11:27 AM
Hi Dhamodharan,
To align filed values in cor. filed names (that are in header) use tabs in paragraph format. u can give 20 tabs in CM, MM, CH.
Hope it will work fine.
Regards
Krishnendu