Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

facing problem in copy of standard SAP program

Former Member
0 Kudos
448

hi,,,,,,,,,,,,

when i execute this program in production server it displays an error ....i m trying to find out this error but this type(error) i cudnt find plz help me .....

i m sending the documents which i rcvd from the system after the execution of this program.

this program executes perfctlly in developmnt server but it creates problem in production server,,,i searched out the type kkblo_t_sortinfo in the whole program but i cud nt find it ,,,,,,,,,



documents.....


Runtime Errors SYNTAX_ERROR
Date and Time 18.11.2006 12:01:19



ShrtText
Syntax error in program "ZVISA_RM07MLBD ".



What happened?
Error in ABAP application program.

The current ABAP program "????????????????????????????????????????" had to be
terminated because one of the
statements could not be executed.

This is probably due to an error in the ABAP program.

In program "ZVISA_RM07MLBD ", the following syntax error occurred
in the Include "RM07MLBD_FORM_01 " in line 1805:
The type KKBLO_T_SORTINFO" is unknown."

also i m sending the include program ver i m facing problem...

*&----


*

*& Include RM07MLBD_FORM_01 *

*&----


*

  • correction Aug. 2005 MM "n856424

  • - the fields "entry time", "entry date", and "User" are "n856424

  • are not filled filled for price change documents "n856424

  • MB5B improved regarding accessibilty "n773673

  • Improvements : March 2003 MM "n599218

  • - print the page numbers "n599218

  • - send warning M7 393 when user deletes the initial "n599218

  • display variant "n599218

  • - show the current activity and the progress "n599218

  • contains FORM routines without preprocessor commands and "n547170

  • no text elements "n547170

*&----


*

*& Form INITIALISIERUNG

*&----


*

  • Vorbelegung der Anzeigevariante *

*----


*

form initialisierung.

repid = sy-repid.

variant_save = 'A'.

clear variante.

variante-report = repid.

  • Default-Variante holen:

def_variante = variante.

call function 'REUSE_ALV_VARIANT_DEFAULT_GET'

exporting

i_save = variant_save

changing

cs_variant = def_variante

exceptions

not_found = 2.

if sy-subrc = 0.

  • save the initial, e.g. default variant "n599218

move def_variante-variant to alv_default_variant. "n599218

p_vari = def_variante-variant.

endif.

  • print-no_print_listinfos = 'X'.

endform. " INITIALISIERUNG

*&----


*

*& Form AKTUELLE_BESTAENDE

*&----


*

  • Ermittlung der aktuellen eigenen Bestände,

  • d.h. der bewerteten Bestände und des Retourensperrbestandes,

  • auf Lagerortebene und auf Material- bzw. Chargenebene;

  • folgende Sonderbestände können gesondert ausgewiesen werden:

  • Lohnbearbeitung ( Sonderbestandskennzeichen O )

  • Kundenkonsignation ( " V, W, M )

  • Lieferantenkonsignation ( " K )

  • Projektbestand ( " Q )

  • Kundenauftragsbestand ( " E )

*----


*

form aktuelle_bestaende.

  • delete the range tables for the creation of table g_t_organ

if g_t_organ[] is initial. "n433765

refresh : g_0000_ra_werks, g_0000_ra_bwkey, g_0000_ra_bukrs.

clear : g_0000_ra_werks, g_0000_ra_bwkey, g_0000_ra_bukrs.

endif.

if bwbst = 'X'.

  • select the valuated stocks

perform aktuelle_bst_bwbst.

elseif lgbst = 'X'.

  • all own stock from storage locations or batches

if xchar = ' '.

perform aktuelle_bst_lgbst_mard.

elseif xchar = 'X'.

perform aktuelle_bst_lgbst_xchar.

endif.

elseif sbbst = 'X'.

  • special stocks

case sobkz.

when 'O'.

perform aktuelle_bst_sbbst_o.

when 'V' or 'W'.

perform aktuelle_bst_sbbst_v_w.

when 'K' or 'M'.

perform aktuelle_bst_sbbst_k_m.

when 'Q'.

perform aktuelle_bst_sbbst_q.

when 'E'.

perform aktuelle_bst_sbbst_e.

when others.

  • Angegebener Sonderbestand nicht vorhanden.

message s290.

perform anforderungsbild.

endcase.

endif.

  • create table g_t_organ with the plants and valuation areas from

  • the database selection if table g_t_organ is empty

perform f0000_create_table_g_t_organ

using c_no_error.

endform. "aktuelle_bestaende.

*&----


*

*& AKTUELLE_BST_LGBST_MARD

*&----


*

form aktuelle_bst_lgbst_mard.

*----


eigener Bestand auf Lagerortebene -


*

*----


... auf Materialebene -


*

select * from mard into corresponding fields of table imard

where werks in g_ra_werks

and lgort in g_ra_lgort

and matnr in matnr.

if sy-subrc ne 0. "no records found ?

message s289.

  • Kein Material in Selektion vorhanden.

perform anforderungsbild.

endif.

  • does the user has the the authority for the found entries ?

loop at imard.

perform f9000_auth_plant_check

using imard-werks.

if g_flag_authority is initial.

delete imard.

else.

perform f9200_collect_plant using imard-werks.

perform f9400_material_key using imard-matnr.

endif.

endloop.

describe table imard lines g_f_cnt_lines.

if g_f_cnt_lines is initial. "no records left ?

message s289.

  • Kein Material in Selektion vorhanden.

perform anforderungsbild.

endif.

if not charg-low is initial or not charg-high is initial.

clear charg.

message w285.

  • Charge wird zurückgesetzt.

endif.

endform. "aktuelle_bst_lgbst_mard

*----


*

  • AKTUELLE_BST_LGBST_XCHAR

*----


*

form aktuelle_bst_lgbst_xchar.

  • read the stock table mchb for batches

select * from mchb into corresponding fields of table imchb

where werks in g_ra_werks

and lgort in g_ra_lgort

and matnr in matnr

and charg in charg.

describe table imchb lines g_f_cnt_lines.

if g_f_cnt_lines is initial. "no records found ?

message s821 with matnr werks lgort.

  • Keine Chargen zu Material & in Werk & Lagerort & vorhanden.

perform anforderungsbild.

endif.

  • process working table with the batches

loop at imchb.

  • does the user has the the authority for the found entries ?

perform f9000_auth_plant_check

using imchb-werks.

if g_flag_authority is initial.

delete imchb.

else.

perform f9200_collect_plant using imchb-werks.

perform f9400_material_key using imchb-matnr.

endif.

endloop.

endform. "aktuelle_bst_lgbst_xchar

*----


*

  • AKTUELLE_BST_SBBST_O

*----


*

form aktuelle_bst_sbbst_o.

  • process Special Stocks with Vendor

  • Bemerkung: Im Gegensatz zu den anderen Sonderbeständen existieren

  • der Lohnbearbeitungs- und Kundenkonsignationsbestand

  • nur auf Werksebene.

select * from mslb into corresponding fields of table xmslb

where werks in g_ra_werks

and matnr in matnr

and charg in charg

and sobkz = 'O'.

if sy-subrc <> 0. "no records found ?

message s289.

  • Kein Material in Selektion vorhanden.

perform anforderungsbild.

endif.

  • process the found records special stock vendor

loop at xmslb.

  • check the authority

perform f9000_auth_plant_check

using xmslb-werks.

if g_flag_authority is initial.

delete xmslb.

else.

  • fill range table g_0000_ra_werks if it is still empty

perform f9200_collect_plant using xmslb-werks.

perform f9400_material_key using xmslb-matnr.

endif.

endloop.

  • error, if no records are left

describe table xmslb lines g_f_cnt_lines.

if g_f_cnt_lines is initial.

message s289.

  • Kein Material in Selektion vorhanden.

perform anforderungsbild.

endif.

sort xmslb.

loop at xmslb.

move-corresponding xmslb to imslb.

collect imslb.

endloop.

free xmslb. refresh xmslb.

if xchar = ' '.

loop at imslb.

move-corresponding imslb to imslbx.

collect imslbx.

endloop.

sort imslbx.

elseif xchar = 'X'.

loop at imslb.

check imslb-charg is initial.

delete imslb.

endloop.

endif.

endform. "aktuelle_bst_sbbst_o.

*----


*

  • AKTUELLE_BST_SBBST_V_W

*----


*

form aktuelle_bst_sbbst_v_w.

*----


Sonderbestand Kundenkonsignation -


*

  • elseif sobkz = 'V' or sobkz = 'W'.

select * from msku into corresponding fields of table xmsku

where werks in g_ra_werks

and matnr in matnr

and charg in charg

and sobkz eq sobkz.

if sy-subrc <> 0. "no records found

message s289.

  • Kein Material in Selektion vorhanden.

perform anforderungsbild.

endif.

  • process Special Stocks with Customer

loop at xmsku.

perform f9000_auth_plant_check using xmsku-werks.

if g_flag_authority is initial.

delete xmsku.

else.

perform f9200_collect_plant using xmsku-werks.

perform f9400_material_key using xmsku-matnr.

endif.

endloop.

describe table xmsku lines g_f_cnt_lines.

if g_f_cnt_lines is initial. "no records found

message s289.

  • Kein Material in Selektion vorhanden.

perform anforderungsbild.

endif.

sort xmsku.

loop at xmsku.

move-corresponding xmsku to imsku.

collect imsku.

endloop.

free xmsku. refresh xmsku.

if xchar = ' '.

loop at imsku.

move-corresponding imsku to imskux.

collect imskux.

endloop.

sort imskux.

elseif xchar = 'X'.

loop at imsku.

check imsku-charg is initial.

delete imsku.

endloop.

endif.

if sy-subrc ne 0.

message s042. "#EC * "n443935

  • Charge ist nicht vorhanden.

perform anforderungsbild.

endif.

endform. "aktuelle_bst_sbbst_v_w

*----


*

  • AKTUELLE_BST_SBBST_K_M

*----


*

form aktuelle_bst_sbbst_k_m.

*----


Sonderbestand Lieferantenkonsignation -


*

  • elseif sobkz = 'K' or sobkz = 'M'.

select * from mkol into corresponding fields of table xmkol

where werks in g_ra_werks

and lgort in g_ra_lgort

and matnr in matnr

and charg in charg

and sobkz eq sobkz.

if sy-subrc <> 0. "no records found

message s289.

  • Kein Material in Selektion vorhanden.

perform anforderungsbild.

endif.

  • process Special Stocks from Vendor

loop at xmkol.

perform f9000_auth_plant_check using xmkol-werks.

if g_flag_authority is initial.

delete xmkol.

else.

perform f9200_collect_plant using xmkol-werks.

perform f9400_material_key using xmkol-matnr.

endif.

endloop.

describe table xmkol lines g_f_cnt_lines.

if g_f_cnt_lines is initial. "no records found

message s289.

  • Kein Material in Selektion vorhanden.

perform anforderungsbild.

endif.

sort xmkol.

loop at xmkol.

move-corresponding xmkol to imkol.

collect imkol.

endloop.

free xmkol. refresh xmkol.

if xchar = ' '.

loop at imkol.

move-corresponding imkol to imkolx.

collect imkolx.

endloop.

sort imkolx.

elseif xchar = 'X'.

loop at imkol.

check imkol-charg is initial.

delete imkol.

endloop.

endif.

if sy-subrc ne 0.

message s042. "#EC * "n443935

  • Charge ist nicht vorhanden.

perform anforderungsbild.

endif.

endform. "aktuelle_bst_sbbst_k_m.

*----


*

  • AKTUELLE_BST_SBBST_Q

*----


*

form aktuelle_bst_sbbst_q.

*----


Projektbestand -


*

  • elseif sobkz = 'Q'.

select * from mspr into corresponding fields of table xmspr

where werks in g_ra_werks

and lgort in g_ra_lgort

and matnr in matnr

and charg in charg

and sobkz eq sobkz.

if sy-subrc <> 0. "no record found

message s289.

  • Kein Material in Selektion vorhanden.

perform anforderungsbild.

endif.

  • process project stock

loop at xmspr.

perform f9000_auth_plant_check using xmspr-werks.

if g_flag_authority is initial.

delete xmspr.

else.

perform f9200_collect_plant using xmspr-werks.

perform f9400_material_key using xmspr-matnr.

endif.

endloop.

describe table xmspr lines g_f_cnt_lines.

if g_f_cnt_lines is initial. "no record left

message s289.

  • Kein Material in Selektion vorhanden.

perform anforderungsbild.

endif.

sort xmspr.

loop at xmspr.

move-corresponding xmspr to imspr.

collect imspr.

endloop.

free xmspr. refresh xmspr.

if xchar = ' '.

loop at imspr.

move-corresponding imspr to imsprx.

collect imsprx.

endloop.

sort imsprx.

elseif xchar = 'X'.

loop at imspr.

check imspr-charg is initial.

delete imspr.

endloop.

endif.

endform.: "aktuelle_bst_sbbst_q

*----


*

  • AKTUELLE_BST_SBBST_E

*----


*

form aktuelle_bst_sbbst_e.

*----


Kundenauftragsbestand -


*

select * from mska into corresponding fields of table xmska

where werks in g_ra_werks

and lgort in g_ra_lgort

and matnr in matnr

and charg in charg

and sobkz eq sobkz.

if sy-subrc <> 0. "no records found

message s289.

  • Kein Material in Selektion vorhanden.

perform anforderungsbild.

endif.

  • process Sales Order Stock

loop at xmska.

perform f9000_auth_plant_check using xmska-werks.

if g_flag_authority is initial.

delete xmska.

else.

perform f9200_collect_plant using xmska-werks.

perform f9400_material_key using xmska-matnr.

endif.

endloop.

describe table xmska lines g_f_cnt_lines.

if g_f_cnt_lines is initial. "no records left ?

message s289.

  • Kein Material in Selektion vorhanden.

perform anforderungsbild.

endif.

sort xmska.

loop at xmska.

move-corresponding xmska to imska.

collect imska.

endloop.

free xmska. refresh xmska.

if xchar = ' '.

loop at imska.

move-corresponding imska to imskax.

collect imskax.

endloop.

sort imskax.

elseif xchar = 'X'.

loop at imska.

check imska-charg is initial.

delete imska.

endloop.

endif.

endform. "aktuelle_bst_sbbst_e

*&----


*

*& Form TABELLEN_LESEN

*&----


*

  • Lesen der Materialkurztexte (Tabelle MAKT), *

  • der Mengeneinheiten (Tabelle MARA) und *

  • Mengen- und Wertfortschreibung zum Material (Tabelle T134M) *

  • (Letzteres ist zum Aussortieren der unbewerteten bzw. *

  • kontierten Warenbewegungen notwendig) *

*----


*

form tabellen_lesen.

if not g_t_mat_key[] is initial. "n451923

  • select the material masters

select matnr meins mtart from mara

into corresponding fields of table imara

for all entries in g_t_mat_key

where matnr = g_t_mat_key-matnr.

  • select the short text for all materials

  • take only the necessary fields "n451923

select matnr maktx from makt "n451923

into corresponding fields of table g_t_makt "n451923

for all entries in g_t_mat_key

where matnr = g_t_mat_key-matnr

and spras = sy-langu.

sort imara by matnr. "n451923

sort g_t_makt by matnr. "n451923

free g_t_mat_key.

endif.

data: begin of k1 occurs 0,

mtart like t134m-mtart,

end of k1.

refresh k1.

loop at imara.

k1-mtart = imara-mtart.

collect k1.

endloop.

if not k1[] is initial. "n451923

select * from t134m

into corresponding fields of table it134m

for all entries in k1 where mtart = k1-mtart

and bwkey in g_ra_bwkey.

endif. "n451923

loop at it134m.

  • read table organ with key bwkey = it134m-bwkey.

perform f9300_read_organ

using c_bwkey it134m-bwkey.

if sy-subrc ne 0.

delete it134m.

endif.

endloop.

  • To find postings with valuation string, but without relevance for

  • the valuated stock, Big-G recommended this logic:

  • Take lines from MSEG where for the combination BUSTW/XAUTO=XBGBB

  • there is an entry in T156W with key BSX.

select bustw xbgbb from t156w

into corresponding fields of table it156w

where vorsl = 'BSX'.

sort it156w by bustw xbgbb.

delete adjacent duplicates from it156w.

delete it156w where bustw = space.

endform. " TABELLEN_LESEN

*&----


*

*& Form UNBEWERTET_WEG

*&----


*

  • Löschen der unbewerteten Materialien aus der internen *

  • Tabelle IMBEW

*----


*

form unbewertet_weg.

sort it134m by bwkey mtart. "n451923

"n450764

  • delete the materials in plants without valuation "n450764

loop at g_t_mbew into g_s_mbew. "n450764

read table imara "n450764

with key matnr = g_s_mbew-matnr "n450764

binary search. "n450764

"n450764

read table it134m with key bwkey = g_s_mbew-bwkey "n450764

mtart = imara-mtart binary search.

if sy-subrc ne 0.

  • message ...

delete g_t_mbew. "n450764

else.

if it134m-wertu = ' '.

delete g_t_mbew. "n450764

else. "n450764

  • enrich the entries with the quantity unit "n450764

move imara-meins to g_s_mbew-meins. "n450764

modify g_t_mbew from g_s_mbew "n450764

transporting meins. "n450764

endif.

endif.

endloop.

endform. " UNBEWERTET_WEG

*&----


*

*& Form FI_BELEGE_LESEN *

*&----


*

  • Lesen der Buchhaltungsbelege *

*----


*

  • Beim Erfassen der Werte ist es notwendig, die Buchhaltungsbelege *

  • zum Material zu lesen, um abweichende Werte zwischen Wareneingang *

  • und Rechnungseingang sowie Nachbelastungen zu berücksichtigen. *

*----


*

form fi_belege_lesen.

  • Not related to note 184465, but a significant performance issue

  • if ORGAN is large due to many plants/storage locations.

data: begin of t_bwkey occurs 0, "184465

bwkey like bsim-bwkey, "184465

end of t_bwkey. "184465

loop at g_t_organ where keytype = c_bwkey.

move g_t_organ-bwkey to t_bwkey-bwkey.

collect t_bwkey. "184465

endloop. "184465

read table t_bwkey index 1. "184465

check sy-subrc = 0. "184465

select * from bsim "n443935

into corresponding fields of table g_t_bsim_lean "n443935

for all entries in t_bwkey where bwkey = t_bwkey-bwkey

and matnr in matnr

and bwtar in bwtar

and budat >= datum-low.

loop at g_t_bsim_lean into g_s_bsim_lean. "n443935

perform f9300_read_organ

using c_bwkey g_s_bsim_lean-bwkey. "n443935

if sy-subrc is initial.

  • record found : the user has the authority, go on

move g_s_organ-bukrs to g_s_bsim_lean-bukrs. "n443935

modify g_t_bsim_lean from g_s_bsim_lean "n443935

transporting bukrs. "n451923

  • create working table with the keys for the FI documents

move-corresponding g_s_bsim_lean "n443935

to g_t_bkpf_key. "n443935

append g_t_bkpf_key.

else.

delete g_t_bsim_lean. "n443935

endif.

endloop.

endform. " FI_BELEGE_LESEN

*&----


*

*& Form BELEGE_SORTIEREN

*&----


*

  • Die Materialbelege werden anhand des Buchungsdatums sortiert.

  • Die Materialbelege mit Buchungsdatum zwischen 'datum-high'

  • und dem aktuellen Datum werden in der internen Tabelle IMSWEG

  • gesammelt, während die Materialbelege mit Buchungsdatum

  • zwischen 'datum-low' und 'datum-high' in der internen Tabelle

  • IMSEG verbleiben.

*----


*

form belege_sortieren.

aktdat = sy-datlo + 30.

if not ( datum-high is initial or datum-high > aktdat ).

loop at g_t_mseg_lean into g_s_mseg_lean

where budat > datum-high.

move-corresponding g_s_mseg_lean to imsweg.

append imsweg.

delete g_t_mseg_lean.

endloop.

endif.

describe table imsweg lines index_2.

endform. " BELEGE_SORTIEREN

*&----


*

*& Form KONTIERT_AUSSORTIEREN

*&----


*

  • Aussortierung der kontierten Belegpositionen, *

  • da diese Mengen nicht bestandsrelevant sind *

*----


*

form kontiert_aussortieren.

  • process table g_t_mseg_lean

  • loop at imseg where kzvbr <> space and "144845

  • ( kzbew = 'B' or kzbew = 'F' ). "144845

  • read table imara with key matnr = imseg-matnr.

  • read table it134m with key mtart = imara-mtart.

  • if not it134m-mengu is initial and not it134m-wertu is initial.

  • Die Felder 'mengu' und 'wertu' (Mengen- bzw. Wertfortschreibung)

  • sind ab Release 3.0 D auch in die Tabelle MSEG aufgenommen.

  • Die Einträge in der Tabelle T134M stellen nach wie vor die generelle

  • Einstellung dar; auf Positionsebene sind jedoch Abänderungen möglich,

  • die anhand der Einträge in der Tabelle MSEG nachverfolgt werden

  • können.

  • delete imseg.

  • endif.

  • endloop.

data : l_f_bwkey like t001k-bwkey. "n497992

sort it134m by bwkey mtart. "n497992

loop at g_t_mseg_lean into g_s_mseg_lean

where kzvbr <> space

and ( kzbew = 'B' or kzbew = 'F' ).

  • get the valuation area "n497992

if curm = '3'. "n497992

  • valuation level is company code "n497992

if g_s_mseg_lean-bukrs is initial. "n497992

  • get the valuation area for this plant "n497992

perform f9300_read_organ "n497992

using c_werks g_s_mseg_lean-werks. "n497992

"n497992

move g_s_organ-bwkey to l_f_bwkey. "n497992

else. "n497992

move g_s_mseg_lean-bukrs to l_f_bwkey. "n497992

endif. "n497992

else. "n497992

  • valuation level is plant "n497992

move g_s_mseg_lean-werks to l_f_bwkey. "n497992

endif. "n497992

read table imara with key matnr = g_s_mseg_lean-matnr

binary search.

if sy-subrc is initial.

read table it134m with key bwkey = l_f_bwkey "n497992

mtart = imara-mtart "n497992

binary search.

if sy-subrc is initial.

if not it134m-mengu is initial and

not it134m-wertu is initial.

delete g_t_mseg_lean.

endif.

endif.

else.

delete g_t_mseg_lean.

endif.

endloop.

endform. " KONTIERT_AUSSORTIEREN

*&----


*

*& Form BELEGE_ERGAENZEN (engl. enrich documents)

*&----


*

  • Material documents and FI documents from BSIM are merged together.

  • Complications:

  • - A material document can have more than one FI document.

  • - There are FI documents without material documnts

  • - There are material documents without FI documents

  • - The document type is customizeable

  • - There is no link from the materia document position to

  • the FI document entry in BSIM (except URZEILE, but this

  • can be filled incorrectly)

*----


*

form belege_ergaenzen. "Version from note 204872

  • - show the current activity and the progress "n599218

call function 'SAPGUI_PROGRESS_INDICATOR' "n599218

exporting "n599218

text = text-061. "Reading FI documents "n599218

  • Eliminate material documents with valuation string, but without

  • relevance to the valuated stock. IT156W contains all valuation

  • strings with posting key BSX. XBGBB says: "I am an accrural posting".

  • For more details please ask Big-G.

loop at g_t_mseg_lean into g_s_mseg_lean.

  • special processing for tied empties active ? "n497992

if not g_cust_tied_empties is initial. "n497992

  • look for MM documents with xauto = L and change "n497992

  • indicators "n497992

case g_s_mseg_lean-xauto. "n497992

when 'X'. "n497992

when space. "n497992

when others. "n547170

  • range table g_ra_xauto contains the special "n547170

  • indicators for the transfer movements of the "n547170

  • tied empties "n547170

if g_s_mseg_lean-xauto in g_ra_xauto. "n547170

move g_s_mseg_lean-xauto "n497992

to g_s_mseg_lean-retail. "n497992

clear g_s_mseg_lean-xauto. "n497992

modify g_t_mseg_lean from g_s_mseg_lean "n497992

transporting xauto retail. "n497992

endif. "n547170

endcase. "n497992

endif. "n497992

read table it156w with key

bustw = g_s_mseg_lean-bustw

xbgbb = g_s_mseg_lean-xauto

transporting no fields

binary search.

if sy-subrc <> 0.

delete g_t_mseg_lean.

else. "n443935

  • enrich the current entry with the company code "n443935

perform f9300_read_organ "n443935

using c_werks g_s_mseg_lean-werks. "n443935

"n443935

check : sy-subrc is initial. "n443935

move g_s_organ-bukrs to g_s_mseg_lean-bukrs. "n443935

modify g_t_mseg_lean from g_s_mseg_lean "n443935

transporting bukrs. "n451923

endif.

endloop.

  • For all available FI documents from BSIM, read the header data

  • from BKPF to get the link to the originating material document.

if not g_t_bkpf_key[] is initial.

  • look for the header of the matching FI documents

sort g_t_bkpf_key by bukrs belnr gjahr.

delete adjacent duplicates from g_t_bkpf_key.

  • save result from database selection into global hashed "n856424

  • table g_t_bkpf "n856424

select * from bkpf "n856424

into corresponding fields of table g_t_bkpf "n856424

for all entries in g_t_bkpf_key

where bukrs = g_t_bkpf_key-bukrs

and belnr = g_t_bkpf_key-belnr

and gjahr = g_t_bkpf_key-gjahr.

if sy-subrc is initial.

  • create working table l_t_keytab_m

free g_t_bkpf_key.

loop at g_t_bsim_lean into g_s_bsim_lean. "n443935

  • enrich the working table g_t_bsim_lean with the "n443935

  • MM doc info "n443935

"n443935

  • look for the matching FI document header "n443935

read table g_t_bkpf assigning "n856424

with key bukrs = g_s_bsim_lean-bukrs "n443935

belnr = g_s_bsim_lean-belnr "n443935

gjahr = g_s_bsim_lean-gjahr. "n443935

"n443935

if sy-subrc is initial. "n443935

  • enrich table G_T_BSIM_LEAN with the MM doc "n443935

  • consider only FI docs created by MM docs here "n856424

check : -awkey to g_s_bsim_lean-awkey. "n856424

modify g_t_bsim_lean from g_s_bsim_lean "n443935

transporting awkey. "n451923

endif. "n443935

endloop. "n443935

"n443935

  • set a break-point : G_T_BSIM_LEAN is available "n443935

"n443935

  • sort working table for acces with MM document "n443935

sort g_t_bsim_lean by bukrs "n443935

bwkey "n443935

matnr "n443935

bwtar "n443935

shkzg "n443935

meins "n443935

budat "n443935

blart "n443935

awkey. "n443935

endif.

endif.

  • For each material document, write the number of the created

  • FI document into IMSEG. If there are more than one FI document,

  • the one with the same BLART and the same posting date is chosen.

  • BLART alone is not sufficient as the document type of the

  • revaluation document is customizeable (T158-BLAUM).

  • If a document as been found to have an entry in KEYTAB, this

  • entry is marked as "accessed". So later on the FI document is

  • known to be already in the list via this material document.

  • clear the working areas "n443935

perform belege_ergaenzen_clear. "n443935

"n443935

  • sort main table with MM document "n443935

sort g_t_mseg_lean by bukrs "n443935

werks "n443935

matnr "n443935

bwtar "n443935

shkzg "n443935

meins "n443935

budat "n443935

blart "n443935

mblnr "n443935

mjahr. "n443935

"n443935

  • process the table with the MM docs with control break "n443935

  • the sequential reading is done in a DO-Loop, because "n451923

  • the MODIFY does not refer the current entry "n451923

clear g_cnt_loop. "n451923

"n451923

do. "n451923

add 1 to g_cnt_loop. "n443935

"n451923

read table g_t_mseg_lean into g_s_mseg_lean "n451923

index g_cnt_loop. "n451923

"n451923

if sy-subrc <> 0. "end of table reached ? "n443935

exit. "n443935

endif. "n443935

"n443935

  • fill group key "n443935

move-corresponding g_s_mseg_lean "n443935

to g_s_mseg_new. "n443935

"n443935

  • valuation area depends on the customizing settings "n443935

if curm = '3'. "n443935

  • the valuation level is company code "n443935

move : g_s_mseg_lean-bukrs "n443935

to g_s_mseg_new-bwkey. "n443935

else. "n443935

  • the valuation level is plant "n443935

move : g_s_mseg_lean-werks "n443935

to g_s_mseg_new-bwkey. "n443935

endif. "n443935

"n443935

  • control break "n443935

if g_cnt_loop > 1. "n443935

if g_s_mseg_new ne g_s_mseg_old. "n443935

perform belege_ergaenzen_2. "n443935

endif. "n443935

endif. "n443935

"n443935

  • save the entry in the working table for this group "n443935

add 1 to g_cnt_mseg_entries. "n443935

move-corresponding g_s_mseg_new "n443935

to g_s_mseg_old. "n443935

move-corresponding g_s_mseg_lean "n451923

to g_s_mseg_work. "n451923

move g_cnt_loop to g_s_mseg_work-tabix. "n451923

append g_s_mseg_work to g_t_mseg_work. "n443935

enddo. "n451923

"n443935

  • process the last group "n443935

perform belege_ergaenzen_2. "n443935

"n443935

  • Append FI-documents without material documents (price change,

  • invoice, revaluation document, ...).

  • set a break-point : process remaining FI docs "n443935

"n443935

  • process the remaining FI documents "n443935

loop at g_t_bsim_lean into g_s_bsim_lean. "n443935

clear g_s_mseg_lean. "n443935

"n443935

case g_s_bsim_lean-accessed. "n443935

when 'D'. "n443935

  • this FI could be assigned to a MM doc successfully "n443935

continue. "-> ignore this entry "n443935

"n443935

when 'X'. "n443935

  • take this entry; but there could be inconsistencies "n443935

  • between the MM and FI documents and set '???' to "n443935

  • movement type in the list "n443935

move '???' to g_s_mseg_lean-bwart. "n443935

"n443935

when others. "n443935

endcase. "n443935

"n443935

  • customizing for the selection of remaining BSIM entries "n497992

  • ( FI document ) without matching MSEG ( MM document ) "n497992

  • like price changes, account adjustments, etc... "n497992

  • "n497992

  • set a break-point : when strange FI documents are shown "n497992

"n497992

if not g_cust_bseg_bsx is initial. "n497992

data l_s_ktosl like bseg-ktosl. "n497992

"n497992

  • look for the matching BSEG entry "n497992

select single ktosl from bseg "n497992

into l_s_ktosl "n497992

where bukrs = g_s_bsim_lean-bukrs "n497992

and belnr = g_s_bsim_lean-belnr "n497992

and gjahr = g_s_bsim_lean-gjahr "n497992

and buzei = g_s_bsim_lean-buzei. "n497992

"n497992

if sy-subrc is initial. "n497992

if l_s_ktosl = 'BSX'. "n497992

  • ok: entry found; transaction key is BSX "n497992

else. "n497992

continue. "Do not process this entry "n497992

endif. "n497992

endif. "n497992

endif. "n497992

  • create a entry in the main working table G_T_MSEG_LEAN "n443935

  • for this remaining FI document, delete the quantity, "n443935

  • and set the info of the original MM doc "n443935

move-corresponding g_s_bsim_lean "n443935

to g_s_mseg_lean. "n443935

clear g_s_mseg_lean-menge. "n443935

move : g_s_bsim_lean-awkey "n443935

to matkey, "n443935

matkey-mblnr to g_s_mseg_lean-mblnr, "n443935

matkey-mjahr to g_s_mseg_lean-mjahr. "n443935

"n443935

perform f9300_read_organ "n443935

using c_bwkey g_s_bsim_lean-bwkey. "n443935

"n443935

move : g_s_organ-werks to g_s_mseg_lean-werks, "n443935

g_s_organ-waers to g_s_mseg_lean-waers. "n443935

  • complete this line with CPU-date, CPU-time and user "n856424

  • read FI doc header in working table G_T_BKPF "n856424

read table g_t_bkpf assigning -usnam to g_s_mseg_lean-usnam. "n856424

endif. "n856424

append g_s_mseg_lean to g_t_mseg_lean. "n443935

endloop. "n443935

"n443935

free : g_t_bsim_lean. "n443935

free : g_t_bkpf. "n856424

endform. "belege_ergaenzen

*&----


*

*& Form BESTAENDE_BERECHNEN

*&----


*

  • Berechnung der Bestände zu 'datum-high' und 'datum-low' *

*----


*

form bestaende_berechnen.

*----


Bestände zu 'datum-high' -


*

if bwbst = 'X'.

sort mat_weg by bwkey matnr shkzg. "144845

sort mat_weg_buk by bwkey matnr shkzg. "144845

loop at g_t_mbew into g_s_mbew. "n450764

clear: mat_weg, mat_weg_buk. "184465

  • table g_s_mbew contains already currency and qty unit "n450764

move-corresponding g_s_mbew to bestand. "n450764

if curm = '1'.

read table mat_weg with key bwkey = g_s_mbew-bwkey "n450764

matnr = g_s_mbew-matnr "n450764

shkzg = 'S' binary search.

bestand-endmenge = g_s_mbew-lbkum - mat_weg-menge. "n450764

bestand-endwert = g_s_mbew-salk3 - mat_weg-dmbtr. "n450764

elseif curm = '3'.

read table mat_weg_buk "n450764

with key bwkey = g_s_mbew-bwkey "n450764

matnr = g_s_mbew-matnr "n450764

shkzg = 'S' binary search.

bestand-endmenge = g_s_mbew-lbkum - mat_weg_buk-menge. "n450764

bestand-endwert = g_s_mbew-salk3 - mat_weg_buk-dmbtr. "n450764

endif. "184465

clear: mat_weg, mat_weg_buk. "184465

if curm = '1'.

read table mat_weg with key bwkey = g_s_mbew-bwkey "n450764

matnr = g_s_mbew-matnr "n450764

shkzg = 'H' binary search.

bestand-endmenge = bestand-endmenge + mat_weg-menge.

bestand-endwert = bestand-endwert + mat_weg-dmbtr. "184465

elseif curm = '3'.

read table mat_weg_buk

with key bwkey = g_s_mbew-bwkey "n450764

matnr = g_s_mbew-matnr "n450764

shkzg = 'H' binary search.

bestand-endmenge = bestand-endmenge + mat_weg_buk-menge.

bestand-endwert = bestand-endwert + mat_weg_buk-dmbtr. "184465

endif.

collect bestand.

endloop.

free g_s_mbew. "n450764

elseif lgbst = 'X'.

*----


... auf Materialebene -


*

if xchar = ' '.

loop at imard.

clear weg_mat-menge.

move-corresponding imard to bestand.

  • In 'bestand' wird über die Lagerorte summiert.

read table weg_mat with key werks = imard-werks

lgort = imard-lgort " P30K140665

matnr = imard-matnr

shkzg = 'S'.

bestand-endmenge = imard-labst + imard-insme + imard-speme

+ imard-einme + imard-retme

- weg_mat-menge.

clear weg_mat-menge.

read table weg_mat with key werks = imard-werks

lgort = imard-lgort " P30K140665

matnr = imard-matnr

shkzg = 'H'.

bestand-endmenge = bestand-endmenge + weg_mat-menge.

read table imara with key matnr = bestand-matnr.

move imara-meins to bestand-meins.

collect bestand.

endloop.

*----


... auf Chargenebene -


*

elseif xchar = 'X'.

loop at imchb.

clear weg_char-menge.

move-corresponding imchb to bestand.

read table weg_char with key werks = imchb-werks

lgort = imchb-lgort " P30K140665

matnr = imchb-matnr

charg = imchb-charg

shkzg = 'S'.

bestand-endmenge = imchb-clabs + imchb-cinsm + imchb-cspem

+ imchb-ceinm + imchb-cretm

- weg_char-menge.

clear weg_char-menge.

read table weg_char with key werks = imchb-werks

lgort = imchb-lgort " P30K140665

matnr = imchb-matnr

charg = imchb-charg

shkzg = 'H'.

bestand-endmenge = bestand-endmenge + weg_char-menge.

read table imara with key matnr = bestand-matnr.

move imara-meins to bestand-meins.

collect bestand.

endloop.

endif.

*----


Sonderbestände -


*

elseif sbbst = 'X'.

if sobkz = 'O'.

if xchar = ' '.

loop at imslbx.

clear weg_mat-menge.

move-corresponding imslbx to bestand.

read table weg_mat with key werks = imslbx-werks

matnr = imslbx-matnr

shkzg = 'S'.

bestand-endmenge = imslbx-lblab + imslbx-lbins + imslbx-lbein

- weg_mat-menge.

clear weg_mat-menge.

read table weg_mat with key werks = imslbx-werks

matnr = imslbx-matnr

shkzg = 'H'.

bestand-endmenge = bestand-endmenge + weg_mat-menge.

read table imara with key matnr = bestand-matnr.

move imara-meins to bestand-meins.

collect bestand.

endloop.

elseif xchar = 'X'.

loop at imslb.

clear weg_char-menge.

move-corresponding imslb to bestand.

read table weg_char with key werks = imslb-werks

matnr = imslb-matnr

charg = imslb-charg

shkzg = 'S'.

bestand-endmenge = imslb-lblab + imslb-lbins + imslb-lbein

- weg_char-menge.

clear weg_char-menge.

read table weg_char with key werks = imslb-werks

matnr = imslb-matnr

charg = imslb-charg

shkzg = 'H'.

bestand-endmenge = bestand-endmenge + weg_char-menge.

read table imara with key matnr = bestand-matnr.

move imara-meins to bestand-meins.

collect bestand.

endloop.

endif.

elseif sobkz = 'V' or sobkz = 'W'.

if xchar = ' '.

loop at imskux.

clear weg_mat-menge.

move-corresponding imskux to bestand.

read table weg_mat with key werks = imskux-werks

matnr = imskux-matnr

shkzg = 'S'.

bestand-endmenge = imskux-kulab + imskux-kuins + imskux-kuein

- weg_mat-menge.

clear weg_mat-menge.

read table weg_mat with key werks = imskux-werks

matnr = imskux-matnr

shkzg = 'H'.

bestand-endmenge = bestand-endmenge + weg_mat-menge.

read table imara with key matnr = bestand-matnr.

move imara-meins to bestand-meins.

collect bestand.

endloop.

elseif xchar = 'X'.

loop at imsku.

clear weg_char-menge.

move-corresponding imsku to bestand.

read table weg_char with key werks = imsku-werks

matnr = imsku-matnr

charg = imsku-charg

shkzg = 'S'.

bestand-endmenge = imsku-kulab + imsku-kuins + imsku-kuein

- weg_char-menge.

clear weg_char-menge.

read table weg_char with key werks = imsku-werks

matnr = imsku-matnr

charg = imsku-charg

shkzg = 'H'.

bestand-endmenge = bestand-endmenge + weg_char-menge.

read table imara with key matnr = bestand-matnr.

move imara-meins to bestand-meins.

collect bestand.

endloop.

endif.

elseif sobkz = 'K' or sobkz = 'M'.

if xchar = ' '.

loop at imkolx.

clear weg_mat-menge.

move-corresponding imkolx to bestand.

read table weg_mat with key werks = imkolx-werks

matnr = imkolx-matnr

lgort = imkolx-lgort

shkzg = 'S'.

bestand-endmenge = imkolx-slabs + imkolx-sinsm + imkolx-seinm

+ imkolx-sspem - weg_mat-menge.

clear weg_mat-menge.

read table weg_mat with key werks = imkolx-werks

matnr = imkolx-matnr

lgort = imkolx-lgort

shkzg = 'H'.

bestand-endmenge = bestand-endmenge + weg_mat-menge.

read table imara with key matnr = bestand-matnr.

move imara-meins to bestand-meins.

collect bestand.

endloop.

elseif xchar = 'X'.

loop at imkol.

clear weg_char-menge.

move-corresponding imkol to bestand.

read table weg_char with key werks = imkol-werks

matnr = imkol-matnr

lgort = imkol-lgort

charg = imkol-charg

shkzg = 'S'.

bestand-endmenge = imkol-slabs + imkol-sinsm + imkol-seinm

+ imkol-sspem - weg_char-menge.

clear weg_char-menge.

read table weg_char with key werks = imkol-werks

matnr = imkol-matnr

lgort = imkol-lgort

charg = imkol-charg

shkzg = 'H'.

bestand-endmenge = bestand-endmenge + weg_char-menge.

read table imara with key matnr = bestand-matnr.

move imara-meins to bestand-meins.

collect bestand.

endloop.

endif.

elseif sobkz = 'Q'.

if xchar = ' '.

loop at imsprx.

clear weg_mat-menge.

move-corresponding imsprx to bestand.

read table weg_mat with key werks = imsprx-werks

matnr = imsprx-matnr

lgort = imsprx-lgort

shkzg = 'S'.

bestand-endmenge = imsprx-prlab + imsprx-prins + imsprx-prspe

+ imsprx-prein - weg_mat-menge.

clear weg_mat-menge.

read table weg_mat with key werks = imsprx-werks

matnr = imsprx-matnr

lgort = imsprx-lgort

shkzg = 'H'.

bestand-endmenge = bestand-endmenge + weg_mat-menge.

read table imara with key matnr = bestand-matnr.

move imara-meins to bestand-meins.

collect bestand.

endloop.

elseif xchar = 'X'.

loop at imspr.

clear weg_char-menge.

move-corresponding imspr to bestand.

read table weg_char with key werks = imspr-werks

matnr = imspr-matnr

lgort = imspr-lgort

charg = imspr-charg

shkzg = 'S'.

bestand-endmenge = imspr-prlab + imspr-prins + imspr-prspe

+ imspr-prein - weg_char-menge.

clear weg_char-menge.

read table weg_char with key werks = imspr-werks

matnr = imspr-matnr

lgort = imspr-lgort

charg = imspr-charg

shkzg = 'H'.

bestand-endmenge = bestand-endmenge + weg_char-menge.

read table imara with key matnr = bestand-matnr.

move imara-meins to bestand-meins.

collect bestand.

endloop.

endif.

elseif sobkz = 'E'.

if xchar = ' '.

loop at imskax.

clear weg_mat-menge.

move-corresponding imskax to bestand.

read table weg_mat with key werks = imskax-werks

matnr = imskax-matnr

lgort = imskax-lgort

shkzg = 'S'.

bestand-endmenge = imskax-kalab + imskax-kains + imskax-kaspe

+ imskax-kaein - weg_mat-menge.

clear weg_mat-menge.

read table weg_mat with key werks = imskax-werks

matnr = imskax-matnr

lgort = imskax-lgort

shkzg = 'H'.

bestand-endmenge = bestand-endmenge + weg_mat-menge.

read table imara with key matnr = bestand-matnr.

move imara-meins to bestand-meins.

collect bestand.

endloop.

elseif xchar = 'X'.

loop at imska.

clear weg_char-menge.

move-corresponding imska to bestand.

read table weg_char with key werks = imska-werks

matnr = imska-matnr

lgort = imska-lgort

charg = imska-charg

shkzg = 'S'.

bestand-endmenge = imska-kalab + imska-kains + imska-kaspe

+ imska-kaein - weg_char-menge.

clear weg_char-menge.

read table weg_char with key werks = imska-werks

matnr = imska-matnr

lgort = imska-lgort

charg = imska-charg

shkzg = 'H'.

bestand-endmenge = bestand-endmenge + weg_char-menge.

read table imara with key matnr = bestand-matnr.

move imara-meins to bestand-meins.

collect bestand.

endloop.

endif.

endif.

endif.

*----


Bestände zu 'datum-low' -


*

if bwbst = 'X'.

sort mat_sum by bwkey matnr shkzg. "144845

sort mat_sum_buk by bwkey matnr shkzg. "144845

loop at bestand.

clear: mat_sum, mat_sum_buk. "184465

if curm = '1'.

read table mat_sum with key bwkey = bestand-bwkey

matnr = bestand-matnr

shkzg = 'S' binary search.

move mat_sum-menge to bestand-soll.

move mat_sum-dmbtr to bestand-sollwert. "184465

elseif curm = '3'.

read table mat_sum_buk with key bwkey = bestand-bwkey

matnr = bestand-matnr

shkzg = 'S' binary search.

move mat_sum_buk-menge to bestand-soll.

move mat_sum_buk-dmbtr to bestand-sollwert. "184465

endif.

clear: mat_sum, mat_sum_buk. "184465

if curm = '1'.

read table mat_sum with key bwkey = bestand-bwkey

matnr = bestand-matnr

shkzg = 'H' binary search.

move mat_sum-menge to bestand-haben.

move mat_sum-dmbtr to bestand-habenwert. "184465

elseif curm = '3'.

read table mat_sum_buk with key bwkey = bestand-bwkey

matnr = bestand-matnr

shkzg = 'H' binary search.

move mat_sum_buk-menge to bestand-haben.

move mat_sum_buk-dmbtr to bestand-habenwert. "184465

endif.

bestand-anfmenge = bestand-endmenge - bestand-soll

+ bestand-haben.

bestand-anfwert = bestand-endwert - bestand-sollwert

+ bestand-habenwert.

modify bestand.

endloop.

*----


... auf Materialebene -


*

elseif lgbst = 'X'.

if xchar = ' '.

loop at bestand.

clear sum_mat-menge.

read table sum_mat with key werks = bestand-werks

matnr = bestand-matnr

shkzg = 'S'.

move sum_mat-menge to bestand-soll.

clear sum_mat-menge.

read table sum_mat with key werks = bestand-werks

matnr = bestand-matnr

shkzg = 'H'.

move sum_mat-menge to bestand-haben.

bestand-anfmenge = bestand-endmenge - bestand-soll

+ bestand-haben.

modify bestand.

endloop.

*----


... auf Chargenebene -


*

elseif xchar = 'X'.

loop at bestand.

clear sum_char-menge.

read table sum_char with key werks = bestand-werks

matnr = bestand-matnr

charg = bestand-charg

shkzg = 'S'.

move sum_char-menge to bestand-soll.

clear sum_char-menge.

read table sum_char with key werks = bestand-werks

matnr = bestand-matnr

charg = bestand-charg

shkzg = 'H'.

move sum_char-menge to bestand-haben.

bestand-anfmenge = bestand-endmenge - bestand-soll

+ bestand-haben.

modify bestand.

endloop.

endif.

*----


Sonderbestände -


*

elseif sbbst = 'X'.

if sobkz = 'O'.

if xchar = ' '.

loop at bestand.

clear sum_mat-menge.

read table sum_mat with key werks = bestand-werks

matnr = bestand-matnr

shkzg = 'S'.

move sum_mat-menge to bestand-soll.

clear sum_mat-menge.

read table sum_mat with key werks = bestand-werks

matnr = bestand-matnr

shkzg = 'H'.

move sum_mat-menge to bestand-haben.

bestand-anfmenge = bestand-endmenge - bestand-soll

+ bestand-haben.

modify bestand.

endloop.

elseif xchar = 'X'.

loop at bestand.

clear sum_char-menge.

read table sum_char with key werks = bestand-werks

matnr = bestand-matnr

charg = bestand-charg

shkzg = 'S'.

move sum_mat-menge to bestand-soll.

clear sum_char-menge.

read table sum_char with key werks = bestand-werks

matnr = bestand-matnr

charg = bestand-charg

shkzg = 'H'.

move sum_mat-menge to bestand-haben.

bestand-anfmenge = bestand-endmenge - bestand-soll

+ bestand-haben.

modify bestand.

endloop.

endif.

elseif sobkz = 'V' or sobkz = 'W'.

if xchar = ' '.

loop at bestand.

clear sum_mat-menge.

read table sum_mat with key werks = bestand-werks

matnr = bestand-matnr

shkzg = 'S'.

move sum_mat-menge to bestand-soll.

clear sum_mat-menge.

read table sum_mat with key werks = bestand-werks

matnr = bestand-matnr

shkzg = 'H'.

move sum_mat-menge to bestand-haben.

bestand-anfmenge = bestand-endmenge - bestand-soll

+ bestand-haben.

modify bestand.

endloop.

elseif xchar = 'X'.

loop at bestand.

clear sum_char-menge.

read table sum_char with key werks = bestand-werks

matnr = bestand-matnr

charg = bestand-charg

shkzg = 'S'.

move sum_char-menge to bestand-soll.

clear sum_char-menge.

read table sum_char with key werks = bestand-werks

matnr = bestand-matnr

charg = bestand-charg

shkzg = 'H'.

move sum_char-menge to bestand-haben.

bestand-anfmenge = bestand-endmenge - bestand-soll

+ bestand-haben.

modify bestand.

endloop.

endif.

  • consider special stock M ,too

elseif sobkz = 'K' or sobkz = 'M'.

if xchar = ' '.

loop at bestand.

clear sum_mat-menge.

read table sum_mat with key werks = bestand-werks

matnr = bestand-matnr

shkzg = 'S'.

move sum_mat-menge to bestand-soll.

clear sum_mat-menge.

read table sum_mat with key werks = bestand-werks

matnr = bestand-matnr

shkzg = 'H'.

move sum_mat-menge to bestand-haben.

bestand-anfmenge = bestand-endmenge - bestand-soll

+ bestand-haben.

modify bestand.

endloop.

elseif xchar = 'X'.

loop at bestand.

clear sum_char-menge.

read table sum_char with key werks = bestand-werks

matnr = bestand-matnr

charg = bestand-charg

shkzg = 'S'.

move sum_char-menge to bestand-soll.

clear sum_char-menge.

read table sum_char with key werks = bestand-werks

matnr = bestand-matnr

charg = bestand-charg

shkzg = 'H'.

move sum_char-menge to bestand-haben.

bestand-anfmenge = bestand-endmenge - bestand-soll

+ bestand-haben.

modify bestand.

endloop.

endif.

elseif sobkz = 'Q'.

if xchar = ' '.

loop at bestand.

clear sum_mat-menge.

read table sum_mat with key werks = bestand-werks

matnr = bestand-matnr

shkzg = 'S'.

move sum_mat-menge to bestand-soll.

clear sum_mat-menge.

read table sum_mat with key werks = bestand-werks

matnr = bestand-matnr

shkzg = 'H'.

move sum_mat-menge to bestand-haben.

bestand-anfmenge = bestand-endmenge - bestand-soll

+ bestand-haben.

modify bestand.

endloop.

elseif xchar = 'X'.

loop at bestand.

clear sum_char-menge.

read table sum_char with key werks = bestand-werks

matnr = bestand-matnr

charg = bestand-charg

shkzg = 'S'.

move sum_char-menge to bestand-soll.

clear sum_char-menge.

read table sum_char with key werks = bestand-werks

matnr = bestand-matnr

charg = bestand-charg

shkzg = 'H'.

move sum_char-menge to bestand-haben.

bestand-anfmenge = bestand-endmenge - bestand-soll

+ bestand-haben.

modify bestand.

endloop.

endif.

elseif sobkz = 'E'.

if xchar = ' '.

loop at bestand.

clear sum_mat-menge.

read table sum_mat with key werks = bestand-werks

matnr = bestand-matnr

shkzg = 'S'.

move sum_mat-menge to bestand-soll.

clear sum_mat-menge.

read table sum_mat with key werks = bestand-werks

matnr = bestand-matnr

shkzg = 'H'.

move sum_mat-menge to bestand-haben.

bestand-anfmenge = bestand-endmenge - bestand-soll

+ bestand-haben.

modify bestand.

endloop.

elseif xchar = 'X'.

loop at bestand.

clear sum_char-menge.

read table sum_char with key werks = bestand-werks

matnr = bestand-matnr

charg = bestand-charg

shkzg = 'S'.

move sum_char-menge to bestand-soll.

clear sum_char-menge.

read table sum_char with key werks = bestand-werks

matnr = bestand-matnr

charg = bestand-charg

shkzg = 'H'.

move sum_char-menge to bestand-haben.

bestand-anfmenge = bestand-endmenge - bestand-soll

+ bestand-haben.

modify bestand.

endloop.

endif.

endif.

endif.

endform. " BESTAENDE_BERECHNEN

*&----


*

*& Form BESTAENDE_AUSGEBEN

*&----


*

  • Ausgabe der Bestände zu 'datum-low' und 'datum-high' *

  • und der Zu- und Abgänge in diesem Zeitintervall *

  • für den Lagerort-/Chargen- und den Sonderbestand *

  • bzw. für den bewerteten Bestand *

*----


*

form bestaende_ausgeben.

  • show the wole list with the ALV

read table bestand index 1.

move-corresponding bestand to bestand1.

append bestand1.

clear g_t_belege. refresh g_t_belege.

if bwbst is initial.

loop at g_t_mseg_lean into g_s_mseg_lean

where matnr = bestand-matnr

and werks = bestand-werks.

check : xchar is initial or

g_s_mseg_lean-charg = bestand-charg.

move-corresponding g_s_mseg_lean

to g_t_belege1.

  • enrich some fields with color and numeric fields with sign

perform f9500_set_color_and_sign

using g_t_belege1 'G_T_BELEGE1'.

append g_t_belege1.

endloop.

elseif not bwbst is initial.

loop at g_t_mseg_lean into g_s_mseg_lean

where matnr = bestand-matnr.

  • get the valuation area for this plant

perform f9300_read_organ

using c_werks g_s_mseg_lean-werks.

check : g_s_organ-bwkey = bestand-bwkey. "184465

move-corresponding g_s_mseg_lean

to g_t_belege1.

  • enrich some fields with color and numeric fields with sign

perform f9500_set_color_and_sign

using g_t_belege1 'G_T_BELEGE1'.

append g_t_belege1.

endloop.

endif.

sort g_t_belege1 by budat mblnr zeile.

events-name = 'TOP_OF_PAGE'.

events-form = 'UEBERSCHRIFT1'.

append events.

  • set this event depending on the entries in working "n599218

  • table BESTAND "n599218

describe table bestand lines g_f_cnt_lines. "n599218

"n599218

if g_f_cnt_lines = 1. "n599218

events-form = 'PRINT_END_OF_LIST'. "n599218

else. "n599218

events-form = 'LISTE'. "n599218

endif. "n599218

events-name = 'END_OF_LIST'.

append events.

perform listausgabe1.

endform. " BESTAENDE_AUSGEBEN

*&----


*

  • FORM ANFORDERUNGSBILD *

*----


*

  • Rücksprung zum Anforderungsbild *

*----


*

form anforderungsbild.

if not sy-calld is initial.

leave.

else.

leave to transaction sy-tcode.

endif.

endform. " ANFORDERUNGSBILD

*&----


*

*& Form F4_FOR_VARIANT

*&----


*

  • F4-Hilfe für Reportvariante *

*----


*

form f4_for_variant.

call function 'REUSE_ALV_VARIANT_F4'

exporting

is_variant = variante

i_save = variant_save

  • it_default_fieldcat =

importing

e_exit = variant_exit

es_variant = def_variante

exceptions

not_found = 2.

if sy-subrc = 2.

message id sy-msgid type 'S' number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

else.

if variant_exit = space.

p_vari = def_variante-variant.

endif.

endif.

endform. " F4_FOR_VARIANT

*&----


*

*& Form LISTAUSGABE

*&----


*

  • text

*----


*

form listausgabe.

if g_cust_color = 'X'. "colorize numeric fields ?

layout-coltab_fieldname = 'FARBE_PRO_FELD'.

else.

layout-info_fieldname = 'FARBE_PRO_ZEILE'.

endif.

layout-f2code = '9PBP'.

if not bwbst is initial.

layout-min_linesize = '92'.

endif.

  • set a break-point : check input data for list viewer "n599218

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

i_interface_check = g_flag_i_check "n599218

i_callback_program = repid

i_callback_pf_status_set = 'STATUS'

i_callback_user_command = 'USER_COMMAND'

  • I_STRUCTURE_NAME =

is_layout = layout

it_fieldcat = fieldcat[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

it_sort = sorttab[]

it_filter = filttab[]

  • IS_SEL_HIDE =

i_default = 'X'

  • i_save = 'A' "note 311825

  • is_variant = variante "note 311825

it_events = events[]

it_event_exit = event_exit[]

is_print = g_s_print

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IMPORTING

  • e_exit_caused_by_caller = 'X'

  • es_exit_caused_by_user = 'X'

tables

  • t_outtab = belege.

t_outtab = g_t_belege

exceptions

  • program_error = 1

others = 2.

  • does the ALV return with an error ?

if not sy-subrc is initial. "Fehler vom ALV ?

message id sy-msgid type 'S' number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. " LISTAUSGABE

*&----


*

*& Form LISTE

*&----


*

form liste.

  • get the number of lines to be processed = total - 1 "n599218

describe table bestand lines g_f_cnt_bestand_total. "n599218

subtract 1 from g_f_cnt_bestand_total. "n599218

clear g_f_cnt_bestand_curr. "n599218

loop at bestand from 2.

  • clear belege. refresh belege.

clear g_t_belege. refresh g_t_belege.

add 1 to g_f_cnt_bestand_curr. "n599218

if bwbst is initial.

loop at g_t_mseg_lean into g_s_mseg_lean

where matnr = bestand-matnr

and werks = bestand-werks.

check : xchar is initial or

g_s_mseg_lean-charg = bestand-charg.

move-corresponding g_s_mseg_lean

to g_t_belege.

  • enrich some fields with color and numeric fields with sign

perform f9500_set_color_and_sign

using g_t_belege 'G_T_BELEGE'.

append g_t_belege.

endloop.

elseif not bwbst is initial.

loop at g_t_mseg_lean into g_s_mseg_lean

where matnr = bestand-matnr.

  • get the valuation area for this plant

perform f9300_read_organ

using c_werks g_s_mseg_lean-werks.

check : g_s_organ-bwkey = bestand-bwkey.

move-corresponding g_s_mseg_lean

to g_t_belege.

  • enrich some fields with color and numeric fields with sign

perform f9500_set_color_and_sign

using g_t_belege 'G_T_BELEGE'.

append g_t_belege.

endloop.

endif.

  • sort belege by budat mblnr zeile.

sort g_t_belege by budat mblnr zeile.

clear events. refresh events.

events-name = 'TOP_OF_PAGE'.

events-form = 'UEBERSCHRIFT'.

append events.

  • the last ALV block should print the end line "n599218

if g_f_cnt_bestand_total = g_f_cnt_bestand_curr. "n599218

  • this is the very last "n599218

events-name = 'END_OF_LIST'. "n599218

events-form = 'PRINT_END_OF_LIST'. "n599218

append events. "n599218

endif. "n599218

clear sorttab. refresh sorttab.

clear filttab. refresh filttab.

call function 'REUSE_ALV_LIST_LAYOUT_INFO_GET'

importing

  • es_layout = layout

et_fieldcat = fieldcat[]

et_sort = sorttab[]

et_filter = filttab[]

  • ES_LIST_SCROLL =

  • ES_VARIANT =

exceptions

no_infos = 1

program_error = 2

others = 3.

layout-list_append = 'X'.

perform listausgabe.

endloop.

endform. " LISTE

*&----


*

  • print_end_of_list "n599218

*----

-


"n599218

"n599218

form print_end_of_list. "n599218

"n599218

  • go on when the report runs in print mode -> last line

check not sy-prdsn is initial.

data: lr_content type ref to cl_salv_form_element.

*... (1) create the information to be displayed by using

  • the ALV Form elements

perform print_end_of_list_render changing lr_content.

*... (2) Sending the information to the ALV

  • Once the inforation to be displayed has been

  • created the information has to be sent to the ALV

  • This is done by calling the static method

  • CL_SALV_FORM_CONTENT=>SET( <content> ) with the content

  • which is to be displayed.

  • Alternativly the function module REUSE_ALV_COMMENTARY_WRITE

  • can still be used.

cl_salv_form_content=>set( lr_content ).

"n599218

endform. "print_end_of_list "n599218

"n599218

*----


*

  • print_end_of_list_render

*----


*

form print_end_of_list_render

changing cr_content type ref to cl_salv_form_element.

data: lr_grid type ref to cl_salv_form_layout_grid,

lr_flow type ref to cl_salv_form_layout_flow,

l_text(500) type c,

l_char(500) type c.

*... create a grid

create object lr_grid.

lr_flow = lr_grid->create_flow( row = 1 column = 1 ).

if bwbst is initial.

  • stocks only

move : g_end_line_77 to l_text.

else.

  • stocks and values

move : g_end_line_91 to l_text.

endif.

  • add line to object

lr_flow->create_text( text = l_text ).

  • copy whole header object

cr_content = lr_grid.

endform. " print_end_of_list_render

*----

-


"n599218

  • create_headline "n599218

*----

-


"n599218

"n599218

form create_headline. "n599218

"n599218

data : l_offset type i, "n599218

l_strlen type i. "n599218

"n599218

  • get the length of the title "n599218

compute l_strlen = strlen( sy-title ). "n599218

"n599218

if bwbst is initial. "n599218

  • stocks only --> small line with 77 bytes "n599218

if l_strlen = 59. "n599218

move : sy-title to g_s_header_77-title. "n599218

elseif l_strlen > 59. "n599218

move : sy-title to g_s_header_77-title, "n599218

'...' to g_s_header_77-title+56(03). "n599218

else. "n599218

compute l_offset = ( 59 - l_strlen ) / 2. "n599218

move : sy-title to g_s_header_77-title+l_offset. "n599218

endif. "n599218

"n599218

write : sy-datlo dd/mm/yyyy to g_s_header_77-date. "n599218

else. "n599218

  • stocks and values --> wide line with 91 bytes "n599218

if l_strlen = 73. "n599218

move : sy-title to g_s_header_91-title. "n599218

elseif l_strlen > 73. "n599218

move : sy-title to g_s_header_91-title, "n599218

'...' to g_s_header_91-title+70(03). "n599218

else. "n599218

compute l_offset = ( 73 - l_strlen ) / 2. "n599218

move : sy-title to g_s_header_91-title+l_offset. "n599218

endif. "n599218

"n599218

write : sy-datlo dd/mm/yyyy to g_s_header_91-date. "n599218

endif. "n599218

"n599218

  • create the end lines, too "n599218

concatenate text-062 "End of List "n599218

':' sy-title "n599218

into g_end_line_77 "n599218

separated by space. "n599218

move : g_end_line_77 to g_end_line_91. "n599218

"n599218

endform. "create_headline "n599218

"n599218

Message was edited by:

ravi gupta

Message was edited by:

ravi gupta

Message was edited by:

ravi gupta

1 ACCEPTED SOLUTION

Former Member
0 Kudos
114

Are u copying all the includes..?

Try copying with another name again using the copy button in SE38.

& also copy only those include with 'Z' or 'Y' where u want to make changes.

5 REPLIES 5

Former Member
0 Kudos
115

Are u copying all the includes..?

Try copying with another name again using the copy button in SE38.

& also copy only those include with 'Z' or 'Y' where u want to make changes.

Former Member
0 Kudos
114

The problem is straight foward

In program "ZVISA_RM07MLBD ", the following syntax error occurred

in the Include "RM07MLBD_FORM_01 " in line 1805:

The type KKBLO_T_SORTINFO" is unknown."

Your copied program is still using a standard include RM07MLBD_FORM_01, which is using the standard type KKBLO_T_SORTINFO.

Looks like the inlcude / type-pools in which the type exists, you have not declared.

What you can do -


Open the standard program and see where KKBLO_T_SORTINFO exists.

Include that include/type-pools in your custom program as well.

That should fix the issue.

Regards,

Ravi

Note - Please mark all the helpful answers

Clemenss
Active Contributor
0 Kudos
114

Hi Ravi,

possibly a service pack has been installed just in the time when you created the copy. I found

data: lt_sort type kkblo_t_sortinfo. "n890109

in the include mentioned on our system. Please check if the includes are identical in development and production server (remote-compare from editor).

But we also have a copy of this in our system. In the copy I found type name like alv_type_sortinfo but no kkblo_t_sortinfo.

Note KKBLO was the predecessor of ALV.

Must have to dio something with version changed by service pack.

Regards,

Clemens

Former Member
0 Kudos
114

HI CLEMENS,

THNX ALOT,

THE PROBLEM HAS BEEN SOLVED,,ONCE AGAIN THNX FOR UR IDEA.......i will b grateful to u.

with regards,

ravi gupta.

Former Member
0 Kudos
114

HI CLEMENS,

THNX ALOT,

THE PROBLEM HAS BEEN SOLVED,,ONCE AGAIN THNX FOR UR IDEA.......i will b grateful to u.

with regards,

ravi gupta.