Skip to Content
author's profile photo Former Member
Former Member

Should I use joins here

Layout set           Z_TESTSCRIPT
Description          Test SAP script

Standard attributes
  First page          FIRST
  Default paragraph   P1
  Tab-stop            1.00 CH
  Page format         DINA4
  Orientation         Landscape
  Lines/inch            6.00
  Characters/inch      10.00

Font attributes
  Font family         COURIER
  Font size           12.0 Point
  Bold                No
  Italic              No
  Underlined          No

Characters    Attributes
  B           Character String Bold
              Standard attributes
              Marker            No
              Font attributes
              Bold              Yes

Paragraphs    Attributes
  P1          Default Paragraph
              Standard attributes
              Line spacing      1.00 LN
              Left margin       1.00 CM
              Alignment         Left-aligned
              Font attributes
              Font family       TIMES
              Font size         12.0 Point

  P2          Header Paragraph
              Standard attributes
              Line spacing      1.00 LN
              Left margin       4.50 CM
              Alignment         Left-aligned
              Font attributes
              Font family       TIMES
              Font size         18.0 Point
              Bold              Yes

  P3          Undelined paragraph
              Standard attributes
              Line spacing      1.00 LN
              Alignment         Left-aligned
              Font attributes
              Font family       TIMES
              Font size         12.0 Point
              Underlined        Yes

Windows       Attributes
  MAIN        Main window
              Window type       MAIN
  HEADER      Main window
              Window type       CONSTANT
  FOOTER      Main window
              Window type       CONSTANT

Pages         Attributes
  FIRST       First Page
              Standard attributes
              Next page         FIRST
              Page counter
              Mode              START
              Numbering type    Arabic numerals
              Page window
              HEADER               Left margin          00.00 CM
                                   Upper margin         00.00 CM
                                   Window width         20.00 CM
                                   Window height        04.00 CM
              MAIN                 Left margin          00.00 CM
                                   Upper margin         05.00 CM
                                   Window width         20.00 CM
                                   Window height        20.0 CM
              FOOTER               Left margin          00.00 CM
                                   Upper margin         25.00 CM
                                   Window width         20.00 CM
                                   Window height        04.00 CM

Text elements for following windows:
HEADER

Element HEADER
/: POSITION XORIGIN 2 CM YORIGIN '-0.5 CM'
/: BOX XPOS 1 CM YPOS 1 CM WIDTH 18 CM HEIGHT 1 CM FRAME 10 TW INTENSITY 10
/
/
/
P2     ,,<B>TEST PURCHASE ORDER</>
/
/

MAIN

Element MAIN
P1  <B>Customer/Supplier:</>,,&KNA1-NAME1&
/
P1  <B>PO No:</>,,&EKPO-EBELN&
/
P1  <B>Part No:</>,,&MAKT-MATNR&
/
P1  <B>Description:</>,,&MAKT-MAKTX&
/
P1  <B>Quantity:,,</>&EKPO-MENGE&
/
P1  <B>Sign:</>&uline(81)&
/
P1  <B>Date:</>&EKKO-AEDAT&

FOOTER

Element FOOTER
/: POSITION XORIGIN 2 CM YORIGIN '-0.5 CM'
/: BOX XPOS 1 CM YPOS 1 CM WIDTH 18 CM HEIGHT 1 CM FRAME 10 TW INTENSITY 10
/
/
/
P2     ,,<B>PLEASE SIGN THE PO BEFORE DISPATCH</>
/
/

 
REPORT ZPSAPSCRIPT.
TABLES : EKKO,                        
         EKPO,                        
         KNA1,                        
         USR01,                       
         MARA,                        
         MAKT.

DATA : BEGIN OF ZOPTION.
        INCLUDE STRUCTURE ITCPO.
DATA : END OF ZOPTION.

PARAMETERS: P_EBELN LIKE EKKO-EBELN,
            P_EBELP LIKE EKPO-EBELP.

CLEAR EKPO.
SELECT SINGLE * FROM EKPO
       WHERE EBELN = P_EBELN AND
             EBELP = P_EBELP.

CLEAR KNA1.
SELECT SINGLE NAME1 FROM KNA1
              INTO KNA1-NAME1
              WHERE KUNNR = EKPO-KUNNR.

CLEAR MAKT.
SELECT SINGLE MAKTX FROM MAKT
              INTO MAKT-MAKTX
              WHERE MATNR = EKPO-MATNR AND
                    SPRAS = SY-LANGU.

CLEAR USR01.
SELECT SINGLE * FROM USR01 WHERE BNAME = SY-UNAME.

ZOPTION-TDDEST    = USR01-SPLD.        "Output device (printer)
ZOPTION-TDIMMED   = 'X'.               "Print immediately
ZOPTION-TDDELETE  = 'X'.               "Delete after printing
ZOPTION-TDPROGRAM = 'ZPQRPRNT'.        "Program Name

CALL FUNCTION 'OPEN_FORM'
     EXPORTING
         APPLICATION        = 'TX'
*         ARCHIVE_INDEX      = ' '
*         ARCHIVE_PARAMS     = ' '
         DEVICE             = 'PRINTER'
         DIALOG             = ' '
         FORM               = 'Z_TESTSCRIPT'
         LANGUAGE           = SY-LANGU
         OPTIONS            = ZOPTION
     IMPORTING
          LANGUAGE           = SY-LANGU
       EXCEPTIONS
         OTHERS     = 1.

CALL FUNCTION 'WRITE_FORM'
     EXPORTING
         ELEMENT       = 'HEADER'
*         FUNCTION      = 'SET'
*         TYPE          = 'BODY'
         WINDOW        = 'HEADER'
     EXCEPTIONS
          ELEMENT       = 1.

CALL FUNCTION 'WRITE_FORM'
     EXPORTING
         ELEMENT       = 'MAIN'
*         FUNCTION      = 'SET'
*         TYPE          = 'BODY'
         WINDOW        = 'MAIN'
     EXCEPTIONS
          ELEMENT       = 1.

CALL FUNCTION 'WRITE_FORM'
     EXPORTING
         ELEMENT       = 'FOOTER'
*         FUNCTION      = 'SET'
*         TYPE          = 'BODY'
         WINDOW        = 'FOOTER'
     EXCEPTIONS
          ELEMENT       = 1.

CALL FUNCTION 'CLOSE_FORM'
     EXCEPTIONS
          UNOPENED = 1
          OTHERS   = 2.

Guys

The above run well but the problem is that header window is not displaying those program symbols.I dont know why,is that because iam not using internal table.I debugged to find out that till write_form all variables are getting data but not transfering to form.Should i declare internal table,fetch the data using input values and fill the form using loop at itable.Please suggest me.

Thanks

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 03:27 PM

    Hi

    in the script remove the lines of text elements

    /E MAIN

    /E HEADER

    /E FOOTER

    and see the output

    Regards

    anji

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Anji,

      Infact I didnt add /E Main to main window text elements,I removed /Header and /Footer from header and windows text elements respectively.I debugged till close_form of abap program,i found values for all the variables kna1-name1,ebeln...so it is not printed in form,I dont know why.One more thing in page windows tab,i created main,header,footer using create element.Even after I create all the three,if i give create element again,it shows main window in the popup box and able to add another main window.Is this by default?Why the values are not printing?I tried giving &date& which is getting printed but not those program variables.Help me out please.

      Thanks

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2007 at 08:34 AM

    check if the script is active or not??

    also check for any errors, SE71, form menu > check >symbols

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2007 at 08:34 AM

    also u can debug the script, SE71, utilities> activate debugger

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      I tried to check that symbols,it says 'undefined symbols' and some decimal error with -0.5 cm ,I changed it to 1 cm,now only undefined symbols error is coming,undefined symbols are coming to main window.All symbols say undefined symbol error.I dont know why,can anyone help?

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.