When we have a Multi-Level BOM and its component details like in CS13 Transaction code, it would be very difficult to calculate the BOM Cost for BW users. For this, we have created a table ZBOM_CS13 with the following structure
Field |
Data Element |
Dtype |
Length |
Decimals |
Description |
|
|
|
|
|
|
MATNR |
MATNR |
CHAR |
18 |
0 |
Material Number |
COMPONENT |
IDNRK |
CHAR |
18 |
0 |
BOM component |
DESCP |
MAKTX |
CHAR |
40 |
0 |
Material Description |
BOM_QTY |
KMPMG |
QUAN |
13 |
3 |
Component quantity |
MEINS |
KMPME |
UNIT |
3 |
0 |
unit of
measure |
MTART |
MTART |
CHAR |
4 |
0 | Material Type |
MRP_TYPE |
DISMM |
CHAR |
2 |
0 |
MRP Type |
Now the table with the below ABAP Code will be filled the Finished goods and its corresponding components.
Please have a look
into the program “RCS13001” for your reference.
*********************************************************************************
Report : ZBOM_AUTO_CS13
*&---------------------------------------------------------------------*
*& Report ZBOM_AUTO_18FEB
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
*eject
* 4.6C
* HGA025984 310100 Verzweigung zum Verwendungsnachweis auf Summenzeilen
* HGB020150 260100 Reserve beim Druck (Var.List)
* HGA020150 240100 UComm anderes Material (ALV)
* HGD246532 171199 Stoppstufe f. Aufl.
* HGC246532 171199 Daten zur KonstrZei in Summensatz
* HGB246532 151199 Blättern in VLst
* HGA246532 081199 ALV_S
* 4.6B
* HGA046836 270799 Aufl. ProjektStl
* 4.6A
* HGA154419 231298 ECN - FB Anpassung
* 4.5B
* HGC072185 180199 Anzeige KndSelDaten
* HGD059252 161198 Conversion-Error entschaerft
* HGC059252 121198 Nachtrag A033687
* HGA059252 121198 ParmEff-Popup abh. vom Stl.-TopMat (auch bei KndStl)
* 4.0C/4.5A
* HGA033687 140798 KndStl-Aufloesen - Kein Ausweichen auf MatStl mehr
* HGA029649 090798 Langtextausgabe (KndStl)
* HGA132240 190597 Langtextausgabe
* HGA084505 060398 neue Gueltigkeit
* HGB084505 030398 KND-Stueckliste
* 4.0A
* HGA025100 230797 Profilvorbelegung / VList Performance
* 3.1I
* HGA162016 300997 falsche Anz. von Kumulierten, wg. fehlendem OBJTP
* 3.1G
* HGA127128 270197 Langtextkennz. / Druck SelKriterien
* 3.0F
* HGA108310 251096 EinsatzwahrscheinlichkeitsHandling
* HGG099459 180996 TCSPR-Default
* HGB099459 010896 alter Materialobjekttyp
* 3.0E
* HGA080825 030796 Vervollst. HG0D51356; x-stell. MatNum
* HGC072824 150596 CATT; Druck im Batch ausschalten
* HGA072824 150596 Werksberechtigungspruefung
* 3.0D
* HGB070841 260496 keine Memoryverwaltung fuer CA
* HGB057558 210396 Langtext Includes auflösen
* 3.0C
* YHG046403 260196 Anpassung an Basisaenderung bzgl. SUBMIT
* YHG032486 051295 Performance/Konvertierungen, Coding
* 3.0B
* YHG020009 231095 Performance
* Puffer Aktivierung / APPEND
* YHG019433 181095 Initialisierung Sortierkennz. in Summensaetzen
* 3.0A
* YHG133751 290695 Erweiterung MaxBloecke - var Liste
* YHG137563 270695 Druck; falsche Positionierung im Listenkopf
* YHG132854 130695 Keine Grafik bei nicht zus.haengender StlStruktur
* YHG123656 160595 Verhalten bei CALLs korrigiert
* 3.0
* YHG140031 040495 SKIP bei var. Liste im Druck korrigiert
* YHG139715 030495 Selectoptions-Anzeige
* YHG139336 300395 Ende der Liste
* YHG139320 300395 Kennz Wissen zugeordnet
* YHG137424 230395 Defaultprofil Absicherung
* YHG134557 160395 Umstellung auf var. Liste
* YHG134257 020395 Korr. CAD-Versorgung
* YHG101965 041094 Schalter Mengenrunden
* YHG100916 150994 Korr. Vgl. mit expliziter Laenge
* 2.2
* YHG088020 100694 Abbr. wg. bei betr.maessig hohen neg. Mengen
* YHG079319 100594 Anzeige Revisionsstand
* YHG079407 030594 Anzeigen Zuordnungen
* YHG078090 120494 neg. Mengen / Batch / Ausnahmeliste / Rahmen
* YHG078090 110494 Anzeige bei Einschraenkungen (z.B. ZwischBgrp)
* YHG077295 050494 MatVerwendung ueber Klassen und Folgeaktionen
* YHG000301 100394 Listenkopf / Anpassung wg. Verwendungsumstellung
* YHG000109 280294 Klassenpositionen
* 2.1D
* YHG072697 180294 GUI-Listanzeige (Nachtrag zu K066003)
* YHG068719 280194 Sortiermoeglichkeiten korrigiert
* YHG066003 240194 GUI-Listanzeige
* 2.1C
* YHG044318 281293 Numerierte Texte / Datumsanzeige
* 2.1
* YHG062728 101293 Langtextanzeige
* YHG056590 021193 Sort von Positionen ohne MatKurztext
* YHG053243 151093 Steuerung der Druckoption geaendert
* YHG052824 141093 Anzeige Mengeneinheiten
* YHG049857 061093 SPA/GPA Vorschlaege
* YHG047511 230993 Zusammenstellung Summensatz geaendert
* YHG044860 130993 CAD-Schnittstelle
* YHG044928 070993 Zusammenstellung Summensatz korr.
* YHG044772 030993 Korr. numerischer Eingaben
* YHG042334 270893 Ausnahmemeldung 'geloescht' aufgenommen
* YHG041147 240893 Dokumentpositionen
* YHG036694 060793 Anzeige und Ueberschriften
* YHG035807 210693 Feldueberlauf bei div. Berechnungen
* YHG035785 210693 Anzeige Gueltigkeitsbereich
* YHG035283 170693 EQUI-Anbindung; Parm. IH-BauGrp u. STPOL-Aenderung
***********************************************************************
*del REPORT RCS13001 MESSAGE-ID 29 LINE-SIZE 79 "YHG066003
*del REPORT RCS13001 MESSAGE-ID 29 LINE-SIZE 81 "YHG066003"YHG139715
REPORT ZBOM_AUTO_18FEB MESSAGE-ID 29 LINE-SIZE 132 "YHG139715
NO STANDARD PAGE HEADING. "YHG036694
***********************************************************************
* D A T E N - Definitionen *
***********************************************************************
*---------------------------------------------------------------------*
* ATAB-Tabellen *
*---------------------------------------------------------------------*
TABLES:
makt, "YHG079407
t418, "YHG068719
tcs03,
tcspr.
types: begin of ty_zbom,
MATNR LIKE MAST-MATNR,
COMPONENT LIKE MAST-MATNR,
DESCP LIKE MAKT-MAKTX,
BOM_QTY LIKE STPO-MENGE,
MEINS LIKE MSEG-MEINS,
MTART LIKE MARA-MTART,
MRP_TYPE LIKE MARC-DISMM,
END OF ty_zBOM.
data: it_zbom type standard table of ty_ZBOM with header line.
data: wa_zbom like it_zbom.
DATA: BEGIN OF cl_clstab OCCURS 0, "YHG079407
class LIKE klah-class, "YHG079407
klart LIKE klah-klart, "YHG079407
chked LIKE csdata-xfeld, "YHG079407
noobj LIKE csdata-xfeld, "YHG079407
dsply LIKE csdata-xfeld, "YHG079407
END OF cl_clstab. "YHG079407
DATA: BEGIN OF cl_objtab OCCURS 0. "YHG079407
INCLUDE STRUCTURE ckssk. "YHG079407
DATA: END OF cl_objtab. "YHG079407
DATA: BEGIN OF cl_objmemo OCCURS 0, "YHG079407
class LIKE klah-class, "YHG079407
klart LIKE klah-klart. "YHG079407
INCLUDE STRUCTURE ckssk. "YHG079407
DATA: END OF cl_objmemo. "YHG079407
* WAs fuer AnzBlockAusgabe (var. Liste)
DATA: BEGIN OF watab OCCURS 0. "YHG134557
INCLUDE STRUCTURE cltable. "YHG134557
DATA: END OF watab. "YHG134557
* Sicherungstabelle der AnzBlockWAs
DATA: BEGIN OF sav_watab OCCURS 0. "YHG134557
INCLUDE STRUCTURE cltable. "YHG134557
DATA: END OF sav_watab. "YHG134557
* Uebergabestruktur Typ STPOX (fuer STB)
DATA: BEGIN OF stb_orig. "YHG134557
INCLUDE STRUCTURE stpox. "YHG134557
DATA: END OF stb_orig. "YHG134557
* Uebergabestruktur Typ STPOL_ADD
DATA: BEGIN OF stb_add. "YHG134557
INCLUDE STRUCTURE stpol_add. "YHG134557
DATA: END OF stb_add. "YHG134557
DATA : BEGIN OF vbap_wa OCCURS 0. "HGB084505
INCLUDE STRUCTURE vbap. "HGB084505
DATA : END OF vbap_wa. "HGB084505
DATA: matpos_flg LIKE csdata-xfeld, "HGB084505
mpos_page LIKE sy-pagno, "HGB084505
mpos_line LIKE sy-linno. "HGB084505
DATA: BEGIN OF wa_kdstb OCCURS 0. "HGA033687
INCLUDE STRUCTURE kdstb. "HGA033687
DATA: END OF wa_kdstb. "HGA033687
*---------------------------------------------------------------------*
* interne Tabellen *
*---------------------------------------------------------------------*
DATA: BEGIN OF selpool.
INCLUDE STRUCTURE cstmat.
DATA: END OF selpool.
DATA: BEGIN OF stb OCCURS 1000.
*del INCLUDE STRUCTURE STPOL. "YHG134557
INCLUDE STRUCTURE stpox. "YHG134557
DATA: END OF stb.
*del DATA: BEGIN OF SUM_STB OCCURS 100. "YHG133751
DATA: BEGIN OF sum_stb, "YHG133751
*del INCLUDE STRUCTURE STPOL. "YHG134557
*del INCLUDE STRUCTURE STPOX. "YHG134557"YHG133751
bmtyp LIKE stpox-bmtyp, "YHG133751
ttidx LIKE stpox-ttidx, "YHG133751
ojtxp LIKE stpox-ojtxp, "YHG133751
mtart LIKE stpox-mtart, "YHG133751
werks like stpox-werks, "HGA025984
vpsta LIKE stpox-vpsta, "YHG133751
fstat LIKE stpox-fstat, "YHG133751
mmein LIKE stpox-mmein, "YHG133751
bwtty LIKE stpox-bwtty, "YHG133751
vprsv LIKE stpox-vprsv, "YHG133751
stprs LIKE stpox-stprs, "YHG133751
verpr LIKE stpox-verpr, "YHG133751
PREIH LIKE STPOX-PREIH, "note 507446
sbdkz LIKE stpox-sbdkz, "YHG133751
xchar LIKE stpox-xchar, "YHG133751
*d mmsta LIKE stpox-mmsta, "YHG133751"note 0413072
MSTAE LIKE STPOX-MSTAE, "note 0413072
MSTDE LIKE STPOX-MSTDE, "note 0413072
mmsta like stpox-mmsta, "note 597265
mmstd like stpox-mmstd, "note 597265
sernp like stpox-sernp, "note 597265
prctr like stpox-prctr, "note 597265
mschg like stpox-mschg, "note 597265
fxpru like stpox-fxpru, "note 597265
kzech LIKE stpox-kzech, "note 597265
kzwsm LIKE stpox-kzwsm, "note 597265
kzeff LIKE stpox-kzeff, "note 597265
mcuob LIKE stpox-mcuob, "note 597265
matkl LIKE stpox-matkl, "note 597265
zeinr LIKE stpox-zeinr, "YHG133751
zeivr LIKE stpox-zeivr, "HGC246532
zeiar LIKE stpox-zeiar, "HGC246532
zeifo LIKE stpox-zeifo, "HGC246532
DISST LIKE STPOX-DISST, "note 507446
DISMM LIKE STPOX-DISMM, "note 507446
mnglg LIKE stpox-mnglg, "YHG133751
msign LIKE stpox-msign, "YHG133751
ausss LIKE stpox-ausss, "YHG133751
kausf LIKE stpox-kausf, "YHG133751
sobsl LIKE stpox-sobsl, "YHG133751
sobsk LIKE stpox-sobsk, "YHG133751
kzaus LIKE stpox-kzaus, "YHG133751
ausdt LIKE stpox-ausdt, "YHG133751
nfmat LIKE stpox-nfmat, "YHG133751
rgekz LIKE stpox-rgekz, "YHG133751
kzdkz LIKE stpox-kzdkz, "YHG133751
lgpro LIKE stpox-lgpro, "YHG133751
revlv LIKE stpox-revlv, "YHG133751
kzkfg LIKE stpox-kzkfg, "YHG133751
fbskz LIKE stpox-fbskz, "YHG133751
stawn LIKE stpox-stawn, "YHG133751
prefe LIKE stpox-prefe, "YHG133751
stabk LIKE stpox-stabk, "YHG133751
dostx LIKE stpox-dostx, "YHG133751
idnrk LIKE stpox-idnrk, "YHG133751
postp LIKE stpox-postp, "HGA162016
sortf LIKE stpox-sortf, "YHG133751
meins LIKE stpox-meins, "YHG133751
potx1 LIKE stpox-potx1, "YHG133751
potx2 LIKE stpox-potx2, "YHG133751
objty LIKE stpox-objty, "YHG133751
dokar LIKE stpox-dokar, "YHG133751
doknr LIKE stpox-doknr, "YHG133751
dokvr LIKE stpox-dokvr, "YHG133751
doktl LIKE stpox-doktl, "YHG133751
class LIKE stpox-class, "YHG133751
klart LIKE stpox-klart, "YHG133751
intrm LIKE stpox-intrm, "YHG133751
xtlnr LIKE stpox-xtlnr, "YHG133751
xloek LIKE stpox-xloek, "YHG133751
sumkz LIKE stpox-sumkz, "YHG133751
index LIKE sy-tabix, "HGA246532
END OF sum_stb. "YHG133751
*del DATA: END OF SUM_STB. "YHG133751
* Materialkatalog
DATA: BEGIN OF matcat OCCURS 50. "YHG134557
INCLUDE STRUCTURE cscmat. "YHG134557
DATA: END OF matcat. "YHG134557
DATA: BEGIN OF sav_stb OCCURS 100.
*del INCLUDE STRUCTURE STPOL. "YHG134557
INCLUDE STRUCTURE stpox. "YHG134557
DATA: END OF sav_stb.
DATA: BEGIN OF ausnm_stb OCCURS 10,
objty LIKE stpox-objty, "YHG134557
idnrk LIKE stpox-idnrk,
revlv LIKE stpox-revlv, "YHG134557
*del MAKTX LIKE STPOL-MAKTX, "YHG035283
doknr LIKE draw-doknr, "YHG078090
dokar LIKE draw-dokar, "YHG078090
doktl LIKE draw-doktl, "YHG078090
dokvr LIKE draw-dokvr, "YHG078090
class LIKE klah-class, "YHG078090
klart LIKE klah-klart, "YHG078090
intrm LIKE stpox-intrm, "YHG134557
ojtxp LIKE stpox-ojtxp, "YHG035283
xtlal LIKE stpox-stlal,
ausnm LIKE stpox-ausnm,
END OF ausnm_stb.
DATA: BEGIN OF txt OCCURS 25.
INCLUDE STRUCTURE tline.
DATA: END OF txt.
*---------------------------------------------------------------------*
* interne Felder *
*---------------------------------------------------------------------*
DATA:
cal_aclas LIKE tappl-applclass, "YHG044860
*del ANZ_STPTX(3) TYPE C, "YHG134557
anz_datuv LIKE stko-datuv,
anz_datub LIKE stko-datuv,
hlp_stlal LIKE stko-stlal,
clo_matnr LIKE mara-matnr, "YHG079407
*del ANZ_STLAL LIKE STKO-STLAL, "YHG134557
anz_abwal LIKE stko-stlal,
hlp_tabix LIKE sy-tabix,
txt_key LIKE thead-tdname,
txt_kyln(3) TYPE n,
col_switch(1) TYPE c, "intensified on/off "YHG066003
tmp_hrechf TYPE f, "temp. HilfsRechenfeld "YHG035807
sum_modus(2) TYPE c,
summ_flag(1) TYPE c,
auth_cnt LIKE sy-subrc, "YHG134557
ret_code LIKE sy-subrc.
* ---------------------------------
DATA: lins_out LIKE sy-linno, "YHG036694
lins_out_sav LIKE sy-linno, "YHG036694
lst_lin_on_p LIKE sy-linno, "YHG036694
lins_to_skip LIKE sy-linno, "YHG036694
lins_per_top LIKE sy-linno, "HGB246532
lins_per_pag LIKE sy-linno. "YHG036694
DATA: anr_datuv LIKE aenr-datuv, "HGA084505
anr_techs LIKE tecs-techs. "HGA084505
* ---------------------------------
DATA: ueberl_flg(1) TYPE c, "YHG066003
*del EDTLIN(79) TYPE C, "YHG066003"YHG134557
*del SAV_EDTLIN(79) TYPE C, "YHG066003"YHG134557
first_flg(1) TYPE c, "YHG066003
anz_meins LIKE stpo-meins, "YHG066003
anz_ktext LIKE makt-maktx. "YHG066003
* ---------------------------------
DATA: ausntp_flg(1) TYPE c. "YHG066003
* ---------------------------------
DATA: objty_mrk LIKE stpob-objty, "YHG068719
page_mat LIKE sy-pagno, "YHG068719
page_kla LIKE sy-pagno, "YHG068719
page_dok LIKE sy-pagno, "YHG068719
page_noo LIKE sy-pagno, "YHG068719
page_exc LIKE sy-pagno. "YHG068719
* ---------------------------------
* --> kann nach Bereinigung der anderen Reports geloescht werden
*d DATA: REAL_LINE LIKE SY-LINNO. "YHG134557"HGA046836
*d DATA: STB-MATNR LIKE MARA-MATNR. "YHG134557"HGA046836
* ---------------------------------
* EndOfBlock-Kennzeichen
DATA: eoblc LIKE csdata-xfeld, "YHG134557
* Zeilenbreite aus dem aktuellen Profil
itf_prfsz LIKE klah-lbrei, "YHG134557"YHG032486
*del SAV_PRFSZ LIKE KLAH-LBREI, "YHG134557"YHG032486
sav_prfsz TYPE i, "YHG032486
* Zeilenbreite des akt. Profils plus Rand ( + 2 )
*del SIZ_LINPF LIKE KLAH-LBREI, "Lnsz plus frame "YHG134557"YHG032486
siz_linpf TYPE i, "YHG032486
* Kennzeichen 'akt. Zeile ist leer'
lnmpt_flg LIKE csdata-xfeld, "YHG134557
* das aktuell gueltige Profil
act_profil LIKE klah-class, "YHG134557
* BlockzeilenZaehler
blclns_cnt LIKE sy-linno, "YHG134557
* Anzahl Zeilen Listenkopf
nbr_hdrlns LIKE sy-linno. "YHG134557
DATA: dstst_flg LIKE csdata-xfeld. "YHG132854
DATA: mem_mngmt(1) TYPE c. "HGB070841
DATA: mnr_lng TYPE i. "HGA080825
*---------------------------------------------------------------------*
* Konstanten *
*---------------------------------------------------------------------*
DATA:
bom_txobj LIKE thead-tdobject VALUE 'BOM',
*d bom_txid like thead-tdid value 'MPO', "HGA029649
bom_txid LIKE thead-tdid, "HGA029649
mbm_txid LIKE thead-tdid VALUE 'MPO', "HGA029649
kbm_txid LIKE thead-tdid VALUE 'KPO', "HGA029649
* maximal anzeigbare Menge
max_num(7) TYPE p DECIMALS 3 VALUE '9999999999.999', "YHG035807
min_num(7) TYPE p DECIMALS 3 VALUE '9999999999.999-', "YHG088020
min_grg LIKE sy-datum VALUE '19000101',
max_grg LIKE sy-datum VALUE '99991231'.
DATA: ueberl_kz(1) TYPE c VALUE '*'. "YHG066003
DATA: b_flag(1) TYPE c VALUE 'X'. "YHG066003
DATA: "YHG041147
otyp_mat(1) TYPE c VALUE '1', "YHG041147
ootyp_mat(1) TYPE c VALUE 'M', "HGB099459
* Objekttyp 'kein Objekt'
otyp_noo(1) TYPE c VALUE '2', "YHG134557
*del OTYP_DOC(1) TYPE C VALUE '3'. "YHG041147 "YHG000109
otyp_doc(1) TYPE c VALUE '3', "YHG000109
otyp_kla(1) TYPE c VALUE '4', "YHG000109
* Objekttyp 'Intramaterial'
otyp_ntm(1) TYPE c VALUE '5'. "YHG134557
DATA: all_pstat(9) TYPE c VALUE 'KVEDLAPSB'. "YHG079407
* ---------------------------------
* langes leeres Feld
DATA: ecfld(250) TYPE c. "YHG134557
data: PLANT_ALL LIKE MAST-WERKS VALUE '* '. "HGA025984
*---------------------------------------------------------------------*
* Selektionsparameter *
*---------------------------------------------------------------------*
*PARAMETERS:
data:
*del PM_MTNRV LIKE MARA-MATNR MEMORY ID MAT, "YHG078090
*d pm_mtnrv like mara-matnr memory id mat obligator "YHG078090"HGC059252
pm_mtnrv LIKE mara-matnr value 'AY0001000',"'CY0000900',"," MEMORY ID mat, "HGC059252
pm_werks LIKE marc-werks value 'KMLS',"MEMORY ID wrk,
pm_stlal LIKE stko-stlal,
pm_stlan LIKE stzu-stlan,
pm_capid LIKE tc04-capid value 'PP01',
*del PM_DATUV LIKE STKO-DATUV DEFAULT SY-DATUM, "YHG078090
pm_datuv LIKE stko-datuv ,"DEFAULT sy-datum OBLIGATORY, "YHG078090
* Parameterbelegung P-Effektivity
pm_techs LIKE tecs-techs, "HGA084505
* Aenderungsnummer
pm_aennr LIKE aenr-aennr, "HGA084505
* Einsatzmenge
pm_emeng LIKE stko-bmeng,
* zugehoeriges SUBMIT-Hilfsfeld:
pm_hemng(13) TYPE n value '',"NO-DISPLAY, "YHG035807
* alv
pm_alvsa LIKE rc29l-valst, "HGA246532
* Profil zur Bildschirmanzeige
*d pm_dsprf like klah-class default 'SAPCSSMXM "YHG133681"HGA025100
pm_dsprf LIKE klah-class, "HGA025100
* Profil beim Druck
*d pm_prprf like klah-class default 'SAPCSSMXM "YHG133681"HGA025100
pm_prprf LIKE klah-class, "HGA025100
pm_ausch(1) TYPE c,
pm_ltext(1) TYPE c,
* (Dok.)Revisionsstand ermitteln
PM_DRLDT(1) TYPE C, "note 438371
pm_dspco(1) TYPE c, "YHG079407
pm_altvo(1) TYPE c,
pm_stpst like rc29l-maxst, "HGD246532
*d PM_GBRAZ(1) TYPE C, "HGA046836
pm_brems(1) TYPE c,
pm_erskz(1) TYPE c,
pm_erssl(1) TYPE c,
pm_beikz(1) TYPE c,
pm_bessl(1) TYPE c,
pm_bagrp LIKE mara-matnr,
pm_postp(1) TYPE c,
pm_ehndl(1) TYPE c value '1',"DEFAULT '1', "HGA108310
pm_sanko LIKE stpo-sanko,
pm_sanfe LIKE stpo-sanfe,
pm_sanka LIKE stpo-sanka,
pm_sanin LIKE stpo-sanin,
pm_sanvs LIKE stpo-sanvs,
pm_rvrel LIKE stpo-rvrel,
pm_schgt LIKE stpo-schgt,
pm_stkkz LIKE stpo-stkkz, "YHG035283
*del PM_ZSTNR(1) TYPE C DEFAULT 'X', "YHG077295
pm_zstnr(1) TYPE c, "YHG077295
pm_sortk(1) TYPE c,
pm_idnrk LIKE mara-matnr.
*PARAMETERS:
data:
* ProjektNr.
pm_pspnr LIKE prst-pspnr, "HGA046836
pm_vbeln LIKE kdst-vbeln, "HGB084505
pm_vbpos LIKE kdst-vbpos. "HGB084505
* reporteigene Konstanten
DATA:
list_id LIKE klah-class VALUE 'SAPCSSMXM ', "YHG137424
* Profil zur Bildschirmanzeige
dflt_dsprf LIKE klah-class VALUE 'SAPCSSMXMP01 ', "YHG137424
* Profil beim Druck
dflt_prprf LIKE klah-class VALUE 'SAPCSSMXMP01 '. "YHG137424
DATA: "HGA046836
* obsolete
pm_gbraz TYPE c. "HGA046836
*---------------------------------------------------------------------*
* spezielle Export- Importbereiche *
*---------------------------------------------------------------------*
DATA: BEGIN OF csbomex.
INCLUDE STRUCTURE csbomex.
DATA: END OF csbomex.
*---------------------------------------------------------------------*
*.. ALV_S beg .............................................. "HGA246532
TYPE-POOLS: slis.
*..................................
DATA:
report_name LIKE sy-repid,
alvlo_stb TYPE slis_layout_alv,
alvvr LIKE disvariant,
alvvr_sav TYPE c,
exit_by_caller TYPE c,
exit_by_user TYPE slis_exit_by_user.
DATA:
wa_stb_fields_tb TYPE slis_fieldcat_alv.
DATA:
* ALV Events complete
alv_evnt_tb_cmpl TYPE slis_t_event,
* ALV Events pf exit only
alv_evnt_tb_pfxt TYPE slis_t_event,
* ALV Top of page table
alv_top_tb TYPE slis_t_listheader,
* field display properties stb tab
stb_fields_tb TYPE slis_t_fieldcat_alv.
DATA:
alvvr_sav_all TYPE c VALUE 'A',
alvvr_sav_no_usr TYPE c VALUE 'X'.
DATA: BEGIN OF alv_stb OCCURS 0.
INCLUDE STRUCTURE stpox_alv.
DATA: END OF alv_stb.
DATA: BEGIN OF ftab OCCURS 200.
INCLUDE STRUCTURE dfies.
DATA: END OF ftab.
DATA: BEGIN OF xcpt_tb OCCURS 10,
dobjt(42) TYPE c,
ojtxp(40) TYPE c,
info(3) type c,
END OF xcpt_tb.
DATA:
* ALV-Variante
pm_alvvr LIKE ltdx-variant,
* alv variant user specific
pm_alvvu TYPE c.
*.. ALV_S end .......................................................*
*---------------------------------------------------------------------*
*eject
***********************************************************************
* M A I N - Routinen *
***********************************************************************
*eject
INITIALIZATION.
*del SET TITLEBAR 'E01' "YHG036694
*del WITH 'Anzeigen Mengenübersicht' 'mehrstufig'. "YHG036694
pm_datuv = sy-datum.
get parameter ID 'FORM' field pm_mtnrv.
*write pm_mtnrv.
SET TITLEBAR 'E01' WITH text-001 text-002. "YHG036694
IMPORT csbomex FROM MEMORY ID 'CSNN_BOMEX'.
cal_aclas = csbomex-aclas. "YHG044860
* CATT-Info besorgen
PERFORM import_catt_flag. "HGC072824
PERFORM tcs03_lesen.
PERFORM tcspr_lesen.
PERFORM set_schalter. "YHG077295
IF NOT csbomex-submf = 'x'.
PERFORM sel_grenzen_01.
*del IF SY-SUBRC = 0. "YHG134557
PERFORM sel_grenzen_02.
*del ENDIF. "YHG134557
IF not pm_alvsa IS INITIAL. "HGA246532
PERFORM get_profs. "HGA025100
ENDIF. "HGA246532
ENDIF.
*eject
* ---------------------------------
AT SELECTION-SCREEN. "YHG078090
* ?Report per SUBMIT gestartet
* nein, ... per SE38 oder sonstwie
IF csbomex-submf IS INITIAL. "YHG078090
PERFORM chk_plant_auth. "HGA072824
IF sy-subrc <> 0. "HGA072824
IF sy-batch IS INITIAL. "HGA072824
MESSAGE e523 WITH 'E:' pm_werks. "HGA072824
ELSE. "HGA072824
LEAVE. "HGA072824
ENDIF. "HGA072824
ENDIF. "HGA072824
* ?weder Stuecklistenverwendung noch StlAnwendung angegeben
* ja, weder - noch
IF pm_stlan IS INITIAL "YHG078090
AND pm_capid IS INITIAL. "YHG078090
* ?Batchverarbeitung aktiv
* nein
IF sy-batch IS INITIAL. "YHG078090
* Msg.: wenigstens eine Verwendg od. eine Anwendg angeben
MESSAGE e560 WITH ''. "YHG078090
* ja, Report laeuft im Moment im Batch
ELSE. "YHG078090
* Report abbrechen - Selektion macht keinen Sinn
LEAVE. "YHG078090
ENDIF. "YHG078090
ENDIF. "YHG078090
* ?weder Einsatzmenge noch Alternative angegeben
* ja, weder - noch
IF pm_emeng IS INITIAL "YHG078090
AND pm_stlal IS INITIAL. "YHG078090
* ?Batchverarbeitung aktiv
* nein
IF sy-batch IS INITIAL. "YHG078090
* Msg.: wenigstens eine Verwendg od. eine Anwendg angeben
MESSAGE w561 WITH ''. "YHG078090
ENDIF. "YHG078090
ENDIF. "YHG078090
* ?weder Material noch KndDaten
* ja, weder - noch
IF pm_mtnrv IS INITIAL "HGC059252
AND ( pm_pspnr IS INITIAL ) "HGA046836
AND ( pm_vbeln IS INITIAL "HGC059252
OR pm_vbpos IS INITIAL ). "HGC059252
* ?Batchverarbeitung aktiv
* nein
IF sy-batch IS INITIAL. "HGC059252
* Msg.: wenigstens ein Mat od. KNDDaten angeben
MESSAGE e562 WITH ''. "HGC059252
* ja, Report laeuft im Moment im Batch
ELSE. "HGC059252
* Report abbrechen - Selektion macht keinen Sinn
LEAVE. "HGC059252
ENDIF. "HGC059252
ENDIF. "HGC059252
CLEAR: "HGA084505
anr_techs, "HGA084505
anr_datuv. "HGA084505
IF NOT pm_aennr IS INITIAL. "HGA084505
CALL FUNCTION 'CC_CHANGE_NUMBER_READ' "HGA084505
EXPORTING "HGA084505
eaennr = pm_aennr "HGA084505
IMPORTING "HGA084505
*d atechs = anr_techs "HGA084505"HGA154419
adatuv = anr_datuv. "HGA084505
IF sy-subrc = 0. "HGA084505
IF NOT anr_datuv IS INITIAL. "HGA084505
IF pm_datuv NE anr_datuv. "HGA084505
pm_datuv = anr_datuv. "HGA084505
MESSAGE w042 WITH pm_datuv. "HGA084505
ENDIF. "HGA084505
ENDIF. "HGA084505
IF NOT anr_techs IS INITIAL. "HGA084505
IF pm_techs NE anr_techs. "HGA084505
pm_techs = anr_techs. "HGA084505
ENDIF. "HGA084505
ENDIF. "HGA084505
ELSE. "HGA084505
MESSAGE w521 WITH 'E:' pm_aennr. "HGA084505
ENDIF. "HGA084505
ENDIF. "HGA084505
ENDIF. "YHG078090
*eject
* ---------------------------------
START-OF-SELECTION.
lins_per_pag = sy-srows. "HGB246532
* If list leafing is inaccurate, enlarge window for max. about 1 line
*del NEW-PAGE LINE-COUNT SY-SROWS. "YHG036694
* IF csbomex-submf IS INITIAL. "YHG049857
* SET PARAMETER ID 'CSV' FIELD pm_stlan. "YHG049857
*** SET PARAMETER ID 'CSA' FIELD pm_capid. "YHG049857
* ENDIF. "YHG049857
*
IF pm_alvsa IS INITIAL. "HGA246532
report_name = sy-repid. "HGA246532
alvlo_stb-detail_popup = 'X'. "HGA246532
alvlo_stb-zebra = 'X'. "HGA246532
PERFORM alv_evnt_tb_prep "HGA246532
USING "HGA246532
'A' "HGA246532
alv_evnt_tb_cmpl. "HGA246532
alvvr-report = report_name. "HGA246532
IF NOT pm_alvvr IS INITIAL. "HGA246532
alvvr-variant = pm_alvvr. "HGA246532
IF NOT pm_alvvu IS INITIAL. "HGA246532
alvvr-username = sy-uname. "HGA246532
ENDIF. "HGA246532
ENDIF. "HGA246532
alvvr_sav = alvvr_sav_all. "HGA246532
else. "HGA246532
if pm_dsprf is initial "HGA246532
or pm_prprf is initial. "HGA246532
perform get_profs. "HGA246532
endif. "HGA246532
*del SET PF-STATUS 'SA13'. "YHG139715
SET PF-STATUS 'S131'. "YHG139715
SET TITLEBAR 'A01'.
*del WITH 'Mengenübersicht' ''. "YHG036694
ENDIF. "HGA246532
*d IF NOT CSBOMEX-SUBMF = 'x'. "YHG046403
*del PM_EMENG = PM_EMENG * 1000 . "YHG044772"YHG046403
*d ELSE. "YHG035807"YHG046403
*d TMP_HRECHF = PM_HEMNG. "YHG035807"YHG046403
*d TMP_HRECHF = TMP_HRECHF / 1000. "YHG035807"YHG046403
*d PM_EMENG = TMP_HRECHF. "YHG035807"YHG046403
*d ENDIF. "YHG046403
PERFORM field_convert USING pm_stlal.
PERFORM sel_grenzen_03.
IF cal_aclas EQ 'CA '. "HGB070841
mem_mngmt = '0'. "HGB070841
ELSE. "HGB070841
mem_mngmt = '1'. "HGB070841
ENDIF. "HGB070841
*d DESCRIBE FIELD makt-matnr LENGTH mnr_lng. "HGA080825"uc
DESCRIBE FIELD makt-matnr "uc
LENGTH mnr_lng "uc
in character mode. "uc
* die eigentliche Aufloesung
*d IF PM_VBELN IS INITIAL "HGB084505"HGA046836
*d OR PM_VBPOS IS INITIAL. "HGB084505"HGA046836
IF ( pm_vbeln IS INITIAL "HGA046836
OR pm_vbpos IS INITIAL ) "HGA046836
AND ( pm_pspnr IS INITIAL ). "HGA046836
PERFORM ecm_proc_init "HGA084505
*d using pm_techs. "HGA084505"HGA059252
USING pm_mtnrv "HGA059252
pm_techs. "HGA059252
* CS_BOM_EXPLOSION_MAT ersetzt "YHG134557
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
altvo = pm_altvo
aufsw = ' '
auskz = pm_ausch
bagrp = pm_bagrp
beikz = pm_beikz
bessl = pm_bessl
brems = pm_brems
capid = pm_capid
datuv = pm_datuv
DRLDT = PM_DRLDT "note 438371
ehndl = pm_ehndl "HGA108310
emeng = pm_emeng
erskz = pm_erskz
erssl = pm_erssl
mbwls = ' '
mtnrv = pm_mtnrv
mehrs = 'X'
*del MMORY = '1' "YHG020009"HGB070841
mmory = mem_mngmt "HGB070841
postp = pm_postp
sanko = pm_sanko
sanfr = pm_sanfe
sanka = pm_sanka
sanin = pm_sanin
sanvs = pm_sanvs
rndkz = tcspr-amekz "YHG100738
rvrel = pm_rvrel
schgt = pm_schgt
stkkz = pm_stkkz
stlal = pm_stlal
stlan = pm_stlan
stpst = pm_stpst "HGD246532
werks = pm_werks
aumgb = 'X' "NOTE_887365
IMPORTING
topmat = selpool
dstst = dstst_flg "YHG132854
TABLES
stb = stb
matcat = matcat
EXCEPTIONS
material_not_found = 4
no_plant_data = 8
no_bom_found = 12
no_suitable_bom_found = 16
alt_not_found = 24
*d missing_authorization = 28. "HGD059252
missing_authorization = 28 "HGD059252
conversion_error = 36. "HGD059252
*d ELSE. "HGB084505"HGA046836
ELSEIF pm_pspnr IS INITIAL. "HGA046836
CALL FUNCTION 'SD_VBAP_SELECT' "HGB084505
EXPORTING "HGB084505
i_document_number = pm_vbeln "HGB084505
i_item_number = pm_vbpos "HGB084505
IMPORTING "HGB084505
e_vbap = vbap_wa "HGB084505
EXCEPTIONS "HGB084505
item_not_found = 1 "HGB084505
OTHERS = 2. "HGB084505
*d wa_kdstb-matnr = vbap_wa-matnr. "HGA033687"HGC059252
*d wa_kdstb-werks = vbap_wa-werks. "HGA033687"HGC059252
*d wa_kdstb-vbeln = pm_vbeln. "HGA033687"HGC059252
*d wa_kdstb-vbpos = pm_vbpos. "HGA033687"HGC059252
*d call function 'GET_KDST' "HGA033687"HGC059252
*d exporting "HGA033687"HGC059252
*d all = 'X' "HGA033687"HGC059252
*d no_buffer = ' ' "HGA033687"HGC059252
*d set = 'X' "HGA033687"HGC059252
*d tables "HGA033687"HGC059252
*d wa = wa_kdstb "HGA033687"HGC059252
*d exceptions "HGA033687"HGC059252
*d* CALL_INVALID = 1 "HGC059252
*d* END_OF_TABLE = 2 "HGC059252
*d* GET_WITHOUT_SET = 3 "HGC059252
*d* KEY_INCOMPLETE = 4 "HGC059252
*d* KEY_INVALID = 5 "HGC059252
*d no_record_found = 32 "HGA033687"HGC059252
*d* OTHERS = 7 "HGC059252
*d . "HGA033687"HGC059252
IF sy-subrc = 0. "HGA033687
* -->
IF vbap_wa-matnr NE pm_mtnrv. "HGB084505
matpos_flg = 'x'. "HGB084505
ENDIF. "HGB084505
IF NOT vbap_wa-techs IS INITIAL. "HGA084505
PERFORM ecm_proc_init "HGA084505
*d using vbap_wa-techs. "HGA084505"HGA059252
USING vbap_wa-matnr "HGA059252
vbap_wa-techs. "HGA059252
ELSE. "HGA084505
*....... I: pm_techs kann auch init sein
PERFORM ecm_proc_init "HGA084505
*d using pm_techs. "HGA084505"HGA059252
USING vbap_wa-matnr "HGA059252
pm_techs. "HGA059252
ENDIF. "HGA084505
* perform werks_best "note 353640 384597
* using "note 353640 384597
* vbap_wa-matnr "note 353640 384597
* changing "note 353640 384597
* vbap_wa-werks. "note 353640 384597
IF matpos_flg IS INITIAL OR "note 847517
pm_mtnrv IS INITIAL. "note 847517
PERFORM COMPUTE_PLANT(SAPLCUKO) "note 384597
USING VBAP_WA-MATNR "note 384597
VBAP_WA-WERKS "note 384597
CHANGING VBAP_WA-WERKS. "note 384597
CALL FUNCTION 'CS_BOM_EXPL_KND_V1' "HGB084505
EXPORTING "HGB084505
altvo = pm_altvo "HGB084505
aufsw = ' ' "HGB084505
auskz = pm_ausch "HGB084505
bagrp = pm_bagrp "HGB084505
beikz = pm_beikz "HGB084505
bessl = pm_bessl "HGB084505
brems = pm_brems "HGB084505
capid = pm_capid "HGB084505
cuobj = vbap_wa-cuobj "HGB084505
datuv = pm_datuv "HGB084505
DRLDT = PM_DRLDT "note 438371
ehndl = pm_ehndl "HGB084505
emeng = pm_emeng "HGB084505
erskz = pm_erskz "HGB084505
erssl = pm_erssl "HGB084505
mbwls = ' ' "HGB084505
mtnrv = vbap_wa-matnr "HGB084505
mehrs = 'X' "HGB084505
mmory = mem_mngmt "HGB084505
postp = pm_postp "HGB084505
sanko = pm_sanko "HGB084505
sanfr = pm_sanfe "HGB084505
sanka = pm_sanka "HGB084505
sanin = pm_sanin "HGB084505
sanvs = pm_sanvs "HGB084505
rndkz = tcspr-amekz "HGB084505
rvrel = pm_rvrel "HGB084505
schgt = pm_schgt "HGB084505
stkkz = pm_stkkz "HGB084505
stlal = pm_stlal "HGB084505
stlan = pm_stlan "HGB084505
stpst = pm_stpst "HGD246532
werks = vbap_wa-werks "HGB084505
vbeln = pm_vbeln "HGB084505
vbpos = pm_vbpos "HGB084505
IMPORTING "HGB084505
topmat = selpool "HGB084505
dstst = dstst_flg "HGB084505
TABLES "HGB084505
stb = stb "HGB084505
matcat = matcat "HGB084505
EXCEPTIONS "HGB084505
material_not_found = 4 "HGB084505
no_plant_data = 8 "HGB084505
*d no_bom_found = 12 "HGB084505"HGC059252
no_bom_found = 32 "HGC059252
no_suitable_bom_found = 16 "HGB084505
alt_not_found = 24 "HGB084505
*d missing_authorization = 28. "HGB084505"HGD059252
missing_authorization = 28 "HGD059252
conversion_error = 36. "HGD059252
* <--
* START OF NOTE 847517
ELSE.
PERFORM COMPUTE_PLANT(SAPLCUKO) "note 1226225
USING PM_MTNRV "note 1226225
VBAP_WA-WERKS "note 1226225
CHANGING VBAP_WA-WERKS. "note 1226225
CALL FUNCTION 'CS_BOM_EXPL_KND_V1'
EXPORTING
altvo = pm_altvo
aufsw = ' '
auskz = pm_ausch
bagrp = pm_bagrp
beikz = pm_beikz
bessl = pm_bessl
brems = pm_brems
capid = pm_capid
cuobj = vbap_wa-cuobj
datuv = pm_datuv
DRLDT = PM_DRLDT
ehndl = pm_ehndl
emeng = pm_emeng
erskz = pm_erskz
erssl = pm_erssl
mbwls = ' '
mtnrv = pm_mtnrv
mehrs = 'X'
mmory = mem_mngmt
postp = pm_postp
sanko = pm_sanko
sanfr = pm_sanfe
sanka = pm_sanka
sanin = pm_sanin
sanvs = pm_sanvs
rndkz = tcspr-amekz
rvrel = pm_rvrel
schgt = pm_schgt
stkkz = pm_stkkz
stlal = pm_stlal
stlan = pm_stlan
stpst = pm_stpst
werks = vbap_wa-werks
vbeln = pm_vbeln
vbpos = pm_vbpos
IMPORTING
topmat = selpool
dstst = dstst_flg
TABLES
stb = stb
matcat = matcat
EXCEPTIONS
material_not_found = 4
no_plant_data = 8
no_bom_found = 32
no_suitable_bom_found = 16
alt_not_found = 24
missing_authorization = 28
conversion_error = 36.
ENDIF.
*END OF NOTE 847517
ELSE. "HGC059252
sy-subrc = 32. "HGC059252
ENDIF. "HGA033687
ELSEIF ( pm_vbeln IS INITIAL "HGA046836
AND pm_vbpos IS INITIAL ) . "HGA046836
PERFORM ECM_PROC_INIT "note 485260
USING PM_MTNRV "note 485260
PM_TECHS. "note 485260
CALL FUNCTION 'CS_BOM_EXPL_PSP_V1' "HGA046836
EXPORTING "HGA046836
altvo = pm_altvo "HGA046836
aufsw = ' ' "HGA046836
auskz = pm_ausch "HGA046836
bagrp = pm_bagrp "HGA046836
beikz = pm_beikz "HGA046836
bessl = pm_bessl "HGA046836
brems = pm_brems "HGA046836
capid = pm_capid "HGA046836
datuv = pm_datuv "HGA046836
DRLDT = PM_DRLDT "note 438371
ehndl = pm_ehndl "HGA046836
emeng = pm_emeng "HGA046836
erskz = pm_erskz "HGA046836
erssl = pm_erssl "HGA046836
mbwls = ' ' "HGA046836
mehrs = 'X' "HGA046836
mmory = mem_mngmt "HGA046836
mtnrv = pm_mtnrv "HGA046836
postp = pm_postp "HGA046836
pspnr = pm_pspnr "HGA046836
rndkz = tcspr-amekz "HGA046836
rvrel = pm_rvrel "HGA046836
sanko = pm_sanko "HGA046836
sanfr = pm_sanfe "HGA046836
sanin = pm_sanin "HGA046836
sanka = pm_sanka "HGA046836
sanvs = pm_sanvs "HGA046836
schgt = pm_schgt "HGA046836
stkkz = pm_stkkz "HGA046836
stlal = pm_stlal "HGA046836
stlan = pm_stlan "HGA046836
stpst = pm_stpst "HGD246532
werks = pm_werks "HGA046836
IMPORTING "HGA046836
topmat = selpool "HGA046836
dstst = dstst_flg "HGA046836
TABLES "HGA046836
stb = stb "HGA046836
matcat = matcat "HGA046836
EXCEPTIONS "HGA046836
material_not_found = 4 "HGA046836
no_plant_data = 8 "HGA046836
no_suitable_bom_found = 16 "HGA046836
alt_not_found = 24 "HGA046836
missing_authorization = 28 "HGA046836
conversion_error = 36 "HGA046836
no_bom_found = 40 "HGA046836
. "HGA046836
IF sy-subrc <> 0. "HGA046836
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. "HGA046836
ENDIF. "HGB084505
* ggf Grafikbutton ausschalten
IF NOT dstst_flg IS INITIAL. "YHG132854
SET PF-STATUS sy-pfkey EXCLUDING 'CSGR'. "YHG132854
ENDIF. "YHG132854
* SubRc auswerten
PERFORM subrc_explr.
*eject
* ---------------------------------
TOP-OF-PAGE.
PERFORM top_01_79.
lins_per_top = sy-linno. "HGB246532
*eject
* ---------------------------------
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM top_01_79.
lins_per_top = sy-linno. "HGB246532
*eject
* ---------------------------------
END-OF-SELECTION.
*del PERFORM ANZEIGEFELDER_SETZEN.
"YHG134557
*del SORT STB ASCENDING BY IDNRK
SORT stb ASCENDING BY msign "YHG078090
idnrk ASCENDING "YHG078090
dokar ASCENDING "YHG041147
doknr ASCENDING "YHG041147
dokvr ASCENDING "YHG041147
doktl ASCENDING "YHG041147
CLASS ASCENDING "note 529728
KLART ASCENDING "note 529728
POSTP ASCENDING "note 529728
potx1 ASCENDING
potx2 ASCENDING
*d sortf ASCENDING. "note 507446
* SORTF ASCENDING "Note 759732 "note 507446
* WERKS ASCENDING. "Note 759732 "note 507446
WERKS ASCENDING "Note 759732
SORTF ASCENDING. "Note 759732
PERFORM stb_erweitern.
PERFORM cs13_vorbereiten.
IF cal_aclas EQ 'CA '. "YHG044860
EXPORT selpool TO MEMORY ID 'CSNN_CSTMAT'. "YHG044860
EXPORT stb TO MEMORY ID 'CSNN_STB'. "YHG044860
EXPORT matcat TO MEMORY ID 'CSNN_MATCAT'. "YHG134257
CLEAR: cal_aclas. "YHG044860
LEAVE. "YHG044860
ENDIF. "YHG044860
IF not pm_alvsa IS INITIAL. "HGA246532
PERFORM cs13.
PERFORM clr_hide_area.
IF NOT mpos_line IS INITIAL. "HGB084505
SCROLL LIST TO PAGE mpos_page LINE mpos_line. "HGB084505
ENDIF. "HGB084505
ELSE. "HGA246532
PERFORM alv_top_tb_prep USING alv_top_tb. "HGA246532
PERFORM cs13_alv. "HGA246532
ENDIF. "HGA246532
*break hcl4.
return.
*eject
* ---------------------------------
INCLUDE rcsnn001.
*eject
***********************************************************************
* F O R M - Routinen *
***********************************************************************
*eject
*---------------------------------------------------------------------*
* ANZEIGEFELDER_SETZEN *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
* entfaellt mit var. Liste
* "YHG134557
*del FORM ANZEIGEFELDER_SETZEN.
*del ENDFORM.
*eject
*---------------------------------------------------------------------*
* ANZEIGE_01_79 *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM anzeige_01_79.
* ---------------------------------
* Routine im wesentlichen nach ANZEIGE_01_79_DRUCK uebernommen
* ---------------------------------
* DATA-Definitionen global vereinbart
*del DATA: UEBERL_KZ(1) TYPE C VALUE '*'. "YHG035807 "YHG066003
*del DATA: UEBERL_FLG(1) TYPE C. "YHG035807 "YHG066003
*del DATA: ANZ_MEINS LIKE STPO-MEINS, "YHG066003
*del ANZ_KTEXT LIKE MAKT-MAKTX. "YHG066003
* ---------------------------------
CHECK stb-sumkz NE 's'.
IF stb-idnrk IS INITIAL.
IF stb-doknr IS INITIAL. "YHG041147
IF stb-class IS INITIAL. "YHG000109
anz_meins = stb-meins.
anz_ktext = stb-potx1.
ELSE. "YHG000109
anz_meins = stb-meins. "YHG000109
anz_ktext = stb-ojtxp. "YHG000109
ENDIF. "YHG000109
ELSE. "YHG041147
anz_meins = stb-meins. "YHG041147
anz_ktext = stb-ojtxp. "YHG041147
ENDIF. "YHG041147
ELSE.
anz_meins = stb-mmein.
*del ANZ_KTEXT = STB-MAKTX. "YHG035283
anz_ktext = stb-ojtxp. "YHG035283
ENDIF.
IF stb-mnglg >= max_num. "YHG035807
ueberl_flg = ueberl_kz. "YHG035807
ELSE. "YHG035807
IF stb-mnglg <= min_num. "YHG088020
ueberl_flg = ueberl_kz. "YHG088020
ELSE. "YHG088020
CLEAR: ueberl_flg. "YHG035807
ENDIF. "YHG088020
ENDIF. "YHG035807
*del IF SY-UCOMM NE 'CSPR'. "YHG066003"YHG134557
PERFORM anzeige_01_79_liste. "YHG066003
*del ELSE. "YHG066003"YHG134557
*del PERFORM ANZEIGE_01_79_DRUCK. "YHG066003"YHG134557
*del ENDIF. "YHG066003"YHG134557
* ?Klassenposition
* und Zuordnungen komplett od. teilweise anzeigen bzw. drucken
* ja
IF stb-objty EQ otyp_kla "YHG079407
AND ( NOT pm_dspco IS INITIAL "YHG079407
*d OR sy-ucomm EQ 'CSCA' "YHG079407"note 351902
*d OR sy-ucomm EQ 'CSPR' ). "YHG079407"note 351902
OR SV_UCOMM EQ 'CSCA' "note 351902
OR SV_UCOMM EQ 'CSPR' ). "note 351902
* Teilkey der Klassenpositionentabelle fuellen
cl_clstab-class = stb-class. "YHG079407
cl_clstab-klart = stb-klart. "YHG079407
* Bearbeitungsstand zur aktuellen Klassenposition versorgen
READ TABLE cl_clstab "YHG079407
WITH KEY cl_clstab(21) "YHG079407
BINARY SEARCH. "YHG079407
* ?Zuordnungen anzeigen
* ja
IF NOT cl_clstab-dsply IS INITIAL. "YHG079407
* ?Klassenposition bereits bearbeitet
* nein
IF cl_clstab-chked IS INITIAL. "YHG079407
* Klassenposition bearbeiten
PERFORM chk_cl_clstab_entry. "YHG079407
ENDIF. "YHG079407
* ?gibt es ueberhaupt Zuordnungen zum Anzeigen
* ja
IF cl_clstab-noobj IS INITIAL. "YHG079407
* na also, dann los
PERFORM anzeige_04_79. "YHG079407
ENDIF. "YHG079407
ENDIF. "YHG079407
ENDIF. "YHG079407
ENDFORM.
*eject
*---------------------------------------------------------------------*
* ANZEIGE_01_79_DRUCK *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
* entfaellt mit var. Liste "YHG134557
*del FORM ANZEIGE_01_79_DRUCK.
*del ENDFORM.
*eject
*---------------------------------------------------------------------*
* ANZEIGE_01_79_LISTE *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
* komplett ueberarbeitet "YHG134557
FORM anzeige_01_79_liste. "YHG066003
DATA: lkl_blockname LIKE klah-class.
* ---------------------------------
* Feld fuer ObjAnzeige in Uebergabestruktur initialisieren
CLEAR: stb_add-dobjt.
CLEAR: lkl_blockname.
* ?die Komponente ist ...
CASE stb_orig-objty.
* ... ein Material
WHEN otyp_mat.
* Blockname festlegen
lkl_blockname = 'ITEM_M '.
* ... ein Material (ein altes)
WHEN 'M'.
* Blockname festlegen
lkl_blockname = 'ITEM_M '.
* ... objektlos; z.B. eine Textposition
WHEN otyp_noo.
* Blockname festlegen
lkl_blockname = 'ITEM_NOO '.
* ... ein Dokument
WHEN otyp_doc.
* Blockname festlegen
lkl_blockname = 'ITEM_D '.
* ... eine Klasse
WHEN otyp_kla.
* Blockname festlegen
lkl_blockname = 'ITEM_C '.
* ... ein Intramaterial
WHEN otyp_ntm.
* Blockname festlegen
lkl_blockname = 'ITEM_NTM '.
* ... ein UFO
WHEN OTHERS.
* Blockname festlegen
CLEAR: lkl_blockname.
ENDCASE.
* Ueberlaufschalter in Uebergabestruktur uebernehmen
stb_add-ovfls = ueberl_flg.
stb_add-dunit = anz_meins.
* ?Komponente ist selber Stueckliste
* ja
IF NOT stb_orig-xtlnr IS INITIAL. "YHG133751
* Kennzeichen in Uebergabestruktur setzen
stb_add-bomfl = b_flag. "YHG133751
ENDIF. "YHG133751
* ?es gibt einen Positionstext
* ja
IF NOT stb_orig-potx1 IS INITIAL.
* ?der Positionstext stimmt mit dem Kurztext ueberein
* ja
IF stb_orig-potx1 EQ stb_orig-ojtxp.
* dann kann man den Positionstext loeschen
CLEAR: stb_orig-potx1.
ENDIF.
ENDIF.
*d IF NOT pm_ltext IS INITIAL. "HGA132240"note 306308
*d IF NOT stb-ltxsp IS INITIAL. "HGA132240"note 306308
IF NOT PM_LTEXT IS INITIAL "note 306308
AND NOT STB-LTXSP IS INITIAL. "note 306308
PERFORM LTEXT_HOLEN. "HGA132240
IF SY-SUBRC = 0. "HGA132240
READ TABLE TXT INDEX 1. "HGA132240
IF STB-POTX1 = TXT-TDLINE. "HGA132240
if stb_orig-potx1 is initial. "note 375902
if stb_orig-ojtxp = txt-tdline. "note 375902
clear: stb_orig-ojtxp. "note 375902
endif. "note 375902
endif. "note 375902
CLEAR: STB_ORIG-POTX1. "HGA132240
READ TABLE TXT INDEX 2. "HGA132240
IF STB-POTX2 = TXT-TDLINE. "HGA132240
CLEAR: STB_ORIG-POTX2. "HGA132240
ENDIF. "HGA132240
ENDIF. "HGA132240
PERFORM TXT_CONV_CHK "note 306308
TABLES "note 306308
TXT "note 306308
USING "note 306308
' ' "note 306308
' '. "note 306308
CALL FUNCTION 'FORMAT_TEXTLINES' "HGA132240
EXPORTING "HGA132240
*d FORMATWIDTH = 41 "HGA132240
FORMATWIDTH = 40 "note 667950
LINEWIDTH = 40 "note 875961
TABLES "HGA132240
LINES = TXT. "HGA132240
IF STB_ORIG-POTX1 IS INITIAL "HGA132240
AND STB_ORIG-POTX2 IS INITIAL. "HGA132240
READ TABLE TXT INDEX 1. "HGA132240
STB_ORIG-POTX1 = TXT-TDLINE. "HGA132240
STB-POTX1 = TXT-TDLINE. "HGA132240
READ TABLE TXT INDEX 2. "HGA132240
STB_ORIG-POTX2 = TXT-TDLINE. "HGA132240
STB-POTX2 = TXT-TDLINE. "HGA132240
ENDIF. "HGA132240
ELSE. "HGA029649
TXT-TDLINE = TEXT-097. "HGA029649
APPEND TXT. "HGA029649
ENDIF. "HGA132240
*d ENDIF. "HGA132240"note 306308
ELSE. "note 306308
PERFORM TXT_CONV_CHK "note 306308
TABLES "note 306308
TXT "note 306308
USING "note 306308
STB_ORIG-POTX1 "note 306308
STB_ORIG-POTX2. "note 306308
ENDIF. "HGA132240
* ?Komponente ist Wissensbaustein zugeordnet
* ja
IF NOT stb_orig-knobj IS INITIAL. "YHG139320
* Kennzeichen in Uebergabestruktur setzen
stb_add-knofl = 'X'. "YHG139320
ENDIF. "YHG139320
* Positionszeile
* je nach Farbschalter
IF col_switch IS INITIAL.
* hellen Hintergrund an-
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
col_switch = 'x'.
ELSE.
* ... oder ausschalten
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
CLEAR: col_switch.
ENDIF.
* WATAB initialisieren und komplett leeren
CLEAR: watab. REFRESH: watab.
* Uebergabestruktur (Typ STPOX) ...
*d watab-tname = 'STPOX'. watab-table = stb_orig . "uc
WATAB-TNAME = 'STPOX'. "uc
assign watab-table to <x_watab-table> casting. "uc
assign stb_orig to <x_stpox_wa> casting. "uc
<x_watab-table> = <x_stpox_wa> . "uc
* ... sichern
APPEND watab.
* WATAB initialisieren
CLEAR watab.
* Uebergabestruktur (Typ STPOL_ADD) ...
*d watab-tname = 'STPOL_ADD'. watab-table = stb_add . "uc
WATAB-TNAME = 'STPOL_ADD'. "uc
assign watab-table to <x_watab-table> casting. "uc
assign stb_add to <x_STPOL_ADD_wa> casting. "uc
<x_watab-table> = <x_STPOL_ADD_wa> . "uc
* ... sichern
APPEND watab.
* WATAB initialisieren
CLEAR watab.
* Daten zur Position ausgeben
PERFORM write_block
USING lkl_blockname
* ausgegebene Zeilen nicht zaehlen
' '
* Hide ausfuehren
'x'. "YHG123656
* ?soll Langtext ausgegeben werdem
* ja
IF NOT pm_ltext IS INITIAL.
* ?gibt es Langtext
* ja
IF NOT stb-ltxsp IS INITIAL.
* Langtext einlesen
*d perform ltext_holen. "HGA132240
READ TABLE txt INDEX 1. "HGA132240
* ?Langtext konnte eingelesen werden
* ja
IF sy-subrc = 0.
* pro Textzeile ...
LOOP AT txt.
* ?wenn Zeile 1 ...
IF sy-tabix = 1.
* gleich der ersten PosTextzeile ist, - nicht ausgeben
CHECK stb-potx1 <> txt-tdline.
ENDIF.
* ?wenn Zeile 1 ...
IF sy-tabix = 2.
* gleich der zweiten PosTextzeile ist, - nicht ausgeben
CHECK stb-potx2 <> txt-tdline.
ENDIF.
* Uebergabestruktur initialisieren
CLEAR: stb_add.
* Textzeile in Uebergabestruktur uebernehmen
stb_add-tline = txt-tdline.
* WATAB initialisieren und komplett leeren
CLEAR watab. REFRESH watab.
* Uebergabestruktur (Typ STPOL_ADD) ...
*d watab-tname = 'STPOL_ADD'. watab-table = stb_add . "uc
WATAB-TNAME = 'STPOL_ADD'. "uc
assign watab-table to <x_watab-table> casting. "uc
assign stb_add to <x_STPOL_ADD_wa> casting. "uc
<x_watab-table> = <x_STPOL_ADD_wa> . "uc
* ... sichern
APPEND watab.
* WATAB initialisieren und komplett leeren
CLEAR watab.
* Langtextzeile ausgeben
PERFORM write_block
USING 'LTEXT_LIN '
* ausgegebene Zeilen nicht zaehlen
' '
* Hide ausfuehren
'x'. "YHG123656
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* ANZEIGE_04_79 *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM anzeige_04_79. "YHG079407
*del IF SY-UCOMM NE 'CSPR'. "YHG134557
PERFORM anzeige_04_79_liste.
*del ELSE. "YHG134557
*del PERFORM ANZEIGE_04_79_DRUCK. "YHG134557
*del ENDIF. "YHG134557
ENDFORM.
*eject
*---------------------------------------------------------------------*
* ANZEIGE_04_79_DRUCK *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
* entfaellt mit var. Liste "YHG134557
*del FORM ANZEIGE_04_79_DRUCK.
*del ENDFORM.
*eject
*---------------------------------------------------------------------*
* ANZEIGE_04_79_LISTE *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
* komplett ueberarbeitet "YHG134557
FORM anzeige_04_79_liste. "YHG079407
* ---------------------------------
DATA: sav_cl_objmemo LIKE cl_objmemo.
* ---------------------------------
* Teilkey der KlassenObjekteMemotabelle fuellen
sav_cl_objmemo(18) = stb-class.
sav_cl_objmemo+18(3) = stb-klart.
* Merktabelle lesen
READ TABLE cl_objmemo
WITH KEY sav_cl_objmemo(21)
BINARY SEARCH.
* ?passende Eintraege (Zuordnungen) gefunden
* ja
IF sy-subrc = 0.
CLEAR: stb_add.
* Alle passenden Zuordnungen ...
LOOP AT cl_objmemo FROM sy-tabix.
* ?Eintrag passt noch
* nein
IF cl_objmemo(21) NE sav_cl_objmemo(21).
* Ausgabe beenden
EXIT.
ENDIF.
* MatNr fuer HIDE-Bereich festlegen
*d CLO_MATNR = CL_OBJMEMO-OBJECT(18). "HGA080825
clo_matnr = cl_objmemo-object(mnr_lng). "HGA080825
* Klassenobjekt (Mat) in Uebergabestruktur uebernehmen
*d WRITE CL_OBJMEMO-OBJECT(18) TO STB_ADD-CLOBJ. "HGA080825
WRITE cl_objmemo-object TO stb_add-clobj(mnr_lng). "HGA080825
* Kurztext zum Objekt in Uebergabestruktur uebernehmen
WRITE cl_objmemo-text(40) TO stb_add-clotx.
* WATAB initialisieren und komplett leeren
CLEAR: watab. REFRESH: watab.
* Uebergabestruktur (Typ STPOL_ADD) ...
*d watab-tname = 'STPOL_ADD'. watab-table = stb_add . "uc
WATAB-TNAME = 'STPOL_ADD'. "uc
assign watab-table to <x_watab-table> casting. "uc
assign stb_add to <x_STPOL_ADD_wa> casting. "uc
<x_watab-table> = <x_STPOL_ADD_wa> . "uc
* ... sichern
APPEND watab.
* WATAB initialisieren
CLEAR watab.
* Daten zum Objekt der Klasse ausgeben
PERFORM write_block
USING 'CLASS_OBJ '
* ausgegebene Zeilen nicht zaehlen
' '
* Hide nicht ausfuehren
' '. "YHG123656
ENDLOOP.
ENDIF.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* AUSNAHMEN_AUSGEBEN *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM ausnahmen_ausgeben.
* ---------------------------------
* Routine im wesentlichen nach AUSNAHMEN_AUSGEBEN_DRUCK uebernommen
* ---------------------------------
ausntp_flg = 'x'. "YHG066003
*del IF SY-UCOMM NE 'CSPR'. "YHG066003"YHG134557
PERFORM ausnahmen_ausgeben_liste. "YHG066003
*del ELSE. "YHG066003"YHG134557
*del PERFORM AUSNAHMEN_AUSGEBEN_DRUCK. "YHG066003"YHG134557
*del ENDIF. "YHG066003"YHG134557
CLEAR: ausntp_flg. "YHG066003
ENDFORM.
*eject
*---------------------------------------------------------------------*
* AUSNAHMEN_AUSGEBEN_DRUCK *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
* entfaellt mit var. Liste
*del FORM AUSNAHME_AUSGEBEN_DRUCK.
*del ENDFORM.
*eject
*---------------------------------------------------------------------*
* AUSNAHMEN_AUSGEBEN_LISTE *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
* komplett ueberarbeitet "YHG134557
FORM ausnahmen_ausgeben_liste. "YHG066003
*----------------------------------
DATA: lkl_stlal LIKE stko-stlal,
lkl_ausnm LIKE stpox-ausnm,
lkl_blockname LIKE klah-class.
*----------------------------------
CLEAR: lkl_stlal,
lkl_ausnm.
READ TABLE ausnm_stb INDEX 1.
CHECK sy-subrc = 0 .
NEW-PAGE.
IF page_exc < 1.
page_exc = sy-pagno.
ENDIF.
SORT ausnm_stb ASCENDING BY ausnm
objty ASCENDING
xtlal ASCENDING.
CLEAR: stb_add.
WRITE text-030 TO stb_add-tline(76).
FORMAT COLOR COL_BACKGROUND INTENSIFIED ON.
CLEAR: watab. REFRESH watab.
*d watab-tname = 'STPOL_ADD'. watab-table = stb_add . "uc
WATAB-TNAME = 'STPOL_ADD'. "uc
assign watab-table to <x_watab-table> casting. "uc
assign stb_add to <x_STPOL_ADD_wa> casting. "uc
<x_watab-table> = <x_STPOL_ADD_wa> . "uc
APPEND watab.
CLEAR: watab.
PERFORM write_block
USING 'X_GNRL_HDNG '
* ausgegebene Zeilen nicht zaehlen
' '
* Hide nicht ausfuehren
' '. "YHG123656
LOOP AT ausnm_stb.
IF lkl_stlal NE ausnm_stb-xtlal
OR lkl_ausnm NE ausnm_stb-ausnm.
lkl_stlal = ausnm_stb-xtlal.
lkl_ausnm = ausnm_stb-ausnm.
CLEAR: stb_add.
CASE ausnm_stb-ausnm.
WHEN 'DELE'.
WRITE text-039 TO stb_add-tline(76).
WHEN 'NBER'.
WRITE text-031 TO stb_add-tline(76).
WHEN 'NREK'.
WRITE text-032 TO stb_add-tline(76).
WHEN 'REKU'.
WRITE text-034 TO stb_add-tline(76).
WHEN 'NOTX'.
IF NOT pm_stlal IS INITIAL
AND NOT pm_altvo IS INITIAL.
WRITE text-035 TO stb_add-tline(35).
WRITE pm_stlal TO stb_add-tline+36(2).
WRITE text-036 TO stb_add-tline+39(37).
CONDENSE stb_add-tline.
ELSE.
WRITE text-035 TO stb_add-tline(35).
WRITE ausnm_stb-xtlal TO stb_add-tline+36(2).
WRITE text-036 TO stb_add-tline+39(37).
CONDENSE stb_add-tline.
ENDIF.
ENDCASE.
CLEAR: watab. REFRESH watab.
*d watab-tname = 'STPOL_ADD'. watab-table = stb_add . "uc
WATAB-TNAME = 'STPOL_ADD'. "uc
assign watab-table to <x_watab-table> casting. "uc
assign stb_add to <x_STPOL_ADD_wa> casting. "uc
<x_watab-table> = <x_STPOL_ADD_wa> . "uc
APPEND watab.
CLEAR: watab.
PERFORM write_block
USING 'X_DTL_HDNG '
* ausgegebene Zeilen nicht zaehlen
' '
* Hide nicht ausfuehren
' '. "YHG123656
ENDIF.
* Feld fuer ObjAnzeige in Uebergabestruktur initialisieren
CLEAR: stb_orig.
CLEAR: lkl_blockname.
* ?die Komponente ist ...
CASE ausnm_stb-objty.
* ... ein Material
WHEN otyp_mat.
stb_orig-idnrk = ausnm_stb-idnrk.
stb_orig-revlv = ausnm_stb-revlv.
* Blockname festlegen
lkl_blockname = 'X_ITEM_M '.
* ... ein Material (ein altes)
WHEN 'M'.
stb_orig-idnrk = ausnm_stb-idnrk.
stb_orig-revlv = ausnm_stb-revlv.
* Blockname festlegen
lkl_blockname = 'X_ITEM_M '.
* ... objektlos; z.B. eine Textposition
WHEN otyp_noo.
* Blockname festlegen
lkl_blockname = 'X_ITEM_NOO '.
* ... ein Dokument
WHEN otyp_doc.
stb_orig-doknr = ausnm_stb-doknr.
stb_orig-dokar = ausnm_stb-dokar.
stb_orig-doktl = ausnm_stb-doktl.
stb_orig-dokvr = ausnm_stb-dokvr.
* Blockname festlegen
lkl_blockname = 'X_ITEM_D '.
* ... eine Klasse
WHEN otyp_kla.
stb_orig-class = ausnm_stb-class.
stb_orig-klart = ausnm_stb-klart.
* Blockname festlegen
lkl_blockname = 'X_ITEM_C '.
* ... ein Intramaterial
WHEN otyp_ntm.
stb_orig-intrm = ausnm_stb-intrm.
* Blockname festlegen
lkl_blockname = 'X_ITEM_NTM '.
* ... ein UFO
WHEN OTHERS.
* Blockname festlegen
CLEAR: lkl_blockname.
ENDCASE.
stb_orig-ojtxp = ausnm_stb-ojtxp.
* WATAB initialisieren und komplett leeren
CLEAR: watab. REFRESH: watab.
* Uebergabestruktur (Typ STPOX) ...
*d watab-tname = 'STPOX'. watab-table = stb_orig . "uc
WATAB-TNAME = 'STPOX'. "uc
assign watab-table to <x_watab-table> casting. "uc
assign stb_orig to <x_STPOX_wa> casting. "uc
<x_watab-table> = <x_STPOX_wa> . "uc
* ... sichern
APPEND watab.
* WATAB initialisieren
CLEAR watab.
* Daten zur Position ausgeben
PERFORM write_block
USING lkl_blockname
* ausgegebene Zeilen nicht zaehlen
' '
* Hide ausfuehren
'x'. "YHG123656
ENDLOOP.
ULINE AT /1(siz_linpf).
PERFORM end_page.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* AUSNAHME_MERKEN *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM ausnahme_merken.
ausnm_stb-objty = stb-objty. "YHG134557
ausnm_stb-idnrk = stb-idnrk.
ausnm_stb-revlv = stb-revlv. "YHG134557
ausnm_stb-doknr = stb-doknr. "YHG078090
ausnm_stb-dokar = stb-dokar. "YHG078090
ausnm_stb-doktl = stb-doktl. "YHG078090
ausnm_stb-dokvr = stb-dokvr. "YHG078090
ausnm_stb-class = stb-class. "YHG078090
ausnm_stb-klart = stb-klart. "YHG078090
ausnm_stb-intrm = stb-intrm. "YHG134557
*del AUSNM_STB-MAKTX = STB-MAKTX. "YHG035283
ausnm_stb-ojtxp = stb-ojtxp. "YHG035283
IF stb-ausnm EQ 'NOTX'.
ausnm_stb-xtlal = stb-xtlal.
ENDIF.
ausnm_stb-ausnm = stb-ausnm.
hlp_tabix = sy-tabix.
COLLECT ausnm_stb.
sy-tabix = hlp_tabix.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* CS13 *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM cs13.
*d IF NOT SY-BATCH IS INITIAL. "YHG078090"HGC072824
IF NOT sy-batch IS INITIAL "HGC072824
AND cattaktiv IS INITIAL. "HGC072824
PERFORM print_mode_batch. "YHG078090
ENDIF. "YHG078090
* ?Druck eingeschaltet
* ja
*d IF sy-ucomm EQ 'CSPR'. "YHG134557"note 351902
IF SV_UCOMM EQ 'CSPR'. "note 351902
* Druckprofil aktivieren
act_profil = pm_prprf. "YHG134557
perform prof_get_cmpl "HGB020150
using itf_prfsz. "HGB020150
perform prrsv_tb_cre. "HGB020150
* nein, Bildschirmausgabe
ELSE. "YHG134557
* Bildschirmausgabeprofil aktivieren
act_profil = pm_dsprf. "YHG134557
ENDIF. "YHG134557
* im Profil definierte Zeilenbreite besorgen
CALL FUNCTION 'CLFC_PROFILE_SIZE' "YHG134557
EXPORTING "YHG134557
*del LISTID = 'SAPCSSMXM '"YHG134557"YHG137424
listid = list_id "YHG137424
profile = act_profil "YHG134557
IMPORTING "YHG134557
*del SIZE = SAV_PRFSZ "YHG134557"YHG032486
size = itf_prfsz "YHG032486
EXCEPTIONS "YHG134557
listid_not_found = 01 "YHG134557
no_valid_listid = 02 "YHG134557
no_valid_profile = 03 "YHG134557
profile_not_found = 04 "YHG134557
profile_not_in_listid = 05. "YHG134557
sav_prfsz = itf_prfsz. "YHG032486
IF sy-subrc <> 0. "YHG137424
* ?Druck eingeschaltet
* ja
*d IF sy-ucomm EQ 'CSPR'. "YHG137424"note 351902
IF SV_UCOMM EQ 'CSPR'. "note 351902
* Druckprofil aktivieren
act_profil = dflt_prprf. "YHG137424
* nein, Bildschirmausgabe
ELSE. "YHG137424
* Bildschirmausgabeprofil aktivieren
act_profil = dflt_dsprf. "YHG137424
ENDIF. "YHG137424
CALL FUNCTION 'CLFC_PROFILE_SIZE' "YHG137424
EXPORTING "YHG137424
listid = list_id "YHG137424
profile = act_profil "YHG137424
IMPORTING "YHG137424
*del SIZE = SAV_PRFSZ. "YHG137424"YHG032486
size = itf_prfsz. "YHG032486
sav_prfsz = itf_prfsz. "YHG032486
ENDIF. "YHG137424
* Zeilenbreiten wg. Rahmen um 2 erhoehen
siz_linpf = sav_prfsz + 2. "YHG134557
*d IF sy-ucomm EQ 'CSPR'. "YHG139715"note 351902
IF SV_UCOMM EQ 'CSPR'. "note 351902
PERFORM prep_druck. "YHG139715
ENDIF. "YHG139715
PERFORM create_dsp_sel. "YHG139715
*d IF sy-ucomm EQ 'CSPR'. "YHG139715"note 351902
IF SV_UCOMM EQ 'CSPR'. "note 351902
PERFORM selkrit_druck. "YHG139715
ENDIF. "YHG139715
LOOP AT stb.
* Uebergabestrukturen initialisieren
CLEAR: stb_orig, "YHG134557
stb_add. "YHG134557
IF stb-ttidx <> matcat-index. "YHG134557
READ TABLE matcat INDEX stb-ttidx. "YHG134557
ENDIF. "YHG134557
* STB-Eintrag in Uebergabestruktur uebernehmen
stb_orig = stb. "YHG134557
IF pm_zstnr IS INITIAL.
CHECK stb-xtlnr IS INITIAL.
ENDIF.
IF NOT pm_idnrk IS INITIAL.
CHECK stb-idnrk EQ pm_idnrk.
ENDIF.
*del IF SY-TABIX = 1. "YHG068719 "YHG078090
IF objty_mrk IS INITIAL. "YHG078090
objty_mrk = stb-objty. "YHG068719
ENDIF. "YHG068719
IF objty_mrk NE stb-objty "YHG068719
AND pm_sortk NE '2'. "YHG068719
objty_mrk = stb-objty. "YHG068719
*d IF sy-ucomm NE 'CSPR'. "YHG068719"note 351902
IF SV_UCOMM NE 'CSPR'. "note 351902
*del ULINE (81). "YHG068719"YHG134557
ULINE AT /1(siz_linpf). "YHG134557
PERFORM end_page. "YHG068719
ENDIF. "YHG068719
NEW-PAGE. "YHG068719
ENDIF. "YHG068719
PERFORM anzeige_01_79.
ENDLOOP.
IF sy-subrc <> 0.
MESSAGE s513 WITH 'E: '.
EXIT.
ELSE. "YHG036694
*d IF sy-ucomm NE 'CSPR'. "YHG036694"note 351902
IF SV_UCOMM NE 'CSPR'. "note 351902
*del ULINE (81). "YHG066003"YHG134557
ULINE AT /1(siz_linpf). "YHG134557
PERFORM end_page. "YHG036694
ENDIF. "YHG036694
ENDIF.
PERFORM ausnahmen_ausgeben.
*d IF sy-ucomm EQ 'CSPR'. "YHG139336"note 351902
IF SV_UCOMM EQ 'CSPR'. "note 351902
SKIP 1. "YHG139336
* Ende der Liste
FORMAT COLOR COL_BACKGROUND. "YHG139336
WRITE: / text-098 INTENSIFIED. "YHG139336
ENDIF. "YHG139336
ENDFORM.
*eject
*---------------------------------------------------------------------*
* CS13_VORBEREITEN *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM cs13_vorbereiten.
CASE pm_sortk.
WHEN '1'.
*del SORT STB ASCENDING BY MAKTX "YHG035283
*del SORT STB ASCENDING BY OJTXP "YHG035283 "YHG068719
SORT stb ASCENDING BY objty "YHG068719
ojtxp ASCENDING "YHG068719
potx1 ASCENDING "YHG056590
potx2 ASCENDING "YHG056590
idnrk ASCENDING
dokar ASCENDING "YHG041147
doknr ASCENDING "YHG041147
dokvr ASCENDING "YHG041147
doktl ASCENDING "YHG041147
sortf ASCENDING
sumkz ASCENDING.
WHEN '2'.
SORT stb ASCENDING BY sortf
idnrk ASCENDING
dokar ASCENDING "YHG041147
doknr ASCENDING "YHG041147
dokvr ASCENDING "YHG041147
doktl ASCENDING "YHG041147
*del MAKTX ASCENDING "YHG035283
ojtxp ASCENDING "YHG035283
potx1 ASCENDING "YHG056590
potx2 ASCENDING "YHG056590
sumkz ASCENDING.
WHEN OTHERS.
*del SORT STB ASCENDING BY IDNRK "YHG068719
SORT stb ASCENDING BY objty "YHG068719
idnrk ASCENDING "YHG068719
dokar ASCENDING "YHG041147
doknr ASCENDING "YHG041147
dokvr ASCENDING "YHG041147
doktl ASCENDING "YHG041147
*del MAKTX ASCENDING "YHG035283
ojtxp ASCENDING "YHG035283
potx1 ASCENDING "YHG056590
potx2 ASCENDING "YHG056590
sortf ASCENDING
sumkz ASCENDING.
ENDCASE.
* ?Fuer Klassenpositionen alle Zuordnungen ausgeben
* ja
IF NOT pm_dspco IS INITIAL. "YHG079407
* alle Zuordnungen aller Klassenpositionen besorgen
PERFORM get_cla_allocs_all. "YHG079407
ENDIF. "YHG079407
ENDFORM.
FORM END_PAGE. "HGB246532
* completely revised and moved from RCSNN001
* ---------------------------------
data:
lin_to_skip_to like sy-linno,
lins_listed like sy-linno.
* ---------------------------------
check sy-ucomm ne 'CSPR'.
FORMAT RESET.
lins_out = sy-linno.
lins_listed = lins_per_pag - lins_per_top.
if lins_out > lins_per_pag.
LINS_OUT = LINS_OUT - LINS_per_pag.
DO.
IF LINS_OUT <= LINS_listed.
EXIT.
ENDIF.
LINS_OUT = LINS_OUT - LINS_listed.
ENDDO.
LINS_TO_SKIP = LINS_listed - LINS_OUT.
else.
LINS_TO_SKIP = LINS_per_pag - LINS_OUT.
endif.
lin_to_skip_to = sy-linno + lins_to_skip.
skip to line lin_to_skip_to.
WRITE: / ' '.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* LISTE_DRUCKEN *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM liste_drucken. "YHG053243
PERFORM cs13. "YHG053243
ENDFORM. "YHG053243
*eject
*---------------------------------------------------------------------*
* LTEXT_HOLEN *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM ltext_holen.
DATA: BEGIN OF txhdr. "HGB057558
INCLUDE STRUCTURE thead. "HGB057558
DATA: END OF txhdr. "HGB057558
*----------------------------------
CLEAR: txt_key.
WRITE sy-mandt TO txt_key USING NO EDIT MASK.
txt_kyln = strlen( txt_key ).
WRITE stb-stlty TO txt_key+txt_kyln.
txt_kyln = strlen( txt_key ).
WRITE stb-stlnr TO txt_key+txt_kyln USING NO EDIT MASK.
txt_kyln = strlen( txt_key ).
WRITE stb-stlkn TO txt_key+txt_kyln.
txt_kyln = strlen( txt_key ).
WRITE stb-stpoz TO txt_key+txt_kyln.
*d bom_txid = mbm_txid. "HGA029649"note 411978
*d IF stb-stlty EQ typ_knd. "HGA029649"note 411978
*d bom_txid = kbm_txid. "HGA029649"note 411978
*d ENDIF. "HGA029649"note 411978
bom_txid(1) = stb-stlty. "note 411978
bom_txid+1 = 'PO'. "note 411978
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = bom_txid
*del LANGUAGE = SY-LANGU "YHG062728
language = stb-ltxsp "YHG062728
name = txt_key
object = bom_txobj
IMPORTING "HGB057558
header = txhdr "HGB057558
TABLES
*d lines = txt. "HGA029649
lines = txt "HGA029649
EXCEPTIONS "HGA029649
not_found = 1. "HGA029649
IF sy-subrc = 0. "HGA029649
PERFORM create_txincl_cmd. "HGB057558
CALL FUNCTION 'TEXT_INCLUDE_REPLACE' "HGB057558
EXPORTING "HGB057558
header = txhdr "HGB057558
TABLES "HGB057558
lines = txt. "HGB057558
ENDIF. "HGA029649
ENDFORM.
*eject
*---------------------------------------------------------------------*
* NEU_ANZEIGE *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM neu_anzeige. "YHG079407
CLEAR: objty_mrk.
* Liste anzeigen
PERFORM cs13.
* Hidebereich loeschen
PERFORM clr_hide_area.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* OBJ_IDENT *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM obj_ident. "YHG068719
* weder Mat noch Doc
*del CHECK: STB-OBJTY = '2' OR STB-OBJTY IS INITIAL. "YHG079407
CHECK: stb-objty NE otyp_mat, "YHG079407
stb-objty NE ootyp_mat, "HGB099459
stb-objty NE otyp_doc, "YHG079407
stb-objty NE otyp_ntm. "YHG134557
* ?T418-WA schon ok
* nein
IF stb-postp NE t418-postp.
* T418 einlesen
PERFORM t418_lesen USING stb-postp.
ENDIF.
* ?MatNr-Eingabe bei diesem PosTyp moeglich
* und keine Textposition
* trifft zu
IF t418-matin NE '-'
AND t418-txpos IS INITIAL.
* aktuelles Objekt ist Material NLAG
stb-objty = '1'.
* PosKurztext in ObjKurztext uebernehmen.
stb-ojtxp = stb-potx1.
MODIFY stb.
ELSE.
IF stb-objty IS INITIAL.
stb-objty = '2'.
MODIFY stb.
ENDIF.
ENDIF.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* SEL_GRENZEN_01 *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM sel_grenzen_01.
IF tcs03-lowdt IS INITIAL.
pm_datuv = syst-datum.
ELSE.
pm_datuv = min_grg.
ENDIF.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* SEL_GRENZEN_02 *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM sel_grenzen_02.
*del PM_CAPID = TCSPR-CAPID. "YHG049857
*del PM_STLAN = TCSPR-STLAN. "YHG049857
* ?Report wurde von woanders per Submit gestartet
* nein
*del IF CSBOMEX-SUBMF IS INITIAL. "YHG049857"YHG134557
* Stuecklistenverwendung aus der ParameterArea vorschlagen
* GET PARAMETER ID 'CSV' FIELD pm_stlan. "YHG049857
* Stuecklistenanwendung aus der ParameterArea vorschlagen
* GET PARAMETER ID 'CSA' FIELD pm_capid. "YHG049857
*del ENDIF. "YHG049857"YHG134557
ENDFORM.
*eject
*---------------------------------------------------------------------*
* SET_MARGIN *
*---------------------------------------------------------------------*
* in Include RCSNN001 verlagert "YHG078090
*---------------------------------------------------------------------*
*eject
*---------------------------------------------------------------------*
* SET_SCHALTER *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM set_schalter. "YHG077295
check csbomex-submf is initial. "HGA246532
IF NOT tcspr-zbgrp IS INITIAL.
pm_zstnr = 'X'.
ENDIF.
IF NOT tcspr-ltext IS INITIAL. "HGA127128
pm_ltext = 'X'. "HGA127128
ENDIF. "HGA127128
IF NOT TCSPR-DSPCO IS INITIAL. "HGA246532
pm_DSPCO = 'X'. "HGA246532
ENDIF. "HGA246532
IF NOT TCSPR-valst IS INITIAL. "HGA246532
pm_alvsa = 'X'. "HGA246532
ENDIF. "HGA246532
ENDFORM.
*eject
*---------------------------------------------------------------------*
* STB_ERWEITERN *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM stb_erweitern.
* ---------------------------------
DATA: hlf_rechf TYPE f.
DATA: lst_index LIKE sy-tabix. "HGA246532
* ---------------------------------
CLEAR: sum_modus.
CLEAR: cl_clstab, "YHG079407
cl_objmemo. "YHG079407
REFRESH: cl_clstab, "YHG079407
cl_objmemo. "YHG079407
IF pm_sortk EQ '2'.
sum_modus = 'x'.
ENDIF.
IF NOT pm_ltext IS INITIAL.
sum_modus+1 = 'x'.
ENDIF.
DESCRIBE TABLE stb LINES lst_index. "HGA246532
LOOP AT stb.
hlp_tabix = sy-tabix. "YHG134431
PERFORM obj_ident. "YHG068719
CHECK stb-sumkz NE '*'.
PERFORM cl_clstab_maint. "YHG079407
sy-tabix = hlp_tabix. "YHG134431
*del HLP_TABIX = SY-TABIX. "YHG134431
IF NOT stb-ausnm IS INITIAL.
PERFORM ausnahme_merken.
ENDIF.
CLEAR: summ_flag.
PERFORM summ_flag_setzen.
IF summ_flag EQ 'x'.
IF sum_stb-sumkz IS INITIAL. "YHG047511
CLEAR: hlf_rechf. "YHG047511
ENDIF. "YHG047511
PERFORM stb_markieren.
*del SUM_STB-MNGLG = SUM_STB-MNGLG + STB-MNGLG. "YHG036694
IF hlf_rechf < max_num. "YHG036694
hlf_rechf = hlf_rechf + stb-mnglg. "YHG036694
ENDIF. "YHG036694
ELSE.
IF sum_stb-sumkz = '*'.
hlf_rechf = hlf_rechf + sum_stb-mnglg. "YHG044928
IF hlf_rechf < max_num. "YHG036694
sum_stb-mnglg = hlf_rechf. "YHG036694
ELSE. "YHG036694
sum_stb-mnglg = max_num. "YHG036694
ENDIF. "YHG036694
sum_stb-index = lst_index + 1 . "HGA246532
PERFORM sumsatz_aufnehmen.
hlf_rechf = stb-mnglg. "YHG044928
lst_index = lst_index + 1 . "HGA246532
ENDIF.
*del SUM_STB = STB. "YHG133751
MOVE-CORRESPONDING stb TO sum_stb. "YHG133751
ENDIF.
ENDLOOP.
"YHG036694
IF sum_stb-sumkz = '*'.
hlf_rechf = hlf_rechf + sum_stb-mnglg. "YHG047511
IF hlf_rechf < max_num. "YHG036694
sum_stb-mnglg = hlf_rechf. "YHG036694
ELSE. "YHG036694
sum_stb-mnglg = max_num. "YHG036694
ENDIF. "YHG036694
sum_stb-index = lst_index + 1 . "HGA246532
PERFORM sumsatz_aufnehmen.
CLEAR: hlf_rechf. "YHG047511
ENDIF.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* STB_MARKIEREN *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM stb_markieren.
DATA: read_index LIKE sy-tabix.
* ----------------------------------
CLEAR: read_index.
stb-sumkz = 's'.
if stb-werks ne sum_stb-werks. "HGA025984
sum_stb-werks = plant_all. "HGA025984
endif. "HGA025984
MODIFY stb INDEX sy-tabix.
IF sum_stb-sumkz NE '*'.
sum_stb-sumkz = '*'.
sav_stb = stb. "YHG044928
read_index = sy-tabix - 1 .
READ TABLE stb INDEX read_index.
sum_stb-mnglg = stb-mnglg.
stb-sumkz = 's'.
MODIFY stb INDEX sy-tabix.
stb = sav_stb. "YHG044928
ENDIF.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* SUMM_FLAG_SETZEN *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM summ_flag_setzen.
CASE sum_modus.
WHEN ' '.
*del IF STB-IDNRK EQ SUM_STB-IDNRK "YHG078090
IF stb-msign EQ sum_stb-msign "YHG078090
AND stb-postp EQ sum_stb-postp "HGA162016
AND STB-WERKS EQ SUM_STB-WERKS "note 507446
AND stb-idnrk EQ sum_stb-idnrk "YHG078090
AND stb-dokar EQ sum_stb-dokar "YHG041147
AND stb-doknr EQ sum_stb-doknr "YHG041147
AND stb-dokvr EQ sum_stb-dokvr "YHG041147
AND stb-doktl EQ sum_stb-doktl "YHG041147
AND stb-class EQ sum_stb-class "YHG079407
AND stb-klart EQ sum_stb-klart "YHG079407
AND stb-intrm EQ sum_stb-intrm "YHG133751
AND NOT sum_stb IS INITIAL.
*del IF STB-IDNRK IS INITIAL. "YHG041147
IF stb-idnrk IS INITIAL "YHG041147
AND stb-msign EQ sum_stb-msign "YHG078090
AND stb-postp EQ sum_stb-postp "HGA162016
AND stb-dokar EQ sum_stb-dokar "YHG041147
AND stb-doknr EQ sum_stb-doknr "YHG041147
AND stb-dokvr EQ sum_stb-dokvr "YHG041147
*del AND STB-DOKTL EQ SUM_STB-DOKTL. "YHG041147"YHG079407
AND stb-doktl EQ sum_stb-doktl "YHG079407
AND stb-class EQ sum_stb-class "YHG079407
*del AND STB-KLART EQ SUM_STB-KLART. "YHG079407"YHG133751
AND stb-klart EQ sum_stb-klart "YHG133751
AND stb-intrm EQ sum_stb-intrm. "YHG133751
IF sum_stb-potx1 EQ stb-potx1
AND sum_stb-potx2 EQ stb-potx2.
summ_flag = 'x'.
ENDIF.
ELSE.
summ_flag = 'x'.
ENDIF.
ENDIF.
WHEN 'x '.
*del IF STB-IDNRK EQ SUM_STB-IDNRK "YHG078090
IF stb-msign EQ sum_stb-msign "YHG078090
AND stb-postp EQ sum_stb-postp "HGA162016
AND STB-WERKS EQ SUM_STB-WERKS "note 507446
AND stb-idnrk EQ sum_stb-idnrk "YHG078090
AND stb-dokar EQ sum_stb-dokar "YHG041147
AND stb-doknr EQ sum_stb-doknr "YHG041147
AND stb-dokvr EQ sum_stb-dokvr "YHG041147
AND stb-doktl EQ sum_stb-doktl "YHG041147
AND stb-class EQ sum_stb-class "YHG079407
AND stb-klart EQ sum_stb-klart "YHG079407
AND stb-intrm EQ sum_stb-intrm "YHG133751
AND stb-sortf EQ sum_stb-sortf
AND NOT sum_stb IS INITIAL.
*del IF STB-IDNRK IS INITIAL. "YHG041147
IF stb-idnrk IS INITIAL "YHG041147
AND stb-msign EQ sum_stb-msign "YHG078090
AND stb-postp EQ sum_stb-postp "HGA162016
AND stb-dokar EQ sum_stb-dokar "YHG041147
AND stb-doknr EQ sum_stb-doknr "YHG041147
AND stb-dokvr EQ sum_stb-dokvr "YHG041147
*del AND STB-DOKTL EQ SUM_STB-DOKTL. "YHG041147"YHG079407
AND stb-doktl EQ sum_stb-doktl "YHG079407
AND stb-class EQ sum_stb-class "YHG079407
*del AND STB-KLART EQ SUM_STB-KLART. "YHG079407"YHG133751
AND stb-klart EQ sum_stb-klart "YHG133751
AND stb-intrm EQ sum_stb-intrm. "YHG133751
IF sum_stb-potx1 EQ stb-potx1
AND sum_stb-potx2 EQ stb-potx2.
summ_flag = 'x'.
ENDIF.
ELSE.
summ_flag = 'x'.
ENDIF.
ENDIF.
WHEN ' x'.
*del IF STB-IDNRK EQ SUM_STB-IDNRK "YHG078090
IF stb-msign EQ sum_stb-msign "YHG078090
AND stb-postp EQ sum_stb-postp "HGA162016
AND STB-WERKS EQ SUM_STB-WERKS "note 507446
AND stb-idnrk EQ sum_stb-idnrk "YHG078090
AND stb-dokar EQ sum_stb-dokar "YHG041147
AND stb-doknr EQ sum_stb-doknr "YHG041147
AND stb-dokvr EQ sum_stb-dokvr "YHG041147
AND stb-doktl EQ sum_stb-doktl "YHG041147
AND stb-class EQ sum_stb-class "YHG079407
AND stb-klart EQ sum_stb-klart "YHG079407
AND stb-intrm EQ sum_stb-intrm "YHG133751
AND stb-potx1 EQ sum_stb-potx1
AND stb-potx2 EQ sum_stb-potx2.
summ_flag = 'x'.
ENDIF.
WHEN 'xx'.
*del IF STB-IDNRK EQ SUM_STB-IDNRK "YHG078090
IF stb-msign EQ sum_stb-msign "YHG078090
AND stb-postp EQ sum_stb-postp "HGA162016
AND STB-WERKS EQ SUM_STB-WERKS "note 507446
AND stb-idnrk EQ sum_stb-idnrk "YHG078090
AND stb-dokar EQ sum_stb-dokar "YHG041147
AND stb-doknr EQ sum_stb-doknr "YHG041147
AND stb-dokvr EQ sum_stb-dokvr "YHG041147
AND stb-doktl EQ sum_stb-doktl "YHG041147
AND stb-class EQ sum_stb-class "YHG079407
AND stb-klart EQ sum_stb-klart "YHG079407
AND stb-intrm EQ sum_stb-intrm "YHG133751
AND stb-potx1 EQ sum_stb-potx1
AND stb-potx2 EQ sum_stb-potx2
AND stb-sortf EQ sum_stb-sortf.
summ_flag = 'x'.
ENDIF.
ENDCASE.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* SUMSATZ_AUFNEHMEN *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM sumsatz_aufnehmen.
sav_stb = stb.
CLEAR: stb.
*d STB = SUM_STB. "YHG133751
IF pm_sortk NE '2'. "YHG019433
CLEAR: sum_stb-sortf. "YHG019433
ENDIF. "YHG019433
MOVE-CORRESPONDING sum_stb TO stb. "YHG133751
CLEAR: stb-datuv,
stb-datub.
APPEND stb.
stb = sav_stb.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* T418_LESEN *
*---------------------------------------------------------------------*
* --> *
* *
* <-- T418-WA *
* *
*---------------------------------------------------------------------*
FORM t418_lesen USING lkl_postp.
* T418-WA initialisieren
CLEAR:
t418.
* Key angeben
t418-postp = lkl_postp.
* PosTypDefinition lesen
READ TABLE t418.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* TCS03_LESEN *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM tcs03_lesen.
tcs03-agb29 = '29'.
READ TABLE tcs03.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* TCSPR_LESEN *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM tcspr_lesen.
tcspr-csusr = sy-uname.
READ TABLE tcspr.
IF sy-subrc <> 0. "HGG099459
tcspr-csusr = 'DUMMY'. "HGG099459
READ TABLE tcspr. "HGG099459
ENDIF. "HGG099459
ENDFORM.
*eject
*---------------------------------------------------------------------*
* TOP_01_79 *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM top_01_79.
*d CHECK sy-ucomm NE 'CSSL'. "YHG139715"note 351902
CHECK SV_UCOMM NE 'CSSL'. "note 351902
* ---------------------------------
* Routine im wesentlichen nach TOP_01_79_DRUCK uebernommen
* ---------------------------------
*del FORMAT INTENSIFIED. "YHG036694 "YHG066003
*del IF SY-UCOMM NE 'CSPR'. "YHG036694 "YHG066003
*del WRITE: / TEXT-002, "YHG036694 "YHG066003
*del 70 SY-DATUM DD/MM/YYYY. "YHG036694 "YHG066003
*del ULINE. "YHG036694 "YHG066003
*del ENDIF. "YHG036694 "YHG066003
*del IF SY-UCOMM NE 'CSPR'. "YHG066003"YHG134557
PERFORM top_01_79_liste. "YHG066003
*del ELSE. "YHG066003"YHG134557
*del PERFORM TOP_01_79_DRUCK. "YHG066003"YHG134557
*del ENDIF. "YHG066003"YHG134557
ENDFORM.
*eject
*---------------------------------------------------------------------*
* TOP_01_79_DRUCK *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
* entfaellt mit var. Liste "YHG134557
*del FORM TOP_01_79_DRUCK.
*del ENDFORM.
*eject
*---------------------------------------------------------------------*
* TOP_01_79_LISTE *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
* komplett ueberarbeitet
FORM top_01_79_liste. "YHG066003
CASE objty_mrk. "YHG068719
WHEN '1'. "YHG068719
IF page_mat < 1. "YHG068719
page_mat = sy-pagno. "YHG068719
ENDIF. "YHG068719
WHEN 'M'. "HGB099459
IF page_mat < 1. "HGB099459
page_mat = sy-pagno. "HGB099459
ENDIF. "HGB099459
WHEN '2'. "YHG068719
IF page_noo < 1. "YHG068719
page_noo = sy-pagno. "YHG068719
ENDIF. "YHG068719
WHEN '3'. "YHG068719
IF page_dok < 1. "YHG068719
page_dok = sy-pagno. "YHG068719
ENDIF. "YHG068719
WHEN '4'. "YHG000109
IF page_kla < 1. "YHG000109
page_kla = sy-pagno. "YHG000109
ENDIF. "YHG000109
ENDCASE. "YHG068719
* Zeilenzaehler initialisieren
CLEAR: blclns_cnt.
* SAV-WATAB-Entry initialisieren
CLEAR: sav_watab.
* SAV-WATAB leeren
REFRESH: sav_watab.
* die aktuellen WATab-Eintraege (var. Liste)
*del LOOP AT WATAB. "YHG020009
* ... nach SAV_WATAB ...
*del SAV_WATAB = WATAB. "YHG020009
* ... sichern
*del APPEND SAV_WATAB. "YHG020009
*del ENDLOOP. "YHG020009
sav_watab[] = watab[]. "YHG020009
* ?EinstiegsStl ist MehrfachStl
* ja
IF NOT selpool-stlal IS INITIAL.
* fuehrende Nullen der AlternativenNr entfernen
IF selpool-stlal(1) = '0'.
selpool-stlal(1) = ' '.
ENDIF.
* nein, keine MehrfachStl
ELSE.
* AlternativenNr loeschen
CLEAR: selpool-stlal.
ENDIF.
* Ausgabeformat festlegen
FORMAT COLOR COL_BACKGROUND INTENSIFIED OFF.
* ?Druck
* ja
*d IF sy-ucomm EQ 'CSPR'. "note 351902
IF SV_UCOMM EQ 'CSPR'. "note 351902
* Strich auf Zeile 2 mit Strichlinie aus AnzBlock ueberschreiben
*del SKIP TO LINE 2. "YHG139336
*del SKIP TO LINE 1. "YHG139336"YHG137563
SKIP TO LINE 2. "YHG137563
ENDIF.
* WATAB initialisieren und komplett leeren
CLEAR: watab. REFRESH: watab.
* Uebergabestruktur (Typ CSTMAT) ...
*d watab-tname = 'CSTMAT'. watab-table = selpool . "uc
WATAB-TNAME = 'CSTMAT'. "uc
assign watab-table to <x_watab-table> casting. "uc
assign selpool to <x_CSTMAT_wa> casting. "uc
<x_watab-table> = <x_CSTMAT_wa> . "uc
* ... sichern
APPEND watab.
* WATAB initialisieren
CLEAR: watab,
stb_add.
stb_add-sldtv = pm_datuv.
stb_add-pspnr = pm_pspnr. "HGA046836
stb_add-vbeln = pm_vbeln. "HGC072185
stb_add-vbpos = pm_vbpos. "HGC072185
* Uebergabestruktur (Typ STPOL_ADD).
*d watab-tname = 'STPOL_ADD'. watab-table = stb_add . "uc
WATAB-TNAME = 'STPOL_ADD'. "uc
assign watab-table to <x_watab-table> casting. "uc
assign stb_add to <x_STPOL_ADD_wa> casting. "uc
<x_watab-table> = <x_STPOL_ADD_wa> . "uc
* ... sichern
APPEND watab.
* WATAB initialisieren
CLEAR watab.
* Listenkopf ausgeben
PERFORM write_block
USING 'LISTHDR '
* ausgegebene Zeilen zaehlen
'x'
* Hide nicht ausfuehren
' '. "YHG123656
IF ausntp_flg IS INITIAL.
* WATAB initialisieren und komplett leeren
CLEAR: watab. REFRESH: watab.
* Uebergabestruktur (Typ STPOX) ...
watab-tname = 'STPOX'.
* ... sichern
APPEND watab.
* WATAB initialisieren und komplett leeren
*del CLEAR: WATAB. "YHG133751
* Uebergabestruktur (Typ CSCMAT) ...
*del WATAB-TNAME = 'CSCMAT'. WATAB-TABLE = MATCAT. "YHG133751
* ... sichern
*del APPEND WATAB. "YHG133751
* WATAB initialisieren
CLEAR watab.
* Uebergabestruktur (Typ STPOL_ADD) ...
watab-tname = 'STPOL_ADD'.
* ... sichern
APPEND watab.
* WATAB initialisieren
CLEAR watab.
* Ausgabe festlegen
FORMAT COLOR COL_HEADING INTENSIFIED ON.
* Listenueberschrift ausgeben
PERFORM write_block
USING 'LISTHDNG '
* ausgegebene Zeilen zaehlen
'x'
* Hide ausfuehren
' '. "YHG123656
ENDIF.
* WATab-Entry (var. Liste) initialisieren
CLEAR: watab.
* WATab (var. Liste) leeren
REFRESH: watab.
* gesicherte Saetze aus SAV_WATAB
*del LOOP AT SAV_WATAB. "YHG020009
* wieder nach WATAB ...
*del WATAB = SAV_WATAB. "YHG020009
* ... uebernehmen
*del APPEND WATAB. "YHG020009
*del ENDLOOP. "YHG020009
watab[] = sav_watab[]. "YHG020009
* Anzahl Zeilen Listenkopf sichern
nbr_hdrlns = blclns_cnt.
* Reset Zeilenzaehler
CLEAR: blclns_cnt.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* WRITE_BLOCK *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM write_block "YHG133914
USING lcl_blcnm
lcl_lncnt
lcl_hidef. "YHG123656
DATA: first_swt(1) TYPE c.
* ---------------------------------
*d IF sy-ucomm EQ 'CSPR'. "HGB020150"note 351902
IF SV_UCOMM EQ 'CSPR'. "note 351902
read table prrsv_tb "HGB020150
with key lcl_blcnm. "HGB020150
reserve prrsv_tb-maxln lines. "HGB020150
endif. "HGB020150
* Kennzeichen 'erste Zeile ausgeben' setzen
first_swt = 'x'.
* bis zum St. Nimmerleinstag
DO.
* Zeile ausgeben
PERFORM write_line
*del USING 'SAPCSSMXM ' "YHG137424
USING list_id "YHG137424
act_profil
lcl_blcnm
first_swt
' '.
* ?Ist die auszugebende Zeile leer (und sitzt BLANK-LINES OFF!!)
* nein
IF lnmpt_flg IS INITIAL.
* ?sollen die ausgegebenen Zeilen (weiter-) gezaehlt werden
* ja
IF NOT lcl_lncnt IS INITIAL.
* Zeilenzaehler um eins erhoehen
blclns_cnt = blclns_cnt + 1 .
ENDIF.
* ?wird gerade gedruckt
* nein
*d IF sy-ucomm NE 'CSPR'. "note 351902
IF SV_UCOMM NE 'CSPR'. "note 351902
* gib die Rahmenstriche aus
WRITE 1 sy-vline.
WRITE AT siz_linpf sy-vline.
* ... und - wenn gewuenscht -
IF NOT lcl_hidef IS INITIAL. "YHG123656
* ... versorge den HIDE-Bereich
PERFORM hide_routine_01.
ENDIF. "YHG123656
IF lcl_blcnm EQ 'ITEM_M ' "HGB084505
AND mpos_line IS INITIAL "HGB084505
AND NOT first_swt IS INITIAL "HGB084505
AND NOT matpos_flg IS INITIAL "HGB084505
AND matcat-matnr EQ pm_mtnrv. "HGB084505
mpos_page = syst-pagno. "HGB084505
mpos_line = syst-linno - nbr_hdrlns - 2. "HGB084505
IF mpos_line < 1. "HGB084505
mpos_line = 1. "HGB084505
ENDIF. "HGB084505
ENDIF. "HGB084505
ELSE. "YHG140031
IF sy-colno = 1. "YHG140031
SKIP. "YHG140031
ENDIF. "YHG140031
ENDIF.
ENDIF.
* ?sitzt EndOfBlock-Kennzeichen
* ja
IF NOT eoblc IS INITIAL.
* ... dann Schleife beenden
EXIT.
ENDIF.
* Kennzeichen 'erste Zeile ausgeben' zuruecknehmen
CLEAR: first_swt.
ENDDO.
ENDFORM.
*eject
*---------------------------------------------------------------------*
* WRITE_LINE *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
FORM write_line
"YHG133914
USING lcl_lstid
lcl_profl
lcl_blcnm
lcl_first
lcl_nline.
DATA: val_shift LIKE sy-cucol.
* ---------------------------------
* ?wenn nicht gedruckt wird, ...
*d IF sy-ucomm NE 'CSPR'. "note 351902
IF SV_UCOMM NE 'CSPR'. "note 351902
* ... Blockausgabe um eine Stelle nach rechts verschieben
val_shift = 1 .
* sonst ...
ELSE.
* ... nicht
CLEAR: val_shift.
ENDIF.
* neue Zeile
NEW-LINE.
* ?wird gerade gedruckt
* nein
*d IF sy-ucomm NE 'CSPR'. "note 351902
IF SV_UCOMM NE 'CSPR'. "note 351902
* Leerzeile in Profillaenge + 2 ausgeben
WRITE AT 2(sav_prfsz) ecfld.
** ja, es wird gedruckt
* ELSE.
** Hintergrundfarben etc. ausschalten
* FORMAT RESET.
ENDIF.
* Zeile endgueltig ausgeben
CALL FUNCTION 'CS_VLIST_BLOCK_PROCESSING'
EXPORTING
blcnm = lcl_blcnm
lstid = lcl_lstid
profl = lcl_profl
first = lcl_first
rshift = val_shift
newline = lcl_nline
IMPORTING
eoblc = eoblc
lnmpt = lnmpt_flg
TABLES
watab = watab
EXCEPTIONS
call_invalid = 4.
ENDFORM.
*. Here begins ALV section ............................ "HGA246532
FORM alv_dsp_sel_dsp.
*...................................
DATA:
sel_fields_tb TYPE slis_t_fieldcat_alv,
wa_sel_fields_tb TYPE slis_fieldcat_alv.
DATA:
alvlo_sel TYPE slis_layout_alv.
*....................................
PERFORM alv_dsp_sel_prep.
PERFORM alv_evnt_tb_prep
USING
'B'
alv_evnt_tb_pfxt.
wa_sel_fields_tb-fieldname = 'TEXT'.
wa_sel_fields_tb-outputlen = 30.
wa_sel_fields_tb-col_pos = 1.
APPEND wa_sel_fields_tb TO sel_fields_tb.
wa_sel_fields_tb-fieldname = 'WERT'.
wa_sel_fields_tb-outputlen = 32.
wa_sel_fields_tb-col_pos = 2.
APPEND wa_sel_fields_tb TO sel_fields_tb.
WRITE text-050 TO alvlo_sel-window_titlebar.
alvvr-handle = '2'. "note 877609
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = report_name
is_layout = alvlo_sel
i_save = ' '
is_variant = alvvr "note 877609
it_fieldcat = sel_fields_tb
it_events = alv_evnt_tb_pfxt
i_screen_start_column = 7
i_screen_start_line = 8
i_screen_end_column = 71
i_screen_end_line = 16
IMPORTING
e_exit_caused_by_caller = exit_by_caller
es_exit_caused_by_user = exit_by_user
TABLES
t_outtab = dsp_sel
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc = 0.
IF exit_by_caller = 'X'.
* Forced Exit by calling program
* <do_something>.
ELSE.
* User left list via F3, F12 or F15
IF exit_by_user-back = 'X'. "F3
* <do_something>.
ELSE.
IF exit_by_user-exit = 'X'. "F15
* <do_something>.
ELSE.
IF exit_by_user-cancel = 'X'. "F12
* <do_something>.
ELSE.
* should not occur!
* <do_Abnormal_End>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
* Fatal error callin ALV
* MESSAGE AXXX(XY) WITH ...
ENDIF.
ENDFORM. "alv_dsp_sel_dsp
FORM alv_dsp_sel_prep.
*...................................
CHECK dsp_sel[] IS INITIAL.
READ TEXTPOOL sy-repid INTO txt_sel.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = report_name
TABLES
selection_table = inp_sel
EXCEPTIONS
not_found = 01
no_report = 02.
LOOP AT inp_sel
WHERE selname NE 'PM_HEMNG'
AND selname NE 'PM_DSPCO'
AND selname NE 'PM_DSPRF'
AND selname NE 'PM_LTEXT'
AND selname NE 'PM_PRPRF'.
LOOP AT txt_sel
*d WHERE id+1 EQ inp_sel-selname. "uc
WHERE key EQ inp_sel-selname. "uc
*d ASSIGN (txt_sel-id+1) TO <pm_name>. "uc
ASSIGN (txt_sel-key) TO <pm_name>. "uc
IF NOT <pm_name> IS INITIAL.
*d dsp_sel-text = txt_sel-text+8. "uc
dsp_sel-text = txt_sel-entry. "uc
dsp_sel-wert = inp_sel-low.
IF inp_sel-selname EQ 'PM_DATUV'.
CLEAR:
dsp_sel-wert.
WRITE pm_datuv TO dsp_sel-wert.
ENDIF.
IF inp_sel-selname EQ 'PM_EMENG'
AND NOT pm_emeng IS INITIAL.
CLEAR:
dsp_sel-wert.
WRITE pm_emeng TO dsp_sel-wert DECIMALS 3.
WHILE dsp_sel-wert(1) EQ space.
SHIFT dsp_sel-wert LEFT.
ENDWHILE.
ENDIF.
APPEND dsp_sel.
ENDIF.
ENDLOOP.
ENDLOOP.
SORT dsp_sel BY text.
CHECK NOT ecm_sl[] IS INITIAL.
REFRESH:
dsp_sel2.
CLEAR:
dsp_sel.
dsp_sel-text = '_'.
APPEND dsp_sel.
dsp_sel-text = text-020.
APPEND dsp_sel.
LOOP AT ecm_sl INTO wa_ecm_sl.
CHECK NOT wa_ecm_sl-value IS INITIAL.
CHECK NOT wa_ecm_sl-fieldname EQ 'DATE_LO'.
dsp_sel2-text = wa_ecm_sl-text.
dsp_sel2-wert = wa_ecm_sl-value.
APPEND dsp_sel2.
ENDLOOP.
APPEND LINES OF dsp_sel2 TO dsp_sel.
ENDFORM. "alv_dsp_sel_prep
FORM alv_evnt_tb_prep
USING
event_spec TYPE c
event_tb TYPE slis_t_event.
*..................................
DATA:
wa_event_tb TYPE slis_alv_event.
*..................................
CHECK event_tb[] IS INITIAL.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = event_tb.
CASE event_spec.
* complete
WHEN 'A'.
READ TABLE event_tb
WITH KEY name = slis_ev_top_of_page
INTO wa_event_tb.
IF sy-subrc = 0.
wa_event_tb-form = 'ALV_TOP_OF_PAGE'.
APPEND wa_event_tb TO event_tb.
ENDIF.
READ TABLE event_tb
WITH KEY name = slis_ev_user_command
INTO wa_event_tb.
IF sy-subrc = 0.
wa_event_tb-form = 'ALV_USER_COMMAND'.
APPEND wa_event_tb TO event_tb.
ENDIF.
READ TABLE event_tb
WITH KEY name = slis_ev_pf_status_set
INTO wa_event_tb.
IF sy-subrc = 0.
wa_event_tb-form = 'ALV_PF_STATUS_SET_MAIN'.
APPEND wa_event_tb TO event_tb.
ENDIF.
* PF EXIT only
WHEN 'B'.
READ TABLE event_tb
WITH KEY name = slis_ev_pf_status_set
INTO wa_event_tb.
IF sy-subrc = 0.
wa_event_tb-form = 'ALV_PF_STATUS_SET_EXIT'.
APPEND wa_event_tb TO event_tb.
ENDIF.
ENDCASE.
ENDFORM. "alv_evnt_tb_prep
FORM alv_pf_status_set_exit
USING
rt_extab TYPE slis_t_extab.
SET PF-STATUS 'SNN1'
EXCLUDING rt_extab.
ENDFORM. "alv_pf_status_set_exit
FORM alv_pf_status_set_main
USING
rt_extab TYPE slis_t_extab.
* SET PF-STATUS 'S131_ALV'
* EXCLUDING rt_extab.
ENDFORM. "alv_pf_status_set_main
FORM alv_stb_prep.
*..................................
CHECK stb-sumkz NE 's'.
IF stb-idnrk IS INITIAL.
IF stb-doknr IS INITIAL.
IF stb-class IS INITIAL.
anz_meins = stb-meins.
anz_ktext = stb-potx1.
ELSE.
anz_meins = stb-meins.
anz_ktext = stb-ojtxp.
ENDIF.
ELSE.
anz_meins = stb-meins.
anz_ktext = stb-ojtxp.
ENDIF.
ELSE.
anz_meins = stb-mmein.
anz_ktext = stb-ojtxp.
ENDIF.
IF stb-mnglg >= max_num.
ueberl_flg = ueberl_kz.
ELSE.
IF stb-mnglg <= min_num.
ueberl_flg = ueberl_kz.
ELSE.
CLEAR: ueberl_flg.
ENDIF.
ENDIF.
CLEAR:
stb_add-dobjt,
stb_add-objic.
CASE stb_orig-objty.
WHEN otyp_mat.
WRITE: stb_orig-idnrk TO ecfld.
stb_add-objic = '@A6@'.
WHEN 'M'.
WRITE: stb_orig-idnrk TO ecfld.
stb_add-objic = '@A6@'.
WHEN otyp_noo.
WRITE: stb_orig-potx1 TO ecfld.
stb_add-objic = '@0Q@'.
WHEN otyp_doc.
write stb_orig-doknr to ecfld. "note 489354
IF ecfld CP '*# '. ENDIF. "note 489354
sy-fdpos = sy-fdpos + 1. "note 489354
CONCATENATE
*d stb_orig-doknr "note 489354
stb_orig-dokar
stb_orig-doktl
stb_orig-dokvr
*d INTO ecfld "note 489354
INTO ecfld+sy-fdpos "note 489354
SEPARATED BY space.
stb_add-objic = '@AR@'.
WHEN otyp_kla.
CONCATENATE
stb_orig-class
stb_orig-klart
INTO ecfld
SEPARATED BY space.
stb_add-objic = '@7C@'.
WHEN otyp_ntm.
WRITE: stb_orig-intrm TO ecfld.
WHEN OTHERS.
ENDCASE.
*d CONDENSE ecfld. "note 515408
stb_add-dobjt = ecfld(40).
CLEAR: ecfld.
stb_add-ovfls = ueberl_flg.
stb_add-dunit = anz_meins.
IF NOT stb_orig-xtlnr IS INITIAL.
stb_add-bomfl = b_flag.
ENDIF.
IF NOT stb_orig-knobj IS INITIAL.
stb_add-knofl = 'X'.
ENDIF.
*d MOVE-CORRESPONDING stb_orig TO alv_stb. "note 331962
MOVE-CORRESPONDING stb_add TO alv_stb.
MOVE-CORRESPONDING stb_orig TO alv_stb. "note 331962
* Phantom item adjusted for ALV filtering "Note 1327742
IF NOT alv_stb-dumps IS INITIAL. "Note 1327742
TRANSLATE alv_stb-dumps TO UPPER CASE. "#EC TRANSLANG "Note 1327742
ENDIF. "Note 1327742
APPEND alv_stb.
ENDFORM. "alv_stb_prep
FORM alv_top_of_page.
*.....................................
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = alv_top_tb.
ENDFORM. "alv_top_of_page
FORM alv_top_tb_prep
USING
top_tb TYPE slis_t_listheader.
*......................................
DATA:
wa_top_tb TYPE slis_listheader.
DATA:
lkl_matnr like mara-matnr. "note 363714
*......................................
* CLEAR wa_top_tb.
* wa_top_tb-typ = 'H'.
* CONCATENATE
* text-001
* text-002
* INTO wa_top_tb-info
* SEPARATED BY space(1).
* APPEND wa_top_tb TO top_tb.
CLEAR wa_top_tb.
if not pm_vbeln is initial
and pm_pspnr is initial.
wa_top_tb-typ = 'S'.
ecfld = text-025.
ecfld+13 = '/'.
ecfld+14 = text-026.
wa_top_tb-key = ecfld(19).
condense wa_top_tb-key.
CLEAR: ecfld.
concatenate
pm_vbeln
pm_vbpos
into wa_top_tb-info
separated by ' / '.
APPEND wa_top_tb TO top_tb.
endif.
if not pm_pspnr is initial
and pm_vbeln is initial.
wa_top_tb-typ = 'S'.
ecfld = text-028.
ecfld+13 = '/'.
ecfld+14 = text-029.
wa_top_tb-key = ecfld(19).
condense wa_top_tb-key no-gaps.
CLEAR: ecfld.
write pm_pspnr to wa_top_tb-info.
wa_top_tb-info+25 = '/'.
wa_top_tb-info+27 = pm_mtnrv.
condense wa_top_tb-info.
APPEND wa_top_tb TO top_tb.
endif.
if wa_top_tb is initial.
wa_top_tb-typ = 'S'.
ecfld = text-010.
wa_top_tb-key = ecfld(11).
CLEAR: ecfld.
*ENHANCEMENT-SECTION RCS13001_L1 SPOTS ES_RCS13001.
write pm_mtnrv to lkl_matnr. "note 363714
*d wa_top_tb-info = pm_mtnrv. "note 363714
wa_top_tb-info = lkl_matnr. "note 363714
*END-ENHANCEMENT-SECTION.
*$*$-Start: RCS13001_L1-------------------------------------------------------------------------$*$*
*ENHANCEMENT 1 MGV_MATNR_LAMA_RCS13001. "active version
write pm_mtnrv to wa_top_tb-info. " DI note 577359
*ENDENHANCEMENT.
*$*$-End: RCS13001_L1-------------------------------------------------------------------------$*$*
APPEND wa_top_tb TO top_tb.
endif.
CLEAR wa_top_tb.
wa_top_tb-typ = 'S'.
ecfld = text-005.
ecfld+5 = '/'.
ecfld+6 = text-006.
ecfld+11 = '/'.
ecfld+12 = text-014.
wa_top_tb-key = ecfld(17).
condense wa_top_tb-key no-gaps.
CLEAR: ecfld.
CONCATENATE
selpool-werks
selpool-stlan
selpool-stlal
INTO wa_top_tb-info
SEPARATED BY ' / '.
APPEND wa_top_tb TO top_tb.
CLEAR wa_top_tb.
wa_top_tb-typ = 'S'.
wa_top_tb-key = text-019.
condense wa_top_tb-key.
wa_top_tb-info = selpool-maktx.
APPEND wa_top_tb TO top_tb.
CLEAR wa_top_tb.
wa_top_tb-typ = 'S'.
ecfld = text-013.
ecfld+13 = ' ('.
* ecfld+15 = selpool-bmein. "NOTE_975832
Write selpool-bmein to ecfld+15(3). "NOTE_975832
ecfld+18 = ')'.
wa_top_tb-key = ecfld(19).
CLEAR: ecfld.
*d wa_top_tb-info = selpool-bmeng. "note 317957
write selpool-bmeng to wa_top_tb-info . "note 317957
condense wa_top_tb-info.
APPEND wa_top_tb TO top_tb.
* ^_NOTE_811372
CLEAR wa_top_tb.
wa_top_tb-typ = 'S'.
ecfld = text-009.
ecfld+11 = ' ('.
* ecfld+13 = selpool-emgme. "NOTE_975832
Write selpool-emgme to ecfld+13(3). "NOTE_975832
ecfld+16 = ')'.
wa_top_tb-key = ecfld(17).
CLEAR: ecfld.
write selpool-emeng to wa_top_tb-info unit selpool-bmein.
CONDENSE wa_top_tb-info.
APPEND wa_top_tb TO top_tb.
*v_NOTE_811372
CLEAR wa_top_tb.
wa_top_tb-typ = 'S'.
* so it looks better
APPEND wa_top_tb TO top_tb.
ENDFORM. "alv_top_tb_prep
FORM alv_user_command
USING i_ucomm LIKE sy-ucomm
i_selfield TYPE slis_selfield.
*.......................................
CASE i_ucomm.
when 'ANMS'. "HGA020150
leave to transaction sy-tcode. "HGA020150
WHEN 'CSAP' or '&IC1'.
SORT stb BY index.
READ TABLE alv_stb INDEX i_selfield-tabindex.
READ TABLE stb INDEX alv_stb-index.
READ TABLE matcat INDEX stb-ttidx.
PERFORM position_anzeigen.
WHEN 'CSAO'.
SORT stb BY index.
READ TABLE alv_stb INDEX i_selfield-tabindex.
READ TABLE stb INDEX alv_stb-index.
PERFORM objekt_anzeigen.
WHEN 'CSWU'.
SORT stb BY index.
READ TABLE alv_stb INDEX i_selfield-tabindex.
READ TABLE stb INDEX alv_stb-index.
PERFORM verwendung_anzeigen.
WHEN 'CSSL'.
PERFORM alv_dsp_sel_dsp.
WHEN 'CSSX'.
PERFORM alv_xcpt_tb_dsp.
ENDCASE.
ENDFORM. "alv_user_command
FORM alv_xcpt_tb_dsp.
*.......................................
DATA:
xcpt_fields_tb TYPE slis_t_fieldcat_alv,
wa_xcpt_fields_tb TYPE slis_fieldcat_alv.
DATA:
alvlo_xcpt TYPE slis_layout_alv.
*.......................................
PERFORM alv_xcpt_tb_prep.
PERFORM alv_evnt_tb_prep
USING
'B'
alv_evnt_tb_pfxt.
wa_xcpt_fields_tb-fieldname = 'DOBJT'.
wa_xcpt_fields_tb-outputlen = 42.
wa_xcpt_fields_tb-col_pos = 1.
APPEND wa_xcpt_fields_tb TO xcpt_fields_tb.
wa_xcpt_fields_tb-fieldname = 'OJTXP'.
wa_xcpt_fields_tb-outputlen = 40.
wa_xcpt_fields_tb-col_pos = 2.
APPEND wa_xcpt_fields_tb TO xcpt_fields_tb.
WRITE text-030 TO alvlo_xcpt-window_titlebar.
alvlo_xcpt-info_fieldname = 'INFO'.
alvvr-handle = '3'. "note 877609
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = report_name
is_layout = alvlo_xcpt
i_save = ' '
is_variant = alvvr "note 877609
it_fieldcat = xcpt_fields_tb
it_events = alv_evnt_tb_pfxt
i_screen_start_column = 4
i_screen_start_line = 4
i_screen_end_column = 87
i_screen_end_line = 12
IMPORTING
e_exit_caused_by_caller = exit_by_caller
es_exit_caused_by_user = exit_by_user
TABLES
t_outtab = xcpt_tb
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc = 0.
IF exit_by_caller = 'X'.
* Forced Exit by calling program
* <do_something>.
ELSE.
* User left list via F3, F12 or F15
IF exit_by_user-back = 'X'. "F3
* <do_something>.
ELSE.
IF exit_by_user-exit = 'X'. "F15
* <do_something>.
ELSE.
IF exit_by_user-cancel = 'X'. "F12
* <do_something>.
ELSE.
* should not occur!
* <do_Abnormal_End>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
* Fatal error callin ALV
* MESSAGE AXXX(XY) WITH ...
ENDIF.
ENDFORM. "alv_xcpt_tb_dsp
FORM alv_xcpt_tb_prep.
*...................................
DATA:
BEGIN OF wa_xcpt_tb,
dobjt(42) TYPE c,
ojtxp(40) TYPE c,
info(3) type c,
END OF wa_xcpt_tb,
dontshift(2) type c value '. ',
lkl_stlal LIKE stko-stlal,
lkl_ausnm LIKE stpox-ausnm.
*..................................
CHECK xcpt_tb[] IS INITIAL.
CLEAR:
wa_xcpt_tb,
lkl_stlal,
lkl_ausnm.
READ TABLE ausnm_stb INDEX 1.
CHECK sy-subrc = 0 .
SORT ausnm_stb
ASCENDING
BY ausnm
objty ASCENDING
xtlal ASCENDING.
CLEAR:
stb_add.
LOOP AT ausnm_stb.
IF lkl_stlal NE ausnm_stb-xtlal
OR lkl_ausnm NE ausnm_stb-ausnm.
lkl_stlal = ausnm_stb-xtlal.
lkl_ausnm = ausnm_stb-ausnm.
CLEAR:
wa_xcpt_tb.
IF sy-tabix > 1.
APPEND wa_xcpt_tb TO xcpt_tb.
ENDIF.
CASE ausnm_stb-ausnm.
WHEN 'DELE'.
WRITE text-039 TO wa_xcpt_tb.
WHEN 'NBER'.
WRITE text-031 TO wa_xcpt_tb.
WHEN 'NREK'.
WRITE text-032 TO wa_xcpt_tb.
WHEN 'REKU'.
WRITE text-034 TO wa_xcpt_tb.
WHEN 'NOTX'.
IF NOT pm_stlal IS INITIAL
AND NOT pm_altvo IS INITIAL.
WRITE text-035 TO wa_xcpt_tb(35).
WRITE pm_stlal TO wa_xcpt_tb+36(2).
WRITE text-036 TO wa_xcpt_tb+39(35).
CONDENSE wa_xcpt_tb.
ELSE.
WRITE text-035 TO wa_xcpt_tb(35).
WRITE ausnm_stb-xtlal TO wa_xcpt_tb+36(2).
WRITE text-036 TO wa_xcpt_tb+39(35).
CONDENSE wa_xcpt_tb.
ENDIF.
ENDCASE.
wa_xcpt_tb-info = 'C30'.
APPEND wa_xcpt_tb TO xcpt_tb.
ENDIF.
CLEAR:
ecfld,
wa_xcpt_tb.
CASE ausnm_stb-objty.
WHEN otyp_mat.
CONCATENATE
ausnm_stb-idnrk
ausnm_stb-revlv
INTO ecfld
SEPARATED BY space.
WHEN 'M'.
CONCATENATE
ausnm_stb-idnrk
ausnm_stb-revlv
INTO ecfld
SEPARATED BY space.
WHEN otyp_doc.
CONCATENATE
ausnm_stb-doknr
ausnm_stb-dokar
ausnm_stb-doktl
ausnm_stb-dokvr
INTO ecfld
SEPARATED BY space.
WHEN otyp_kla.
CONCATENATE
ausnm_stb-class
ausnm_stb-klart
INTO ecfld
SEPARATED BY space.
WHEN otyp_ntm.
WRITE: ausnm_stb-intrm TO ecfld.
WHEN OTHERS.
ENDCASE.
CONDENSE ecfld.
wa_xcpt_tb-dobjt = dontshift.
WRITE ecfld TO wa_xcpt_tb-dobjt+2(40).
wa_xcpt_tb-ojtxp = ausnm_stb-ojtxp.
APPEND wa_xcpt_tb TO xcpt_tb.
ENDLOOP.
ENDFORM. "alv_xcpt_tb_prep
FORM cs13_alv.
*...................................
LOOP AT stb.
* Uebergabestrukturen initialisieren
CLEAR:
stb_orig,
stb_add.
IF stb-ttidx <> matcat-index.
READ TABLE matcat INDEX stb-ttidx.
ENDIF.
IF pm_zstnr IS INITIAL.
CHECK stb-xtlnr IS INITIAL.
ENDIF.
IF NOT pm_idnrk IS INITIAL.
CHECK stb-idnrk EQ pm_idnrk.
ENDIF.
* STB-Eintrag in Uebergabestruktur uebernehmen
stb_orig = stb.
PERFORM alv_stb_prep.
ENDLOOP.
PERFORM stb_fields_tb_prep.
* alvvr-handle = '1'. "note 877609
* CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
* EXPORTING
* i_callback_program = report_name
* i_structure_name = 'STPOX_ALV'
* is_layout = alvlo_stb
* i_save = alvvr_sav_all
* is_variant = alvvr
* it_events = alv_evnt_tb_cmpl
* it_fieldcat = stb_fields_tb
* IMPORTING
* e_exit_caused_by_caller = exit_by_caller
* es_exit_caused_by_user = exit_by_user
* TABLES
* t_outtab = alv_stb
* EXCEPTIONS
* program_error = 1
* OTHERS = 2.
*
* IF sy-subrc = 0.
* IF exit_by_caller = 'X'.
** Forced Exit by calling program
** <do_something>.
* ELSE.
** User left list via F3, F12 or F15
* IF exit_by_user-back = 'X'. "F3
** <do_something>.
* ELSE.
* IF exit_by_user-exit = 'X'. "F15
** <do_something>.
* ELSE.
* IF exit_by_user-cancel = 'X'. "F12
** <do_something>.
* ELSE.
** should not occur!
** <do_Abnormal_End>.
* ENDIF.
* ENDIF.
* ENDIF.
* ENDIF.
* ELSE.
** Fatal error callin ALV
** MESSAGE AXXX(XY) WITH ...
* ENDIF.
*
* IF sy-subrc <> 0.
* MESSAGE s513 WITH 'E: '.
* EXIT.
* ENDIF.
loop at alv_stb.
WA_zbom-MATNR = pm_mtnrv.
WA_zbom-COMPONENT = alv_stb-DOBJT.
WA_zbom-DESCP = alv_stb-OJTXP.
WA_zbom-BOM_QTY = alv_stb-MNGLG.
WA_zbom-MEINS = alv_stb-DUNIT.
WA_zbom-MTART = alv_stb-MTART.
WA_zbom-MRP_TYPE = alv_stb-DISMM.
* insert into zbom values wa_zbom.
modify zbom_cs13 from wa_zbom.
* APPEND wa_zbom to IT_ZBOM.
* write :/ 'Rows inserted', sy-dbcnt .
clear wa_zbom.
endloop.
ENDFORM. "cs13_alv
FORM stb_fields_tb_prep.
*.....................................
*dCALL FUNCTION 'GET_FIELDTAB' "uc 070302
*d EXPORTING "uc 070302
*d langu = sy-langu "uc 070302
*d tabname = 'STPOX_ALV' "uc 070302
*d withtext = ' ' "uc 070302
*d only = 'T' "uc 070302
*d TABLES "uc 070302
*d fieldtab = ftab "uc 070302
*d EXCEPTIONS "uc 070302
*d OTHERS = 1. "uc 070302
CALL FUNCTION 'DDIF_FIELDINFO_GET' "uc 070302
EXPORTING "uc 070302
LANGU = SY-LANGU "uc 070302
TABNAME = 'STPOX_ALV' "uc 070302
* UCLEN = '01' "uc 070302
TABLES "uc 070302
DFIES_TAB = ftab "uc 070302
EXCEPTIONS "uc 070302
OTHERS = 1. "uc 070302
LOOP AT ftab.
CLEAR: wa_stb_fields_tb.
CASE ftab-fieldname.
WHEN 'OBJIC'.
wa_stb_fields_tb-fieldname = 'OBJIC'.
wa_stb_fields_tb-outputlen = 3 .
wa_stb_fields_tb-icon = 'X' .
wa_stb_fields_tb-key = 'X' .
wa_stb_fields_tb-fix_column = 'X' .
wa_stb_fields_tb-col_pos = 1.
APPEND wa_stb_fields_tb TO stb_fields_tb.
WHEN 'DOBJT'.
wa_stb_fields_tb-fieldname = 'DOBJT'.
wa_stb_fields_tb-outputlen = 23 .
wa_stb_fields_tb-key = 'X' .
wa_stb_fields_tb-fix_column = 'X' .
wa_stb_fields_tb-col_pos = 2.
APPEND wa_stb_fields_tb TO stb_fields_tb.
WHEN 'OJTXP'.
wa_stb_fields_tb-fieldname = 'OJTXP'.
wa_stb_fields_tb-outputlen = 32.
wa_stb_fields_tb-col_pos = 3.
APPEND wa_stb_fields_tb TO stb_fields_tb.
WHEN 'OVFLS'.
wa_stb_fields_tb-fieldname = 'OVFLS'.
wa_stb_fields_tb-outputlen = 3 .
wa_stb_fields_tb-just = 'R' .
wa_stb_fields_tb-col_pos = 4.
APPEND wa_stb_fields_tb TO stb_fields_tb.
WHEN 'MNGLG'.
wa_stb_fields_tb-fieldname = 'MNGLG'.
wa_stb_fields_tb-col_pos = 5.
wa_stb_fields_tb-outputlen = 18.
wa_stb_fields_tb-no_sum = 'X'.
APPEND wa_stb_fields_tb TO stb_fields_tb.
WHEN 'SUMKZ'.
wa_stb_fields_tb-fieldname = 'SUMKZ'.
wa_stb_fields_tb-just = 'R' .
wa_stb_fields_tb-outputlen = 3 .
wa_stb_fields_tb-col_pos = 6.
APPEND wa_stb_fields_tb TO stb_fields_tb.
WHEN 'DUNIT'.
wa_stb_fields_tb-fieldname = 'DUNIT'.
wa_stb_fields_tb-outputlen = 3 .
wa_stb_fields_tb-col_pos = 7.
APPEND wa_stb_fields_tb TO stb_fields_tb.
WHEN OTHERS.
wa_stb_fields_tb-fieldname = ftab-fieldname.
wa_stb_fields_tb-no_out = 'X'.
wa_stb_fields_tb-no_sum = 'X'.
APPEND wa_stb_fields_tb TO stb_fields_tb.
ENDCASE.
ENDLOOP.
ENDFORM. "stb_fields_tb_prep
*. Here ends ALV section .............................. "HGA246532
*---------------------------------------------------------------------*
* *
*---------------------------------------------------------------------*
* Input : *
* *
* Output: *
* *
*---------------------------------------------------------------------*
*********************************************************************************
*********************************************************************************
Report: ZBOM_CS13_MAIN
***************************************************************************************************************************************************************************************************************************************************
*&---------------------------------------------------------------------*
*& Report ZBOM_AUTO_MAIN
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZBOM_CS13_MAIN.
tables: zbom_cs13.
types : BEGIN OF ty_ITMAT,
MATNR LIKE MARA-MATNR,
END OF ty_ITMAT.
data: itmat type standard table of ty_itmat with header line.
*data: gv_flag type char20 value 'MAIN'.
delete from ZBOM_CS13.
write:/ sy-dbcnt, ' rows deleted'.
SELECT MATNR INTO CORRESPONDING FIELDS OF TABLE ITMAT FROM MARA WHERE
*MATNR IN MATERIAL.
MTART = 'FERT'.
*write:/ 'SAP'.
LOOP AT ITMAT.
*write:/ itmat-matnr.
set parameter id 'FORM' field itmat-matnr.
SUBMIT ZBOM_AUTO_CS13 and return.
endloop.
***************************************************************************************************************************************************************************************************************************************************