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: 

Wht is the CONVERSION_EXIT for suffixing SPACES(for MATNR)?

Former Member
0 Kudos

Hi Experts,

Am trying to get CHANGENR from CDPOS (actually,UDATE from CDHDR), so I wanna to pass TABKEY, so,

my MATNR is 80071, so am using CONVERSION_INPUT and am getting matnr as 000000000000080071, fine working well!

But, when comes to Alphabets, Wht is Conversion Exit? I mean,

if MATNR is ABCD1234 or -ABCD1234, so to pass it for TABKEY in CDPOS, I need to hv matnr as ABCD1234__________(suffixing the spaces),

So,pls. let me know that How can I get it?

thanq.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

I believe he is already using the conversion exit, but for alphanumeric material numbers, he is not getting the trailing spaces when he is preparing the tabkey. I think he may be using CONCATENATE to prepare the TABKEY, instead he should move the values by offset, then he will get the TABKEY correctly with the trailing spaces between the material number and the next field he is trying to use.

12 REPLIES 12

Former Member
0 Kudos

You cannot use CONCATENATE in such cases you have to move values using offsets.

Something like this

tabkey+0(18) = matnr.

tabkey_18(xx) = yyyy.....

Former Member
0 Kudos

Hi,

You can pass the MATNR directly when it is having the Alphabets, no need to use th conversion exit or no need to use the SPACES

Regards

Sudheer

Former Member
0 Kudos

If you use conv FM for charcters then it will give what ever input you have,it will not add.

Try to look at MM04 Transaction ,just enter material number and debug it.

Thanks

Seshu

Former Member
0 Kudos

Look at:

CONVERSION_EXIT_MATN1_INPUT Material number conversion (INPUT)

CONVERSION_EXIT_MATN1_OUTPUT Material number conversion (OUTPUT)

Excuse me Srinivas

Rob

Former Member
0 Kudos

hi,

try using FM

CONVERSION_EXIT_MATNL_INPUT

CONVERSION_EXIT_MATNE_INPUT

Former Member
0 Kudos

hi,

say if v_matnr ca 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.

pass the v_matnr directly

else.

covert it and pass

endif.

Thansk

Mahesh

Former Member
0 Kudos

I believe he is already using the conversion exit, but for alphanumeric material numbers, he is not getting the trailing spaces when he is preparing the tabkey. I think he may be using CONCATENATE to prepare the TABKEY, instead he should move the values by offset, then he will get the TABKEY correctly with the trailing spaces between the material number and the next field he is trying to use.

0 Kudos

thanq,

yes, ur guess exactly correct! yes, I will follow OFFSETTING operation.

thanq.

Message was edited by:

Srikhar

0 Kudos

Hi,

Do u hv any clue, Why its happening like this(for rest its working well)?

matnr = -NEW_PART1 (starts with MINUS sign)

my code is,

<b><i> z_tabkey+0(3) = sy-mandt.

z_tabkey+4(21) = i_selplnt-matnr.

z_tabkey+22(25) = i_selplnt-werks.</i></b>

Result is = 100 -NEW_PART1----


4000 (not getting cdpos-change nr)

It shuld b = 100-NEW_PART1----


4000 (getting cdpos-changenr and its like

same in CDPOS-TABKEY)

so, Why am getting a single space btween 0 & - ? i.e. 100<u><b>?</b></u>-NEW_PART1

thanq.

Message was edited by:

Srikhar

0 Kudos

Shouldn't the offsets be

z_tabkey+0(3) = sy-mandt.

z_tabkey+3(18) = i_selplnt-matnr.

z_tabkey+21(4) = i_selplnt-werks.

0 Kudos

I do not have any idea about your functionality..

I have done similar type requirement , initially i get the data from cdhdr table by passing only material #,

then i get the change doc number from cdhdr, I will pass change document number from cdhdr to FM ( To read item level).

Any how see program and you may get good idea :

REPORT ZQA_MATERIAL_CHANGE_LIST no standard page heading line-size 132.

tables: bdcp, mara, makt.

data: i_cdhdr like cdhdr occurs 0 with header line,

i_cdshw like cdshw occurs 0 with header line.

  • SELECTION SCREEN ELEMENTS ------------------------------------------*

SELECTION-SCREEN BEGIN OF BLOCK one

WITH FRAME TITLE text-001.

Select-options: s_datum for sy-datum obligatory.

select-options : s_time for sy-uzeit.

  • Start of change Seshu 02/19/2007

  • Reason - Added Material Number as Range Option

*select-options : p_matnr for mara-matnr.

select-options s_matnr for mara-matnr.

select-options: S_usernm for sy-uname.

SELECTION-SCREEN END OF BLOCK one.

SELECTION-SCREEN BEGIN OF BLOCK two

WITH FRAME TITLE text-002.

parameters: r_all radiobutton group one default 'X',

r_erps radiobutton group one,

r_select radiobutton group one.

SELECTION-SCREEN: BEGIN OF LINE, POSITION 5.

parameter p_fname like bdcp-fldname.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK two.

ranges r_objectid for cdhdr-objectid.

  • List of fields transmitted to ERPsy-Daisy

select-options so_fname for i_cdshw-fname no-display.

  • START OF SELECTION --------------------------------------------------*

START-OF-SELECTION.

if r_select is initial.

clear p_fname.

endif.

perform set_erpsy_daisy_fields.

perform get_data.

perform write_report.

  • SUBROUTINES ---------------------------------------------------------*

&----


*& Form get_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM get_data.

  • data: v_objectid like cdhdr-objectid.

*

    • move p_matnr to v_objectid.

*

loop at s_matnr.

move : s_matnr-low to r_objectid-low,

s_matnr-high to r_objectid-high,

s_matnr-option to r_objectid-option,

s_matnr-sign to r_objectid-sign.

append r_objectid.

endloop.

**if v_objectid is initial.

*select * from cdhdr into table i_cdhdr

  • where USERNAME in s_usernm

  • and OBJECTCLAS = 'MATERIAL'

  • and UDATE in s_datum

  • and utime in s_time.

*

*

*else.

select * from cdhdr into table i_cdhdr

where OBJECTID in r_objectid

and USERNAME in s_usernm

and OBJECTCLAS = 'MATERIAL'

and UDATE in s_datum

and utime in s_time.

*endif.

if sy-subrc ne 0.

message e000(zwave) with 'No Data Found for given Selection'.

endif.

ENDFORM. " get_data

&----


*& Form write_report

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM write_report.

data: v_fname(60) type c,

v_changenr like i_cdhdr-changenr,

v_count type i value 0.

sort i_cdhdr by tcode changenr.

  • list materials created ---------------------------------------

if not s_datum-high is initial.

uline.

format color col_heading intensified on.

write: / sy-vline,

'Materials created since',

25 s_datum-low ,39 'to',43 s_datum-high,

132 sy-vline.

format color off.

uline.

else.

uline.

format color col_heading intensified on.

write: / sy-vline,

'Materials created since',

s_datum-low ,

132 sy-vline.

format color off.

ULINE.

endif.

loop at i_cdhdr where tcode = 'MM01' or

tcode = 'MM11'.

perform write_header_line using i_cdhdr.

endloop.

uline.

  • list materials deleted ---------------------------------------

if not s_datum-high is initial.

uline.

format color col_heading intensified on.

write: / sy-vline,

'Materials flagged for deletion since',

43 s_datum-low ,55 'to',59 s_datum-high,

132 sy-vline.

format color off.

uline.

else.

uline.

format color col_heading intensified on.

write: / sy-vline,

'Materials flagged for deletion since',

s_datum-low,

132 sy-vline.

format color off.

uline.

endif.

loop at i_cdhdr where tcode = 'MM06' or

tcode = 'MM16'.

perform write_header_line using i_cdhdr.

endloop.

uline.

  • display detail for material changes ---------------------------

skip.

if not s_datum-high is initial.

uline.

format color col_heading intensified on.

write: / sy-vline,

'Materials changed since',

28 s_datum-low ,39 'to',43 s_datum-high,

132 sy-vline.

format color off.

else.

uline.

format color col_heading intensified on.

write: / sy-vline,

'Materials changed since',

s_datum-low ,

132 sy-vline.

format color off.

endif.

  • display material change transactions (immediate and change)

loop at i_cdhdr where tcode = 'MM02' or

tcode = 'MM12'.

  • retrieve change document line items

perform get_change_positions using i_cdhdr-changenr.

  • display each item matching field on parameter screen, only

  • ERPsy-Daisy materials, or all fields if both paramters blank

v_count = 0.

loop at i_cdshw.

if ( p_fname is initial or

i_cdshw-fname = p_fname ) and

i_cdshw-fname in so_fname.

  • write header line if this is the first line item from change

  • order to meet above criteria

add 1 to v_count.

if v_count = 1.

if i_cdhdr-changenr <> v_changenr.

if sy-index <> 1.

uline.

endif.

perform write_header_line using i_cdhdr.

endif.

endif.

v_changenr = i_cdhdr-changenr.

  • write change line

concatenate '(' i_cdshw-fname ')'

into v_fname.

concatenate i_cdshw-ftext v_fname

into v_fname separated by space.

write: / sy-vline.

if i_cdshw-chngind = 'U'. "update

write 12 'Change >'.

elseif i_cdshw-chngind = 'D' or

i_cdshw-chngind = 'I'.

write 12 'Deleted >'.

elseif i_cdshw-chngind = 'I'.

write 12 'Inserted >'.

endif.

write: v_fname,

132 sy-vline.

write: / sy-vline,

16 'Old Value:',

(40) i_cdshw-f_old,

132 sy-vline,

/ sy-vline,

16 'New Value:',

(40) i_cdshw-f_new,

132 sy-vline.

endif.

endloop.

endloop.

uline.

ENDFORM. " write_report

&----


*& Form write_header_line

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM write_header_line using x_cdhdr like cdhdr.

data: v_date(10) type c,

v_time(8) type c.

  • get material description

select single maktx

from makt

into makt-maktx

where matnr = x_cdhdr-objectid.

format color col_heading intensified off.

write: / sy-vline,

x_cdhdr-objectid+8(10) no-zero,

(40) makt-maktx,

x_cdhdr-tcode,

x_cdhdr-username,

x_cdhdr-udate,

x_cdhdr-utime,

132 sy-vline.

format color off.

ENDFORM. " write_header_line

&----


*& Form get_change_positions

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM get_change_positions using x_chgnbr.

CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'

EXPORTING

  • ARCHIVE_HANDLE = 0

CHANGENUMBER = x_chgnbr

  • TABLEKEY = ' '

  • TABLENAME = ' '

  • IMPORTING

  • HEADER =

TABLES

EDITPOS = i_cdshw

  • EDITPOS_WITH_HEADER =

  • EXCEPTIONS

  • NO_POSITION_FOUND = 1

  • WRONG_ACCESS_TO_ARCHIVE = 2

  • OTHERS = 3

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDFORM. " get_change_positions

&----


*& Form set_erpsy_daisy_fields

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM set_erpsy_daisy_fields.

if r_erps = 'X'.

move: 'I' to so_fname-sign,

'EQ' to so_fname-option,

'BISMT' to so_fname-low.

append so_fname.

move 'MATNR' to so_fname-low.

append so_fname.

move 'MAKTX' to so_fname-low.

append so_fname.

  • MVKE fields

move 'VKORG' to so_fname-low.

append so_fname.

move 'VTWEG' to so_fname-low.

append so_fname.

move 'VMSTA' to so_fname-low.

append so_fname.

move 'VMSTA' to so_fname-low.

append so_fname.

move 'VRKME' to so_fname-low.

append so_fname.

move 'MSTAV' to so_fname-low.

append so_fname.

  • MARA fields

move 'MTART' to so_fname-low.

append so_fname.

move 'MATKL' to so_fname-low.

append so_fname.

move 'MEINS' to so_fname-low.

append so_fname.

move 'EAN11' to so_fname-low.

append so_fname.

  • MARC fields

move 'MTVFP' to so_fname-low.

append so_fname.

move 'MSTDV' to so_fname-low.

append so_fname.

move 'PLIFZ' to so_fname-low.

append so_fname.

move 'WERKS' to so_fname-low.

append so_fname.

move 'ZZDEPT' to so_fname-low.

append so_fname.

move 'ZZATP1' to so_fname-low.

append so_fname.

move 'ZZATP2' to so_fname-low.

append so_fname.

move 'ZZATP3' to so_fname-low.

append so_fname.

move 'ZZATP4' to so_fname-low.

append so_fname.

move 'ZZATP5' to so_fname-low.

append so_fname.

move 'ZZATP6' to so_fname-low.

append so_fname.

move 'ZZATP7' to so_fname-low.

append so_fname.

  • MARM fields

move 'UMREN' to so_fname-low.

append so_fname.

move 'UMRES' to so_fname-low.

append so_fname.

endif.

ENDFORM. " set_erpsy_daisy_fields

Text elements :

P_FNAME Field name

R_ALL All Fields

R_ERPS Only ERPsy-Daisy Fields

R_SELECT Field:

S_DATUM Changes from Date

S_MATNR Material

S_TIME Changes from Time

S_USERNM User

Thanks

Seshu

0 Kudos

Also, instead of trying it out this way, the easiest way to do this is to define z_tabkey as a structure with 3 fields instead of just a character variable. Something like this.

data: begin of z_tabkey,

mandt like marc-mandt,

matnr like marc-matnr,

werks like marc-werks.

data: end of z_tabkey.

Now you don't have to worry about the offsets, you can simply move the values into the corresponding fields.

z_tabkey-mandt = sy-mandt.

z_tabkey-matnr = i_selplnt-matnr.

z_tabkey-werks = i_selplnt-werks.

and then pass z_tabkey just like you use it now.