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

Error during compiling

former_member143179
Participant
0 Likes
4,915

Dear Sir,

We are using SAP provided program ZPSFCSPLT , for Production Order Printing . As the standard program does not print WBS-Element , so we are trying to modify the same program . As a part of modification , we inserted following statement :

Select PROJN from AFPO into t_job where AUFNR = caufvd_tab-AUFNR .

But the amended program is not getting compiled . The error is as following

Incorrect nesting:Before the statement "ENDFORM", the structure introduced by "SELECT" must be concluded by "ENDSELECT".....

Request you to kindly help us .

Regards

B V Mittal

The complete list of changed program is as below :

REPORT zpsfcsplt MESSAGE-ID co.

----


  • *

  • PPS-Print: Operation-split *

  • *

----


  • DATA-Statements general

INCLUDE ppcoincl.

  • DATA-Statements specific for production orders

INCLUDE codrgt10.

DATA: t_job TYPE AFPO-PROJN .

  • entry to print

PERFORM print_sub.

----


  • FORM PRINT_SUB *

----


  • ........ *

----


FORM print_sub.

DATA use_default.

  • Document-tables

INCLUDE lcodrinc.

LOOP AT itab_tdr WHERE object = obj-pos

OR object = obj-sop

AND aufnr = print_co-aufnr.

EXIT.

ENDLOOP.

CHECK sy-subrc IS INITIAL.

  • fill workarea of header (probably more than 1 order is to be printed)

READ TABLE itab_tdr WITH KEY object = obj-alt

aufnr = print_co-aufnr.

CHECK sy-subrc IS INITIAL.

  • Save Indextable of header

itab_ord = itab_tdr.

  • check if SAPscript form was maintained

IF print_co-forml = space.

IF sy-batch = space AND sy-binpt = space.

MESSAGE e298(c2) WITH print_co-lstid

print_co-auart

print_co-repid

print_co-drvar.

ELSE.

MESSAGE i298(c2) WITH print_co-lstid

print_co-auart

print_co-repid

print_co-drvar.

ENDIF.

ENDIF.

READ TABLE caufvd_tab WITH KEY aufnr = itab_ord-aufnr.

CHECK sy-subrc IS INITIAL.

PERFORM pppr_std_init_order USING caufvd_tab.

Select PROJN from AFPO into t_job where AUFNR = caufvd_tab-AUFNR .

PERFORM pppr_collect_destinations USING print_co.

DO print_co-copys TIMES.

IF sy-index GT 1.

MOVE text-dup TO print_co-drtxt.

ENDIF.

  • get destination

use_default = 'X'. " default destination in 1st run

LOOP AT destination_tab.

pr_options-tddest = destination_tab-dest.

  • call OPEN_FORM to open formular

PERFORM pppr_open_form USING 'MAIN'.

  • Print split tickets

PERFORM split_ticket USING print_co-use_wcp

destination_tab-dest

use_default.

  • call CLOSE_FORM to finish formular

PERFORM pppr_close_form.

CLEAR use_default. " default destination only in 1st run

ENDLOOP.

ENDDO.

ENDFORM. "PRINT_SUB

----


  • FORM SPLIT_TICKET *

----


  • ........ *

----


FORM split_ticket USING use_wcp LIKE t496p-use_wcp

destination LIKE t496p-drdest

use_default.

DATA: counter_abs(4) TYPE n.

DATA: number_of_tickets(4) TYPE n.

DATA: BEGIN OF b OCCURS 0.

INCLUDE STRUCTURE kbedp.

DATA: END OF b.

DATA: BEGIN OF a.

INCLUDE STRUCTURE afvgd.

DATA: END OF a.

DATA flg_act_read.

CLEAR counter_abs.

LOOP AT itab_tdr WHERE object = obj-pos

OR object = obj-sop

AND aufnr = itab_ord-aufnr.

  • Save ITAB of operation

itab_vrg = itab_tdr.

  • Get sequence (only if changed)

IF itab_vrg-aplfl NE affld-plnfl OR itab_vrg-aufnr NE affld-aufnr.

READ TABLE affld_tab INDEX itab_tdr-index_plfl.

affld = affld_tab.

PERFORM pppr_get_tables USING drpart-seq.

ENDIF.

  • initialize operation

PERFORM pppr_std_init_operation

USING x_field space const-flg_yes space.

CHECK NOT x_field IS INITIAL.

  • output only for work center printer

CHECK use_wcp IS INITIAL "no use of wcp

OR destination = afvgd-pdest "wcp requested

OR ( afvgd-pdest IS INITIAL "if wcp not given ...

AND NOT use_default IS INITIAL ). "... use default printer

CLEAR flg_act_read.

READ TABLE kbedp_tab

WITH KEY bedid = afvgd-bedid

bedzl = afvgd-bedzl

BINARY SEARCH TRANSPORTING NO FIELDS.

IF sy-subrc = 0.

LOOP AT kbedp_tab FROM sy-tabix.

IF kbedp_tab-bedid <> afvgd-bedid

OR kbedp_tab-bedzl <> afvgd-bedzl.

EXIT.

ENDIF.

kbedp = kbedp_tab.

MOVE-CORRESPONDING kbedp TO a.

  • calculation of the activities using the operation-formalism

PERFORM get_activity(saplcodr)

USING a

rcr01

ttl_activ

afvgd-mgvrg

caufvd.

ADD 1 TO counter_abs.

  • check wether number of tickets on page greater than possible

IF NOT print_co-azabs IS INITIAL.

IF counter_abs > print_co-azabs.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command = 'NEW-PAGE'.

CLEAR counter_abs.

ADD 1 TO counter_abs.

ENDIF.

ENDIF.

  • preserve form of skip

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command = 'PROTECT'.

  • print infos of header

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'HDR_STD'

window = 'MAIN'.

  • print infos of operation

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'OPR_SPLT_HDR'

window = 'MAIN'.

  • print operation info (optional with barcode)

IF print_co-barco IS INITIAL.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'OPR_SPLT'

window = 'MAIN'.

ELSE.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'OPR_SPLT_BC'

window = 'MAIN'.

ENDIF.

  • print operation text

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'OPR_TEXT_SHORT'

window = 'MAIN'.

  • print activities

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'OPR_ACT_TYP'

window = 'MAIN'.

  • print infos depending on the type of split

IF kbedp-ename IS INITIAL.

  • print infos of machine-split

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'OPR_TYP_MACH'

window = 'MAIN'.

ELSE.

  • print infos of pers-split

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'OPR_TYP_PERS'

window = 'MAIN'.

ENDIF.

  • print mask for manual entries

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'OPR_MASK'

window = 'MAIN'.

  • end preservation of slip

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command = 'ENDPROTECT'.

ENDLOOP.

  • no kbeds found

ELSE.

  • calculation of the activities using the operation-formalism

PERFORM get_activity(saplcodr)

USING afvgd

rcr01

ttl_activ

afvgd-mgvrg

caufvd.

IF afvgd-spanz = 0.

afvgd-spanz = 1.

ENDIF.

DATA: counter TYPE i.

DO afvgd-spanz TIMES.

kbedp-split = sy-index.

ADD 1 TO counter_abs.

counter = counter + 1.

  • check wether number of tickets on page greater than possible

IF NOT print_co-azabs IS INITIAL.

IF counter_abs > print_co-azabs.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command = 'NEW-PAGE'.

CLEAR counter_abs.

ADD 1 TO counter_abs.

ENDIF.

ENDIF.

  • preserve form of skip

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command = 'PROTECT'.

  • print infos of header

*--- If condition entered by Jeetu -


**

IF counter EQ 1.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'HDR_STD'

window = 'MAIN'.

ENDIF.

  • print infos of operation

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'OPR_DATA_HDR'

window = 'MAIN'.

  • print operation info (optional with barcode)

IF print_co-barco IS INITIAL.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'OPR_DATA'

window = 'MAIN'.

ELSE.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'OPR_DATA_BC'

window = 'MAIN'.

ENDIF.

  • print operation text

**---- Lines entered by Jeetu -


**

CONCATENATE afvgd-mandt afvgd-aufpl afvgd-aplzl INTO stxh-tdname.

CONDENSE stxh-tdname.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'OPR_TEXT'

window = 'MAIN'.

**--- Commented By Jeetu -


**

    • print activities

  • CALL FUNCTION 'WRITE_FORM'

  • EXPORTING

  • element = 'OPR_ACT_TYP'

  • window = 'MAIN'.

    • print mask for manual entries

  • CALL FUNCTION 'WRITE_FORM'

  • EXPORTING

  • element = 'OPR_MASK'

  • window = 'MAIN'.

  • end preservation of slip

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command = 'ENDPROTECT'.

ENDDO.

ENDIF.

ENDLOOP.

ENDFORM. "SPLIT_TICKET

  • INCLUDE for ATAB-Table-Read

INCLUDE codrgett. "PPPR-Form-Routinen: pppr_get_tables

INCLUDE codrif01. "PPPR-Form-Routinen: Druck-Parts lesen

INCLUDE codrif02. "PPPR-Form-Routinen: Open/Close Form

INCLUDE codrif04. "PPPR-Form-Routinen: read_mat

INCLUDE codrif17. "PSFC-Form-Routinen: std_init_operation

INCLUDE codrif20. "PSFC-Form-Routinen: pppr_collect_destinations

2 REPLIES 2
Read only

Former Member
0 Likes
1,761

hi,

do this way ..

Select PROJN from AFPO into corresponding fields of table t_job where AUFNR = caufvd_tab-AUFNR .

Read only

Former Member
0 Likes
1,761

Hi,

you need to write

Select single PROJN from AFPO into t_job where AUFNR = caufvd_tab-AUFNR

or

select PROJN from AFPO into t_job where AUFNR = caufvd_tab-AUFNR

endselect.

Edited by: ameen shaik on May 7, 2008 5:32 PM