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

report length

Former Member
0 Likes
1,943

Hi,

I changed the material description column from 25 to 40 in length. As a result the end columns in the report are moved into the next line. I want all the columns in one line.

I am not sure how to fix this without moving the columns onto next line.

The report is a custom report.

Thanks for the help,

Sobhan.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,869

Hi,

Increase the LINE-SIZE.

REPORT Z***** LINE-SIZE XXX

Regards,

Lanka

Hi,

Increase the LINE-SIZE.

REPORT Z***** LINE-SIZE XXX

Regards,

Lanka

13 REPLIES 13
Read only

Former Member
0 Likes
1,869

Check out line size in program.

report <program name> no standard page heading message-id mg

<b>line-size 134</b> line-count 64.

Change it as required and it should be able to display data in one line.

Read only

Former Member
0 Likes
1,869

Just add this -:)


REPORT ZTEST LINE-SIZE 200.

In <b>LINE-SIZE</b> you can define the lenght of the report -:)

Greetings,

Blag.

Read only

Former Member
0 Likes
1,870

Hi,

Increase the LINE-SIZE.

REPORT Z***** LINE-SIZE XXX

Regards,

Lanka

Read only

0 Likes
1,869

Hi all,

Thank you so much for the quick responses.

In the report the line size is 255.

LINE-SIZE 255

I think with 255, I should be able to see all columns in one line. But the last two columns are going to the next line.

Thanks,

Sobhan

Read only

0 Likes
1,869

Hi,

The maximum width of a list(LINE-SIZE) is 1023 characters.

SAP Help:

If the you want the report list (i.e. the output) to be printable, do not define a LINE-SIZE with a value greater than 132 because most printers cannot handle wider lists. You cannot print lists wider than 255 characters at all using the standard print functions. To print the contents of the lists, you need to write a special print routine that arranges the data in shorter lines (for example, using the PRINT ON addition in the NEW-PAGE statement.

Regards,

Lanka

Read only

0 Likes
1,869

If still it is goingto next line, make line size 280 and test.

Read only

0 Likes
1,869

Hi All,

I tries with 300 and 500. There is no difference int the output.

Thanks,

Sobhan

Read only

0 Likes
1,869

Can you post your code please?

Regards,

Rich Heilman

Read only

0 Likes
1,869

Hi,

Please check may be you are using '/' in your program . This will leads the report to next line.

Lanka

Sorry I haven't seen Srinivas Adavi already suggested this.

Message was edited by: Lanka Murthy

Read only

0 Likes
1,869

report zmppr_fin_goods_inv_demand no standard page heading

line-size 255 "$006

line-count 58(1).

----


*Type-Pools

----


type-pools: col,

icon. "$006

----


*Data Definitions

----


data: begin of wa_rec_all,

matgrp like mara-extwg,

----


  • CHANGED "$001

----


  • flavor(8),

----


flavor(13), "$001

----


matnr like mara-matnr,

matdec like makt-maktx,

plant like mard-werks,

qty type p decimals 0,

beskz type marc-beskz,

end of wa_rec_all.

data: begin of wa_rec,

matnr type mard-matnr,

plant type mard-werks,

unres type mard-labst,

matgrp like mara-extwg,

flavor like mara-prdha,

uom like mara-meins,

trans like marc-trame,

prod like marc-beskz,

sobsl like marc-sobsl, "$005

matdec like makt-maktx,

end of wa_rec.

data: begin of wa_src, "$005

matnr type mard-matnr, "$005

plant type mard-werks, "$005

beskz type marc-beskz, "$005

sobsl type marc-sobsl, "$005

end of wa_src, "$005

g_matnr type mara-matnr, "$005

g_maktx type makt-maktx, "$006

i_src like hashed table of wa_src "$005

with unique key matnr plant. "$005

data: begin of wa_vend, "$005

ebeln type eord-ebeln, "$005

lifnr type eord-lifnr, "$005

name type lfa1-name1, "$005

end of wa_vend, "$005

i_vend like table of wa_vend. "$005

data: wa_rec_prd like wa_rec_all,

itab_rec_all like sorted table of wa_rec_all

with non-unique key matgrp flavor matnr,

itab_rec_prd like sorted table of wa_rec_prd

with non-unique key matgrp flavor matnr,

itab_rec_trans like sorted table of wa_rec_all

with non-unique key matgrp flavor matnr,

itab_rec_fin like itab_rec_all,

f_date type sy-datum,

f_time type sy-uzeit,

f_len type i,

f_lines1 type i,

f_lines2 type i,

f_matnr like wa_rec-matnr,

f_matgrp like wa_rec-matgrp,

f_flavor like wa_rec_all-flavor,

f_found,

f_current_title type string,

f_header value 'X',

f_num type i.

*Data used for calculation and writing the list

data: begin of wa_line_total,

matnr(6),

matdec(40), " $010

col1(5) type p decimals 0,

col2 like wa_line_total-col1,

col25 like wa_line_total-col1,

col3 like wa_line_total-col1,

col4 like wa_line_total-col1,

col5 like wa_line_total-col1,

col6 like wa_line_total-col1,

col7 like wa_line_total-col1,

col8 like wa_line_total-col1,

col9 like wa_line_total-col1,

col10 like wa_line_total-col1,

colob like wa_line_total-col1, "$002

colun like wa_line_total-col1, "$002

end of wa_line_total,

wa_sub_total like wa_line_total,

wa_g_total like wa_line_total,

f_int.

*Data used for demand

data: "$002

----


  • REMOVED "$003

----


  • BEGIN OF wa_mdkp, "$002

  • matnr TYPE mdkp-matnr, "$002

  • dplnt TYPE mdkp-plwrk, "$002

  • dtnum TYPE mdkp-dtnum, "$002

  • cflag TYPE mdkp-cflag, "$002

  • END OF wa_mdkp, "$002

----


begin of wa_demand, "$002

matnr type mdkp-matnr, "$002

----


  • CHANGED "$003

----


  • delkz TYPE mdtb-delkz, "$002

----


delkz(1), "$003

----


qty type mdtb-mng01, "$002

end of wa_demand, "$002

i_demand like hashed table of wa_demand "$002

with unique key matnr delkz. "$002

----


  • REMOVED "$003

----


**DATA: mdtb TYPE mdtb OCCURS 0 WITH HEADER LINE. "$002

*DATA: BEGIN OF mdtbx OCCURS 0. "$002

  • INCLUDE STRUCTURE mdtb. "$002

*DATA: END OF mdtbx. "$002

*

*TABLES: mdtc. "$002

----


data: begin of wa_vbbe, "$003

matnr type vbbe-matnr, "$003

werks type vbbe-werks, "$003

vbtyp type vbbe-vbtyp, "$003

date type vbbe-mbdat, "$003

uom type vbbe-meins, "$003

qty type vbbe-vmeng, "$003

end of wa_vbbe, "$003

begin of wa_mdub, "$003

matnr type mdub-matnr, "$003

reswk type mdub-reswk, "$003

uom type mdub-meins, "$003

qty type mdub-mng02, "$003

qtydl type mdub-glmng, "$003

date type mdub-eindt, "$003

werks type mdub-werks, "$003

plifz type mdub-plifz, "$003

buom type mara-meins, "$003

end of wa_mdub, "$003

begin of wa_mdua, "$003

matnr type mdua-matnr, "$003

reswk type mdua-reswk, "$003

werks type mdua-werks, "$003

date type mdua-frgdt, "$003

qty type mdua-menge, "$003

uom type mdua-meins, "$003

buom type mara-meins, "$003

end of wa_mdua, "$003

begin of wa_mdup, "$003

matnr type mdup-matnr, "$003

pwwrk type mdup-pwwrk, "$003

plwrk type mdup-plwrk, "$003

qty type mdup-gsmng, "$003

uom type mdup-meins, "$003

date type mdup-psttr, "$003

end of wa_mdup, "$003

i_vbbe like table of wa_vbbe, "$003

i_mdub like table of wa_mdub, "$003

i_mdua like table of wa_mdua, "$003

i_mdup like table of wa_mdup. "$003

  • Data used for products on order "$006

data: begin of wa_ordsrc, "$006

ebeln type ekko-ebeln, "$006

lifnr type ekko-lifnr, "$006

vname type lfa1-name1, "$006

ebelp type ekpo-ebelp, "$006

matnr type ekpo-matnr, "$006

werks type ekpo-werks, "$006

menge type ekpo-menge, "$006

meins type ekpo-meins, "$006

eindt type eket-eindt, "$006

end of wa_ordsrc, "$006

begin of wa_orditem, "$006

ebeln like wa_ordsrc-ebeln, "$006

ebelp like wa_ordsrc-ebelp, "$006

lifnr like wa_ordsrc-lifnr, "$006

vname like wa_ordsrc-vname, "$006

menge like wa_ordsrc-menge, "$006

meins like wa_ordsrc-meins, "$006

eindt like wa_ordsrc-eindt, "$006

end of wa_orditem, "$006

i_orditem like table of wa_orditem, "$006

begin of wa_order, "$006

matnr type ekpo-matnr, "$006

werks type ekpo-werks, "$006

items like i_orditem, "$006

end of wa_order, "$006

i_ordsrc like table of wa_ordsrc, "$006

i_order like hashed table of wa_order "$006

with unique key matnr werks. "$006

data: begin of wa_oborder, "$007

vbeln type vbbe-vbeln, "$007

kunnr type vbbe-kunnr, "$007

matnr type vbbe-matnr, "$007

vmeng type vbbe-vmeng, "$007

meins type vbbe-meins, "$007

edatu type vbep-edatu, "$007

kname type kna1-name1, "$007

end of wa_oborder, "$007

i_oborder like table of wa_oborder. "$007

data: begin of wa_srcplt, "$009

sobsl type zsrcplt-sobsl, "$009

stext type zsrcplt-stext, "$009

end of wa_srcplt, "$009

i_srcplt like hashed table of wa_srcplt "$009

with unique key sobsl. "$009

field-symbols: <order> like wa_order. "$006

----


*Constants

----


constants: c_mat_uom type mara-meins value 'CS', "Cases

c_status1(2) value '01',

c_status2(2) value '99',

----


  • REMOVED "$003

----


  • c_dtart TYPE mdkp-dtart VALUE 'MD', "$002

  • c_plscn TYPE mdkp-plscn VALUE '000', "$002

  • c_delkzun1 TYPE mdtb-delkz VALUE 'U2', "$002

  • c_delkzun2 TYPE mdtb-delkz VALUE 'U3', "$002

  • c_delkzun TYPE mdtb-delkz VALUE 'Ux', "$002

  • c_delkzob TYPE mdtb-delkz VALUE 'VC', "$002

----


c_vbbe_c type vbbe-vbtyp value 'C', "$003

c_vbbe_j type vbbe-vbtyp value 'J', "$003

c_united(1) value 'U', "$003

c_otherb(1) value 'O', "$003

c_lsizee type i value 155, "$005

c_lsizeg type i value 111, "$005

c_lsized type i value 22, "$005

c_lsizese type i value 30, "$005

c_lsizesg type i value 18, "$005

c_lsizepe type i value 30, "$006

c_lsizepg type i value 18, "$006

c_lsizeb type i value 36, "$005

c_spbh(2) value '41', "$005

c_spch(2) value '42', "$005

c_spbr(2) value '44', "$005

c_spag(2) value '43', "$005

c_spht(2) value '46', "$005

c_spsv(2) value '47', "$005

c_spgp(2) value '48', "$005

c_sp(2) value ' '. "$005

----


*Parameters / Select Options

----


selection-screen begin of block bl_1

with frame title text-001.

selection-screen begin of line.

parameters: p_ereg radiobutton group 1 default 'X'. "east

selection-screen comment 4(27) text-044 for field p_ereg.

parameters: p_demand as checkbox. "$002

selection-screen comment 35(11) text-048 for field p_demand."$002

selection-screen end of line.

selection-screen begin of line.

parameters: p_greg radiobutton group 1. "gulf

selection-screen comment 4(30) text-045 for field p_greg.

parameters: p_dplant(2) type n. "$002

selection-screen comment 38(15) text-049 for field p_dplant."$002

selection-screen comment 53(13) text-053. "$002

selection-screen end of line.

*SELECTION-SCREEN SKIP.

selection-screen end of block bl_1.

selection-screen begin of block bl_2

with frame title text-043.

selection-screen begin of line.

parameters: p_lall as checkbox default 'X'.

selection-screen comment 4(20) text-046 for field p_lall.

selection-screen position 30.

parameters: p_ltrns as checkbox. "separate

selection-screen comment 34(30) text-040 for field p_ltrns.

selection-screen end of line.

selection-screen begin of line.

parameters: p_lprd as checkbox.

selection-screen comment 4(20) text-047 for field p_lprd.

selection-screen position 30.

parameters: p_ltrni as checkbox. "integrated

selection-screen comment 34(30) text-041 for field p_ltrni.

selection-screen end of line.

parameters: p_src as checkbox. "$005

parameters: p_pur as checkbox. "$006

selection-screen end of block bl_2.

select-options p_plant for wa_rec-plant no-display.

----


*Initialization

----


initialization.

f_date = sy-datum.

f_time = sy-uzeit.

perform get_srcplt. "$009

----


*At Selection-Screen

----


at selection-screen.

if sy-ucomm = 'ONLI'. "$002

if not p_demand is initial and p_dplant is initial. "$002

message e003(zfi) with text-050 text-049. "$002

elseif p_demand is initial and not p_dplant is initial. "$002

message w003(zfi) with text-051 text-049 "$002

text-052 text-048. "$002

elseif not p_demand is initial and "$002

p_dplant <> '10' and p_dplant <> '20' and "$002

p_dplant <> '51' and p_dplant <> '56'. "$002

message e003(zfi) with text-054 text-049. "$002

endif. "$002

endif. "$002

----


*Start Of Selection

----


start-of-selection.

format color col_background intensified off.

if p_lall is initial and p_lprd is initial.

f_header = space.

write / text-026.

else.

perform choose_plants.

perform retreive_data.

  • see if any data was selected

describe table itab_rec_all lines f_lines1.

describe table itab_rec_prd lines f_lines2.

if f_lines1 = 0 and f_lines2 = 0.

f_header = space.

write / text-025.

else.

  • pull in the demand if required "$002

if p_demand = 'X'. "$002

perform get_demand. "$002

endif. "$002

  • pull in the products on order if required "$006

if p_pur = 'X'. "$006

perform get_onorder. "$006

endif. "$006

perform process_data.

clear g_matnr. "$005

endif.

endif.

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

*Line Selection

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

at line-selection. "$005 "$007

perform line_selection.

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

*Top of Page

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

top-of-page.

data: f_pos type i,

l_len type i. "$006

set left scroll-boundary column 35.

  • write out page header

format color col_background intensified off.

f_pos = sy-linsz - 11.

write: / text-002.

if not p_demand is initial. "$002

format color col_background intensified on. "$002

write: text-049, p_dplant. "$002

format color col_background intensified off. "$002

endif. "$002

write: at f_pos text-021 no-gap, sy-pagno no-gap.

f_pos = sy-linsz - 28.

write: / f_current_title,

at f_pos text-022, f_date, f_time.

  • write out the column headers

uline.

if f_header = 'X'.

format color col_heading intensified off.

write: sy-vline as line no-gap, text-003 no-gap,

sy-vline as line no-gap, text-004 no-gap.

if not p_demand is initial.

write: sy-vline as line no-gap, text-055 no-gap centered,

sy-vline as line no-gap, text-056 no-gap centered.

endif.

l_len = '10'. "$006

if not p_src is initial. "$006

add 3 to l_len. "$006

endif. "$006

if not p_pur is initial. "$006

add 3 to l_len. "$006

endif. "$006

if p_ereg = 'X'.

----


  • CHANGED "$006

----


  • IF p_src IS INITIAL. "$005

  • WRITE: sy-vline AS LINE NO-GAP, text-011 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-012 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-031 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-013 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-014 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-015 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-016 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-017 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-018 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-019 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-020 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP.

  • ELSE. "$005

  • WRITE: sy-vline AS LINE NO-GAP, "$005

  • (13) text-011 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • (13) text-012 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • (13) text-031 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • (13) text-013 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • (13) text-014 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • (13) text-015 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • (13) text-016 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • (13) text-017 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • (13) text-018 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • (13) text-019 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • text-020 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP. "$005

  • ENDIF. "$005

----


write: sy-vline as line no-gap, "$006

at (l_len) text-011 no-gap centered, "$006

sy-vline as line no-gap, "$006

at (l_len) text-012 no-gap centered, "$006

sy-vline as line no-gap, "$006

at (l_len) text-031 no-gap centered, "$006

sy-vline as line no-gap, "$006

at (l_len) text-013 no-gap centered, "$006

sy-vline as line no-gap, "$006

at (l_len) text-014 no-gap centered, "$006

sy-vline as line no-gap, "$006

at (l_len) text-015 no-gap centered, "$006

sy-vline as line no-gap, "$006

at (l_len) text-016 no-gap centered, "$006

sy-vline as line no-gap, "$006

at (l_len) text-017 no-gap centered, "$006

sy-vline as line no-gap, "$006

at (l_len) text-018 no-gap centered, "$006

sy-vline as line no-gap, "$006

at (l_len) text-019 no-gap centered, "$006

sy-vline as line no-gap, "$006

text-020 no-gap centered, "$006

sy-vline as line no-gap. "$006

----


else.

----


  • CHANGED "$006

----


  • IF p_src IS INITIAL.

  • WRITE: sy-vline AS LINE NO-GAP, text-005 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-010 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-006 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-007 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-008 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-009 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP, text-020 NO-GAP CENTERED,

  • sy-vline AS LINE NO-GAP.

*

  • ELSE.

  • WRITE: sy-vline AS LINE NO-GAP, "$005

  • (13) text-005 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • (13) text-010 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • (13) text-006 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • (13) text-007 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • (13) text-008 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • (13) text-009 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP, "$005

  • text-020 NO-GAP CENTERED, "$005

  • sy-vline AS LINE NO-GAP. "$005

  • ENDIF.

  • ENDIF.

----


write: sy-vline as line no-gap, "$006

at (l_len) text-005 no-gap centered, "$006

sy-vline as line no-gap, "$006

at (l_len) text-010 no-gap centered, "$006

sy-vline as line no-gap, "$006

at (l_len) text-006 no-gap centered, "$006

sy-vline as line no-gap, "$006

at (l_len) text-007 no-gap centered, "$006

sy-vline as line no-gap, "$006

at (l_len) text-008 no-gap centered, "$006

sy-vline as line no-gap, "$006

at (l_len) text-009 no-gap centered, "$006

sy-vline as line no-gap, "$006

text-020 no-gap centered, "$006

sy-vline as line no-gap. "$006

endif.

----


uline.

endif.

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

*End of Page

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

end-of-page.

uline.

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

*Subroutines

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

&----


*& Form choose_plants

&----


  • Add in the correct plants to the p_plant table

----


  • --> p1 text

  • <-- p2 text

----


form choose_plants.

move: 'I' to p_plant-sign,

'EQ' to p_plant-option.

if p_ereg = 'X'.

move: '1010' to p_plant-low.

append p_plant.

move: '2010' to p_plant-low.

append p_plant.

move: '3010' to p_plant-low.

append p_plant.

move: '2011' to p_plant-low.

append p_plant.

move: '2012' to p_plant-low.

append p_plant.

move: '1020' to p_plant-low.

append p_plant.

move: '2020' to p_plant-low.

append p_plant.

move: '3020' to p_plant-low.

append p_plant.

move: '2022' to p_plant-low.

append p_plant.

move: '2030' to p_plant-low.

append p_plant.

move: '2033' to p_plant-low.

append p_plant.

move: '2060' to p_plant-low.

append p_plant.

move: '2040' to p_plant-low.

append p_plant.

move: '2031' to p_plant-low.

append p_plant.

move: '2062' to p_plant-low.

append p_plant.

move: '2061' to p_plant-low.

append p_plant.

move: '2032' to p_plant-low.

append p_plant.

else.

move: '1051' to p_plant-low.

append p_plant.

move: '2051' to p_plant-low.

append p_plant.

move: '3051' to p_plant-low.

append p_plant.

move: '1056' to p_plant-low.

append p_plant.

move: '2056' to p_plant-low.

append p_plant.

move: '3056' to p_plant-low.

append p_plant.

move: '2052' to p_plant-low.

append p_plant.

move: '2054' to p_plant-low.

append p_plant.

move: '2053' to p_plant-low.

append p_plant.

move: '2055' to p_plant-low.

append p_plant.

endif.

endform. " choose_plants

**&----


*

**& Form get_cases

**&----


*

    • text

**----


*

    • -->P_WA_REC_UNRES text

**----


*

*FORM get_cases USING p_qty.

*

  • DATA: f_factor TYPE f.

*

*

    • CALL FUNCTION 'MC_UNIT_CONVERSION'

    • EXPORTING

    • matnr = wa_rec-matnr

    • nach_meins = c_mat_uom

    • von_meins = wa_rec-uom

    • IMPORTING

    • umref = f_factor.

**

    • p_qty = p_qty * f_factor.

*

*

*ENDFORM. " get_cases

&----


*& Form retreive_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form retreive_data.

describe field wa_rec-flavor length f_len.

----


  • CHANGED "$001

----


  • SUBTRACT 8 FROM f_len.

----


subtract 13 from f_len. "$001

----


  • pull out the data

select mard~matnr

mard~werks

mard~labst

mara~extwg

mara~prdha

mara~meins

marc~trame

marc~beskz

marc~sobsl "$005

makt~maktx

into wa_rec

from mard

join mara on mardmatnr = maramatnr

join marc on mardmatnr = marcmatnr

and mardwerks = marcwerks

join makt on mardmatnr = maktmatnr

where mard~lgort = 'FULL'

and mard~werks in p_plant

and marc~mmsta <> c_status1

and marc~mmsta <> c_status2

and mara~mstae <> c_status1

and mara~mstae <> c_status2

----


  • CHANGED "$004

----


  • AND ( mara~mtart = 'ZFGS'

  • OR mara~mtart = 'LEER' )

----


and mara~mtart = 'ZFGS' "$004

----


order by mard~matnr.

clear wa_rec_all.

clear wa_rec_prd.

wa_src-matnr = wa_rec-matnr. "$005

wa_src-plant = wa_rec-plant. "$005

wa_src-beskz = wa_rec-prod. "$005

wa_src-sobsl = wa_rec-sobsl. "$005

insert wa_src into table i_src. "$005

wa_rec_all-matgrp = wa_rec-matgrp.

----


  • CHANGED "$001

----


  • wa_rec_all-flavor = wa_rec-flavor+f_len(8).

----


wa_rec_all-flavor = wa_rec-flavor+f_len(13). "$001

----


wa_rec_all-matnr = wa_rec-matnr.

wa_rec_all-matdec = wa_rec-matdec.

wa_rec_all-plant = wa_rec-plant.

wa_rec_all-beskz = wa_rec-prod.

  • get these quantities in cases

  • PERFORM get_cases USING wa_rec-unres.

  • PERFORM get_cases USING wa_rec-trans.

if p_ltrns = 'X'.

wa_rec_all-qty = wa_rec-trans.

insert wa_rec_all into table itab_rec_trans.

endif.

if p_ltrni = 'X'.

wa_rec_all-qty = wa_rec-unres + wa_rec-trans.

else.

wa_rec_all-qty = wa_rec-unres.

endif.

insert wa_rec_all into table itab_rec_all.

  • see if we are capturing produced goods

if p_lprd = 'X'.

if f_matnr <> wa_rec-matnr and not f_matnr is initial.

  • check to see if the last material was produced

if f_found = space.

  • this wasn't produced so delete the entries

  • continue deleting until return code = 4 (Entry did not exist)

  • because DELETE TABLE only deletes the first entry

do.

delete table itab_rec_prd with table key matgrp = f_matgrp

flavor = f_flavor

matnr = f_matnr.

if sy-subrc = 4.

exit.

endif.

enddo.

endif.

  • reset the keys

f_matnr = wa_rec-matnr.

f_matgrp = wa_rec-matgrp.

----


  • CHANGED "$001

----


  • f_flavor = wa_rec-flavor+f_len(8).

----


f_flavor = wa_rec-flavor+f_len(13). "$001

----


f_found = space.

if wa_rec-prod = 'E'.

f_found = 'X'.

endif.

else.

if wa_rec-prod = 'E'.

f_found = 'X'.

endif.

f_matnr = wa_rec-matnr.

f_matgrp = wa_rec-matgrp.

----


  • CHANGED "$001

----


  • f_flavor = wa_rec-flavor+f_len(8).

----


f_flavor = wa_rec-flavor+f_len(13). "$001

----


endif.

  • insert this record into the prd table

insert wa_rec_all into table itab_rec_prd.

endif. "p_lprd = 'X'

endselect.

  • check to see if the last material was produced

if sy-subrc = 0 and p_lprd = 'X' and f_found = space.

  • this wasn't produced so delete the entries

  • continue deleting until return code = 4 (Entry did not exist)

  • because DELETE TABLE only deletes the first entry

do.

delete table itab_rec_prd with table key matgrp = f_matgrp

flavor = f_flavor

matnr = f_matnr.

if sy-subrc = 4.

exit.

endif.

enddo.

endif.

endform. " retreive_data

&----


*& Form process_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form process_data.

data: l_size type i.

if p_ereg = 'X'.

l_size = c_lsizee.

if not p_src is initial.

add c_lsizese to l_size.

endif.

if not p_pur is initial. "$006

add c_lsizepe to l_size. "$006

endif. "$006

else.

l_size = c_lsizeg.

if not p_src is initial.

add c_lsizesg to l_size.

endif.

if not p_pur is initial. "$006

add c_lsizepg to l_size. "$006

endif. "$006

endif.

if not p_demand is initial.

add c_lsized to l_size.

endif.

if p_lall = 'X'.

f_current_title = text-023.

new-page line-size l_size.

***REMOVE FOR PRODUCTION**************

f_matgrp = 's'.

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

move itab_rec_all to itab_rec_fin.

perform write_list.

endif.

if p_lprd = 'X'.

f_current_title = text-024.

new-page line-size l_size.

***REMOVE FOR PRODUCTION**************

f_matgrp = 's'.

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

move itab_rec_prd to itab_rec_fin.

perform write_list.

endif.

if p_ltrns = 'X'.

f_current_title = text-030.

new-page line-size l_size.

***REMOVE FOR PRODUCTION**************

f_matgrp = 's'.

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

move itab_rec_trans to itab_rec_fin.

perform write_list.

endif.

endform. " process_data

&----


*& Form write_list

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form write_list.

describe field wa_rec_all-matnr length f_num.

subtract 6 from f_num.

clear: wa_line_total, wa_sub_total, wa_g_total.

loop at itab_rec_fin into wa_rec_all.

  • Check to see if this is a new material group

if f_matgrp <> wa_rec_all-matgrp.

  • New material group encountered

if not wa_line_total is initial.

perform write_line.

perform write_sub_total.

endif.

clear wa_line_total.

clear wa_sub_total.

format color col_positive intensified off.

write: / sy-vline as line no-gap,

text-027, wa_rec_all-matgrp no-gap,

sy-vline as line no-gap,

at sy-linsz sy-vline as line no-gap.

clear f_int.

f_matgrp = wa_rec_all-matgrp.

f_flavor = wa_rec_all-flavor.

f_matnr = wa_rec_all-matnr.

elseif f_flavor <> wa_rec_all-flavor.

  • New flavor encountered

perform write_line.

f_flavor = wa_rec_all-flavor.

f_matnr = wa_rec_all-matnr.

elseif f_matnr <> wa_rec_all-matnr.

  • New material encountered

perform write_line.

f_matnr = wa_rec_all-matnr.

endif.

  • match the correct plants with the correct columns

perform calc_plant_totals.

endloop.

if sy-subrc = 0.

  • write out the last line, sub-total and grand total

perform write_line.

perform write_sub_total.

perform write_g_total.

else.

write 'write list'.

endif.

endform. " write_list

&----


*& Form calc_plant_totals

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form calc_plant_totals.

shift wa_rec_all-matdec left deleting leading space.

wa_line_total-matnr = wa_rec_all-matnr+f_num(6).

  • wa_line_total-matdec = wa_rec_all-matdec(25).

wa_line_total-matdec = wa_rec_all-matdec. "$010

if p_ereg = 'X'.

  • Eastern region

case wa_rec_all-plant.

when '1010' or '2010' or '3010' or '2011' or '2012'.

add wa_rec_all-qty to wa_line_total-col1.

when '1020' or '2020' or '3020'.

add wa_rec_all-qty to wa_line_total-col2.

when '2022'.

add wa_rec_all-qty to wa_line_total-col25.

when '2030' or '2033'.

add wa_rec_all-qty to wa_line_total-col3.

when '2060'.

add wa_rec_all-qty to wa_line_total-col4.

when '2040'.

add wa_rec_all-qty to wa_line_total-col5.

when '2031'.

add wa_rec_all-qty to wa_line_total-col6.

when '2062'.

add wa_rec_all-qty to wa_line_total-col7.

when '2061'.

add wa_rec_all-qty to wa_line_total-col8.

when '2032'.

add wa_rec_all-qty to wa_line_total-col9.

endcase.

else.

  • Gulf region

case wa_rec_all-plant.

when '1051' or '2051' or '3051'.

add wa_rec_all-qty to wa_line_total-col1.

when '1056' or '2056' or '3056'.

add wa_rec_all-qty to wa_line_total-col2.

when '2052'.

add wa_rec_all-qty to wa_line_total-col3.

when '2054'.

add wa_rec_all-qty to wa_line_total-col4.

when '2053'.

add wa_rec_all-qty to wa_line_total-col5.

when '2055'.

add wa_rec_all-qty to wa_line_total-col6.

endcase.

endif.

endform. " calc_plant_totals

&----


*& Form write_line

&----


  • text

----


  • -->

----


form write_line.

data: f_mat(6),

f_matnr_full like mara-matnr,

l_matnr type mara-matnr,

l_qty(5) type p decimals 0.

if f_int = 'X'.

format color col_normal intensified on.

clear f_int.

else.

format color col_normal intensified off.

f_int = 'X'.

endif.

add wa_line_total-col1 to wa_sub_total-col1.

add wa_line_total-col2 to wa_sub_total-col2.

add wa_line_total-col25 to wa_sub_total-col25.

add wa_line_total-col3 to wa_sub_total-col3.

add wa_line_total-col4 to wa_sub_total-col4.

add wa_line_total-col5 to wa_sub_total-col5.

add wa_line_total-col6 to wa_sub_total-col6.

add wa_line_total-col7 to wa_sub_total-col7.

add wa_line_total-col8 to wa_sub_total-col8.

add wa_line_total-col9 to wa_sub_total-col9.

f_matnr_full = wa_line_total-matnr.

shift f_matnr_full right deleting trailing space.

overlay f_matnr_full with '000000000000000000' only space.

f_mat = wa_line_total-matnr.

shift f_mat left deleting leading '0'.

write: / sy-vline as line no-gap, f_mat right-justified no-gap,

sy-vline as line no-gap, wa_line_total-matdec no-gap,

sy-vline as line no-gap.

  • hide the material number

g_matnr = f_matnr_full. "$006

hide g_matnr. "$006

g_maktx = wa_line_total-matdec. "$006

hide g_maktx. "$006

if not p_demand is initial. "$002

l_matnr = wa_line_total-matnr. "$002

shift l_matnr right deleting trailing space. "$002

overlay l_matnr with '000000000000000000' only space. "$002

  • other bottlers

clear wa_demand. "$002

read table i_demand into wa_demand "$002

with table key matnr = l_matnr "$002

----


  • CHANGED "$003

----


  • delkz = c_delkzob. "$002

----


delkz = c_otherb. "$003

----


l_qty = wa_demand-qty. "$002

add l_qty to wa_sub_total-colob. "$002

write: l_qty no-gap, sy-vline as line no-gap. "$002

  • united

clear wa_demand. "$002

read table i_demand into wa_demand "$002

with table key matnr = l_matnr "$002

----


  • CHANGED "$003

----


  • delkz = c_delkzun. "$002

----


delkz = c_united. "$003

----


l_qty = wa_demand-qty. "$002

add l_qty to wa_sub_total-colun. "$002

write: l_qty no-gap, sy-vline as line no-gap. "$002

endif. "$002

  • check for purchased

if not p_pur is initial. "$006

if not p_ereg is initial. "$006

  • first column is birmingham

perform read_pur using f_matnr_full '1010' '2010' "$006

'3010' '2011' '2012'. "$006

else. "$006

  • first column is br

perform read_pur using f_matnr_full '1051' '2051' "$006

'3051' space space. "$006

endif. "$006

endif.

if not p_src is initial. "$005

if not p_ereg is initial. "$005

  • first column is birmingham

perform read_src using f_matnr_full '1010'. "$005

else. "$005

  • first column is br

perform read_src using f_matnr_full '1051'. "$005

endif. "$005

endif. "$005

if wa_line_total-col1 = 0.

perform is_blocked using 1 f_matnr_full wa_line_total-col1.

else.

write wa_line_total-col1 no-gap.

endif.

write: sy-vline as line no-gap.

  • check for purchased

if not p_pur is initial. "$006

if not p_ereg is initial. "$006

  • this column is chatt

perform read_pur using f_matnr_full '1020' '2020' "$006

'3020' space space. "$006

else. "$006

  • first column is ht

perform read_pur using f_matnr_full '1056' '2056' "$006

'3056' space space. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$005

if not p_ereg is initial. "$005

  • this column is chatt

perform read_src using f_matnr_full '1020'. "$005

else. "$005

  • this column is ht

perform read_src using f_matnr_full '1056'. "$005

endif. "$005

endif. "$005

if wa_line_total-col2 = 0.

perform is_blocked using 2 f_matnr_full wa_line_total-col2.

else.

write wa_line_total-col2 no-gap.

endif.

if p_ereg = 'X'.

write: sy-vline as line no-gap.

  • check for purchased

if not p_pur is initial. "$006

  • this column is LM

perform read_pur using f_matnr_full '2022' space "$006

space space space. "$006

endif.

if not p_src is initial. "$005

perform read_src using f_matnr_full '2022'. "$005

endif. "$005

if wa_line_total-col25 = 0.

perform is_blocked using 25 f_matnr_full wa_line_total-col25.

else.

write wa_line_total-col25 no-gap.

endif.

endif.

write sy-vline as line no-gap.

  • check for purchased

if not p_pur is initial. "$006

if not p_ereg is initial. "$006

  • this column is aug

perform read_pur using f_matnr_full '2030' '2033' "$006

space space space. "$006

else. "$006

  • this column is mccomb

perform read_pur using f_matnr_full '2052' space "$006

space space space. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$005

if not p_ereg is initial. "$005

  • this column is aug

perform read_src using f_matnr_full '2030'. "$005

else. "$005

  • this column is mccomb

perform read_src using f_matnr_full '2052'. "$005

endif. "$005

endif. "$005

if wa_line_total-col3 = 0.

perform is_blocked using 3 f_matnr_full wa_line_total-col3.

else.

write wa_line_total-col3 no-gap.

endif.

write sy-vline as line no-gap.

  • check for purchased

if not p_pur is initial. "$006

if not p_ereg is initial. "$006

  • this column is sav

perform read_pur using f_matnr_full '2060' space "$006

space space space. "$006

else. "$006

  • this column is lav

perform read_pur using f_matnr_full '2054' space "$006

space space space. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$005

if not p_ereg is initial. "$005

  • this column is sav

perform read_src using f_matnr_full '2060'. "$005

else. "$005

  • this column is laf

perform read_src using f_matnr_full '2054'. "$005

endif. "$005

endif. "$005

if wa_line_total-col4 = 0.

perform is_blocked using 4 f_matnr_full wa_line_total-col4.

else.

write wa_line_total-col4 no-gap.

endif.

write sy-vline as line no-gap.

  • check for purchased

if not p_pur is initial. "$006

if not p_ereg is initial. "$006

  • this column is spart

perform read_pur using f_matnr_full '2040' space "$006

space space space. "$006

else. "$006

  • this column is lk

perform read_pur using f_matnr_full '2053' space "$006

space space space. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$005

if not p_ereg is initial. "$005

  • this column is spart

perform read_src using f_matnr_full '2040'. "$005

else. "$005

  • this column is lk

perform read_src using f_matnr_full '2053'. "$005

endif. "$005

endif. "$005

if wa_line_total-col5 = 0.

perform is_blocked using 5 f_matnr_full wa_line_total-col5.

else.

write wa_line_total-col5 no-gap.

endif.

write sy-vline as line no-gap.

  • check for purchased

if not p_pur is initial. "$006

if not p_ereg is initial. "$006

  • this column is way

perform read_pur using f_matnr_full '2031' space "$006

space space space. "$006

else. "$006

  • this column is gulf

perform read_pur using f_matnr_full '2055' space "$006

space space space. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$005

if not p_ereg is initial. "$005

  • this column is way

perform read_src using f_matnr_full '2031'. "$005

else. "$005

  • this column is gulf

perform read_src using f_matnr_full '2055'. "$005

endif. "$005

endif. "$005

if wa_line_total-col6 = 0.

perform is_blocked using 6 f_matnr_full wa_line_total-col6.

else.

write wa_line_total-col6 no-gap.

endif.

if p_ereg = 'X'.

write sy-vline as line no-gap.

  • check for purchased

if not p_pur is initial. "$006

  • this column is brun

perform read_pur using f_matnr_full '2062' space "$006

space space space. "$006

endif. "$006

if not p_src is initial. "$005

  • this column is brun

perform read_src using f_matnr_full '2062'. "$005

endif. "$005

if wa_line_total-col7 = 0.

perform is_blocked using 7 f_matnr_full wa_line_total-col7.

else.

write wa_line_total-col7 no-gap.

endif.

write sy-vline as line no-gap.

  • check for purchased

if not p_pur is initial. "$006

  • this column is states

perform read_pur using f_matnr_full '2061' space "$006

space space space. "$006

endif. "$006

if not p_src is initial. "$005

  • this column is states

perform read_src using f_matnr_full '2061'. "$005

endif. "$005

if wa_line_total-col8 = 0.

perform is_blocked using 8 f_matnr_full wa_line_total-col8.

else.

write wa_line_total-col8 no-gap.

endif.

write sy-vline as line no-gap.

  • check for purchased

if not p_pur is initial. "$006

  • this column is mcr

perform read_pur using f_matnr_full '2032' space "$006

space space space. "$006

endif. "$006

if not p_src is initial. "$005

  • this column is mcR

perform read_src using f_matnr_full '2032'. "$005

endif. "$005

if wa_line_total-col9 = 0.

perform is_blocked using 9 f_matnr_full wa_line_total-col9.

else.

write wa_line_total-col9 no-gap.

endif.

endif.

  • calculate line total

wa_line_total-col10 = wa_line_total-col1

+ wa_line_total-col2

+ wa_line_total-col25

+ wa_line_total-col3

+ wa_line_total-col4

+ wa_line_total-col5

+ wa_line_total-col6

+ wa_line_total-col7

+ wa_line_total-col8

+ wa_line_total-col9.

write: sy-vline as line no-gap, wa_line_total-col10 no-gap,

sy-vline as line no-gap.

clear wa_line_total.

endform. " write_line

&----


*& Form write_sub_total

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form write_sub_total.

data: l_len type i. "$006

add wa_sub_total-col1 to wa_g_total-col1.

add wa_sub_total-col2 to wa_g_total-col2.

add wa_sub_total-col25 to wa_g_total-col25.

add wa_sub_total-col3 to wa_g_total-col3.

add wa_sub_total-col4 to wa_g_total-col4.

add wa_sub_total-col5 to wa_g_total-col5.

add wa_sub_total-col6 to wa_g_total-col6.

add wa_sub_total-col7 to wa_g_total-col7.

add wa_sub_total-col8 to wa_g_total-col8.

add wa_sub_total-col9 to wa_g_total-col9.

add wa_sub_total-colob to wa_g_total-colob. "$002

add wa_sub_total-colun to wa_g_total-colun. "$002

  • write out the current sub total

format color col_total intensified off.

write: / sy-vline as line no-gap, text-028 no-gap.

if not p_demand is initial. "$002

write: sy-vline as line no-gap, wa_sub_total-colob no-gap,"$002

sy-vline as line no-gap, wa_sub_total-colun no-gap."$002

endif. "$002

----


  • Changed "006

----


  • IF p_src IS INITIAL. "$005

----


if p_src is initial and p_pur is initial. "$006

----


write: sy-vline as line no-gap, wa_sub_total-col1 no-gap,

sy-vline as line no-gap, wa_sub_total-col2 no-gap.

if p_ereg = 'X'.

write: sy-vline as line no-gap, wa_sub_total-col25 no-gap.

endif.

write: sy-vline as line no-gap, wa_sub_total-col3 no-gap,

sy-vline as line no-gap, wa_sub_total-col4 no-gap,

sy-vline as line no-gap, wa_sub_total-col5 no-gap,

sy-vline as line no-gap, wa_sub_total-col6 no-gap.

if p_ereg = 'X'.

write: sy-vline as line no-gap, wa_sub_total-col7 no-gap,

sy-vline as line no-gap, wa_sub_total-col8 no-gap,

sy-vline as line no-gap, wa_sub_total-col9 no-gap.

endif.

else. "$005

----


  • Changed "006

----


  • WRITE: sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_sub_total-col1 NO-GAP, "$005

  • sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_sub_total-col2 NO-GAP. "$005

  • IF p_ereg = 'X'. "$005

  • WRITE: sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_sub_total-col25 NO-GAP.

  • "$005

  • ENDIF. "$005

*

  • WRITE: sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_sub_total-col3 NO-GAP, "$005

  • sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_sub_total-col4 NO-GAP, "$005

  • sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_sub_total-col5 NO-GAP, "$005

  • sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_sub_total-col6 NO-GAP. "$005

*

  • IF p_ereg = 'X'. "$005

  • WRITE: sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_sub_total-col7 NO-GAP, "$005

  • sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_sub_total-col8 NO-GAP, "$005

  • sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_sub_total-col9 NO-GAP. "$005

  • ENDIF. "$005

----


l_len = 0. "$006

if not p_src is initial. "$006

add 3 to l_len. "$006

endif. "$006

if not p_pur is initial. "$006

add 3 to l_len. "$006

endif. "$006

write: sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_sub_total-col1 no-gap, "$006

sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_sub_total-col2 no-gap. "$006

if p_ereg = 'X'. "$006

write: sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_sub_total-col25 no-gap.

"$006

endif. "$006

write: sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_sub_total-col3 no-gap, "$006

sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_sub_total-col4 no-gap, "$006

sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_sub_total-col5 no-gap, "$006

sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_sub_total-col6 no-gap. "$006

if p_ereg = 'X'. "$006

write: sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_sub_total-col7 no-gap, "$006

sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_sub_total-col8 no-gap, "$006

sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_sub_total-col9 no-gap. "$006

endif.

----


endif. "$005

*calculate line total

wa_sub_total-col10 = wa_sub_total-col1

+ wa_sub_total-col2

+ wa_sub_total-col25

+ wa_sub_total-col3

+ wa_sub_total-col4

+ wa_sub_total-col5

+ wa_sub_total-col6

+ wa_sub_total-col7

+ wa_sub_total-col8

+ wa_sub_total-col9.

write: sy-vline as line no-gap, wa_sub_total-col10 no-gap,

sy-vline as line no-gap.

endform. " write_sub_total

&----


*& Form write_g_total

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form write_g_total.

data: l_len type i.

uline.

  • write out the grand total

format color col_total intensified on.

write: / sy-vline as line no-gap, text-029 no-gap.

if not p_demand is initial. "$002

write: sy-vline as line no-gap, wa_g_total-colob no-gap,"$002

sy-vline as line no-gap, wa_g_total-colun no-gap."$002

endif. "$002

----


  • Changed "006

----


  • IF p_src IS INITIAL. "$005

----


if p_src is initial and p_pur is initial. "$006

----


write: sy-vline as line no-gap, wa_g_total-col1 no-gap,

sy-vline as line no-gap, wa_g_total-col2 no-gap.

if p_ereg = 'X'.

write: sy-vline as line no-gap, wa_g_total-col25 no-gap.

endif.

write: sy-vline as line no-gap, wa_g_total-col3 no-gap,

sy-vline as line no-gap, wa_g_total-col4 no-gap,

sy-vline as line no-gap, wa_g_total-col5 no-gap,

sy-vline as line no-gap, wa_g_total-col6 no-gap.

if p_ereg = 'X'.

write: sy-vline as line no-gap, wa_g_total-col7 no-gap,

sy-vline as line no-gap, wa_g_total-col8 no-gap,

sy-vline as line no-gap, wa_g_total-col9 no-gap.

endif.

else. "$005

----


  • Changed "006

----


  • WRITE: sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_g_total-col1 NO-GAP, "$005

  • sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_g_total-col2 NO-GAP. "$005

  • IF p_ereg = 'X'. "$005

  • WRITE: sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_g_total-col25 NO-GAP.

  • ENDIF. "$005

*

  • WRITE: sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_g_total-col3 NO-GAP, "$005

  • sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_g_total-col4 NO-GAP, "$005

  • sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_g_total-col5 NO-GAP, "$005

  • sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_g_total-col6 NO-GAP. "$005

*

  • IF p_ereg = 'X'. "$005

  • WRITE: sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_g_total-col7 NO-GAP, "$005

  • sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_g_total-col8 NO-GAP, "$005

  • sy-vline AS LINE NO-GAP, c_sp, "$005

  • wa_g_total-col9 NO-GAP. "$005

  • ENDIF. "$005

----


l_len = 0. "$006

if not p_src is initial. "$006

add 3 to l_len. "$006

endif. "$006

if not p_pur is initial. "$006

add 3 to l_len. "$006

endif. "$006

write: sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_g_total-col1 no-gap, "$006

sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_g_total-col2 no-gap. "$006

if p_ereg = 'X'. "$006

write: sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_g_total-col25 no-gap.

endif. "$006

write: sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_g_total-col3 no-gap, "$006

sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_g_total-col4 no-gap, "$006

sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_g_total-col5 no-gap, "$006

sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_g_total-col6 no-gap. "$006

if p_ereg = 'X'. "$006

write: sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_g_total-col7 no-gap, "$006

sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_g_total-col8 no-gap, "$006

sy-vline as line no-gap, at (l_len) space no-gap,"$006

wa_g_total-col9 no-gap. "$006

endif. "$006

----


endif. "$005

*calculate line total

wa_g_total-col10 = wa_g_total-col1

+ wa_g_total-col2

+ wa_g_total-col25

+ wa_g_total-col3

+ wa_g_total-col4

+ wa_g_total-col5

+ wa_g_total-col6

+ wa_g_total-col7

+ wa_g_total-col8

+ wa_g_total-col9.

write: sy-vline as line no-gap, wa_g_total-col10 no-gap,

sy-vline as line no-gap.

uline.

endform. " write_g_total

&----


*& Form is_blocked

&----


  • text

----


  • -->P_1 text

  • -->P_F_MAT text

  • -->P_WA_LINE_TOTAL_COL1 text

----


form is_blocked using p_which

p_matnr

p_qty.

data: l_col type i. "$005

clear p_plant.

refresh p_plant.

move: 'I' to p_plant-sign,

'EQ' to p_plant-option.

if p_ereg = 'X'.

  • Eastern region

case p_which.

when 1.

move: '1010' to p_plant-low.

append p_plant.

move: '2010' to p_plant-low.

append p_plant.

move: '3010' to p_plant-low.

append p_plant.

move: '2011' to p_plant-low.

append p_plant.

move: '2012' to p_plant-low.

append p_plant.

when 2.

move: '1020' to p_plant-low.

append p_plant.

move: '2020' to p_plant-low.

append p_plant.

move: '3020' to p_plant-low.

append p_plant.

when 25.

move: '2022' to p_plant-low.

append p_plant.

when 3.

move: '2030' to p_plant-low.

append p_plant.

move: '2033' to p_plant-low.

append p_plant.

when 4.

move: '2060' to p_plant-low.

append p_plant.

when 5.

move: '2040' to p_plant-low.

append p_plant.

when 6.

move: '2031' to p_plant-low.

append p_plant.

when 7.

move: '2062' to p_plant-low.

append p_plant.

when 8.

move: '2061' to p_plant-low.

append p_plant.

when 9.

move: '2032' to p_plant-low.

append p_plant.

endcase.

else.

  • Gulf region

case p_which.

when 1.

move: '1051' to p_plant-low.

append p_plant.

move: '2051' to p_plant-low.

append p_plant.

move: '3051' to p_plant-low.

append p_plant.

when 2.

move: '1056' to p_plant-low.

append p_plant.

move: '2056' to p_plant-low.

append p_plant.

move: '3056' to p_plant-low.

append p_plant.

when 3.

move: '2052' to p_plant-low.

append p_plant.

when 4.

move: '2054' to p_plant-low.

append p_plant.

when 5.

move: '2053' to p_plant-low.

append p_plant.

when 6.

move: '2055' to p_plant-low.

append p_plant.

endcase.

endif.

  • see if this material is blocked for all of the selected plants

select single matnr from marc into f_matnr

where matnr = p_matnr

and werks in p_plant

and mmsta <> c_status1

and mmsta <> c_status2.

if sy-subrc = 0.

write p_qty no-gap.

else.

if not p_src is initial. "$005

l_col = sy-colno - 3. "$005

write: at l_col ' '. "$005

endif. "$005

write ' *** ' no-gap.

endif.

endform. " is_blocked

&----


*& Form get_demand

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form get_demand. "$002

data: l_datet like sy-datum, "$002

l_datef like l_datet, "$002

l_united type mdkp-plwrk, "$002

l_otherb type mdkp-plwrk, "$002

l_day type scal-indicator. "$002

l_datet = sy-datum. "$002

l_datef = l_datet. "$002

  • first, decide when next friday is.

call function 'DATE_COMPUTE_DAY' "$002

exporting "$002

date = l_datet "$002

importing "$002

day = l_day. "$002

  • add number of days until next Friday

case l_day. "$002

when '1'. "$002

add 11 to l_datef. "$002

when '2'. "$002

add 10 to l_datef. "$002

when '3'. "$002

add 9 to l_datef. "$002

when '4'. "$002

add 8 to l_datef. "$002

when '5'. "$002

add 7 to l_datef. "$002

when '6'. "$002

add 6 to l_datef. "$002

when '7'. "$002

add 12 to l_datef. "$002

endcase. "$002

  • fill united plant and otherbottlers

concatenate '10' p_dplant into l_united. "$002

concatenate '30' p_dplant into l_otherb. "$002

----


  • CHANGED "$003

----


  • SELECT matnr plwrk dtnum cflag INTO wa_mdkp "$002

  • FROM mdkp "$002

  • WHERE mdkp~dtart = c_dtart "$002

  • AND mdkp~plscn = c_plscn "$002

  • AND ( mdkp~plwrk = l_united OR "$002

  • mdkp~plwrk = l_otherb ). "$002

*

*

  • CLEAR mdtbx. REFRESH mdtbx. "$002

  • IF wa_mdkp-cflag = 'X'. "$002

    • pull from mdtc

  • IMPORT mdtbx FROM DATABASE mdtc(ar) ID wa_mdkp-dtnum. "$002

*

*

  • ELSE. "$002

    • pull from mdtb

  • SELECT * FROM mdtb INTO TABLE mdtbx "$002

  • WHERE mdtb~dat00 <= l_datef "$002

  • AND ( mdtb~delkz = c_delkzun1 OR "$002

  • mdtb~delkz = c_delkzun2 OR "$002

  • mdtb~delkz = c_delkzob ). "$002

*

  • ENDIF. "$002

*

*

  • LOOP AT mdtbx. "$002

  • CLEAR wa_demand. "$002

  • CHECK mdtbx-delkz = c_delkzun1 OR "$002

  • mdtbx-delkz = c_delkzun2 OR "$002

  • mdtbx-delkz = c_delkzob. "$002

*

  • CHECK mdtbx-dat00 <= l_datef. "$002

*

  • IF mdtbx-delkz = c_delkzun1 OR "$002

  • mdtbx-delkz = c_delkzun2. "$002

    • this is united demand so make sure this is a sales or prd plant

  • CHECK mdtbx-wrk02(2) = '10' OR "$002

  • mdtbx-wrk02(2) = '20'. "$002

*

    • make sure demand plant begins with '10'

  • CHECK wa_mdkp-dplnt(2) = '10'. "$002

*

    • make delkz the same

  • mdtbx-delkz = c_delkzun. "$002

  • ELSE. "$002

    • make sure demand plant begins with '30'

  • CHECK wa_mdkp-dplnt(2) = '30'. "$002

  • ENDIF. "$002

*

  • wa_demand-matnr = wa_mdkp-matnr. "$002

  • wa_demand-qty = mdtbx-mng01. "$002

  • wa_demand-delkz = mdtbx-delkz. "$002

  • COLLECT wa_demand INTO i_demand. "$002

*

  • ENDLOOP. "$002

*

*

  • ENDSELECT. "$002

----


  • get vbbe

select matnr werks vbtyp mbdat meins vmeng "$003

from vbbe into table i_vbbe "$003

where vmeng <> 0 and mbdat <= l_datef "$003

and ( werks = l_united or werks = l_otherb ). "$003

  • loop through and collect into wa_demand

loop at i_vbbe into wa_vbbe. "$003

clear wa_demand. "$003

wa_demand-matnr = wa_vbbe-matnr. "$003

if wa_vbbe-vbtyp = c_vbbe_c and wa_vbbe-werks = l_otherb."$003

  • other bottler demand

wa_demand-delkz = c_otherb. "$003

elseif wa_vbbe-vbtyp = c_vbbe_j and wa_vbbe-werks = l_otherb."$003

  • other bottler demand

wa_demand-delkz = c_otherb. "$003

elseif wa_vbbe-vbtyp = c_vbbe_j and wa_vbbe-werks = l_united."$003

  • united demand

wa_demand-delkz = c_united. "$003

else. "$003

continue. "$003

endif. "$003

  • units are store in base unit of measure - no conv necessary

wa_demand-qty = wa_vbbe-qty. "$003

collect wa_demand into i_demand. "$003

endloop. "$003

  • get mdub

select mdubmatnr mdubreswk mdub~meins "$003

mdubmng02 mdubglmng mdub~eindt "$003

mdubwerks mdubplifz mara~meins "$003

from mdub "$003

join mara on mdubmatnr = maramatnr "$003

into table i_mdub "$003

where mng02 <> 0 and loekz = ' ' "$003

and reswk = l_united. "$003

loop at i_mdub into wa_mdub. "$003

clear wa_demand. "$003

wa_mdub-date = wa_mdub-date - wa_mdub-plifz. "$003

check wa_mdub-date <= l_datef. "$003

  • subtract the delivered quantity...

wa_demand-qty = wa_mdub-qty - wa_mdub-qtydl. "$003

check wa_demand-qty <> 0. "$003

  • make sure this is a sales or production plant

check wa_mdub-werks(2) = '10' or "$003

wa_mdub-werks(2) = '20'. "$003

if wa_mdub-uom <> wa_mdub-buom. "$003

perform conv_uom using wa_demand-qty wa_demand-qty "$003

wa_mdub-uom wa_mdub-matnr "$003

wa_mdub-buom. "$003

endif. "$003

  • this is all united demand

wa_demand-delkz = c_united. "$003

wa_demand-matnr = wa_mdub-matnr. "$003

collect wa_demand into i_demand. "$003

endloop. "$003

  • get mdua

select mduamatnr mduareswk mduawerks mduafrgdt "$003

mduamenge mduameins mara~meins "$003

from mdua

join mara on mduamatnr = maramatnr "$003

into table i_mdua "$003

where menge <> 0 and loekz = ' ' "$003

and reswk = l_united "$003

and frgdt <= l_datef. "$003

loop at i_mdua into wa_mdua. "$003

clear wa_demand. "$003

  • make sure this is a sales or production plant

check wa_mdua-werks(2) = '10' or "$003

wa_mdua-werks(2) = '20'. "$003

wa_demand-qty = wa_mdua-qty. "$003

if wa_mdua-uom <> wa_mdua-buom. "$003

perform conv_uom using wa_mdua-qty wa_demand-qty "$003

wa_mdua-uom wa_mdua-matnr "$003

wa_mdua-buom. "$003

endif.

  • this is all united demand

wa_demand-delkz = c_united. "$003

wa_demand-matnr = wa_mdua-matnr. "$003

collect wa_demand into i_demand. "$003

endloop. "$003

  • get mdup

select matnr pwwrk plwrk gsmng meins psttr "$003

from mdup into table i_mdup "$003

where gsmng <> 0 and plscn = '000' "$003

and pwwrk = l_united "$003

and psttr <= l_datef. "$003

loop at i_mdup into wa_mdup. "$003

clear wa_demand. "$003

  • make sure this is a sales or production plant

check wa_mdup-plwrk(2) = '10' or "$003

wa_mdup-plwrk(2) = '20'. "$003

  • units are store in base unit of measure - no conv necessary

wa_demand-qty = wa_mdup-qty. "$003

  • this is all united demand

wa_demand-delkz = c_united. "$003

wa_demand-matnr = wa_mdup-matnr. "$003

collect wa_demand into i_demand. "$003

endloop. "$003

----


endform. " get_demand

&----


*& Form conv_uom

&----


  • text

----


  • -->P_QTY_from text

  • -->P_QTY_TO text

  • -->P_UOM_FROM text

  • -->P_MATNR text

  • -->P_UOM_TO text

----


form conv_uom using p_qty_from "$003

p_qty_to "$003

p_uom_from "$003

p_matnr "$003

p_uom_to. "$003

data: l_factor type f. "$003

call function 'MC_UNIT_CONVERSION' "$003

exporting "$003

matnr = p_matnr "$003

nach_meins = p_uom_to "$003

von_meins = p_uom_from "$003

importing "$003

umref = l_factor. "$003

p_qty_to = p_qty_from * l_factor. "$003

endform. " conv_uom

&----


*& Form read_src

&----


  • text

----


  • -->P_F_MATNR_FULL text

  • -->P_2194 text

  • -->P_L_SRC text

----


form read_src using p_matnr type mara-matnr

p_plant type mard-werks.

data: l_src(2). "$005

clear wa_src.

read table i_src into wa_src

with table key matnr = p_matnr "$005

plant = p_plant. "$005

if sy-subrc <> 0. "$005

  • no entry for this plant / matnr so get it.

clear wa_src. "$005

select single matnr werks beskz sobsl "$005

into wa_src "$005

from marc "$005

where matnr = p_matnr and werks = p_plant. "$005

if sy-subrc = 0. "$005

insert wa_src into table i_src. "$005

endif. "$005

endif. "$005

if wa_src-beskz = 'E'. "$005

l_src = 'PR'. "$005

else. "$005

----


  • CHANGED "$009

----


  • CASE wa_src-sobsl. "$005

  • WHEN c_spbh. "$005

  • l_src = 'BH'. "$005

  • WHEN c_spch. "$005

  • l_src = 'CH'. "$005

  • WHEN c_spag. "$005

  • l_src = 'AG'. "$005

  • WHEN c_spbr. "$005

  • l_src = 'BR'. "$005

  • WHEN c_spht. "$005

  • l_src = 'HT'. "$005

  • WHEN c_spsv. "$008

  • l_src = 'SV'. "$008

  • WHEN c_spgp. "$008

  • l_src = 'GP'. "$008

  • WHEN OTHERS. "$005

  • l_src = 'PU'. "$005

  • ENDCASE. "$005

----


clear wa_srcplt. "$009

read table i_srcplt into wa_srcplt "$009

with table key sobsl = wa_src-sobsl. "$009

if sy-subrc = 0. "$009

l_src = wa_srcplt-stext. "$009

else. "$009

l_src = 'PU'. "$009

endif. "$009

----


endif. "$005

if wa_src is initial. "$005

l_src = ' '. "$005

endif. "$005

if l_src = 'PU'. "$005

format hotspot on. "$005

----


  • Removed (this is placed in calling form) "$006

----


  • g_matnr = p_matnr. "$005

  • HIDE g_matnr. "$005

----


endif. "$005

write: l_src. "$005

if l_src = 'PU'. "$005

format hotspot off. "$005

endif. "$005

endform. " read_src

&----


*& Form show_vend

&----


  • text

----


  • -->P_MATNR text

  • -->P_plant text

----


form show_vend using p_matnr

p_plant.

read table i_src into wa_src with table key matnr = p_matnr"$005

plant = p_plant."$005

  • make sure this item is purchased.

----


  • CHANGED "$009

----


  • CHECK wa_src-beskz <> 'E' AND wa_src-sobsl <> c_spbh AND "$005

  • wa_src-sobsl <> c_spch AND wa_src-sobsl <> c_spag AND"$005

  • wa_src-sobsl <> c_spbr AND wa_src-sobsl <> c_spht "$005

  • AND wa_src-sobsl <> c_spsv AND wa_src-sobsl <> c_spgp. "$008

----


clear wa_srcplt. "$009

read table i_srcplt into wa_srcplt "$009

with table key sobsl = wa_src-sobsl. "$009

  • if this is purchased and purchased from someone in the table then skip

check wa_src-beskz <> 'E' and sy-subrc <> 0. "$009

----


  • lookup this vendor

select eordebeln eordlifnr lfa1~name1 into table i_vend "$005

from eord "$005

join lfa1 on eordlifnr = lfa1lifnr "$005

where eord~matnr = wa_src-matnr "$005

and eord~werks = wa_src-plant. "$005

format color col_heading intensified off. "$005

write: /(26) sy-uline as line. "$005

write: / sy-vline as line no-gap, text-063 no-gap,

sy-vline as line no-gap, text-064 no-gap,

sy-vline as line no-gap.

write: /(26) sy-uline as line. "$005

format color col_normal intensified off. "$005

write: / sy-vline as line no-gap, p_plant, "$005

sy-vline as line no-gap, p_matnr no-gap, "$005

sy-vline as line no-gap. "$005

write: /(26) sy-uline as line. "$005

skip 2. "$005

format color col_heading intensified off. "$005

write: /(59) sy-uline as line. "$005

write: / sy-vline as line no-gap, text-060 no-gap,

sy-vline as line no-gap, text-061 no-gap,

sy-vline as line no-gap.

write: /(59) sy-uline as line. "$005

format color col_normal intensified off. "$005

loop at i_vend into wa_vend. "$005

write: / sy-vline as line no-gap, wa_vend-lifnr, "$005

wa_vend-name no-gap, sy-vline as line no-gap, "$005

wa_vend-ebeln no-gap, sy-vline as line no-gap. "$005

hide wa_vend. "$005

endloop. "$005

if sy-subrc <> 0. "$005

write: / sy-vline as line no-gap, text-062 no-gap, "$005

sy-vline as line no-gap. "$005

endif. "$005

write: /(59) sy-uline as line. "$005

clear wa_vend. "$005

endform. " show_vend

&----


*& Form get_onorder

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form get_onorder. "$006

select ekkoebeln ekkolifnr lfa1name1 ekpoebelp "$006

ekpomatnr ekpowerks ekpomenge ekpomeins "$006

into table i_ordsrc "$006

from ekko "$006

join ekpo on ekkoebeln = ekpoebeln "$006

join lfa1 on ekkolifnr = lfa1lifnr "$006

join mara on ekpomatnr = maramatnr

where ekko~bsart = 'NB' and "$006

ekpo~werks in p_plant and "$006

ekko~loekz = space and "$006

ekpo~loekz = space and "$006

ekpo~elikz = space and "$006

mara~mtart = 'ZFGS'. "$006

loop at i_ordsrc into wa_ordsrc. "$006

  • first get the delivery date.

  • SELECT SINGLE eindt FROM eket INTO wa_ordsrc-eindt "$006

  • WHERE ebeln = wa_ordsrc-ebeln AND "$006

  • ebelp = wa_ordsrc-ebelp. "$006

  • move to order table

clear wa_orditem. "$006

move-corresponding wa_ordsrc to wa_orditem. "$006

read table i_order assigning <order> "$006

with table key matnr = wa_ordsrc-matnr "$006

werks = wa_ordsrc-werks. "$006

if sy-subrc = 0. "$006

append wa_orditem to <order>-items. "$006

else. "$006

clear: wa_order. "$006

wa_order-matnr = wa_ordsrc-matnr. "$006

wa_order-werks = wa_ordsrc-werks. "$006

append wa_orditem to wa_order-items. "$006

insert wa_order into table i_order. "$006

endif. "$006

endloop. "$006

endform. " get_onorder

&----


*& Form read_pur

&----


  • text

----


  • -->P_F_MATNR_FULL text

  • -->P_3036 text

  • -->P_3037 text

  • -->P_3038 text

----


form read_pur using p_matnr "$006

p_werks1 "$006

p_werks2 "$006

p_werks3 "$006

p_werks4 "$006

p_werks5. "$006

data: l_found.

  • check first werks

read table i_order into wa_order with table key matnr = p_matnr

werks = p_werks1.

if sy-subrc = 0.

l_found = 'X'.

endif.

  • check second werks

if l_found is initial and not p_werks2 is initial.

read table i_order into wa_order with table key matnr = p_matnr

werks = p_werks2.

if sy-subrc = 0.

l_found = 'X'.

endif.

endif.

  • check third werks

if l_found is initial and not p_werks3 is initial.

read table i_order into wa_order with table key matnr = p_matnr

werks = p_werks3.

if sy-subrc = 0.

l_found = 'X'.

endif.

endif.

  • check fourth werks

if l_found is initial and not p_werks4 is initial.

read table i_order into wa_order with table key matnr = p_matnr

werks = p_werks4.

if sy-subrc = 0.

l_found = 'X'.

endif.

endif.

  • check fifth werks

if l_found is initial and not p_werks5 is initial.

read table i_order into wa_order with table key matnr = p_matnr

werks = p_werks5.

if sy-subrc = 0.

l_found = 'X'.

endif.

endif.

if not l_found is initial.

format hotspot on.

write: icon_order as icon.

format hotspot off.

else.

write: (3) space no-gap.

endif.

endform. " read_pur

&----


*& Form show_pur

&----


  • text

----


  • -->P_G_MATNR text

  • -->P_1140 text

  • -->P_1141 text

  • -->P_1142 text

  • -->P_1143 text

  • -->P_1144 text

----


form show_pur using p_matnr "$006

p_werks1 "$006

p_werks2 "$006

p_werks3 "$006

p_werks4 "$006

p_werks5. "$006

data: l_linsz type i.

l_linsz = 135.

  • move all the data into the ordsrc table

refresh: i_ordsrc. "$006

  • werks 1

read table i_order into wa_order with table key matnr = p_matnr"$006

werks = p_werks1."$006

if sy-subrc = 0. "$006

clear wa_ordsrc. "$006

move-corresponding wa_order to wa_ordsrc. "$006

loop at wa_order-items into wa_orditem. "$006

move-corresponding wa_orditem to wa_ordsrc. "$006

  • get the delivery date

select single eindt from eket into wa_ordsrc-eindt "$006

where ebeln = wa_ordsrc-ebeln and "$006

ebelp = wa_ordsrc-ebelp. "$006

append wa_ordsrc to i_ordsrc. "$006

endloop. "$006

endif. "$006

  • werks 2

read table i_order into wa_order with table key matnr = p_matnr"$006

werks = p_werks2."$006

if sy-subrc = 0. "$006

clear wa_ordsrc. "$006

move-corresponding wa_order to wa_ordsrc. "$006

loop at wa_order-items into wa_orditem. "$006

move-corresponding wa_orditem to wa_ordsrc. "$006

  • get the delivery date

select single eindt from eket into wa_ordsrc-eindt "$006

where ebeln = wa_ordsrc-ebeln and "$006

ebelp = wa_ordsrc-ebelp. "$006

append wa_ordsrc to i_ordsrc. "$006

endloop. "$006

endif. "$006

  • werks3

read table i_order into wa_order with table key matnr = p_matnr"$006

werks = p_werks3."$006

if sy-subrc = 0. "$006

clear wa_ordsrc. "$006

move-corresponding wa_order to wa_ordsrc. "$006

loop at wa_order-items into wa_orditem. "$006

move-corresponding wa_orditem to wa_ordsrc. "$006

  • get the delivery date

select single eindt from eket into wa_ordsrc-eindt "$006

where ebeln = wa_ordsrc-ebeln and "$006

ebelp = wa_ordsrc-ebelp. "$006

append wa_ordsrc to i_ordsrc. "$006

endloop. "$006

endif. "$006

  • werks 4

read table i_order into wa_order with table key matnr = p_matnr"$006

werks = p_werks4."$006

if sy-subrc = 0. "$006

clear wa_ordsrc. "$006

move-corresponding wa_order to wa_ordsrc. "$006

loop at wa_order-items into wa_orditem. "$006

move-corresponding wa_orditem to wa_ordsrc. "$006

  • get the delivery date

select single eindt from eket into wa_ordsrc-eindt "$006

where ebeln = wa_ordsrc-ebeln and "$006

ebelp = wa_ordsrc-ebelp. "$006

append wa_ordsrc to i_ordsrc. "$006

endloop. "$006

endif. "$006

  • werks 5

read table i_order into wa_order with table key matnr = p_matnr"$006

werks = p_werks5."$006

if sy-subrc = 0. "$006

clear wa_ordsrc. "$006

move-corresponding wa_order to wa_ordsrc. "$006

loop at wa_order-items into wa_orditem. "$006

move-corresponding wa_orditem to wa_ordsrc. "$006

  • get the delivery date

select single eindt from eket into wa_ordsrc-eindt "$006

where ebeln = wa_ordsrc-ebeln and "$006

ebelp = wa_ordsrc-ebelp. "$006

append wa_ordsrc to i_ordsrc. "$006

endloop. "$006

endif. "$006

sort i_ordsrc by lifnr ebeln matnr werks. "$006

loop at i_ordsrc into wa_ordsrc. "$006

at first. "$006

format color col_heading intensified off. "$006

write: at /(l_linsz) sy-uline as line. "$006

write: at / sy-vline as line no-gap, text-c00 no-gap, "$006

sy-vline as line no-gap, text-c06 no-gap, "$006

sy-vline as line no-gap, text-c05 no-gap, "$006

sy-vline as line no-gap, text-c01 no-gap, "$006

sy-vline as line no-gap, text-c02 no-gap, "$006

sy-vline as line no-gap, text-c03 no-gap, "$006

sy-vline as line no-gap, text-c04 no-gap, "$006

sy-vline as line no-gap. "$006

write: at /(l_linsz) sy-uline as line. "$006

format color col_normal intensified off. "$006

endat. "$006

write: / sy-vline as line no-gap. "$006

format hotspot on. "$006

write: wa_ordsrc-ebeln no-gap. "$006

format hotspot off. "$006

write: sy-vline as line no-gap, wa_ordsrc-werks, "$006

sy-vline as line no-gap, wa_ordsrc-lifnr, "$006

wa_ordsrc-vname no-gap, "$006

sy-vline as line no-gap, (10) wa_ordsrc-matnr, "$006

(25) g_maktx no-gap, "$006

sy-vline as line no-gap, wa_ordsrc-menge no-gap,"$006

sy-vline as line no-gap, wa_ordsrc-meins no-gap,"$006

sy-vline as line no-gap, wa_ordsrc-eindt no-gap,"$006

sy-vline as line no-gap. "$006

hide wa_ordsrc-ebeln. "$006

at last. "$006

write: at /(l_linsz) sy-uline as line. "$006

endat. "$006

endloop. "$006

clear: wa_ordsrc-ebeln. "$006

endform. " show_pur

&----


*& Form line_selection

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form line_selection.

data: l_posl like sy-cucol, "$005

l_posh like sy-cucol. "$005

if sy-lsind = 1. "$005

check not g_matnr is initial. "$005

  • check for click on Material "$006

if sy-cucol >= 3 and sy-cucol <= 8. "$006

set parameter id 'MAT' field g_matnr. "$006

call transaction 'MD04'. "$006

endif. "$006

  • check for click on other bottler demand

if not p_demand is initial. "$007

l_posl = c_lsizeb. "$007

l_posl = l_posl - sy-staco + 1. "$007

l_posh = l_posl + 9. "$007

if l_posl <= sy-cucol and l_posh >= sy-cucol. "$007

perform show_oborder. "$007

endif. "$007

endif. "$007

l_posl = c_lsizeb. "$005

if not p_demand is initial. "$005

add c_lsized to l_posl. "$005

endif. "$005

l_posl = l_posl - sy-staco + 1. "$005

l_posh = l_posl + 1. "$005

if not p_ereg is initial. "$005

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked birmingham

perform show_pur using g_matnr '1010' '2010' "$006

'3010' '2011' '2012'. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked birmingham

perform show_vend using g_matnr '1010'. "$005

endif. "$005

endif. "$006

  • check chattanooga

add 14 to l_posl. "$005

add 14 to l_posh. "$005

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked chatt

perform show_pur using g_matnr '1020' '2020' "$006

'3020' space space. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked chatt

perform show_vend using g_matnr '1020'. "$005

endif. "$005

endif. "$006

  • check lm

add 14 to l_posl. "$005

add 14 to l_posh. "$005

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked lm

perform show_pur using g_matnr '2022' space "$006

space space space. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked lm

perform show_vend using g_matnr '2022'. "$005

endif. "$005

endif. "$006

  • check aug

add 14 to l_posl. "$005

add 14 to l_posh. "$005

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked aug

perform show_pur using g_matnr '2030' '2033' "$006

space space space. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked aug

perform show_vend using g_matnr '2030'. "$005

endif. "$005

endif. "$006

  • check sav

add 14 to l_posl. "$005

add 14 to l_posh. "$005

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked sav

perform show_pur using g_matnr '2060' space "$006

space space space. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked sav

perform show_vend using g_matnr '2060'. "$005

endif. "$005

endif. "$006

  • check spart

add 14 to l_posl. "$005

add 14 to l_posh. "$005

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked spart

perform show_pur using g_matnr '2040' space "$006

space space space. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked spart

perform show_vend using g_matnr '2040'. "$005

endif. "$005

endif. "$006

  • check way

add 14 to l_posl. "$005

add 14 to l_posh. "$005

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked way

perform show_pur using g_matnr '2031' space "$006

space space space.. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked way

perform show_vend using g_matnr '2031'. "$005

endif. "$005

endif. "$006

  • check brun

add 14 to l_posl. "$005

add 14 to l_posh. "$005

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked brun

perform show_pur using g_matnr '2062' space "$006

space space space. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked brun

perform show_vend using g_matnr '2062'. "$005

endif. "$005

endif. "$006

  • check states

add 14 to l_posl. "$005

add 14 to l_posh. "$005

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked states

perform show_pur using g_matnr '2061' space "$006

space space space. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked states

perform show_vend using g_matnr '2061'. "$005

endif. "$005

endif. "$006

  • check mcrae

add 14 to l_posl. "$005

add 14 to l_posh. "$005

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked mcrae

perform show_pur using g_matnr '2032' space "$006

space space space. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked mcrae

perform show_vend using g_matnr '2032'. "$005

endif. "$005

endif. "$006

else. "$005

  • gulf region

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked br

perform show_pur using g_matnr '1051' '2051' "$006

'3051' space space. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked br

perform show_vend using g_matnr '1051'. "$005

endif. "$005

endif. "$006

  • check hatt

add 14 to l_posl. "$005

add 14 to l_posh. "$005

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked hatt

perform show_pur using g_matnr '1056' '2056' "$006

'3056' space space. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked hatt

perform show_vend using g_matnr '1056'. "$005

endif. "$005

endif. "$006

  • check mccomb

add 14 to l_posl. "$005

add 14 to l_posh. "$005

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked mccomb

perform show_pur using g_matnr '2052' space "$006

space space space. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked mccomb

perform show_vend using g_matnr '2052'. "$005

endif. "$005

endif. "$006

  • check laf

add 14 to l_posl. "$005

add 14 to l_posh. "$005

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked laf

perform show_pur using g_matnr '2054' space "$006

space space space. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked laf

perform show_vend using g_matnr '2054'. "$005

endif. "$005

endif. "$006

  • check lak

add 14 to l_posl. "$005

add 14 to l_posh. "$005

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked lak

perform show_pur using g_matnr '2053' space "$006

space space space. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked lak

perform show_vend using g_matnr '2053'. "$005

endif.

endif. "$006

  • check gp

add 14 to l_posl. "$005

add 14 to l_posh. "$005

if not p_pur is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$006

  • they clicked gp

perform show_pur using g_matnr '2055' space "$006

space space space. "$006

endif. "$006

if not p_src is initial. "$006

add 3 to l_posl. "$006

add 3 to l_posh. "$006

endif. "$006

endif. "$006

if not p_src is initial. "$006

if l_posl = sy-cucol or l_posh = sy-cucol. "$005

  • they clicked gp

perform show_vend using g_matnr '2055'. "$005

endif. "$005

endif. "$006

endif. "$005

clear: g_matnr. "$005

elseif sy-lsind = 2. "$005

if not wa_ordsrc-ebeln is initial. "$006

l_posl = sy-staco - 1 + sy-cucol. "$006

if l_posl <= 12 and l_posl >= 3. "$006

set parameter id 'BES' field wa_ordsrc-ebeln. "$006

call transaction 'ME23N'. "$006

endif. "$006

endif. "$006

clear wa_ordsrc-ebeln. "$006

if not wa_oborder-vbeln is initial. "$007

set parameter id 'AUN' field wa_oborder-vbeln. "$007

call transaction 'VA03' and skip first screen. "$007

endif. "$007

clear wa_oborder-vbeln. "$007

  • CHECK NOT wa_vend IS INITIAL. "$005

*

  • WRITE: / wa_vend-ebeln.

*

    • view the contract

  • SET PARAMETER ID 'VRT' FIELD wa_vend-ebeln.

  • CALL TRANSACTION 'ME33K' ."AND SKIP FIRST SCREEN.

*

  • CLEAR wa_vend. "$005

endif. "$005

endform. " line_selection

&----


*& Form show_oborder

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form show_oborder. "$007

data: l_datet like sy-datum, "$007

l_datef like l_datet, "$007

l_otherb type mdkp-plwrk, "$007

l_day type scal-indicator, "$007

l_switch, "$007

l_matnr(10), "$007

l_mat type string. "$007

refresh i_oborder. "$007

clear wa_oborder. "$007

l_datet = sy-datum. "$007

l_datef = l_datet. "$007

  • first, decide when next friday is.

call function 'DATE_COMPUTE_DAY' "$007

exporting "$007

date = l_datet "$007

importing "$007

day = l_day. "$007

  • add number of days until next Friday

case l_day. "$007

when '1'. "$007

add 11 to l_datef. "$007

when '2'. "$007

add 10 to l_datef. "$007

when '3'. "$007

add 9 to l_datef. "$007

when '4'. "$007

add 8 to l_datef. "$007

when '5'. "$007

add 7 to l_datef. "$007

when '6'. "$007

add 6 to l_datef. "$007

when '7'. "$007

add 12 to l_datef. "$007

endcase. "$007

  • fill otherbottlers plant

concatenate '30' p_dplant into l_otherb. "$007

  • get vbbe/vbep/kna1

select vbbevbeln vbbekunnr vbbematnr vbbevmeng "$007

vbbemeins vbepedatu kna1~name1 "$007

into table i_oborder "$007

from vbbe "$007

join vbep on vbbevbeln = vbepvbeln and "$007

vbbeposnr = vbepposnr and "$007

vbbeetenr = vbepetenr "$007

join kna1 on vbbekunnr = kna1kunnr "$007

where vbbe~vmeng <> 0 and "$007

vbbe~matnr = g_matnr and "$007

vbbe~mbdat <= l_datef and "$007

vbbe~werks = l_otherb and "$007

( vbbevbtyp = c_vbbe_c or vbbevbtyp = c_vbbe_j ). "$007

  • print out the data

loop at i_oborder into wa_oborder. "$007

at first. "$007

format color col_background intensified off. "$007

write: g_matnr to l_matnr. "$007

concatenate l_matnr g_maktx into l_mat "$007

separated by space. "$007

write: / text-h02, l_mat. "$007

format color col_heading intensified off. "$007

write: /(94) sy-uline as line. "$007

write: / sy-vline as line no-gap, text-h00 no-gap, "$007

sy-vline as line no-gap, text-h01 no-gap, "$007

sy-vline as line no-gap, "$007

text-h03 centered no-gap, "$007

sy-vline as line no-gap, text-h04 no-gap, "$007

sy-vline as line no-gap. "$007

write: /(94) sy-uline as line. "$007

endat. "$007

if l_switch is initial. "$007

format color col_normal intensified off. "$007

l_switch = 'X'. "$007

else. "$007

format color col_normal intensified on. "$007

clear l_switch. "$007

endif. "$007

write: / sy-vline as line no-gap, wa_oborder-vbeln no-gap,"$007

sy-vline as line no-gap, wa_oborder-kunnr, "$007

wa_oborder-kname no-gap, "$007

sy-vline as line no-gap, wa_oborder-vmeng, "$007

wa_oborder-meins no-gap, "$007

sy-vline as line no-gap, wa_oborder-edatu no-gap,"$007

sy-vline as line no-gap. "$007

hide: wa_oborder-vbeln. "$007

at last. "$007

write: /(94) sy-uline as line. "$007

endat. "$007

endloop. "$007

clear: wa_oborder-vbeln. "$007

endform. " show_oborder

&----


*& Form get_srcplt

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form get_srcplt.

select sobsl stext from zsrcplt into table i_srcplt. "$009

endform. " get_srcplt

Read only

0 Likes
1,869

It will be very difficult for anyone to follow such a big code. Instead, please try to change back the description to its original length and see if that is the reason why you are getting the line split.

As I see it, there are a lot of new-page commands with dynamic line sizes. So I am not sure why you needed new page with different lengths.

So the easiest thing to do is to try to isolate the problem by focussing exactly on the problem area. Go in debugging and see why it is spilling over into next line.

Srinivas

Read only

0 Likes
1,869

Hello All,

Thanks for the solutions. You are all correct. The LINE-SIZE controls the the report horizontal length. In the code as Srinivas mentioned the LINE-SIZE is calculated within the program. That is because of the type of report and number of columns. Each report has a different number of columns. So I changed the LINE-SIZE calculation and that fixed the problem.

Thanks for the great help.

Sobhan.

Read only

Former Member
0 Likes
1,869

A line will not automatically go into next line in SAP like a word document or a wordpad document.

I guess you have introduced a '/' somewhere when you were making the changes and that might have caused the last columns to go to next line.

Srinivas