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

Script labels

Former Member
0 Likes
1,018

Hi experts,

In scripts how we create labels. Where the same possibility is not there in smartform. I dont know about lables in scripts. Please explain me detially.

Thanks

Ahammad

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
853

Hi

What do you mean by Labels in Scripts?

It is the field names or some Free Text literals

You can hardcode them in the script with a proper Paragraph format and with proper FONT and TAB setting before the data of the fields is displayed.

In main window we display the repetetive data for the fields

Before MAIN window declare another window and in that window write all these field Lables(texts) and display, so that under each field label data is displayed

Reward points for useful Answers

Regards

Anji

6 REPLIES 6
Read only

Former Member
0 Likes
854

Hi

What do you mean by Labels in Scripts?

It is the field names or some Free Text literals

You can hardcode them in the script with a proper Paragraph format and with proper FONT and TAB setting before the data of the fields is displayed.

In main window we display the repetetive data for the fields

Before MAIN window declare another window and in that window write all these field Lables(texts) and display, so that under each field label data is displayed

Reward points for useful Answers

Regards

Anji

Read only

0 Likes
853

Hi ,

Please send me one example regarding this.

In smartforms lables are not possible.Than what is the alternate way for this.

Thanks

Read only

Former Member
0 Likes
853

Hi ahammad

Here is ur sample program

 TABLES : ZPACK,ZTRN. 

DATA: BEGIN OF ITAB OCCURS 0, 
      ZPKSLIP_NO LIKE ZTRN-ZPKSLIP_NO, 
      ZCARTON_NO LIKE ZPACK-ZCARTON_NO, 
      END OF ITAB. 

DATA MVAR(12) TYPE C. 
DATA MCTR(6) TYPE C. 

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001. 
SELECT-OPTIONS: ZSLIP FOR ZTRN-ZPKSLIP_NO NO-EXTENSION NO INTERVALS 
OBLIGATORY default 6. 
SELECTION-SCREEN END OF BLOCK B1. 

SELECT * FROM ZPACK INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE 
ZPKSLIP_NO EQ ZSLIP-LOW . 

CALL FUNCTION 'OPEN_FORM' 
  EXPORTING 
    FORM = 'ZTEST_RAJ'. 

DO 4 TIMES. 

  MCTR = 100000 + SY-INDEX. 
  MCTR = MCTR+1(5). 
  CONCATENATE '55C/06/' MCTR INTO MVAR. 

  DO 80 TIMES. 
    ITAB-ZPKSLIP_NO = MVAR. 
    ITAB-ZCARTON_NO = SY-INDEX. 
    APPEND ITAB. 
    CLEAR ITAB. 
  ENDDO. 

ENDDO. 

SORT ITAB BY ZPKSLIP_NO ZCARTON_NO. 

CALL FUNCTION 'START_FORM' 
  EXPORTING 
    FORM = 'ZTEST_RAJ'. 

LOOP AT ITAB. 

  AT NEW ZPKSLIP_NO. 

    CALL FUNCTION 'WRITE_FORM' 
      EXPORTING 
        ELEMENT = '101' 
        WINDOW  = 'MAIN'. 

  ENDAT. 

  CALL FUNCTION 'WRITE_FORM' 
    EXPORTING 
      ELEMENT = '102' 
      WINDOW  = 'MAIN'. 

  AT END OF ZPKSLIP_NO. 

    CALL FUNCTION 'END_FORM'. 

    CALL FUNCTION 'START_FORM' 
      EXPORTING 
        FORM = 'ZTEST_RAJ'. 

  ENDAT. 

ENDLOOP. 

CALL FUNCTION 'END_FORM'. 

CALL FUNCTION 'CLOSE_FORM'. 
  
<u><b>
In sap script write :</b></u> 
 /E   101                             
 P1   ,,&ITAB-ZPKSLIP_NO(R)&          
 P1                                   
 /E   102                             
 P1   ,,&ITAB-ZCARTON_NO(R)&   

Reward all helpfull answers

Regards

Pavan

Read only

Former Member
0 Likes
853

Hi Ahammad,

Select the <b>window name</b> and Click the <b>TEXT</b> button (the last icon).

Upon clicking that, it takes you to another window.

Go to <b>GOTO</b> option in the toolbar and select <b>CHANGE EDITOR</b>.

Here you can type your field (Ex. Ahammad) this will display as it is.

Else if you want to display a variable or an internal table content put it between two &'s. Ex. &it_name&.

This should answer your query.

Reward points if useful.

Thanks,

Tej..

Read only

former_member673464
Active Contributor
0 Likes
853

hi...

In scripts we can declare multiple main windows in a single page where as in smartforms we cannot create multiple main windows in a single page.We create labels using these main windows.When we want to print address for the customers we can declare each address in a each single main window using scripts.In smartforms it is not possible.

regards,

veeresh

Read only

Former Member
0 Likes
853

Hi,

What you need to do is as follows:

1 Create one main window with the exact format of the labels

2 call this window as many times as you want in the page (in sap script )

3 in the driver program

open_form

loop at itab.

pass your values to the variables for 1st sticker

write_form- MAIN Window

use the FM CONTROL_FORM

and pass the command NEW_WINDOW

endloop.

At each loop pass it will print a new sticker from left to right & when it reaches the end of the line it will go to the next row of stickers

you create only one main window , do all the formatting once ,

then import this window as many times as you want in the page

mind well even the variable name doesnt need to be changed

do a loop of what you want to print

once the sticker has been printed , move to the next sticker simply by using the NEW-WINDOW command

Example:

You need to use OPEN_FORM

before startin teh loop

withing the loop use

WRITE_FORM

CONTROL_FORM

one all loop passes are over CLOSE_FORM

Regards,

Guarav