Skip to Content
0
Former Member
May 16, 2008 at 10:06 AM

can anybody help me

27 Views

I have written the below code in include ZXMG0U02 of user exit EXIT_SAPLMGMU_001

This code is giving error as v_matnr is unkown. where as i have defined it in a variable.

Requirement is I need to send material which is created or changed to file on application server.

need help.

*Constant varaible for File format.

CONSTANTS : gc_productcode(15) TYPE c VALUE 'ProductCode',

gc_Prodesc1(25) TYPE c VALUE 'ProductDescription1',

gc_Prodesc2(25) TYPE c VALUE 'ProductDescription2',

gc_salesgrp(10) TYPE c VALUE 'SalesGroup',

gc_stockunit(10) TYPE c VALUE 'StockUnit',

gc_unitweight(10) TYPE c VALUE 'UnitWeight',

gc_volume(10) TYPE c VALUE 'Volume',

gc_length(8) TYPE c VALUE 'Length',

gc_height(8) TYPE c VALUE 'Height',

gc_seriallot(10) TYPE c VALUE 'Serial/Lot',

gc_palletqty(10) TYPE c VALUE 'PalletQty',

gc_unitpercar(15) TYPE c VALUE 'UnitPerCarton',

gc_unno(5) TYPE c VALUE 'UNNo.'.

*Type declaration for storing the output file

DATA: BEGIN OF g_file OCCURS 0,

matnr TYPE mara-matnr, "Material Number

fil1 TYPE c VALUE ',',

maktx TYPE makt-maktx, "Material description

fil2 TYPE c VALUE ',',

prodesc(30) TYPE c, "Material description

fil3 TYPE c VALUE ',',

salegrp(3) TYPE c, "

fil4 TYPE c VALUE ',',

mseht TYPE t006a-mseht, "Text description of the UOM

fil5 TYPE c VALUE ',',

brgew TYPE mara-brgew, "

fil6 TYPE c VALUE ',',

volum TYPE mara-volum, "

fil7 TYPE c VALUE ',',

ength(5) TYPE c, "

fil8 TYPE c VALUE ',',

wheel_width TYPE zwid, "Wheel Width

fil9 TYPE c VALUE ',',

wheel_diam TYPE zdiam, "Use diameter to get height

fil10 TYPE c VALUE ',',

serial(1) TYPE c, "

fil11 TYPE c VALUE ',',

palqty(10) TYPE c, "

fil12 TYPE c VALUE ',',

unipcar(5) TYPE c, "

fil13 TYPE c VALUE ',',

unno(4) TYPE c, "

END OF g_file.

*Table declaration for storing data.

DATA : t_file1 LIKE g_file OCCURS 0 WITH HEADER LINE.

DATA : t_file2 LIKE g_file OCCURS 0 WITH HEADER LINE.

DATA : t_zkgplant LIKE zmmkaganplant OCCURS 0 WITH HEADER LINE.

*Data declaration for text file.

DATA : v_filename(256) TYPE c.

*variable declaration.

DATA : v_werks LIKE marc-werks,

v_meins LIKE mara-meins,

v_kaganplntcode LIKE zmmkaganplant-werks.

DATA : g_cvstab type string.

CONCATENATE gc_productcode gc_Prodesc1 gc_Prodesc2 gc_salesgrp gc_stockunit gc_unitweight gc_volume gc_length gc_height gc_seriallot

gc_palletqty gc_unitpercar gc_unno INTO g_cvstab separated by ','.

loop at t_file2.

IF SY-UCOMM = 'BU'.

select amatnr bmaktx cmseht abrgew avolum awheel_width a~wheel_diam

into corresponding fields of table t_file1

from ( ( mara as a inner join makt as b on amatnr = bmatnr )

inner join T006A as c on c~mandt = sy-mandt )

where v_werks = v_kaganplntcode.

endloop.

*File path

DATA : gu_file1 LIKE rlgrap-filename VALUE '/interface/SYSID/outbound/KAGAN/' matnr sy-datum sy-uzeit '.txt'.

DATA : gu_file2 LIKE rlgrap-filename VALUE '/interface/SYSID/outbound/KAGAN/ARCHIVE/' matnr sy-datum sy-uzeit '.txt'.

REPLACE 'SYSID' WITH sy-sysid INTO gu_file1.

CONDENSE gu_file1 NO-GAPS.

REPLACE 'SYSID' WITH sy-sysid INTO gu_file2.

CONDENSE gu_file2 NO-GAPS.

OPEN DATASET gu_file1 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

TRANSFER g_cvstab to gu_file1.

TRANSFER t_file1 to gu_file1.

CLOSE DATASET gu_file1.