‎2007 Jan 05 5:48 AM
In this a sapscript driving program .this is use for printing data when I click print preview one line have different text .i want to correct that text in script form. But I m not able to identify form name can u tell me how to get form name or how to solve the problem.
REPORT zj_1i57fp MESSAGE-ID 8i.
TABLES: t001w,
j_1iwrkcus,
j_1iregset,
j_1iindcus,
j_1iexcdtl,
j_1iexchdr,
lfa1,
adrc,
t001.
Begin 11.05.99
DATA : BEGIN OF listtab OCCURS 30,
procdoc(1) TYPE c,
exnum LIKE j_1iexchdr-exnum,
exdat LIKE j_1iexchdr-exdat,
srgrp LIKE j_1iexchdr-srgrp,
preprn LIKE j_1iexchdr-preprn,
exbed LIKE j_1iexchdr-exbed,
exsed LIKE j_1iexchdr-exsed,
exaed LIKE j_1iexchdr-exaed,
list_line LIKE sy-linno,
END OF listtab.
End 11.05.99
DATA : BEGIN OF options.
INCLUDE STRUCTURE itcpo.
DATA : END OF options.
DATA : BEGIN OF result.
INCLUDE STRUCTURE itcpp.
DATA : END OF result.
DATA : BEGIN OF thead OCCURS 10.
INCLUDE STRUCTURE thead.
DATA : END OF thead.
DATA : BEGIN OF tlines OCCURS 10.
INCLUDE STRUCTURE tline.
DATA : END OF tlines.
DATA : text_id(4) TYPE c.
DATA : doc_num LIKE j_1iexchdr-exnum, " pai 17/09/98
m_length TYPE i. " pai
Begin 11.05.99
DATA : doc_no LIKE j_1iexchdr-exnum,
doc_dt LIKE j_1iexchdr-exdat,
series LIKE j_1iexchdr-srgrp,
preprn LIKE j_1iexchdr-preprn,
m_selected,
m_date(10) TYPE c,
tabix LIKE sy-tabix.
DATA : it_pcrdtl LIKE TABLE OF zeou_pcrdtl WITH HEADER LINE,
it_pcrhdr LIKE TABLE OF zeou_pcrhdr WITH HEADER LINE .
DATA : wa_mara TYPE mara,
wa_t032t TYPE t023t.
DATA : gv_tot_duty TYPE konv-kwert,
gv_tot_amt TYPE konv-kwert,
gv_tot_val TYPE konv-kwert.
SELECT-OPTIONS: se_exnum FOR j_1iexchdr-exnum,
se_exdat FOR j_1iexchdr-exdat.
*
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK 4 WITH FRAME TITLE text-005.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 01.
PARAMETERS: p_print RADIOBUTTON GROUP grp1 DEFAULT 'X'.
SELECTION-SCREEN COMMENT (15) text-006.
SELECTION-SCREEN POSITION 20.
PARAMETERS: p_reprn RADIOBUTTON GROUP grp1.
SELECTION-SCREEN COMMENT (20) text-007.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK 4.
End 11.05.99
*
doc_num = doc_no. " pai
m_length = STRLEN( doc_num ).
WHILE m_length < 10.
CONCATENATE '0' doc_num INTO doc_num.
m_length = m_length + 1.
ENDWHILE.
doc_no = doc_num. " pai
*
Begin 11.05.99
TOP-OF-PAGE.
WRITE :/3 text-001,
text-002,
text-003,
text-004.
*
START-OF-SELECTION.
IF p_print = 'X'.
SELECT * INTO CORRESPONDING FIELDS OF TABLE listtab FROM j_1iexchdr
WHERE trntyp = '57FC' AND status = 'P' AND
exnum IN se_exnum AND exdat IN se_exdat AND preprn = ''.
ELSEIF p_reprn = 'X'.
SELECT * INTO CORRESPONDING FIELDS OF TABLE listtab FROM j_1iexchdr
WHERE trntyp = '57FC' AND status = 'P' AND
exnum IN se_exnum AND exdat IN se_exdat.
ENDIF.
IF sy-subrc <> 0.
MESSAGE e000(8i) WITH
'No data available or Document already printed'.
ENDIF.
*
END-OF-SELECTION.
SET PF-STATUS '100'.
SORT listtab BY exnum exdat.
LOOP AT listtab.
WRITE 😕 listtab-procdoc AS CHECKBOX.
WRITE : listtab-exnum UNDER text-001,
listtab-exdat UNDER text-002.
WRITE AT 30 listtab-srgrp.
WRITE AT 45 listtab-preprn.
listtab-list_line = sy-linno.
MODIFY listtab.
ENDLOOP.
*
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'EPRN'.
DO.
tabix = sy-index.
READ LINE sy-index FIELD VALUE listtab-procdoc.
IF sy-subrc <> 0.
EXIT.
ENDIF.
IF listtab-procdoc = 'X'.
READ TABLE listtab WITH KEY list_line = tabix.
doc_no = listtab-exnum.
doc_dt = listtab-exdat.
series = listtab-srgrp.
m_selected = 'y'.
EXIT.
ENDIF.
ENDDO.
ENDCASE.
Call fn. module to capture pre-printed excise no.
IF m_selected = 'y'.
CALL FUNCTION 'J_1I_ACCEPT_VALUE'
EXPORTING
i_preprn = preprn
IMPORTING
o_preprn = preprn.
ELSE.
MESSAGE e000(8i) WITH 'Select a Document'.
ENDIF.
Check whether entered pre-printed excise no. already exists
SELECT SINGLE * FROM j_1iexchdr WHERE preprn = preprn AND
status <> 'D' AND
NOT ( exnum = doc_no
AND exdat = doc_dt
AND srgrp = series ).
IF sy-subrc = 0.
SET CURSOR FIELD 'PREPRN'.
MESSAGE e000(8i) WITH 'Pre-printed excise no.' preprn 'already used'.
ENDIF.
End 11.05.99
*
SELECT SINGLE * FROM j_1iexchdr
WHERE exnum = doc_no
AND exdat = doc_dt
AND srgrp = series.
IF SY-SUBRC <> 0.
MESSAGE E000(8I) WITH 'Invalid Challan number entered'.
"10.05.99
ELSEIF J_1IEXCHDR-PREPRN <> PREPRN AND J_1IEXCHDR-PREPRN <> ''.
MESSAGE E000(8I) WITH
'57F4' DOC_NO 'already printed with pre-printed excise no.'
J_1IEXCHDR-PREPRN.
ENDIF.
IF J_1IEXCHDR-STATUS NE 'P'.
MESSAGE E000(8I) WITH 'Challan status is not posted..cannot print'.
ENDIF.
Begin 10.05.99
j_1iexchdr-exbed = j_1iexchdr-exbed + j_1iexchdr-exsed +
j_1iexchdr-exaed.
Begin 10.05.99
Print totals of BED, SED, AED
j_1iexchdr-exbed = listtab-exbed + listtab-exsed + listtab-exaed.
listtab-procdoc = ''.
listtab-preprn = preprn.
MODIFY LINE listtab-list_line FIELD VALUE listtab-procdoc
listtab-preprn LINE FORMAT COLOR 6 INPUT OFF.
End 10.05.99
Printing options
options-tdcopies = 1 .
options-tdnewid = 'X' .
options-tddataset = 'LIST1' .
options-tddelete = 'X' .
options-tdprogram = sy-repid.
options-tdpreview = 'X' .
PERFORM open_form.
PERFORM get_header_data.
PERFORM write_form USING 'TITLE' 'DOC_TITLE_T' 'SET'.
PERFORM write_form USING 'INFO' 'HEADER_DATA' 'SET'.
Print Line items
PERFORM write_form USING 'MAIN' 'DASH_LINE' 'SET'.
PERFORM write_form USING 'MAIN' 'ITEM_HEADER' 'SET'.
PERFORM write_form USING 'MAIN' 'DASH_LINE' 'SET'.
****Start of Changes***********************************
DATA: gs_mseg TYPE mseg.
CLEAR: gs_mseg.
SELECT * FROM zeou_pcrdtl INTO TABLE it_pcrdtl
WHERE exnum = doc_no " j_1iexcdtl-exnum
AND exdat = doc_dt. " j_1iexcdtl-exdat.
****End of Changes*************************************
SELECT * FROM j_1iexcdtl WHERE exnum = doc_no AND
exdat = doc_dt.
SELECT SINGLE * FROM zeou_pcidtl INTO it_pcidtl
WHERE ebeln = j_1iexcdtl-rdoc1
AND matnr = j_1iexcdtl-matnr.
****Start of Changes***********************************
SELECT SINGLE * FROM zeou_pcrdtl INTO it_pcrdtl
WHERE exnum = j_1iexcdtl-exnum
AND exdat = j_1iexcdtl-exdat.
SELECT SINGLE * FROM mseg
INTO gs_mseg
WHERE mblnr = j_1iexcdtl-rdoc2
AND mjahr = j_1iexcdtl-ryear2
AND parent_id = j_1iexcdtl-ritem2.
CLEAR it_pcrdtl.
READ TABLE it_pcrdtl WITH KEY mblnr = gs_mseg-mblnr
mjahr = gs_mseg-mjahr
zeile = gs_mseg-zeile.
****End of Changes*************************************
SELECT SINGLE * FROM mara INTO wa_mara
WHERE matnr = j_1iexcdtl-matnr.
SELECT SINGLE * FROM t023t INTO wa_t032t
WHERE matkl = wa_mara-matkl
AND spras = 'EN'.
PERFORM write_form USING 'MAIN' 'ITEM_VALUES' 'SET'.
gv_tot_duty = gv_tot_duty + it_pcrdtl-boedr.
gv_tot_val = gv_tot_val + it_pcrdtl-pcram.
gv_tot_amt = gv_tot_amt + j_1iexcdtl-exbas.
ENDSELECT.
PERFORM write_form USING 'MAIN' 'DASH_LINE' 'SET'.
PERFORM write_form USING 'MAIN' 'TOTAL' 'SET'.
SELECT SINGLE * FROM zeou_pcrhdr INTO it_pcrhdr
WHERE pcrnr = it_pcrdtl-pcrnr
AND pcrdt = it_pcrdtl-pcrdt.
PERFORM write_form USING 'MAIN' 'JOB_WORKER_ADDRESS' 'SET'.
*
PERFORM write_form USING 'HEADER' ' ' ' '.
text_id = 'PROC'.
*concatenate j_1iexchdr-rdoc j_1iexchdr-ryear into thead-tdname.
thead-tdname = '57FC'.
PERFORM read_text.
LOOP AT tlines.
IF tlines-tdline NE space.
j_1iregset-j_1irgdesc = tlines-tdline.
ENDIF.
ENDLOOP.
PERFORM write_form USING 'FOOTER' ' ' 'SET'.
PERFORM endform.
Update table with entered preprn excise no. "10.05.99
UPDATE j_1iexchdr SET preprn = preprn
WHERE exnum = doc_no
AND exdat = doc_dt
AND srgrp = series.
&----
*& Form OPEN_FORM
&----
text *
----
--> p1 text
<-- p2 text
----
FORM open_form.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
application = ''
device = 'PRINTER'
dialog = 'X'
form = 'ZJ_1I_57F4'
IMPORTING
RESULT = RESULT
exceptions
canceled = 1
device = 2
form = 3
OPTIONS = 4
unclosed = 5
OTHERS = 6.
IF sy-subrc NE 0.
MESSAGE e888.
ENDIF.
ENDFORM. " OPEN_FORM
&----
*& Form WRITE_FORM
&----
text *
----
--> p1 text
<-- p2 text
----
FORM write_form USING window element fnction.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = element
function = fnction
window = window
IMPORTING
PENDING_LINES =
EXCEPTIONS
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
OTHERS = 7.
ENDFORM. " WRITE_FORM
&----
*& Form ENDFORM
&----
text *
----
--> p1 text
<-- p2 text
----
FORM endform.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = RESULT
TABLES
OTFDATA =
exceptions
unopened = 1
OTHERS = 2.
ENDFORM. " ENDFORM
&----
*& Form GET_HEADER_DATA
&----
text *
----
--> p1 text
<-- p2 text
----
FORM get_header_data.
CLEAR: t001w,j_1iwrkcus,j_1iregset,j_1iindcus.
SELECT SINGLE * FROM t001w
WHERE werks = j_1iexchdr-werks.
SELECT SINGLE * FROM j_1iwrkcus
WHERE j_1iwerks = j_1iexchdr-werks.
IF sy-subrc <> 0.
MESSAGE e000(8i) WITH 'plant customisation not found'.
ENDIF.
SELECT SINGLE * FROM j_1iregset
WHERE j_1iregid = j_1iwrkcus-j_1iregid.
IF sy-subrc <> 0.
MESSAGE e000(8i) WITH 'register id customisation not found'.
ENDIF.
SELECT SINGLE * FROM j_1iindcus WHERE
j_1ibukrs = j_1iexchdr-bukrs.
IF sy-subrc <> 0.
MESSAGE e000(8i) WITH 'Customisation missing .. indcus'.
ENDIF.
SELECT SINGLE * FROM lfa1 WHERE
lifnr = j_1iexchdr-lifnr.
IF sy-subrc <> 0.
MESSAGE e000(8i) WITH 'Vendor record missing ....'.
**Vendor full address
ELSE.
SELECT SINGLE * FROM t001
WHERE bukrs EQ j_1iexchdr-bukrs.
SELECT SINGLE * FROM adrc
WHERE addrnumber EQ lfa1-adrnr.
****
ENDIF.
ENDFORM. " GET_HEADER_DATA
&----
*& Form READ_TEXT
&----
text *
----
--> p1 text
<-- p2 text
----
FORM read_text.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = text_id
language = sy-langu
name = thead-tdname
object = 'J1IF'
archive_handle = 0
IMPORTING
header = thead
TABLES
lines = tlines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
ENDFORM. " READ_TEXT
‎2007 Jan 05 5:52 AM
Hi ,
The form name is passed as a parameter to the FM OPEN_FORM , in your case look at the code
CALL FUNCTION 'OPEN_FORM'
EXPORTING
application = ''
device = 'PRINTER'
dialog = 'X'
form = 'ZJ_1I_57F4' " Form Name
IMPORTING
RESULT = RESULT
exceptions
canceled = 1
device = 2
form = 3
OPTIONS = 4
unclosed = 5
OTHERS = 6., Now use se71 to see the from and check the text .
Please do revert back in case you want more information.
Regards
Arun
‎2007 Jan 05 6:10 AM
Hi Arun
plz tell me....
After enter form name which option is selected for checking text.or how to check text element.
‎2007 Jan 05 6:34 AM
‎2007 Jan 05 6:38 AM
do you mean, you want to identify the text in sapscript form ?
‎2007 Jan 05 7:07 AM
Hi
Goto SO10
give the name of st text name and change the text and save it.
Regs
Rams
‎2007 Jan 05 5:53 AM
‎2007 Jan 05 5:57 AM