2011 Aug 12 6:01 AM
Hi experts,
I am working on the picking list form.
We have a requirement to include packing instructions also for some plants, while calculating 'no of cartons'.
I included the code in the smart form itself, in program lines.
Is there any problem in including a 'form ... end form' in the smart form program lines?
I am sure ... the 'if .. endif'..nesting is correct, but i am still getting this error.
Incorrect nesting: Before the statement "FORM", the structure introduced by "FUNCTION" must be concluded with "ENDFUNCTION".
I am not calling any function from here. I am not able to understand this error. Please help.
Thanks,
Ammu
2011 Aug 12 6:47 AM
Hi Ammu,
Check all this 1) Paste your code 2) Did you called any Fm here .Check and post .
Regards,
Madhu.
2011 Aug 12 7:02 AM
Hi Madhu,
No i had not called any FM.
Please find the code below.
if wf_werks NEQ '5600'.
SELECT SINGLE knumh FROM kotp210 into wf_knumh
WHERE kappl = wl_app AND
kschl = wl_stoc AND
werks = wf_werks AND
lgort = wf_lgort AND
matnr = wf_matnr AND
datbi >= sy-datlo AND
datab <= sy-datlo.
IF sy-subrc EQ 0.
PERFORM get_target_qty USING wf_matnr wf_knumh CHANGING wf_trgqty wf_box_trgqty.
ELSE.
SELECT SINGLE knumh FROM kotp200 INTO wf_knumh
WHERE kappl = wl_app AND
kschl = wl_stoc AND
werks = wf_werks AND
matnr = wf_matnr AND
datbi >= sy-datlo AND
datab <= sy-datlo.
IF sy-subrc EQ 0.
PERFORM get_target_qty USING wf_matnr wf_knumh CHANGING wf_trgqty wf_box_trgqty.
ELSE.
SELECT SINGLE knumh FROM kotp001 INTO wf_knumh
WHERE kappl = wl_app AND
kschl = wl_stoc AND
matnr = wf_matnr AND
datbi >= sy-datlo AND
datab <= sy-datlo.
IF sy-subrc EQ 0.
PERFORM get_target_qty USING wf_matnr wf_knumh CHANGING wf_trgqty wf_box_trgqty.
ENDIF.
ENDIF.
ENDIF.
*
*** Calulating cartons.
if wf_box_trgqty GT 0.
lf_cartons = wf_trgqty / wf_box_trgqty." (Picked qty / Case pack qty)
wa_knmt-cartons = lf_cartons.
modify table t_knmt from wa_knmt.
clear wa_knmt.
endif.
endif.
FORM get_target_qty USING wf_matnr wf_knumh CHANGING wf_trgqty wf_box_trgqty.
SELECT SINGLE knumh packnr packnr1 packnr2 packnr3 packnr4
FROM kondp
INTO wa_kondp
WHERE knumh = wf_knumh.
IF sy-subrc EQ 0.
SELECT packnr matnr trgqty baseunit
FROM packpo
APPENDING TABLE t_packpo
WHERE packnr = wa_kondp-packnr.
IF sy-subrc EQ 0.
READ TABLE t_packpo INTO wa_packpo WITH KEY matnr = wf_matnr.
IF sy-subrc = 0.
wf_trgqty = wa_packpo-trgqty.
ENDIF.
LOOP AT t_packpo INTO wa_packpo WHERE baseunit EQ 'BOX'.
wf_box_trgqty = wa_packpo-trgqty.
ENDLOOP.
ENDIF.
IF NOT wa_kondp-packnr1 IS INITIAL.
SELECT packnr matnr trgqty baseunit
FROM packpo
APPENDING TABLE t_packpo
WHERE packnr = wa_kondp-packnr1.
ENDIF.
IF NOT wa_kondp-packnr1 IS INITIAL.
SELECT packnr matnr trgqty baseunit
FROM packpo
APPENDING TABLE t_packpo
WHERE packnr = wa_kondp-packnr2.
ENDIF.
IF NOT wa_kondp-packnr1 IS INITIAL.
SELECT SINGLE packnr matnr trgqty baseunit
FROM packpo
APPENDING TABLE t_packpo
WHERE packnr = wa_kondp-packnr3.
ENDIF.
IF NOT wa_kondp-packnr1 IS INITIAL.
SELECT SINGLE packnr matnr trgqty baseunit
FROM packpo
APPENDING TABLE t_packpo
WHERE packnr = wa_kondp-packnr4.
ENDIF.
endif.
*
*
endform.
2011 Aug 12 7:11 AM
Hi Ammu,
Did you checked the error you are getting in which node.Here there is no open function statement.Can you check by commenting all these lines.
Regards,
Madhu.
2011 Aug 12 9:46 AM
Hi AmmuNair,
In the first line of code you have pasted:
if wf_werks NEQ '5600'.replace with :
if wf_werks NE '5600'.And Before First line of the code
if wf_werks NEQ '5600'.if there is any CALL FUCNTION just comment that.
If stiil any problem:
Copy paste the FORM get_target_qty.. ENDFORM in the Global Definitions > Form Routines and comment the FORM get_target_qty.. ENDFORM in the program lines .
Hope this helps,
BR
Dep
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |