搜档网
当前位置:搜档网 › ABAP:SMARTFORMS

ABAP:SMARTFORMS

ABAP:SMARTFORMS
ABAP:SMARTFORMS

ABAP:SMARTFORMS 之一:数据从程序中传送到Form中

SMARTFORMS和SAPSCRIPT FORM都是SAP中设计打印报表的工具,但是SAPScript需要手工一条一条的根据坐标和长、高画表格线,这样极为不方便,而SmartForms有一个GUI 来直接画界面,因此,总的来说,使用SmartForms来设计报表打印要简单很多。而且SAPSrcipt 在不同的Client中需要传输,测试起来也不方便。传输SAPScript的事务代码为:SCC1,对应程序名为RSTXSCRP。

事务代码:SMARTFORMS

在SAP的ABAP编程中,一般开发过程都是在Report程序中取出所有需要的数据,将数据进行相应的处理以后保存到输出内表中,再打印内表中的数据,但是SmartForms是一个独立的外部Function Module,对于程序内部定义的内表数据不能直接传递,需要定义外部的数据结构Structure或者使用标准的表结构,如果程序变更,需要传递的数据发生变化,那么该Sturcture也需要修改,这是SmartForms中不方便的地方。

当然我们也可以在SmartForms内部写取数据的逻辑,但是在SmartForms中编程总不是很方便,而且有时我们的数据需要首先以List或者ALV List的方式显示,然后再打印,所以在smartforms中书写取数据逻辑只能对一些要求非常简单的场合适用。

我们决定还是在Report程序中进行取数逻辑,然后想办法将数据传递到SMARTFORMS中。我们知道在SAP中可以将一个对象Export到内存或者数据库中,我们就可以根据一个类似于句柄的字符串再次取出该数据,传送一个字符串到SmartForms中是没有任何问题的,所以我们只需要Export内表到内存或者数据库中,将句柄传递到SmartForms中,在SmartForms 中首先定义完全相同类型的内表,再将数据Impor到内表中即可完全恢复数据,这样就完成的数据的传递工作。

以下是Import和Export的Include程序:

*&---------------------------------------------------------------------*

*& 包括 ZINC_SF_HELPER *

*&---------------------------------------------------------------------*

TYPES buffer_id(80) TYPE c.

DATA wa_indx TYPE indx.

DEFINE savebuffer.

perform save_to_buffer using &1 &2.

END-OF-DEFINITION.

DEFINE clearbuffer.

perform clear_buffer using &1.

END-OF-DEFINITION.

*&--------------------------------------------------------------------*

*& Form Get_Unique_Id

*&--------------------------------------------------------------------*

* text

*---------------------------------------------------------------------*

* -->ID text

*---------------------------------------------------------------------*

*FORM get_unique_id USING typeid TYPE c CHANGING id TYPE c. * DATA: m_buff(32) TYPE c.

* CALL FUNCTION'TH_GET_SESSION_ID'

* IMPORTING

* session_id = m_buff

** ID_LEN =

* .

* CONCATENATE sy-repid '_' m_buff typeid INTO id.

*ENDFORM. "Get_Unique_Id

*&--------------------------------------------------------------------* *& Form Save_To_Buffer

*&--------------------------------------------------------------------* * text

*---------------------------------------------------------------------* * -->T text

* -->BUFF_ID text

*---------------------------------------------------------------------* FORM save_to_buffer USING t TYPE table typeid TYPE c .

wa_indx-aedat = sy-datum.

wa_indx-usera = sy-uname.

wa_indx-pgmid = sy-repid.

* PERFORM get_unique_id USING buff_id CHANGING buff_id.

EXPORT t TO DATABASE indx(hk) ID typeid from wa_indx. ENDFORM. "Save_To_Buffer

*&--------------------------------------------------------------------* *& Form Clear_Buffer

*&--------------------------------------------------------------------* * text

*---------------------------------------------------------------------* * -->BUFF_ID text

*---------------------------------------------------------------------* FORM clear_buffer USING buffid TYPE c.

DELETE FROM DATABASE indx(hk) ID buffid.

ENDFORM. "Clear_Buffer

form Restor_buffer using typeid type c changing t type table. import t from database indx(hk) id typeid.

endform.

下面是调用示例:

form frm_print_data .

DATA: headername(18) TYPE c.

DATA: itemsname(18) TYPE c.

" 在句柄中加上服务器当前时间作为句柄名称,防止多人同时使用该程序,导致句柄名称相同 CONCATENATE 'ZSPMMF1002HD' SY-UZEIT INTO headername .

CONCATENATE 'ZSPMMF1002IT' SY-UZEIT INTO itemsname.

savebuffer ig_output_h[] headername. "ig_output_h是保存输出表单表头数据的内表 savebuffer ig_output_d[] itemsname. "ig_output_d是保存输出数据明细的内表,与表头数据有关联字段

DATA: wl_fmname TYPE rs38l_fnam.

* 通过SmartForms的名称取得编译以后的对应的Function Module的名称CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZSPMMF1007X' "SmartForms的名称

* VARIANT = ' '

* DIRECT_CALL = ' '

IMPORTING

fm_name = wl_fmname

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3

.

IF sy-subrc<> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CALL FUNCTION wl_fmname

EXPORTING

* ARCHIVE_INDEX =

* ARCHIVE_INDEX_TAB =

* ARCHIVE_PARAMETERS =

* CONTROL_PARAMETERS =

* MAIL_APPL_OBJ =

* MAIL_RECIPIENT =

* MAIL_SENDER =

* OUTPUT_OPTIONS =

* USER_SETTINGS = 'X'

ptr_header = headername

ptr_items = itemsname

* IMPORTING

* DOCUMENT_OUTPUT_INFO =

* JOB_OUTPUT_INFO =

* JOB_OUTPUT_OPTIONS =

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5

.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

clearbuffer headername. "调用完毕以后,删除数据

clearbuffer itemsname.

endform. " frm_print_data

将数据Export到内存可以取得较好的效率,但是一般SAP的应用服务器都会使用群集,因此我们Export数据到数据库中会保险一些。

在系列文章之二,说明SmartForms的设计。

ABAP:SmartForms 之二--设计

报表要求:(见下表)

要求:

1、不是套打,表格线也需要输出

2、每张报表打印8行记录,不足的空白行也需要输出

3、按凭证号打印单据,可以连续打印多张报表。

一、创建样式:

在创建Form之前,需要创建多种段落和字体样式,供Form中的文字使用。需要设置多种“段落格式”,并且必须在“表头数据”中设定“标准段落”

1.创建段落格式,一般有RH(Report Header),PD(Page Header), PB(Page Bottom),LD(Line Header and Details),字体:CNSONG,9pt。注意最好在各段落的“首行缩”中设定1mm的缩进,否则,在Form中表格线和文字之间会没有任何间隙。

2.设置“表头数据”中“标准段落”

3、保存并激活样式文件。

二、创建SmartForm

1、在“全局设置”-〉“表格属性”-〉“输出选项”中

设定“页格式”:即纸张的大小

“样式”:设定本Form使用的默认样式文件,这里指定为第一步创建的样式文件。

2、在“全局设置”-〉“表格接口”-〉“导入”

设置两个参数:

ptr_header type c

ptr_items type c

这两个参数用来传入我们在Report中Export内表数据的句柄(ID key)。

3、在“全局设置”-〉“全局定义”中进行多项设定

a、“类型”设定,在这里需要定义4个类型,一个用来保存表头数据的工作区和内表,一个用来保存明细数据的工作区和内表,它们的结构必须与Report中Export到数据库中的内表的结构完全对应一致,否则,我们将不能从传入的句柄(ID key)中恢复内表数据。

* 领料单抬头信息

TYPES:

BEGIN OF TYP_header_ROW ,

mblnr LIKE mseg-mblnr, " 凭证号

bldat LIKE rkpf-rsdat, " 凭证日期

c_so(16) TYPE c, " 销售订单号

c_issdt LIKE sy-datum, " 发货日期

werks LIKE mseg-werks, " 地点

PLNAT_NAME LIKE t001w-name1, " 出货单位名称

kokrs LIKE mseg-kokrs, " 控制范围

kostl LIKE mseg-kostl, " 成本中心

cc_name LIKE cskt-ktext, " 成本中心名称名称

c_depart(45) TYPE c, " 领料部门

bwart LIKE mseg-bwart, " 移动类型代码

btext_mt LIKE t156t-btext, " 移动类型描述

c_btext_mt(60) TYPE c, " 移动类型次数

C_TOTAL(17) TYPE C, "合计输出时由用户手工填写

END OF TYP_header_ROW .

TYPES: TYP_HEADER_TABLE TYPE TYP_HEADER_ROW OCCURS 0.

* 领料单明细信息

TYPES:

BEGIN OF TYP_ITEMS_ROW ,

mblnr LIKE mseg-mblnr, " 物料凭证编号 : 物料凭证

rsnum LIKE rkpf-rsnum, " 凭证号 : 预留单

mjahr LIKE mseg-mjahr, " 物料凭证年度

zeile LIKE mseg-zeile, " 序号

bwart LIKE mseg-bwart, " 移动类型代码

werks LIKE mseg-werks, " 地点

kokrs LIKE mseg-kokrs, " 控制范围

kostl LIKE mseg-kostl, " 成本中心

matnr LIKE mseg-matnr, " 物料号码

maktx LIKE makt-maktx, " 物料描述

erfme LIKE mseg-erfme, " 计量单位

c_planc LIKE resb-bdmng, " 计划数量(手工填写)

c_outc LIKE mseg-erfmg, " 实发数量

c_count(6) TYPE c, " 件数(手工填写)

lgort LIKE mseg-lgort, " 仓储地点

charg LIKE mseg-charg, " 备注

END OF TYP_ITEMS_ROW.

TYPES: TYP_ITEMS_TABLE TYPE TYP_ITEMS_ROW OCCURS 0.

b、在“全局数据”中,定义全局的变量,我们需要定义如下几个变量

wa_header type typ_header_row "表头数据工作区,由于SmartForms中的内表不能有HeaderLine,因此必须定义一个与内表结构一样的工作区

ig_header type typ_header_table "表头数据内表

wa_items type typ_items_row "表单明细工作区

ig_items type typ_items_table "表单明细内表

wa_blanks type typ_items_row "空白行工作区

ig_blanks type typ_items_table "空白行内表

g_count type i "记录一张报表的明细的记录数量

G_CURRLINE type i "记录所有报表共计打印了多少行,用于判断最后一页

G_TOTALLINES type i "记录内表ig_items总行数,用于判断最后一页

G_CURRPAGE type i "一个凭证的当前页码

G_TOTALPAGE type i "一个凭证的总页码

c、在“初始化”中,将数据句柄中的内表恢复到刚设定的全局变量中

输入参数:ptr_header,ptr_items,ig_header,ig_items,g_totallines

perform Restor_buffer using ptr_header changing ig_header.

perform Restor_buffer using ptr_items changing ig_items.

DESCRIBE TABLE IG_ITEMS LINES G_TOTALLINES.

d、在Freecode"格式化程序"中,定义Form Restor_buffer函数

form Restor_buffer using typeid type c changing t type table.

import t from database indx(hk) id typeid.

endform.

至此,我们已经得到了表头和明细这2个内表的数据,下面准备画报表并输出数据。

4、在“页和窗口”中,在“%Page1”页下,添加3个窗口

"MAIN主窗口": 在SmartForm中,只有窗口类型为“主窗口”的窗口,才能被循环。例如,在最前面的样表中,明细数据有20条,不能在一页中打印输出完毕,需要输出4页才能打印完一张单据的数据,在这4张单据中,表头和表尾是不变的,但是表中间部分数据却是变化的,中间这个窗口需要被循环输出4次。因此需要将这个窗口类型设定为“主窗口”。在本例中为现实明细数据的这部分。

“窗口1”:从表最上面到明细栏的标题栏(包括标题栏)

“窗口2”:最底下2行。

注意:窗口的宽度加上遍距不能大于纸张宽度。

创建好这三个窗口,设定好窗口的宽度,高度,以及位置信息。下图是整个SmartForm的结构

注意,我将输出表头的窗口“%windows1 页头”放在了输出明细数据的窗口“主窗口”的下面,

这是必须的,因为表头中的数据需要从表头内表ig_header中来。loop1是循环内表ig_header,将数据放到表头工作区wa_header中。因此,%windows1 页头窗口就可以直接使用工作区wa_header中的数据。如果该窗口放在了主窗口的前面,那么至少第一页中表头会没有数据,而且后面每一页的表头显示的都是下一个表头的内容。

注:虽然打印机输出时,现打印%WINDOWS1 页头,再打印MAIN主窗口,最后打

印%WINDOW2页尾窗口,但是程序执行时,却是按照上图中树结构从上到下进行处理的,是先处理MAIN主窗口,其次%WINDOWS1 页头,最后%WINDOW2页尾窗口的逻辑顺序,可以从跟踪SMARTFORMS程序得知。

下面详细介绍整个逻辑流程和代码:

1、%LOOP1表头循环

设置:数据-〉loop循环-〉操作数:ig_header into wa_header

作用:循环表头内表中的数据,每次打印一个凭证的行项目数据。由于内表在这里不能有工作区,因此将每个表头数据放置到另外的工作区。

2、%LOOP4计算单个凭证总页码

设置:数据-〉loop循环-〉操作数:IG_ITEMS INTO WA_ITEMS

WHERE条件:IBLNR = WA_HEADER-IBLNR

作用:由于在打印每张凭证及行项目之前,需要知道该凭证的总页数,因此需要首先计算

IG_ITEMS内表中有多少条当前凭证的行记录数。

3、%CODE4累计单个凭证的行项目数

输入参数:G_COUNT

代码:

G_COUNT = G_COUNT + 1.

作用:累计当前凭证的行项目数。

4、%CODE1计算当前凭证总页码

输入参数:G_TOTALPAGE,G_COUNT

代码:

G_TOTALPAGE = 0.

*计算单个凭证的总页码

G_TOTALPAGE = G_COUNT MOD 8.

IF G_TOTALPAGE = 0.

G_TOTALPAGE = G_COUNT DIV 8.

ELSE.

G_TOTALPAGE = G_COUNT DIV 8 + 1.

ENDIF.

G_COUNT = 0.

作用:根据第三步累计的单个凭证的总行项目数,以及每页打印的行记录数(8),计算该凭证需要打印的总页数。计算完毕以后,G_COUNT重新置0。

6、%LOOP2循环输出明细

设置:数据-〉loop循环-〉操作数:IG_ITEMS INTO WA_ITEMS

WHERE条件:IBLNR = WA_HEADER-IBLNR

作用:这里的循环条件与第2步的条件完全一致,准备循环打印当前凭证的所有行项目。

7、%CODE2记录行数加1

输入参数:G_COUNT,G_CURRLINE

代码:

* 每打印一行行记录,记录数量加1

G_COUNT = G_COUNT + 1.

G_CURRLINE = G_CURRLINE + 1.

作用:每循环一次,当前凭证打印的行记录数加1,所有凭证打印的总行记录数加1。

8、%TEMPLATE4数据明细

作用:模板,行记录的表格,以及相关文本内容。LOOP2每循环一次,就打印输出一行该模板以及文本内容。行高一般为5mm(根据实际调整),注意模板的宽度不能超过窗口的宽度。在“细节”中可以调整模板的每个单元格的宽度,以及每行的高度。

9、%TEXT22 - %TEXT30文本内容

%TEXT22 序号:&G_COUNT(CZT4R)& 输出选项-〉输出结构:第1行第1列

%TEXT23物料号码:&WA_ITEMS-MATNR& 输出选项-〉输出结构:第1行第2列

依此类推。

10、%CODE5计算当前页码

输入参数:G_COUNT,G_CURRPAGE

代码:

DATA: L_LINE TYPE I.

L_LINE = G_COUNT MOD 8.

IF L_LINE = 0.

G_CURRPAGE = G_COUNT / 8.

ELSE.

G_CURRPAGE = G_COUNT DIV 8 + 1.

ENDIF.

作用:每输出一行,计算当前行所在的页码,即为当前页

11、%CODE3计算空行

输入参数:G_COUNT,IG_BLANKS,WA_BLANKS

代码:

G_COUNT = G_COUNT MOD 8.

* 需要的空记录行数

IF G_COUNT <> 0.

G_COUNT = 8 - G_COUNT.

ENDIF.

CLEAR IG_BLANKS[].

DO G_COUNT TIMES.

APPEND wa_blanks to ig_blanks.

ENDDO.

G_COUNT = 0.

作用:在当前凭证的所有有效数据行打印完毕以后,还需要计算需要打印多少空行,才能刚好打印满一张纸。用计算的数量,填充内表IG_BLANKS,计算完毕以后,G_COUNT必须清0。

12、%LOOP3 补充打印空行

设置:数据-〉loop循环-〉操作数:IG_BLANKSS INTO WA_BLANKS

WHERE条件:无

作用:循环内表IG_BLANKS,次数为内表中的记录数,即空行数,打印输出空行。

13、%TEMPLATE5空数据明细

作用:该模板与第8步的TEMPLATE4完全一样,只是该模板下不需要有文本TEXT,只序号输出模板的表格线即可。

到此步骤,已经打印完毕了当前凭证的所有有效数据行和补充的空行,如果当前凭证需要打印多页,例如有30条行记录,需要打印3个满页,第4页数出6行数据,补充2个空行,这3次分页是系统自动分页的,分也之前,自动处理页头和页尾窗口,输出这两个窗口的内容。自动分页的条件是“MAIN主窗口”的高度被打印满了,因此一定要注意,主窗口的高度必须等于你需要的高度,不要多,也不要少,在本例中,高度为8行x 5mm = 40mm

14、%CONDITION1分页

设置:一般属性-〉节点条件:G_CURRLINE <> G_TOTALLINES

作用:在一个凭证打印完毕以后,将要进入打印下一个凭证之前,需要分页,但是在打印完最后一个凭证的最后一页以后,却不能有分页,否则最后会多一个空行。

15、%COMMAND1强制分页

设置:一般属性-〉转到新页:%PAGE1

作用:在G_CURRLINE <> G_TOTALLINES 条件成立(不是最后一行)的情况下,强制分页。

你也许会说,这里不强制分页,系统也会自动分页,因为前面输出的高度正好都满足的各窗口的高度,会自动进行分页,确实如此,系统会自动进行分页,但是在这里强调:强制分页是必须的,不能使用自动分页,原因是:自动分页发生的时间不是我们预想的,我们需要在第13步执行完毕以后,马上进行分页,这时,WA_HEADER中的内容还是当前凭证的数据,这样,在处理页头和页尾窗口时,数据是正确的。而自动分页却不在此时发生,而是在第1步LOOP1循环再次执行以后,也就是WA_HEADER之中的内容变成下一条以后才发生,这样我们就不能输出正确的表头和表尾数据,因此必须使用强制的分页命令。

16、表头和表尾窗口

由于这两个窗口非常简单,仅输出文字描述和WA_HEADER中的内容,因此不详细说明。

Q&A

1.打印预览表格线都正常,但是用针式打印机输出出现部分表格线无法输出。

答:这个可能是由于针式打印机的分辨率较小的缘故,使用激光或者喷墨打印机可以正常输出,或者在SmartForms中加粗表格线,使用30TW。

2.在使用穿孔纸连续打印时,后面的纸张出现错位现象。

答:原因不是很清楚,需要设置打印机中的纸张格式,将纸张高度根据错位的距离进行加或者减,多次调整以后可以达到没有错位。

主谓一致用法总结

主谓一致 使用主谓一致时,必须遵循三个原则,即语法一致原则、意义一致原则和就近一致原则。 一、当单数可数名词、不可数名词、复合不定代词、单个不定式(疑问词+不定式)、动名词或主语从句以及表示“时间、价值、重量、距离、书名、影片名称”等名词作主语时,谓语动词通常用单数形式。例如: The curtains are closed and the living room is dark when Mom and Dad enter. Visiting a place like this is always very interesting. Why pleasant smells do not reduce pain in men is a question still to be answered by scientists. 二、all(some, a lot, plenty, any, part, the rest, most等)+of+名词作主语以及分数、百分数构成短语作主语时,谓语动词单复数形式取决于of后的名词或代词。表示复数概念用复数;表示单数概念用单数。例如: As a result of the serious flood, two-thirds of the buildings in the area need repairing. One study says that 90% of our time is spent watching television

or using computers. While the rest of the passengers were getting out, she glanced at the faces around her. 三、在“名词/代词+介宾结构+谓语+…”结构中,谓语动词与名词/代词保持一致,介宾结构看作插入成分。该结构中的常见介词及介词短语有with, together with, along with, as well as, like, but, except, besides, including等。例如: Healthy eating along with regular exercise is probably the only way to become fit. Nobody but Tom and his father has ever been there. 四、a number of / a group of / a variety of / a total of 等构成短语作主语时,谓语动词用复数形式;而the number of / the group of / the variety of / the total of 等构成短语作主语时,谓语动词用单数形式。例如: The low number of attacks that happen every year proves that sharks do not feed on humans if they have the choice. Nowadays, a large number of women, especially those from the countryside, work in the clothing industry. 五、quality / pair / amount等构成短语作主语时,谓语动词根据

主谓一致的用法及专项练习题

主谓一致的用法及专项练习题 一、主谓一致三原则 主谓一致是指谓语动词与主语在人称和数上保持一致,主谓一致必须遵循三原则:语法一致原则,意义一致原则,就近一致原则。1.语法一致原则:指主语是单数形式,谓语动词用单数形式, 主语是复数形式,谓语也用复数形式。 Tom is a good student. 汤姆是个好学生。 They often play football on the playgroun。 他们经常在操场上踢足球。 2.意义一致:指主语形式上为单数,但意义为复数,因此谓语动词 用复数形 或主语形式上为复数,但表示单数意义,这是谓语动词用单数形式。 My family are having lunch now. 我们一家人现在正吃午饭。 Twenty dollars is too expensive for the book. 这本书20美元太贵了。 3.就近一致:指谓语动词用单数形式还是用复数形式,取决于最靠 近他的主语。例如: Not only the teacher but also his students like playing football. 不仅老师喜欢踢足球,而且他的学生也喜欢踢足球。 There is a pen and some books on the desk. 课桌上有一支钢笔和一些书。 二、主谓一致常考题型 1. 单数名词(代词),不可数名词作主语时,谓语用单数形式,复数 名词(代词) 作主语,谓语用复数形式。 The desk is Tom’s. 这张桌子是汤姆的。

Some water is in the bottle. 一些水在瓶子里。 The students are playing football on the playground. 这些学生正在操场上踢足球。 2. many a+单数名词作主语,意义为“许多”,谓语要用单数。 Many a student has been to Shanghai. 许多学生到过上海。 3. more than one+单数名词作主语,谓语用单数。 More than one student has ever been to Beijing. 不止一个学生曾经去过北京。 4. 表示时间,价格,重量,数目,长度,数学运算等的词或短语作 主语时,这些通常作一个整体概念,谓语用单数形式。例如: Two months is a long holiday. 两个月是一个长假。 Twenty pounds isn’t so heavy. 2 0英镑并不太重。 Ten miles isn’t a long distance. 1 0英里并不是一段很长的距离。 Five minus four is one. 5减4等于1。 5. 主语是each/every+单数名词+and(each/every)+单数名词时, 谓语动词用单数。 Each boy and each girl has got a seat. 每个男孩和女孩都有一个座位。 Every man and every woman is at work. 每个男人和女人都在工作。 6. one and a half+复数名词作主语,谓语动词用单数形式。 One and a half hours is enough. 一个半小时足够了。 7. 动词不定式/动名词作主语时,谓语动词用单数形式。 To see is to believe 眼见为实。 Doing eye exercises is good for your eyes. 做眼睛保健操对你的眼睛十分有益。 8. a/an+单数名词+or two 作主语,谓语动词用单数。 A student or two has failed the exam.

主谓一致知识点总结(word)

主谓一致知识点总结(word) 一、主谓一致 1.—Mum,____ofthe apples____gone bad. —We'd better eat up the rest as soon as possible. A.one third; have B.one thirds; have C.one third; has D.first three; has 【答案】A 【解析】 试题分析:句意:-妈妈,三分之一的苹果已经坏了。-我们最好尽快吃了。在英语中的分数,分子用基数词,分母用序数词,当分子大于一时,分母要用复数形式。所以选A。 考点:考查分数及主谓一致。 2.Not only his friends but also he ________ always interested in science fiction. A.show B.shows C.are D.is 【答案】D 【解析】 【详解】 句意:不仅他的朋友,而且他总是对科幻小说感兴趣。考查主谓一致。not only…but also连接两个主语的时候,谓语动词的数由离其最近的主语来决定,即就近原则,所以此处要根据he来确定谓语动词的形式;因为后面是interested in,所以用be interested in“对…感兴趣”,所以谓语动词用is;故答案选D。 3. students in our class going to the summer camp in Beijing next week. A.Two fifths; is B.Second fifths; are C.Second fifths; is D.Two fifths; are 【答案】D 【解析】 【详解】 句意:我们班五分之二的学生打算下周去北京参加夏令营。 表达分数时,分子用基数词,分母用序数词,因此五分之二的表达应该是two fifths,排除B,C;分数后面的名词为复数名词students,根据主谓一致的原则,只能用are,故答案选D。 【点睛】

(完整版)主谓一致用法总结

主谓一致用法总结 I.主谓一致定义 II.谓语受主语支配,和主语在人称和数上保持一致,这叫做主谓一致。 III.例: My favorite food is noodles. II. 主谓一致的重要原则 ?语法原则 ?意义原则 ?就近一致 (一)语法一致 IV.顾名思义,即谓语在语法角度上与主语保持一致,不考虑主语的意义。 V.以单数名词或代词,动词不定式短语作主语时,谓语动词要用单数;主语为复数时,谓语用复数。例如: 注意:不定式及动名词作主语时,谓语 动词单数。E.g. 2) 由and或both……and连接的并列成分作主语时,谓语动词用复数。例如: Both you and he are right. Mr. and Mrs. Brown have a son called Tom. 但并列主语如果指的是同一人,同一事物或同一概念,谓语动词用单数。例如:The poet and writer has written lots of books. The poet and the writer have come. 可通过名词前定冠词来判断。 3) 由and连接的并列单数主语之前如果分别由each, every修饰时,其谓语动词要用单数形式。例如: Now every man and every woman has the right to receive education. 4) 主语后面跟有 but ,except, besides, with ,together with 等介词短语时,谓语动词仍用与主语(即前面的词语)保持一致。例如: The teacher with his students is going to have a picnic in the park. The students with the teacher are going to have a picnic in the park. Nobody but two boys was late for class. 5) 集合名词作主语谓语动词要用复数。 如people, police, cattle, clothes等。 集合名词指可用来指称一群对象的词语,这些对象可以是人、动物、或是一群概念等事物。 常见集合名词:people, police, cattle, goods, clothes等。 e.g. The police are looking for him. ?有些集合名词如class, team, group, family 根据其表达意义不同,单复数用法也不同。

(完整版)高一英语“主谓一致”用法归纳

高一英语“主谓一致”用法归纳 一、基本概念 所谓一致关系(Agreement)就是在英语句子中各个成分之间必须在人称、数、性等方面要保持一定的语法关系。在英语中最主要的一致关系是主语与谓语动词之间的一致。在判断一个句子主语、谓语是否一致时,要遵循下列三个原则:语法一致原则、意义一致原则和就近一致原则。一般来说,主语的单复数形式决定着谓语动词需要采用的单复数形式。比较:The student studies very hard.这个学生学习非常努力。The students study very hard.这些学生学习非常努力。 主谓一致的原则说起来简单,但在实际使用中遇到的情况要复杂很多。在处理主谓一致的问题时,可依据上面提到的三个原则。“语法一致”也就是平常说的从语法形式上取得一致,即主语为单数形式,谓语动词亦用单数形式。“意义一致”就是从意义着眼来处理主谓语一致问题。有时,主语形式为单数,但意义为复数,谓语动词依意义而定,也采用复数形式。“就近原则”是指谓语动词的人称和数往往和其最近的主语保持一致。 二、基本用法 1.集合名词与谓语动词的一致 集合名词作主语,如果表示整体概念,谓语动词用单数形式;如果强调其成员,则用复数形式。常用的集合名词有: army,audience,class,club,committee,company,couple,crowd,family,flock,group,government,j-ury, majority,minority,organization,party,personnel,publ-ic,staff,team,union等。 The football team are discussing the problem with the coach now. 足球队员们现在正在与教练讨论这个问题。 The police have caught the criminal.警察已经逮捕了那个罪犯。 The majority were/was for the proposal.大多数人赞同这个提议。 Only a minority of students receive the scholarship.只有少数学生获得了奖学金。 【注意】 (1)有些有生命的集合名词作主语时,谓语动词只用复数。这样的名词常用的有:cattle,people,police,folk等。 The cattle are grazing in the fields.牛在田里吃草。 (2)无生命的集合名词作主语时,谓语动词常用单数形式。这样的名词常用的有:clothing,furniture,machinery,jewellery等。 Warm clothing is necessary in cold climates.气候寒冷的地方需要暖和的衣服。 All the furniture has been moved to another room. 所有家具已经搬到了另一个房间里。 2.由either...or...,neither...nor...,not only...but(also)...连接的两个名词或代词作主语时,主谓一致遵循就近原则,即谓语动词应与最近的一个主语的人称和数保持一致。 Either he or I am wrong.不是他错就是我错。 Not only the students but(also) the teacher is active in sports and games.不但学生,就连老师都积极参加体育运动。 Does neither the teacher nor the students know this matter? 教师和学生都不知道这件事吗? 【经典回放】 Either you or one of your students ______ to attend the meeting that is due tomorrow.

主谓一致用法详细讲解40例

主谓一致详细讲解 1.由and所连接的两个名词指同一人物、同一事物、同一概念时,谓语动词要用单数形式。 例如: Both bread and butter were sold out in that grocery. Zhang Hua and Li Ming are good students. 注意:当两个主语为不可分的东西时,谓语动词用单数形式。例如: A watch and chain was found on the desk. Bread and butter is nutritious. When and where this took place is still unknown. 注意:一身兼二职的情况:The writer and runner is attending the conference. 2. 由every…and every…, each…and each…, many a…and many a …, no ...and no…等构 成复合主语时,谓语动词用单数形式。例如: Each man and each woman is invited.每个男人和女人都邀请了。 No boy and no girl is there now. 现在那里没有一个男孩和女孩。 Many a boy and many a girl has been invited.很多男孩和女孩都被邀请了。 In China every boy and every girl has the right to receive education. 在中国每个男孩和女孩都有接受教育的权利。 3. 由or, not only... but also..., not…but…, either...or, neither...nor,whether……or……连接 主语时,谓语与靠近的主语一致,即就近一致的原则。例如: He or his brothers were to blame .Either you or I am mad. Are either you or I mad? Neither you nor he is right. Not only the teacher but also his family were friendly to me. 4. 当主语后跟有with, along with, together with, besides, except, like, including, in addition to, as well as, rather than等词时,谓语动词根据前面的主语变化。例如: All but one were here just now. A library with five thousand books is offered to the nation. She as well as the other teachers is going t o Nanjing. 5. 某些词结尾字母为s, 但并不是复数形式,如: physics, maths , economics (经济学), politics, news…作主语时用单数形式。means, works(著作)单复同形。例如: Physics is very important. Every means has been tried. Every possible means has been used to prevent air pollution, but the sky is still not clear . 6. 当一些由两部分构成的表示衣物或工具的名称作主语时, 谓语用复数形式, 如: trousers , shorts, shoes, glasses, goods, clothes, chopsticks, scissors. 如果这些词由a pair, piece, kind , type ,box + of 修饰,则用单数形式.例如: My trousers are white and his clothes are black. A pair of shoes is lying here. These kinds of glasses are popular. 7.单复数同形的名词,如sheep, deer 等做主语时,应根据主语的单复数意义确定谓语动词 的形式。例如: A deer is over there. Some deer are over there . 8.population做主语时,通常看作单数,若population前有分数、百分数修饰时,则句子谓 语通常用复数。例如: The population in China is very large and 80% of the population live in rural areas . 9. 复数名词, 如: people, police, public ,crew ,cattle作主语时, 谓语动词用复数形式。例如:The police like to help people. People are talking abou t the news .. The cattle are grazing in the fields . 10. 集体名词, 如: family ,crowd ,class ,team ,audience ,committee ,club, group ,enemy ,

词的用法与主谓一致

词的用法与主谓一致 1.I considered_____ to the cinema while she suggested _____ to the concert. a. to go, to go b. going, going c. to go, going d. going, to go 2.I can’t go home now. A lot of work____ to be done. a. remains b. leaves c. is remained d. will leave 3.I have _____ a lot of money____ books. a. cost, in b. spent, on c. paid, on d. used, for 4.It’s silly of him to_____ such a proud girl. a. fall love with b. fall in love c. fall in love with d. fall in love for 5.Her singing _____ like a bell_____. a. hears, rings b. sounds, ringing c. listens, ringing d. seems, to ring 6.Look! The bus is coming. It will stop_____ passengers. a. picking up b. to pick up c. taking up d. to take up 7.The price of fish____ since last month. a. has come up b. has gone up c. has been risen up d. had got up 8.The salesmen____ the old people and made them buy their poor quality goods. a. took out b. took over c. took off d. took in 9.I don’t think they can____ us in the game. a. win b. fight c. beat d. hit 10.Mary often comes to me for-_____ writing. a. an advice of b. advice on c. advices about d. the advice in 11.The writer____ all his life. a. kept poor b. kept poorly c. remained poor d. remained poorly 12.He____ his overcoat and took out his summer clothes. a. set out b. set off c. set up d. set aside 13.I have___ American country music, but I have never_____ it. a. heard of, heard of b. heard, heard c. heard, heard of d. heard of, heard 14.The Second World War____ in September, 1939. a. was happened b. happened c. was taken place d. took place 15._____ the end, all slaves there were set_____. a. At, freely b. By, freely c. On, free d. In, free 16.Freedom is_____ the most important thing to people. a. considered as b. thought of to be c. looked on as d. regarded to be 17.What do you___ the book ? Is it interesting? a. think b. think of c. think over d. think on 18.It is wrong to_____. a. tell lie b. tell lies c. talk a lie d. say lies 19.There was no_____ to_____ in the narrow road. a. room, turn around b. rooms, turn around c. place, turn out d. places, turn out 20.Please accept my kindest____ and best____. a. wish, regard b. wish, regards c. regards, wishes d. regard, wishes 21.Sometimes it is hard to____ how an accident_____. a. talk, came out b. say, came up c. tell, came about d. speak, came along

高中英语主谓一致用法超全面

高中英语主谓一致用法超全面! 主谓一致 语法形式上的一致 主语为单数形式,谓语动词用单数形式;主语为复数形式,谓语动词也用复数形式。例如: Jane and Mary look healthy and strong. The number of mistakes was surprising. 解释:主语是 the number ,谓语是 was对于数字而言,它是单数,所以用了was; 反思:the number of通常跟 a number of 来对比,a number of 是大量的的意思;后面通常是可数名词的复数,所以谓语也跟着用复数形式,比如 a number of people are rushing to the toilet. 意义上一致 1.主语形式虽为单数,但意义为复数,谓语动词用复数。例如: The crowd were running for their lives. 单数形式表示复数意义的词有people,police,cattle,militia等。

2.主语形式为复数而意义上却是单数,谓语动词用单数。例如: The news was very exciting. 形复意单的单词有news,works(工厂)和一些以ics结尾的学科名称,如physics,politics,mathematics等。 就近原则 即谓语动词的单、复数形式取决于最靠近它的词语。如用连词or,either…or,neither...nor,not only…but also等连接的并列主语,如果一个是单数,一个是复数,谓语动词与靠近它的主语一致。例如: Either your students or Mr. Wang knows this. 应注意的几个问题 1.名词作主语 1)某些集体名词(如family,team等)作主语时,如果作为一个整体看待,谓语动词用单数形式;如果就其中一个个成员而言,谓语动词用复数形式。例如: The whole family are watching TV. His family is going to have a long journey. 这类名词有:audience,class,club,committee,company,crew,crowd,enemy,government,group,party,public,team,

高考英语主谓一致用法全汇总

高考英语主谓一致用法全汇总 一、主谓一致的概念 主谓一致是指“人称”和“数”方面的一致关系。一般情况下,主谓之间的一致关系由以下三个原则支配: 语法一致原则、意义一致原则、就近原则。 “主谓一致”考查内容涉及名词单数或复数作主语、不可数名词作主语、不定式作主语、并列结构作主语、特殊名词作主语时与谓语动词的一致等。 二、名词作主语 01 某些集体名词,如family,team等作主语时,如果作为一个整体看待,谓语动词用单数形式,如果就其中一个个成员而言,谓语动词用复数形式。 如: His family is a happy one.他的家庭是一个幸福的家庭。 The whole family are watching TV.全家人都在看电视。 这类名词有audience,class,club,company,crew,enemy,crowd,government,group,party,public,team等。名词population一词的使用情况类似。 “a group(crowd) of+复数名词”等短语之后的谓语动词也同样可用单数或复数,前者强调整体,后者强调各个部分。

02 某些集体名词,如people,police,cattle等,只当复数看待,谓语动词必须用复数。 The police are searching for the thief.警察正在搜捕那个贼。03 单、复数同形的名词作主语时,谓语动词应根据意义决定单、复数。 如: A sheep is over there.那边有只羊。 Some sheep are over there.那边有些羊。 04 名词所有格之后的名词被省略,这种情况一般只指商店、工厂、住宅等,作主语时,动词一般用单数。 如: The doctor’s is across the street.诊所在街道的对面。 My uncle’s is not far from here.我叔叔家离这儿不远。常见的省略名词有the baker’s,the barber’s,the carpenter’s,the Zhang’s等。 表示店铺的名词,一般作集体名词看待,但用作主语时,谓语动词往往用复数。 如:

主谓一致用法详解

主谓一致用法详解 一:主谓一致一般有以下三条原则: 1、语法一致,即在语法形式上取得一致,例如主语为单数形式,谓语也用单数形式,主语 用复数形式,谓语也用复数形式。 The number of mistakes was surprising. Li Ping and her twin sister naturally look a lot alike. 2、意义一致,即从意义上着眼处理一致关系。例如,主语形式虽为单数但意义为复数,谓 语动词也采取复数形式。 The crowed were fighting for their lives. 或者主语形式虽为复数但意义上视为单数,谓语动词也用单数形式。 Three years in a strange land seems like a long time. 3、就近原则,即谓语动词的单复数取决于最靠近它的主语。 There is a teacher and some students in our classroom. 4)就前原则,当主语后面跟有 as well as, as much as,no less than, along with, with, like, rather than, together with, but, except, besides,including, in addition to 等词组时,其谓语动词的单复数按主语的单复数而定。 1)The teacher , with 6 girls and 8 boys of her class, ______ visiting a museum when the earthquake struck. (NMET2004 北京卷) A. was B . were C. had been D. would be 2)Nobody but John and Helen _is_____ absent. I, rather than you,_am____ responsible for the accident. 二:用单数的情况 1)当主语为表示度量、时间、金钱、距离等复数名词,一般根据意义一致的原则,把这些 复数名词看作一个整体,谓语动词采取单数。 Ten dollars is not enough. Three months is a long time. 2)有些以-s结尾的n(如news, mathematics, physics, politics)因在意义为单数,所以谓语采用单数形式。 The news is exciting. Physics is one of the most difficult subjects for me. 3)如果主语是一个表示抽象概念的不定式,动名词或名词性从句,谓动都采用单数形式。 To say sth is one thing and to do is another. Whether he comes or not doesn’t matter. Reading English magazines and novels is helpful to our English study. 4)如果主语为单数,尽管后面跟with, together with, as well as, no less than, like, but, except等引导的短语谓动仍用单数形式。 The teacher, as well as some Ss is coming. Nobody but Tom and Marry was in the classroom just now. 5)由some, any, no, every构成的复合代词,都作单数看待,因此谓动都采取单数形 式。 Is everyone here?

主谓一致用法总结教学提纲

主谓一致用法总结

主谓一致 使用主谓一致时,必须遵循三个原则,即语法一致原则、意义一致原则和就近一致原则。 一、当单数可数名词、不可数名词、复合不定代词、单个不定式(疑问词+不定式)、动名词或主语从句以及表示“时间、价值、重量、距离、书名、影片名称”等名词作主语时,谓语动词通常用单数形式。例如: The curtains are closed and the living room is dark when Mom and Dad enter. Visiting a place like this is always very interesting. Why pleasant smells do not reduce pain in men is a question still to be answered by scientists. 二、all(some, a lot, plenty, any, part, the rest, most等)+of+名词作主语以及分数、百分数构成短语作主语时,谓语动词单复数形式取决于of后的名词或代词。表示复数概念用复数;表示单数概念用单数。例如: As a result of the serious flood, two-thirds of the buildings in the area need repairing. One study says that 90% of our time is spent watching television or using computers. While the rest of the passengers were getting out, she glanced at the faces around her.

初中英语主谓一致的用法及专项练习题带答案解析

初中英语主谓一致的用法及专项练习题 一、主谓一致三原则 主谓一致是指谓语动词与主语在人称和数上保持一致,主谓一致必须遵循三原则:语法一致原则,意义一致原则,就近一致原则。 1. 语法一致原则:指主语是单数形式,谓语动词用单数形式,主语是复数形式,谓语也用复数形式。 Tom is a good student. 汤姆是个好学生。 They often play football on the playground. 他们经常在操场上踢足球。 2. 意义一致:指主语形式上为单数,但意义为复数,因此谓语动词用复数形式;或主语形式上为复数,但表示单数意义,这是谓语动词用单数形式。 My family is having lunch now. 我们一家人现在正吃午饭。 My family has moved three times.我们家搬过3次。 3. 就近一致:指谓语动词用单数形式还是用复数形式,取决于最靠近他的主语。例如: Not only the teacher but also his students like playing football. 不仅老师喜欢踢足球,而且他的学生也喜欢踢足球。 There is a pen and some books on the desk. 课桌上有一支钢笔和一些书。 二、主谓一致常考题型 1. 单数名词(代词,不可数名词作主语时,谓语用单数形式,复数名词(代词作主语,谓语用复数形式。

The desk is Tom’s. 这张桌子是汤姆的。 Some water is in the bottle. 一些水在瓶子里。 The students are playing football on the playground. 这些学生正在操场上踢足球。 2. many a+单数名词作主语,意义虽为“许多”,但谓语要用单数形式。 Many a student has been to Shanghai. 许多学生到过上海。 3. more than one+单数名词作主语,谓语用单数。 More than one student has ever been to Beijing. 不止一个学生曾经去过北京。 4. 表示时间,价格,重量,数目,长度,数学运算等的词或短语作主语时,这些通常作一个整体概念,谓语用单数形式。例如: Two months is a long holiday. 两个月是一个长假。 Twenty pounds isn’t so heavy. 20英镑并不太重。 Te n miles isn’t a long distance. 10英里并不是一段很长的距离。 Five minus four is one. 5减4等于1。 但是,如果时间,距离,价格,度量衡的服饰名词与pass,go by,waste,use,spend 等词连用时,谓语动词用复数,如: Five years has passed since I joined the Party.我入党5年了。 5. 主语是each/every+单数名词+and(each/every+单数名词时,谓语动词用单数。 Each boy and each girl has got a seat. 每个男孩和女孩都有一个座位。

【英语】英语主谓一致技巧小结及练习题

【英语】英语主谓一致技巧小结及练习题 一、主谓一致 1.In the near future, there ____ self-driving cars in our city. A.is B.was C.are D.will be 【答案】D 【解析】 【详解】 句意:在不久的将来,我们城市将有自动驾驶汽车。选项A、C为一般现在时;B为一般过去时;D为一般将来时。根据In the near future可知,本题考查there be结构的一般将来时。该结构有两种表达:there is going to be或there will be。分析选项可知,D正确。 2.--- Do you like pop music? --- Yes, very much. But _____ my father _____ my mother likes it. They both like Beijing Opera. A.both, and B.either, or C.not only, but also D.neither, nor 【答案】D 【解析】 【详解】 句意:——你喜欢流行音乐吗?——是的,非常喜欢。但是我爸爸和妈妈都不喜欢。他们喜欢京剧。考查并列连词辨析。A. both, and两者都…;B. either, or或者…或者…,表示两者之一;C. not only, but also不但…而且…;D. neither, nor既不…也不…,表示两者都不。根据下文They both like Beijing Opera.以及转折词but,可知我爸爸和妈妈都不喜欢流行音乐;结合选项可知D选项符合题意,故答案选D。 3.Everyone except Tom and Jim _______ going to visit some friends in Shenzhen. A.is B.are C.am D.be 【答案】A 【解析】 【详解】 句意:除了汤姆和吉姆之外,每个人都会去拜访在深圳的一些朋友。Except意为“除了”,引起的结构跟在主语后面,不能看作是并列主语,主语如是单数,其谓语动词仍然用单数形式,本句主语是everyone,不定代词,谓语动词用be动词单数is,故选A。 【点睛】 as well as, with, along with, like, together with, rather than, except, but, including, accompanied by, plus, besides, in addition to, no less than 等引起的结构跟在主语后面,不能看作是并列主语,该主语不受这些词组引导的插入语的影响,主语如是单数,其谓语动词仍然用单数形式。例如:1) My mother, as well as my father, has a key to the office. 2) The man together with his wife and children sits there watching TV. 3) His sister no less than you is wrong. 4) The reading course book, plus its reference books, is helpful to college students.

相关主题