ALV Control break events
Hi all,
I have a requirement in ALV ,
100 abc
100 xyz
using control break statement how we remove two hundreds and display output only one 100 ,names
100 abc
xyz.
regrads,
Praveen
Hi,
with the help of sort option you can get that. just check this sample.
REPORT ZTEST_ALV1 .
TYPE-POOLS: SLIS.
DATA:
LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
LT_SORT TYPE SLIS_T_SORTINFO_ALV,
LS_SORT TYPE SLIS_SORTINFO_ALV.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
END OF ITAB.
ITAB-VBELN = '12345'.
ITAB-POSNR = '10'.
APPEND ITAB.
CLEAR ITAB.
ITAB-VBELN = '12345'.
ITAB-POSNR = '11'.
APPEND ITAB.
CLEAR ITAB.
ITAB-VBELN = '12345'.
ITAB-POSNR = '12'.
APPEND ITAB.
CLEAR ITAB.
ITAB-VBELN = '12356'.
ITAB-POSNR = '10'.
APPEND ITAB.
CLEAR ITAB.
ITAB-VBELN = '12356'.
ITAB-POSNR = '11'.
APPEND ITAB.
CLEAR ITAB.
ITAB-VBELN = '12356'.
ITAB-POSNR = '12'.
APPEND ITAB.
CLEAR ITAB.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'ITAB'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = LT_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 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.
LS_SORT-FIELDNAME = 'VBELN'.
LS_SORT-UP = 'X'.
*ls_sort-group = 'UL'. "using this you can get new lines
APPEND LS_SORT TO LT_SORT.
CLEAR LS_SORT.
LS_SORT-FIELDNAME = 'POSNR'.
LS_SORT-UP = 'X'.
*ls_sort-group = '*'."using this you get new pages
APPEND LS_SORT TO LT_SORT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = LT_FIELDCAT
IT_SORT = LT_SORT
TABLES
T_OUTTAB = ITAB.
Regards
vijay
Similar Messages
-
In alv report can i use control break events? if no .whay?
Hi all,
in alv report can i use control break events? if no .whay?hi,
you can use control break statements in ALV report.
for example: if one PO is having more than one line item, that time you need to display PO only once. -
Smartforms, how to use control break events
Please help with this requirement.
Purchase Docu No.111
Pur Item No Mat no Quantity
1 2356 2000
2 1256 2000
3 8556 2000
Purchase Docu No.112
Pur Item No Mat no Quantity
1 9656 2000
2 7356 2000
3 1356 2000
Purchase Docu No.113
Pur Item No Mat no Quantity
1 5356 2000
2 8356 2000
This i have to design for the smartform.
1 header data then its item data.
like is Script i can call the WIndow elements using control break events in the driver prog but how to get this kind of output in Smartforms.???????
ThanksI dont want trigger new page.
In the same page i want like this
I have purchase docu data in only 1 internal table.
So, for every new VBELN, under this i want its corresponding item details.
I have created the command node for the main window with 2 rows, in the 1st row i am giving VBELN and in the 2nd row i am giving in item details like item no, matnr etc etc and in the condition its askng Field name and Comparison Value.
How shold i give condition.??????
Thanks
Edited by: Jalaaluddin Syed on May 1, 2008 5:03 PM -
Bdc on vk11 using control break events
hi
have any one done bdc for vk11 using control break events.my flat file is
ZTAX X IN 1000 1200 2000 A0
ZTAX X IN 1000 1210 3000 A1
ZTAX X US 7676 01 4000 L3
ZTAX X US 7676 02 5000 s1
i need the logic for this any sample code will be usefulhi, check the sample code using Control break statements.
LOOP AT IT_MAIN.
WRITE : IT_MAIN.
C_TABIX = SY-TABIX.
<b>AT NEW LIFNR_001.</b>
READ TABLE IT_MAIN INDEX C_TABIX.
REFRESH IT_BDC.
perform bdc_dynpro using 'SAPMM06E' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RM06E-BSTNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EKKO-LIFNR'
IT_MAIN-LIFNR_001.
perform bdc_field using 'RM06E-BSART'
IT_MAIN-BSART_002.
perform bdc_field using 'RM06E-BEDAT'
IT_MAIN-BEDAT_003.
perform bdc_field using 'EKKO-EKORG'
IT_MAIN-EKORG_004.
perform bdc_field using 'EKKO-EKGRP'
IT_MAIN-EKGRP_005.
perform bdc_field using 'RM06E-LPEIN'
IT_MAIN-LPEIN_006.
perform bdc_field using 'RM06E-WERKS'
IT_MAIN-WERKS_007.
MOVE 1 TO CNT.
<b>ENDAT.</b>
perform bdc_dynpro using 'SAPMM06E' '0120'.
perform bdc_field using 'BDC_CURSOR'
'EKPO-TXZ01(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
CONCATENATE 'EKPO-EMATN(' CNT ')' INTO FLD.
perform bdc_field using FLD IT_MAIN-EMATN_01_008.
CONCATENATE 'EKPO-TXZ01(' CNT ')' INTO FLD.
perform bdc_field using FLD IT_MAIN-TXZ01_01_009.
CONCATENATE 'EKPO-MENGE(' CNT ')' INTO FLD.
perform bdc_field using FLD IT_MAIN-MENGE_01_010.
perform bdc_dynpro using 'SAPMM06E' '0120'.
perform bdc_field using 'BDC_CURSOR'
'RM06E-EBELP'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
CNT = CNT + 1.
IF CNT = 6.
CNT = 1.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=P+'.
ENDIF.
<b>AT END OF LIFNR_001.</b>
READ TABLE IT_MAIN INDEX C_TABIX.
RECORD = IT_MAIN.
perform bdc_dynpro using 'SAPLSPO1' '0100'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
CALL TRANSACTION 'ME21' USING IT_BDC MODE 'A' MESSAGES INTO IT_MESSAGES.
clear: cnt, C_tabix .
<b>ENDAT.</b>
ENDLOOP. -
hi sap fans,
i got one issue in alv's
the o/p display in alv's is like this
top-of-page: reconsilation a/c,
check date,
check no.
o/p: bank a/c, amount,,
client asking me at end of bank a/c no i want a a special row with fields 'reconsilation(lable only),total no of line items,total amount of this bank account.
regards
udaya bhasker bandiHi
look thsi threds http://www.sdn.sap.com/irj/scn/advancedsearch?query=controlbreskin+alv
Regards,
Pravin -
Hi sdn,
i have a problem when i grouping the materials under the same invoice.
EX:
date address invoice material
1 apple
tomato
banana
2 apple
orange
when i use at new statement o/p coming like above, bcoz address have so many lines.
To avoid this i skip material to upper position.
Then,
date address invoice material
1 apple
tomato
banana
2 apple
orange
Here also no problem, but when ever the page
changes how can i move this material to upper page
please suggest me.Hi Ramya,
Please create new internal table like this.
DATA: BEGIN OF ITAB2 OCCURS 0,
CC_GL LIKE ...
COST_CENTER LIKE ...
GL_ACCOUNT LIKE ...
MATERIAL LIKE ...
PRICE LIKE ...
DATA: END OF ITAB2.
DATA: WA_ITAB2 LIKE ITAB2.
SORT ITAB1.
LOOP AT ITAB1.
MOVE ITAB1-COST_CENTER TO ITAB2-CC_GL(4).
MOVE ITAB1-GL_ACCOUNT TO ITAB2-CC_GL+4(10).
MOVE-CORRESPONDING ITAB1 TO ITAB2.
APPEND ITAB2.
ENDLOOP ITAB1.
SORT ITAB2.
LOOP ITAB2 INTO WA_ITAB2.
AT NEW CC_GL.
ENDAT.
ENDLOOP.
Please check the syntax ... and hope this will help.
Regards,
Ferry Lianto -
Control break functionality for ALV
HI experts,
i want to know how to use control break functionality in ALV's
i 've an int table , which i am processing for AT NEW lgtyp (storage type)
for every set of same lgtyp records , iam making some calculations on itab,
and getting my final int table.
so, for every set of new lgtyp values , i've a new final int table ,
which i need to pass to ALV.
my requirement is for every new storage type
get a block of output.
how to do this in ALV, waiting for response.Hi,
DOnt use AT NEW , use ON CHAGE
Refer this code
FORM sub_claculate_plug .
*--Local Variables
DATA : lv_index LIKE sy-tabix,
lv_total TYPE kzwi2.
LOOP AT it_final INTO wa_final.
lv_index = sy-tabix.
v_month = wa_final-erdat+4(2).
v_year = wa_final-erdat+0(4).
IF NOT p_bud IS INITIAL.
*--Collect all the plug numbers
PERFORM sub_collect_plug.
ENDIF.
ON CHANGE OF v_month.
v_ship = v_ship + v_wdays.
ENDON.
CLEAR : wa_nday.
READ TABLE it_nday INTO wa_nday WITH KEY erdat = wa_final-erdat
BINARY SEARCH.
IF sy-subrc EQ 0.
IF wa_nday-flag NE 'X'.
IF v_wdays NE 0.
wa_final-totbud = p_bud / v_wdays.
ENDIF.
ENDIF.
ENDIF.
wa_final-totrev = wa_final-corebus +
wa_final-onbulk +
wa_final-premier +
wa_final-shipit +
wa_final-onpromo +
wa_final-netrev +
wa_final-storev +
wa_final-connet +
wa_final-sporder.
lv_total = wa_final-corebus +
wa_final-onpromo +
wa_final-netrev.
IF NOT wa_final-oltot IS INITIAL.
wa_final-ordsize = lv_total / wa_final-oltot.
ENDIF.
MODIFY it_final FROM wa_final INDEX lv_index TRANSPORTING
totbud totrev ordsize.
*--Clear
CLEAR : wa_final,
v_days,
v_jan,
v_wdays,
v_ndays,
v_count.
ENDLOOP.
ENDFORM. " sub_claculate_plug
Regards,
Prashant -
Doubts with control break statements on internal table loops (AT/ENDAT)
Hi, i've had a couple of doubts for a long while which I hope someone can clarify today:
1) I know how to use the AT statements, however, i'm not sure I get correctly what this part of help regarding this commands means:
<i>"The control level structure with internal tables is static. It corresponds exactly to the sequence of columns in the internal table (from left to right). In this context, the criteria according to which you sort the internal table are unimportant."</i>
I've always sorted the internal table before the control break and it works that way. For example:
SORT ITAB BY EBELN EBELP.
LOOP AT ITAB.
AT NEW EBELN.
* Code for the order header
ENDAT.
ENDLOOP.
If I <b>don't</b> sort the internal table, it doesn't work! (i get dupplicated processing). In the example, if i have more than one register with the same EBELN and they're not consecutive, the header gets processed twice. I really don't get that part of the help text.
2) I know this: <i>"At the start of a new control level (i.e. immediately after AT), the following occurs in the output area of the current LOOP statement:
All character type fields (on the right) are filled with "*" after the current control level key.
All other fields (on the right) are set to their initial values after the current control level key."</i>
My doubt is: WHY is that this way? Because sometimes (most times) I need those fields INSIDE the statement! So when that happened i've solved it in one of three ways:
LOOP AT ITAB INTO WA_ITAB.
WA_ITAB_AUX = WA_ITAB.
AT NEW FIELD.
WA_ITAB = WA_ITAB_AUX.
* ...Rest of the code for the first register
ENDAT.
ENDLOOP.
LOOP AT ITAB INTO WA_ITAB.
AT NEW FIELD.
READ TABLE ITAB INDEX SY-TABIX INTO WA_ITAB.
* ...Rest of the code for the first register
ENDAT.
ENDLOOP.
* (Without AT)
LOOP AT ITAB INTO WA_ITAB.
IF WA_ITAB-FIELD <> FIELD_AUX.
FIELD_AUX = WA_ITAB_FIELD.
* ...Rest of the code for the first register
ENDIF.
ENDLOOP.
Is there any problem with this way of coding? Can be done better?
Thank you very much in advance.Hi..,
1)
See if u sort the table on a field on which u r using AT ENDAT .. then all the records which are having the same value for that field will form a group or those reocrds will be at one place.. so when u sort the table for all the records AT ENDAT will get executed onli once..
If u dont sort this table on this field then all these records will be at different places and in between there may be records with different value for this field.. so this AT ENDAT will get executed for each record !!
2)
No u cannot use the Right hand fields of the field in the table .. Because these AT events work as Group based operations... So till that field on which AT ENDAT is working it breaks that record into two groups.. One is the left hand fields including that field.. and right hand fields as another group.. and makes the right hand group as stars ****. Thats y u can observe that even any one field in the left hand group changes the AT ENDAT will get executed !!!!
Hope u understood !!!
regards,
sai ramesh -
Control Break Statements ----- Please Help me
I have some idea about the control-break statements(AT-ENDAT). Can any one please give me the example ?
Thanks in Advance. Points will be rewarded immediately.sample program for AT events
Using AT FIRST , AT NEW, AT THE END OF , AT LAST.
DATA: BEGIN OF ITAB OCCURS 0,
F1 TYPE I,
F2(6) TYPE C,
F3(10) TYPE N,
F4(16) TYPE P DECIMALS 2,
END OF ITAB.
DATA: SUB_TOT(10) TYPE P DECIMALS 3.
**--1
ITAB-F1 = 1.
ITAB-F2 = 'ONE'.
ITAB-F3 = 10.
ITAB-F4 = '1000.00'.
APPEND ITAB.
CLEAR ITAB.
ITAB-F1 = 1.
ITAB-F2 = 'ONE'.
ITAB-F3 = 20.
ITAB-F4 = '2000.00'.
APPEND ITAB.
CLEAR ITAB.
ITAB-F1 = 1.
ITAB-F2 = 'ONE'.
ITAB-F3 = 30.
ITAB-F4 = '3000.00'.
APPEND ITAB.
CLEAR ITAB.
*--2
ITAB-F1 = 2.
ITAB-F2 = 'TWO'.
ITAB-F3 = 10.
ITAB-F4 = '1000.00'.
APPEND ITAB.
CLEAR ITAB.
ITAB-F1 = 2.
ITAB-F2 = 'TWO'.
ITAB-F3 = 20.
ITAB-F4 = '2000.00'.
APPEND ITAB.
CLEAR ITAB.
ITAB-F1 = 3.
ITAB-F2 = 'THREE'.
ITAB-F3 = 10.
ITAB-F4 = '1000.00'.
APPEND ITAB.
CLEAR ITAB.
ITAB-F1 = 3.
ITAB-F2 = 'THREE'.
ITAB-F3 = 20.
ITAB-F4 = '2000.00'.
APPEND ITAB.
CLEAR ITAB.
SORT ITAB BY F1.
LOOP AT ITAB.
AT FIRST.
WRITE: /35 ' MATERIAL DETAILS:'.
ULINE.
ENDAT.
AT NEW F1.
WRITE: / 'DETAILS OF MATERIAL:' COLOR 7 , ITAB-F1.
ULINE.
ENDAT.
WRITE: / ITAB-F1, ITAB-F2, ITAB-F3, ITAB-F4.
SUB_TOT = SUB_TOT + ITAB-F4.
AT END OF F1.
ULINE.
WRITE: / 'SUB TOTAL :' COLOR 3 INVERSE ON, SUB_TOT COLOR 3 INVERSE ON.
CLEAR SUB_TOT.
ENDAT.
AT LAST.
SUM.
ULINE.
WRITE: 'SUM:', ITAB-F4.
ULINE.
ENDAT.
ENDLOOP.
Reward points if helpful.
Rgds,
Abhishek -
Control-break statements:value not being displayed.
Hi all,
Iam using the control break statement at end of ..., sum.
value is not being displayed,instead it is showing *********.
even in the debugging mode the value is not being displayed.
iam passing the values into a temp IT,but still the values are not being dispalyed.
here is the following snippet of code.
what could be the mistake?
Please give me the suitable answer.
Thanks in advance.
LOOP AT FT_ITAB INTO FT_WA.
FTY_WA-EBELN = FT_WA-EBELN.
FTY_WA-EBELP = FT_WA-EBELP.
FTY_WA-NAME1 = FT_WA-NAME1.
FTY_WA-ZTERM = FT_WA-ZTERM.
FTY_WA-INCO1 = FT_WA-INCO1.
FTY_WA-WAERS = FT_WA-WAERS.
FTY_WA-SUBMI = FT_WA-SUBMI.
AT END OF EBELN.
SUM.
FTY_WA-BRTWR = FT_WA-BRTWR.
FTY_WA-KTMNG = FT_WA-KTMNG.
FTY_WA-NETPR = FT_WA-NETPR.
APPEND FTY_WA TO FTY_ITAB.
CLEAR FTY_WA.
ENDAT.Abhi,
i tried as you said values are being diplayed,but they are not gettin totaled,i want the sum of values at the end of line item,I need to pass these valuse to alv.
here is the complete code.Please tell me how should I proceed.
TABLES:EKKO,EKPO,LFA1.
TYPE-POOLS:SLIS.
DATA:HEADER TYPE SLIS_T_FIELDCAT_ALV,
WA TYPE SLIS_FIELDCAT_ALV,
LAYOUT TYPE SLIS_LAYOUT_ALV.
TYPES:BEGIN OF PH_TY,
PH_EBELN LIKE EKKO-EBELN,
PH_AEDAT LIKE EKKO-AEDAT,
PH_LIFNR LIKE EKKO-LIFNR,
PH_ZTERM LIKE EKKO-ZTERM,
PH_EKORG LIKE EKKO-EKORG,
PH_WAERS LIKE EKKO-WAERS,
PH_SUBMI LIKE EKKO-SUBMI,
PH_INCO1 LIKE EKKO-INCO1,
PO_EBELN LIKE EKPO-EBELN,
PO_EBELP LIKE EKPO-EBELP,
PO_BRTWR LIKE EKPO-BRTWR,
PO_KTMNG LIKE EKPO-KTMNG,
PO_NETPR LIKE EKPO-NETPR,
END OF PH_TY.
TYPES:BEGIN OF PO_TY,
PO_EBELN LIKE EKPO-EBELN,
PO_EBELP LIKE EKPO-EBELP,
PO_BRTWR LIKE EKPO-BRTWR,
PO_KTMNG LIKE EKPO-KTMNG,
PO_NETPR LIKE EKPO-NETPR,
END OF PO_TY.
TYPES:BEGIN OF VO_TY,
VO_LIFNR LIKE LFA1-LIFNR,
VO_NAME1 LIKE LFA1-LIFNR,
END OF VO_TY.
TYPES:BEGIN OF FI_TY,
EBELN LIKE EKKO-EBELN,
AEDAT LIKE EKKO-AEDAT,
LIFNR LIKE EKKO-LIFNR,
ZTERM LIKE EKKO-ZTERM,
EKORG LIKE EKKO-EKORG,
WAERS LIKE EKKO-WAERS,
SUBMI LIKE EKKO-SUBMI,
INCO1 LIKE EKKO-INCO1,
EBELN_I LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
NAME1 LIKE LFA1-LIFNR,
BRTWR LIKE EKPO-EBELN,
KTMNG LIKE EKPO-EBELN,
NETPR LIKE EKPO-EBELN,
LIFNR1 LIKE LFA1-LIFNR,
END OF FI_TY.
TYPES:BEGIN OF FT_TY,
EBELN LIKE EKKO-EBELN,
ZTERM LIKE EKKO-ZTERM,
WAERS LIKE EKKO-WAERS,
SUBMI LIKE EKKO-SUBMI,
INCO1 LIKE EKKO-INCO1,
EBELP LIKE EKPO-EBELP,
NAME1 LIKE LFA1-LIFNR,
BRTWR LIKE EKPO-EBELN,
KTMNG LIKE EKPO-EBELN,
NETPR LIKE EKPO-EBELN,
END OF FT_TY.
DATA: PH_ITAB TYPE STANDARD TABLE OF PH_TY,
PO_ITAB TYPE STANDARD TABLE OF PO_TY,
VO_ITAB TYPE STANDARD TABLE OF VO_TY,
FI_ITAB TYPE STANDARD TABLE OF FI_TY,
FT_ITAB TYPE STANDARD TABLE OF FT_TY,
FTY_ITAB TYPE STANDARD TABLE OF FT_TY,
FTY1_ITAB TYPE STANDARD TABLE OF FT_TY.
DATA:PH_WA LIKE LINE OF PH_ITAB,
PO_WA LIKE LINE OF PO_ITAB,
VO_WA LIKE LINE OF VO_ITAB,
FI_WA LIKE LINE OF FI_ITAB,
FT_WA LIKE LINE OF FT_ITAB,
FT_WA1 LIKE LINE OF FT_ITAB,
FTY_WA LIKE LINE OF FT_ITAB,
FTY1_WA LIKE LINE OF FT_ITAB.
SELECT A~EBELN
A~AEDAT
A~LIFNR
A~ZTERM
A~EKORG
A~WAERS
A~SUBMI
A~INCO1
B~EBELN
B~EBELP
B~BRTWR
B~KTMNG
B~NETPR
INTO TABLE PH_ITAB FROM EKKO AS A
INNER JOIN EKPO AS B
ON AEBELN = BEBELN
UP TO 25 ROWS.
CHECK PH_ITAB[] IS NOT INITIAL.
SELECT LIFNR
NAME1
FROM LFA1 INTO TABLE VO_ITAB
FOR ALL ENTRIES IN PH_ITAB
WHERE LIFNR = PH_ITAB-PH_LIFNR.
CHECK VO_ITAB[] IS NOT INITIAL.
SORT PH_ITAB BY PH_EBELN.
SORT VO_ITAB BY VO_LIFNR.
LOOP AT PH_ITAB INTO PH_WA.
FI_WA-SUBMI = PH_WA-PH_SUBMI.
FI_WA-EBELN = PH_WA-PH_EBELN.
FI_WA-ZTERM = PH_WA-PH_ZTERM.
FI_WA-INCO1 = PH_WA-PH_INCO1.
FI_WA-WAERS = PH_WA-PH_WAERS.
FI_WA-EBELP = PH_WA-PO_EBELP.
FI_WA-BRTWR = PH_WA-PO_BRTWR.
FI_WA-KTMNG = PH_WA-PO_KTMNG.
FI_WA-NETPR = PH_WA-PO_NETPR.
READ TABLE VO_ITAB INTO VO_WA WITH KEY VO_LIFNR = PH_WA-PH_LIFNR BINARY SEARCH.
FI_WA-NAME1 = VO_WA-VO_NAME1.
APPEND FI_WA TO FI_ITAB.
CLEAR FI_WA.
ENDLOOP.
LOOP AT FI_ITAB INTO FI_WA.
FT_WA-EBELN = FI_WA-EBELN.
FT_WA-EBELP = FI_WA-EBELP.
FT_WA-NAME1 = FI_WA-NAME1.
FT_WA-ZTERM = FI_WA-ZTERM.
FT_WA-INCO1 = FI_WA-INCO1.
FT_WA-WAERS = FI_WA-WAERS.
FT_WA-SUBMI = FI_WA-SUBMI.
FT_WA-BRTWR = FI_WA-BRTWR.
FT_WA-KTMNG = FI_WA-KTMNG.
FT_WA-NETPR = FI_WA-NETPR.
APPEND FT_WA TO FT_ITAB.
CLEAR FT_WA.
ENDLOOP.
LOOP AT FT_ITAB INTO FT_WA.
AT END OF EBELN.
SUM.
FTY_WA-EBELN = FT_WA-EBELN.
FTY_WA-EBELP = FT_WA-EBELP.
FTY_WA-NAME1 = FT_WA-NAME1.
FTY_WA-ZTERM = FT_WA-ZTERM.
FTY_WA-INCO1 = FT_WA-INCO1.
FTY_WA-WAERS = FT_WA-WAERS.
FTY_WA-SUBMI = FT_WA-SUBMI.
FTY_WA-BRTWR = FT_WA-BRTWR + FTY_WA-BRTWR.
FTY_WA-KTMNG = FT_WA-KTMNG + FTY_WA-KTMNG.
FTY_WA-NETPR = FT_WA-NETPR + FTY_WA-KTMNG.
ENDAT.
APPEND FTY_WA TO FTY_ITAB.
CLEAR FTY_WA.
ENDLOOP.
WA-SELTEXT_L = 'ebeln'.
WA-COL_POS = '1'.
WA-FIELDNAME = 'EBELN'.
WA-TABNAME = 'FTY_ITAB'.
WA-OUTPUTLEN = '15'.
APPEND WA TO HEADER.
CLEAR WA.
WA-SELTEXT_L = 'SUBMI'.
WA-COL_POS = '2'.
WA-FIELDNAME = 'SUBMI'.
WA-TABNAME = 'FTY_ITAB'.
WA-OUTPUTLEN = '15'.
APPEND WA TO HEADER.
CLEAR WA.
WA-SELTEXT_L = 'NAME1'.
WA-COL_POS = '3'.
WA-FIELDNAME = 'NAME1'.
WA-TABNAME = 'FTY_ITAB'.
WA-OUTPUTLEN = '15'.
APPEND WA TO HEADER.
CLEAR WA.
WA-SELTEXT_L = 'ZTERM'.
WA-COL_POS = '4'.
WA-FIELDNAME = 'ZTERM'.
WA-TABNAME = 'FTY_ITAB'.
WA-OUTPUTLEN = '15'.
APPEND WA TO HEADER.
CLEAR WA.
WA-SELTEXT_L = 'INCO1'.
WA-COL_POS = '5'.
WA-FIELDNAME = 'INCO1'.
WA-TABNAME = 'FTY_ITAB'.
WA-OUTPUTLEN = '15'.
APPEND WA TO HEADER.
CLEAR WA.
WA-SELTEXT_L = 'WAERS'.
WA-COL_POS = '6'.
WA-FIELDNAME = 'WAERS'.
WA-TABNAME = 'FTY_ITAB'.
WA-OUTPUTLEN = '15'.
APPEND WA TO HEADER.
CLEAR WA.
WA-SELTEXT_L = 'brtwr'.
WA-COL_POS = '7'.
WA-FIELDNAME = 'BRTWR'.
WA-TABNAME = 'FTY_ITAB'.
WA-OUTPUTLEN = '20'.
APPEND WA TO HEADER.
CLEAR WA.
WA-SELTEXT_L = 'netpr'.
WA-COL_POS = '8'.
WA-FIELDNAME = 'NETPR'.
WA-TABNAME = 'FTY_ITAB'.
WA-OUTPUTLEN = '20'.
APPEND WA TO HEADER.
CLEAR WA.
WA-SELTEXT_L = 'ktmng'.
WA-COL_POS = '9'.
WA-FIELDNAME = 'KTMNG'.
WA-TABNAME = 'FTY_ITAB'.
WA-OUTPUTLEN = '20'.
APPEND WA TO HEADER.
CLEAR WA.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = header[]
TABLES
T_OUTTAB = FTY_ITAB[].
IF SY-SUBRC = 0.
ENDIF. -
Dear all,
How to write control break statement in smart form while printing multiple line items in loop.
like at new at last etc.....
For eg; multiple lines having same material with different batch, how to total all batches for the same material and print it for single material.
Thanks in advance.
<MOVED BY MODERATOR TO THE CORRECT FORUM>
Edited by: Alvaro Tejada Galindo on Nov 5, 2008 11:15 AMHi
Make use of the Calculations tab
select accordingly the operation required ( TOTAL)
Give the field name which you want to total
Give the Target field name where you want the total to be and use this field to display the Total
Give the time for total also
i.e After Loop etc.
if you want SUBTOTALS
then print this value in the Event which you created as I mentioned in the previous Post
If GrandTotal
Then in the Footer area of the table print this value.
in the conditions tab remove the check box AT PAGE BREAK if you want only at end of all the data
http://help.sap.com/saphelp_nw70/helpdata/EN/a5/de6838abce021ae10000009b38f842/frameset.htm
regards
Prasanth -
Control break statements in smart forms
Hi,
Can we use control break statements(at new,at end of) in smart forms?
if no why?
if yes, how?
Regards,
Sonikayou can use control block statements in smartforms by using the SORT events.
In TABLES go to to the SORT section.Here you can give the field by which you want the table to be sorted.There are two radio buttons available for sort : SORT BEGIN and SORT end.
On selecting any one sort event are generated automatically and event nodes are created in smartforms.Inside these event nodes you can add text nodes or code nodes and write your code.
SORT BEGIN works like AT NEW
SORT END works like AT END OF. -
Hi all
in control break statments AT NEW COMMAND will provide astrik and blank in the out put in right side of the column.why!
in the case of on change of it will not give astrik and blank on the right side of the column in the out put . why!
regards
Nagendra.Control Break Statements:
1. At First
2. At last
3. At New
4. At End of
5. on change.
*at first, at last, at new, at end of are also called as at
events and these will be used in loop.....endloop of an
internal table.
*'on change' can be used in out side of the loop...endloop.
1.At first event will be executed only for the first
iteration of the loop...endloop. This event is used for
writing headings.
2. At last event will be triggered for the last iteration
of the loop...endloop.
3. At new event will be triggered for every new value
enters in to the field.
4. event at end of will be triggered if the current running
value is the last value.
5. on change will be triggered for any change in the
specified field value. -
difference between on change and at first.
in which scenario which control break statement
we have to useHi Sunil!!
ON CHANGE OF f.
Addition:
... OR f1
This statement is not allowed in an ABAP Objects context. See Prohibit ON CHANGE OF - ENDON.
Effect
Executes the processing block enclosed by the "ON CHANGE OF f" and "ENDON" statements whenever the contents of the field f change (control break processing).
Normally, you use the statement to manipulate database fields during GET events or SELECT/ENDSELECT processing.
Note
There are special control structures for processing control breaks in LOOP s on internal tables or extract datasets (AT).
ON CHANGE OF is unsuitable for recognizing control levels in loops of this type because it always creates a global auxiliary field which is used to check for changes. This global auxiliary field is only changed in the relevant ON CHANGE OF statement. It is not reset when the processing enters loops or subroutines, so unwanted effects can occur if the loop or subroutine is executed again. Also, since it is set to its initial value when created (like any other field), any ON CHANGE OF processing will be executed after the first test, unless the contents of the field concerned happen to be identical to the initial value.
Example
DATA T100_WA TYPE T100.
SELECT * FROM T100
INTO T100_WA
WHERE SPRSL = SY-LANGU AND
MSGNR < '010'
ORDER BY PRIMARY KEY.
ON CHANGE OF T100_WA-ARBGB.
ULINE.
WRITE: / '**', T100_WA-ARBGB, '**'.
ENDON.
WRITE: / T100_WA-MSGNR, T100_WA-TEXT.
ENDSELECT.
Displays all messages with their numbers in the logon language, provided the number is less than '010'.
Each time the message class changes, it is output.
Addition
... OR f1
Effect
Also executes the code whenever the contents of the field f1 changes.
You can use this addition several times.
Example
Logical database F1S
NODES: SPFLI, SFLIGHT, SBOOK.
GET SBOOK.
ON CHANGE OF SPFLI-CARRID OR
SPFLI-CONNID OR
SFLIGHT-FLDATE.
ULINE.
WRITE: /5 SPFLI-CARRID, SPFLI-CONNID,
5 SFLIGHT-FLDATE, SPFLI-FLTIME,
5 SFLIGHT-SEATSMAX, SFLIGHT-SEATSOCC.
ENDON.
WRITE: / SBOOK-CUSTOMID.
The code between ON CHANGE OF and ENDON is executed only if at least one of the fields SPFLI-CARRID, SPFLI-CONNID or SFLIGHT-FLDATE has changed, i.e. there is a different flight connection (which also has bookings).
Notes
Between ON CHANGE OF and ENDON, you can use ELSE for case distinction.
You can also use ELSEIF statements in conjunction with special implementation of ON, but should always try to avoid this because they may not be supported in future.
Related
AT - control breaks with internal tables
AT - control breaks with extracts
AT FIRST.
Effect
The variants AT FIRST make sense within a LOOP.
The processing block between AT FIRST and ENDAT is executed before the individual lines are processed; the processing block between AT LAST and ENDAT is executed after all the individual lines have been processed.
In AT FIRST or AT LAST ... ENDAT processing, all argument fields are filled with "*" (internal tables).
When you are processing extract datasets, a control total SUM(n) can only be processed with AT END OF or AT LAST.
Example
DATA: BEGIN OF COMPANIES OCCURS 20,
NAME(30),
PRODUCT(20),
SALES TYPE I,
END OF COMPANIES.
LOOP AT COMPANIES.
AT FIRST.
SUM.
WRITE: 'Sum of all SALES:',
55 COMPANIES-SALES.
ENDAT.
WRITE: / COMPANIES-NAME, COMPANIES-PRODUCT,
55 COMPANIES-SALES.
ENDLOOP.
kindly reward if useful -
Hi,
When i use control breaks and write a output i get astreix(*) in the output.
I even tried with a local vriable but the value is not displayed in the output. i need to output the material description in the output.
My code is as follows:
LOOP AT lt_output INTO wa_output.
AT NEW matnr.
CLEAR: lv_matdesc.
MOVE: wa_output-maktx TO lv_matdesc.
WRITE: / '|', wa_output-matnr, 30(40) lv_matdesc, 80(5)
wa_output-cocode, 86(4) wa_output-valarea, 93 '|'.
ENDAT.
AT END OF matnr.
WRITE: / '|', 2(91) sy-uline, 93 '|'.
WRITE: / '|', '*', 4(15) wa_output-matnr, 93 '|'.
WRITE:/'|', 48(10) lv_mat_qty, 59(4) wa_output-bum, 70(15)
lv_mat_amt, 85 wa_output-curr, 93 '|'.
WRITE: / '|', 2(91) sy-uline, 93 '|'.
CLEAR: lv_mat_qty, lv_mat_amt.
ENDAT.
AT LAST.
WRITE: / '|', 2(91) sy-uline , 93 '|'.
WRITE: / '|', '***', 5(15) 'Total', 93 '|'.
WRITE:/'|', 48(10) lv_total_qty, 59(4) wa_output-bum, 70(15)
lv_total_amt, 85 wa_output-curr, 93 '|'.
WRITE: / '|', 2(91) sy-uline, 93 '|'.
ENDAT.
ENDLOOP.
The output looks like this:
9M27W8.X9B.0 **************************************** **** ****
WE 4700001289 001 04/10/2002 1.000 PC 31,667.65 CAD
WE 4700001454 001 07/29/2002 1.000 PC 30,074.63 CAD
WE 4700001455 001 07/29/2002 1.000 PC 30,074.63 CAD
WE 4700001457 001 07/29/2002 1.000 PC 30,513.47 CAD
*9M27W8.X9B.0
4.000 **** 122,330.38 *****
**Total
1,441.000 **** 38,926,097.05 *****Hi,
LOOP AT lt_output INTO wa_output.
wa_out = wa_output. " and use this variable in the events to print the data instead of wa_output.
AT NEW matnr.
CLEAR: lv_matdesc.
MOVE: wa_output-maktx TO lv_matdesc.
WRITE: / '|', wa_output-matnr, 30(40) lv_matdesc, 80(5)
wa_output-cocode, 86(4) wa_output-valarea, 93 '|'.
ENDAT.
AT END OF matnr.
WRITE: / '|', 2(91) sy-uline, 93 '|'.
WRITE: / '|', '*', 4(15) wa_output-matnr, 93 '|'.
WRITE:/'|', 48(10) lv_mat_qty, 59(4) wa_output-bum, 70(15)
lv_mat_amt, 85 wa_output-curr, 93 '|'.
WRITE: / '|', 2(91) sy-uline, 93 '|'.
CLEAR: lv_mat_qty, lv_mat_amt.
ENDAT.
AT LAST.
WRITE: / '|', 2(91) sy-uline , 93 '|'.
WRITE: / '|', '***', 5(15) 'Total', 93 '|'.
WRITE:/'|', 48(10) lv_total_qty, 59(4) wa_output-bum, 70(15)
lv_total_amt, 85 wa_output-curr, 93 '|'.
WRITE: / '|', 2(91) sy-uline, 93 '|'.
ENDAT.
ENDLOOP.
Maybe you are looking for
-
Adapter JNDI are errored out in JNDI tree on Weblogic
Hey, I have setup weblogic 10.3.4 and SOA Suite 11g. The adapters seem to be deployed and active with a green 'OK' status in the deployments on the soa_server1. However when I go to the jndi tree for the soa_server1, all the adapters have an '!' for
-
Transferring phone numbers from old Casio Boulder
I need help! Would someone be able to tell me how to get all of my phone numbers out of my Casio and into my i Phone 4? They were absolutely no help at the Verizon store today. I spent over an hour there while they tried to activate my phone. I asked
-
Move OCR and Vote Disk to a new SAN
Hi, Can you guys help me with some links/documents for moving OCR and Vote disk files from old SAN to new SAN. Both SAN will have ocfs2 formatted 3 partitions on which ocr and votedisk will be placed (normal redundancy). Oracle version 11g R2, OS lin
-
Not able to sync Exchange Server :-(
Hello all, I am having trouble while setting up exchange account. Need help, i am getting no where. Here's where I am stucked... 1.Details entered Email: [email protected] UserName : [email protected] Password : *** Description : [email protected] 2.
-
Reg: Configuration of AAA using TACACS+
Hi, I am Anubhav ,i m new to TACACS+ server and trying to implement aaa authentication using Cisco TACACS+ Server for which i've decided following AAA commands and a fall back user user1 has been configured on router to be authenticated. aaa authenti