Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

problem with sap script

Former Member
0 Likes
1,690

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

19 REPLIES 19
Read only

Former Member
0 Likes
1,665

Hi ben,

can you show how you use the address-statement in the script?

Regards, Dieter

Read only

0 Likes
1,665

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.

Read only

Former Member
0 Likes
1,665

Hi,

In the Command Line you might have not given the correct Paragraph:

I think you have give '/:' for that lines.Check.

Regards,

Anji

Read only

Former Member
0 Likes
1,665

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

Read only

SantoshKallem
Active Contributor
0 Likes
1,665

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

Read only

0 Likes
1,665

Santosh, u mean at element =' ' in write form.

Read only

SantoshKallem
Active Contributor
0 Likes
1,665

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

Read only

0 Likes
1,665

what shold i have to define in quotes. I already given \E in the address windows

Read only

SantoshKallem
Active Contributor
0 Likes
1,665

what ever u gave the text element in script at address window

give the same thing in <b>element = ' '</b> this single quotes.

Read only

Former Member
0 Likes
1,665

i am getting error the window address is not found

Read only

SantoshKallem
Active Contributor
0 Likes
1,665

window name in script and in driver program should be same. and it is case sensitive.

Read only

Former Member
0 Likes
1,665

both are same

Read only

Former Member
0 Likes
1,665

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.

Read only

0 Likes
1,665

Hi ben,

instead of this

WINDOW = 'ADDRESS'

in the write_form give

WINDOW = 'MAIN'

hope this helps,

keerthi

Read only

SantoshKallem
Active Contributor
0 Likes
1,665

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

Read only

Former Member
0 Likes
1,665

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

Read only

0 Likes
1,665

Hi ben,

dont use comma in the script:

/: &itab-name1& ,,&itab-ort01&

regards,

keerthi

Read only

0 Likes
1,665

its not working even after removing the comma. Im getting page numbers at the top of the screen

Read only

0 Likes
1,665

Hi,

/E CUSTOMERDETAILS

<b>/:</b> &itab-name1&<b>,,</b>&itab-ort01&

Give two commas which means a tab.