cancel
Showing results for 
Search instead for 
Did you mean: 

Iam still unanswered

Former Member
0 Kudos

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.

My previous posts are also same.Still I didnt get any solution.I tried debugging the form too.It says unknown symbol error in that main window for all symbols(I checked using check->texts).Why it says unknown symbol.Values are captured in my abap program but not in script.I tried giving /: DEFINE &KNA1-NAME1

/:DEFINE &EKPO-EBELN& to all symbols.When I checked,that unknown symbol error doesnt come as I defined them,but values are not printed.Iam strucked.Please help me.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

instead of

POSITION XORIGIN 2 CM YORIGIN '-0.5 CM'

This

Replace '-.5' cm

Regards,

naimesh_patel
Active Contributor
0 Kudos

I have tried to regenearate the problem but in my system it is not giving me any error.

May be you are facing problem because of the data.

My Observation is falles:

1. You have defined the parameters without the "OBLIGATORY". As you are using these criteira as main selection and if you don't provide any values in the field it will not facth any data. So, make it mandatory

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

2. Use START-OF-SELECTION before starting the selection and check for the successful data retrival.

START-OF-SELECTION.
CLEAR EKPO.
SELECT SINGLE * FROM EKPO
       WHERE EBELN = P_EBELN AND
             EBELP = P_EBELP.
IF SY-DBCNT IS INITIAL.
  MESSAGE S398(00) WITH 'Do data is selected..!'
  LEAVE LIST-PROCESSING.
ENDIF.

Hope it helps.

Regards,

Naimesh Patel

Former Member
0 Kudos

Is it printing in your system?Its true that but its mandatory.I entered the data,even i debugged yarr in abap program kna1-name1 and others are picking data.Both your points mean same.I did it in debugging and find that data passed to variables but not to the firm.I did another script program whre i used internal tables and loop statement,Is loop statement not necessary here?