‎2008 Feb 19 8:24 AM
Hi,
I am facing one problem in SAP script while I am customizing PO Printout according to client requirement.
What I have to do is to print the company's excise details on the PO Print, for that i have written a external subroutine to fetch the data and to pass the script. But now the problem is that i dont the variable to which i must the pass the excise details data for printout.
I tried to create same variable in top inclue of print program of MEDRUCK Script SAPFM06P. But all in vain.
Please help me out.
POINTs SURELY WILL BE REWARDED,
Regards,
Varun
‎2008 Feb 19 8:32 AM
Hi ,
Please follow the below procedure.
1. Write your external subroutine in the layout where you exactly you want to print the data.
PERFORM GET_TEXT IN PROGRAM ZPRTTEXT
USING &NAST-SPRAS&
2. Create a new Z/Y program, and write your code.
Sample Code:
form get_text tables in_tab structure itcsy
out_tab structure itcsy.
tables: zmtx.
data: begin of i_text occurs 0,
langu like zmtx-langu,
sortseq like zmtx-sortseq,
text like zmtx-text,
end of i_text.
data: v_count type i value 1,
v_langu like zmtx-langu.
read table in_tab index 1.
call function 'CONVERSION_EXIT_ISOLA_INPUT'
exporting
input = in_tab-value
importing
output = v_langu
EXCEPTIONS
UNKNOWN_LANGUAGE = 1
OTHERS = 2
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
select langu sortseq text from zmtx
into table i_text
where langu = v_langu.
loop at i_text.
condense i_text-text.
read table out_tab index sy-tabix.
out_tab-value = i_text-text.
modify out_tab from out_tab index sy-tabix.
endloop.
endform.
100% you will get correct data.
‎2008 Feb 19 8:30 AM
Hi
Refer this piece of code:
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.
Thanks
Vasudha
‎2008 Feb 19 8:58 AM
Hi Vasudha,
Thanx for your Replya.
But in your Example, The variable BARCODE is not decalred in my SCRIPT Driver program. So Where it will be declared ? I can not declare it in Driver program, becuase it is a standard modification. then how can i pass value to the changing parameteres of the subroutine?
Regards,
Varun Sanghi
‎2008 Feb 19 9:19 AM
Varun,
You need to create a Z program and this subroutine is a part of the Z program
‎2008 Feb 19 8:32 AM
Hi ,
Please follow the below procedure.
1. Write your external subroutine in the layout where you exactly you want to print the data.
PERFORM GET_TEXT IN PROGRAM ZPRTTEXT
USING &NAST-SPRAS&
2. Create a new Z/Y program, and write your code.
Sample Code:
form get_text tables in_tab structure itcsy
out_tab structure itcsy.
tables: zmtx.
data: begin of i_text occurs 0,
langu like zmtx-langu,
sortseq like zmtx-sortseq,
text like zmtx-text,
end of i_text.
data: v_count type i value 1,
v_langu like zmtx-langu.
read table in_tab index 1.
call function 'CONVERSION_EXIT_ISOLA_INPUT'
exporting
input = in_tab-value
importing
output = v_langu
EXCEPTIONS
UNKNOWN_LANGUAGE = 1
OTHERS = 2
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
select langu sortseq text from zmtx
into table i_text
where langu = v_langu.
loop at i_text.
condense i_text-text.
read table out_tab index sy-tabix.
out_tab-value = i_text-text.
modify out_tab from out_tab index sy-tabix.
endloop.
endform.
100% you will get correct data.