‎2007 Mar 06 9:28 AM
Hey,
I am getting a strange problem when i execute sap script. I am getting logo in logo window which is good. But when i try to retrieve customer name number country in the address window, in the output i am getting &itab-kunnr& &itab-name1& &itab-land1& .
Can i know how to resolve the problem.
Thanks in advance
‎2007 Mar 06 9:32 AM
Hi ben,
can you show how you use the address-statement in the script?
Regards, Dieter
‎2007 Mar 06 5:37 PM
This is my code.
tables: kna1.
select-options: cust for kna1-kunnr.
data: begin of itab occurs 1000,
kunnr type kunnr,
1and1 type land1,
name1 type name1,
end of itab.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZBPFORM'
LANGUAGE = SY-LANGU
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12
.
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 kunnr land1 name1 from kna1 into table itab where kunnr in cust.
loop at itab.
CALL FUNCTION 'START_FORM'
EXPORTING
ARCHIVE_INDEX =
FORM = 'ZBPFORM'
LANGUAGE = SY-LANGU
STARTPAGE = 'PAGE1'
PROGRAM = 'ZBPFORM'
MAIL_APPL_OBJECT =
IMPORTING
LANGUAGE =
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
SPOOL_ERROR = 6
CODEPAGE = 7
OTHERS = 8
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ELE! '
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'ADDRESS'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'END_FORM'
IMPORTING
RESULT =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SPOOL_ERROR = 3
CODEPAGE = 4
OTHERS = 5
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endloop.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
‎2007 Mar 06 9:32 AM
Hi,
In the Command Line you might have not given the correct Paragraph:
I think you have give '/:' for that lines.Check.
Regards,
Anji
‎2007 Mar 06 9:34 AM
Hello,
You have to give like this:
/E &itab-kunnr& &itab-name1& &itab-land1&
I think it is like this
/: &itab-kunnr& &itab-name1& &itab-land1&
PLease check this:
Vasanth
‎2007 Mar 06 5:44 PM
u did't uncomment text element in write form. uncomment it.
/E elem
&itab-KUNNR& &itab-name1& &itab-land1&
HOPE THIS SOLVES U R PROB.
REGARDS
SANTHOSH REDDY
‎2007 Mar 06 6:06 PM
‎2007 Mar 06 6:09 PM
yes.
for each element u have to write one write form.
maintain one text element in that window.
and write the contents with default paragraph ( * )or any other paragraph u defined
‎2007 Mar 06 6:20 PM
what shold i have to define in quotes. I already given \E in the address windows
‎2007 Mar 06 6:23 PM
what ever u gave the text element in script at address window
give the same thing in <b>element = ' '</b> this single quotes.
‎2007 Mar 06 6:47 PM
‎2007 Mar 06 6:49 PM
window name in script and in driver program should be same. and it is case sensitive.
‎2007 Mar 06 7:19 PM
‎2007 Mar 07 2:11 AM
I am unable to see the data at ouptut. But i am getting the total number of pages and i am able to print the constants which are declared in the main form.
Can i know how to resolve the problem.
‎2007 Mar 07 2:32 AM
Hi ben,
instead of this
WINDOW = 'ADDRESS'
in the write_form give
WINDOW = 'MAIN'
hope this helps,
keerthi
‎2007 Mar 07 3:18 AM
text element for MAIN indow is Compulsory.
for Address window is optional. if u want to print the contents in any window which is not constant then u have to use text element.
loop at itab.
call function 'write_form'
window = 'MAIN'.
element = 'ELEL'
call function write_form
window = 'ADDRESS'
element = 'ADDR'
ENDLOOP.
here i did't write all parameters. go with all required.
hope u understood.
if u want to print the constants then no need of text elements. but u are writing contents in address window which are not constants.
regards
‎2007 Mar 08 2:05 AM
data is not displayed in output.
*******************************************************************************
REPORT ZBPSAPSCIPT .
tables: kna1.
select-options: cust for kna1-kunnr.
data: begin of itab occurs 100,
kunnr type kunnr,
land1 type land1,
ort01 type ort01,
end of itab.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'ZBPSCRIPT '
LANGUAGE = SY-LANGU
.
IF SY-SUBRC <> 0.
ENDIF.
select ort01 name1 from kna1 into table itab where kunnr in cust.
loop at itab.
CALL FUNCTION 'START_FORM'
EXPORTING
FORM = 'ZBPSCRIPT'
LANGUAGE = ' '
STARTPAGE = 'p1'
PROGRAM = 'ZBPSAPSCRIPT '
.
IF SY-SUBRC <> 0.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'CUSTOMERDETAILS'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
.
IF SY-SUBRC <> 0.
ENDIF.
CALL FUNCTION 'END_FORM'
.
IF SY-SUBRC <> 0.
ENDIF.
endloop.
CALL FUNCTION 'CLOSE_FORM'
.
IF SY-SUBRC <> 0.
ENDIF.
*********************************************************************
code written in Main form
/E CUSTOMERDETAILS
&itab-name1&,&itab-ort01&
***********************************************************************************************
The comma is displayed but not the fields.
Can i know where the problem lies in the code.
Thanks in advance
‎2007 Mar 08 2:21 AM
Hi ben,
dont use comma in the script:
/: &itab-name1& ,,&itab-ort01&
regards,
keerthi
‎2007 Mar 08 2:35 AM
its not working even after removing the comma. Im getting page numbers at the top of the screen
‎2007 Mar 08 2:53 AM
Hi,
/E CUSTOMERDETAILS
<b>/:</b> &itab-name1&<b>,,</b>&itab-ort01&
Give two commas which means a tab.