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

control break statements needed help

kiran_k8
Active Contributor
0 Likes
657

Hi Folks,

I am getting as

vendor A

some data

vendor A

some data.

vendor B

some data.

vendor B

some data.

But I want it as

vendor A

some data

some data.

Vendor B

some data

some data.

Kindly let me know,

FORM classical.

FORMAT RESET.

FORMAT COLOR COL_NORMAL.

sort itfinal by lifnr.

LOOP AT itfinal.

sl_no = sl_no + 1.

itfinal-awkey1 = itfinal-awkey+0(10).

WRITE:/ sy-vline,

2 sl_no,

7 sy-vline,

10 itfinal-bukrs,

21 sy-vline,

23 itfinal-belnr,

35 sy-vline,

38 itfinal-gjahr,

47 sy-vline,

48 itfinal-wt_qsshh,

69 sy-vline,

70 itfinal-wt_qbshh,

91 sy-vline,

94 itfinal-awkey1,

108 sy-vline,

110 itfinal-budat,

125 sy-vline.

at end of lifnr.

uline.

new-page.

clear: sl_no.

endat.

ENDLOOP.

write:/ sy-vline.

ENDFORM. "classical

*********************

TOP-OF-PAGE.

DATA : name1(60).

DATA : month_text(127),

string(99).

  • CALL FUNCTION 'MONTH_NAMES_GET'

  • EXPORTING

  • language = sy-langu

    • IMPORTING

    • RETURN_CODE =

  • TABLES

  • month_names = month_names[]

  • EXCEPTIONS

  • month_names_not_found = 1

  • OTHERS = 2

  • .

  • IF sy-subrc <> 0.

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

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

  • ENDIF.

FORMAT RESET.

FORMAT COLOR COL_POSITIVE.

  • IF NOT s_budat-low IS INITIAL .

  • READ TABLE month_names WITH KEY mnr = s_budat-low+4(2).

  • IF sy-subrc = 0.

  • month = month_names-ltx.

string1 = 'TDS on Work Contracts for'.

CONCATENATE string1 itfinal-bukrs date1 'to' date2 INTO title SEPARATED BY space.

WRITE 😕 title.

SKIP 1.

  • ENDIF.

  • ENDIF.

CONCATENATE itfinal-name1 ',' itfinal-ort01

INTO name1 SEPARATED BY space.

WRITE 😕 'Vendor Code :', itfinal-lifnr.

WRITE 😕 'Vendor Name and City :', name1.

SKIP 1.

WRITE 😕 'TNGST Registration No :', itfinal-j_1ilstno,

/ 'CST Registration No :', itfinal-j_1icstno.

SKIP 1.

  • Display the coloumn headings

FORMAT RESET.

FORMAT COLOR COL_HEADING.

WRITE 😕 sy-uline.

WRITE:/ sy-vline,

2 'SI.No',

7 sy-vline,

10 'Comp.Code',

21 sy-vline,

22 'Acct.Doc.No',

35 sy-vline,

37 'Fiscal Yr.',

47 sy-vline,

49 'Tax Base Amt.',

69 sy-vline,

71 'Tax Amt.',

91 sy-vline,

94 'Invoice No.' ,

108 sy-vline,

110 'Posting Date',

125 sy-vline,

1 ACCEPTED SOLUTION
Read only

Pawan_Kesari
Active Contributor
0 Likes
633

Check the structure of you internal table itfinal . I guess LIFNR should be the first field to get desire output.

4 REPLIES 4
Read only

Former Member
0 Likes
633

Hi,

whenever u use control break statements, u need to sort the internal tables with the key fields.

Read only

Former Member
0 Likes
633

Hi,

please check out the below program it might give a brief idea about how to use the control break statements

DATA: BEGIN OF ITAB OCCURS 0,

MATNR TYPE MATNR,

WERKS TYPE WERKS_D,

VALUE TYPE NETPR,

END OF ITAB.

ITAB-MATNR = 'ABC'.

ITAB-WERKS = '0100'.

ITAB-VALUE = '10.00'.

APPEND ITAB.

ITAB-MATNR = '1ABC'.

ITAB-WERKS = '0100'.

ITAB-VALUE = '10.00'.

APPEND ITAB.

SORT ITAB BY MATNR WERKS.

LOOP AT ITAB.

AT FIRST.

WRITE : 'AT FIRST'.

ENDAT.

AT NEW MATNR.

WRITE : 'AT NEW MATERIAL NUMBER'.

ENDAT.

AT END OF MATNR.

SUM.

WRITE: / ITAB-MATNR, 'MATERIAL TOTAL - ', ITAB-VALUE.

ENDAT.

AT END OF WERKS.

SUM.

WRITE: / ITAB-WERKS, 'PLANT TOTAL - ', ITAB-VALUE.

ENDAT.

AT LAST.

WRITE : 'AT LAST'.

ENDAT.

ENDLOOP.

for more information please check out the link below it might help you

http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb381a358411d1829f0000e829fbfe/content.htm

**********please reward points if the information is helpful to you*********************

Read only

Former Member
0 Likes
633

Take vendor as first filed in your Internal table....

Sort Internal table by vendor

Then loop at table .

at new vendor.

print data .

endat.

endloop.

If useful reward .........

Read only

Pawan_Kesari
Active Contributor
0 Likes
634

Check the structure of you internal table itfinal . I guess LIFNR should be the first field to get desire output.