Skip to Content
avatar image
Former Member

"how to create label in window" in sap scripts

i want to create a label on main window, can any one please tell.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    May 23, 2007 at 08:19 AM

    Hi,

    here is a 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'.

    In sap script write :

    /E 101

    P1 ,,&ITAB-ZPKSLIP_NO(R)&

    P1

    /E 102

    P1 ,,&ITAB-ZCARTON_NO(R)&

    Reward if helpful,

    Regards,

    Sooness

    Add comment
    10|10000 characters needed characters exceeded