08-09-2013 7:21 AM
hi
i want to pass 30000.000 into a idoc_data-sdata+170(14) place
but i am not able to pass decimals after .000 and it is working fine for if the value is 30000.200 with out two zeros of decimal value and it is as
30000.2
I want to pass all the decimals after . with decimal
and one more case is if the value is 30000 with out decimal then also it shud pass 30000.000(3 decimal values).
below is the code where ia m not able to pass.
if message_type = 'DESADV' and e1edl24-hipos is initial.
modify idoc_data index x_lines.
endif.
data : lt_lips type standard table of lips,"internal table
ls_lips type lips." work area
data : lv_var1 type string,
* Data : lv_var1(15) type p DECIMALS 3,
lv_var2(6) type c,
lv_var3(15) TYPE c,
lv_var4(4) type c.
if message_type = 'DESADV'.
lt_lips[] = data-tab_lips[] .
read table idoc_data with key segnam = 'E1EDL20'.
if sy-subrc ne 0.
clear: e1edl20.
else.
e1edl20 = idoc_data-sdata.
endif.
read table lt_lips into ls_lips with key vbeln = e1edl20-vbeln
posnr = e1edl24-posnr.
if sy-subrc = 0.
if e1edl24-hipos is not initial and e1edl24-posnr = ls_lips-posnr.
lv_var1 = lv_var1 + e1edl24-lfimg.
clear idoc_data.
delete idoc_data index x_lines.
loop at idoc_data where segnam = 'E1EDL24'.
lv_var2 = idoc_data-sdata+0(6).
if lv_var2 = e1edl24-hipos.
split e1edl24-lfimg at '.' INTO lv_var3 lv_var4.
idoc_data-sdata+176(14) = idoc_data-sdata+176(14) + lv_var1.
shift idoc_data-sdata+176(14) left DELETING LEADING space.
CONCATENATE '.' lv_var4 into lv_var4.
* if idoc_data-sdata+176(14) cn '.' .
* concatenate idoc_data-sdata+176(14) '.000' INTO idoc_data-sdata+176(14)." SEPARATED BY lv_var4.
* elseif idoc_data-sdata+176(14) ca '0123456789'.
*
* else.
* concatenate idoc_data-sdata+176(14) lv_var4 INTO idoc_data-sdata+176(14)." SEPARATED BY lv_var4.
* endif.
modify idoc_data index sy-tabix.
endif.
endloop.
endif.
endif.
endif.
08-09-2013 8:42 AM
Hi,
why didn't you use WRITE ... USING EDIT MASK ... TO .. ?
regards
Fred
08-12-2013 7:00 AM
no frederic its not working
i found some other solution but if the variable value in a loop of std subroutine then the value is getting cleared
plse suggest
08-12-2013 7:33 AM
Hi Ravikumar,
Pass the decimal value to a character type variable and assign this character type variable to idoc_sdata+176(14).
Sample Coding:
PARAMETERS: p_curr TYPE p DECIMALS 3.
DATA: gv_curr TYPE char18,
gv_sdata TYPE edi_sdata.
START-OF-SELECTION.
gv_curr = p_curr. "Assign the decimal value to a character type variable
gv_sdata = gv_curr. "Assign the character type variable to idoc-sdata
WRITE: / gv_sdata.
Thanks & Regards,
T. Prasanna Kumar
08-12-2013 8:41 AM
Hi,
You are trying to update segment E1EDL24.
Dont use offset postions for this. It is too complex. Instead do the following: -
DATA: ST_E1EDL24 type E1EDL24.
ST_E1EDL24 = IIDOC_DATA-SDATA.
ST_E1EDL24-FIELD = 'blah blah blah'.
IDOC_DATA-SDATA = ST_E1EDL24.
Thanks
Martin
08-12-2013 9:45 AM
why not pass as character and then manipualte it at the receiver side or wherever you run logic.
08-12-2013 10:27 AM
no folks i am not able to use either char or the solution suggested by martin
below is code
split e1edl24-lfimg at '.' INTO lv_var3 lv_var4." the value of e1edl24-lfimg here is 30000.000 and i am splitting at . into var3 n var4
lv_var5 = lv_var5 + lv_var4.
idoc_data-sdata+176(15) = idoc_data-sdata+176(15) + e1edl24-lfimg.
concatenate idoc_data-sdata+176(15) lv_var5 INTO idoc_data-sdata+176(15) SEPARATED BY '.'.
but it is not working out plse help since last 4 days i am stuck up here
08-12-2013 12:03 PM
HI MARTIN,
i have done as suggested by u but still i am not able to pass the data with decimals
below is code
st_e1edl24 = idoc_data-sdata.
st_e1edl24-lfimg = st_e1edl24-lfimg + e1edl24-lfimg.
st_e1edl24-lgmng = st_e1edl24-lgmng + e1edl24-lgmng.
st_e1edl24-ntgew = st_e1edl24-ntgew + e1edl24-ntgew.
st_e1edl24-brgew = st_e1edl24-brgew + e1edl24-brgew.
st_e1edl24-volum = st_e1edl24-volum + e1edl24-volum.
shift st_e1edl24-lfimg left deleting leading space.
shift st_e1edl24-lgmng left deleting leading space.
shift st_e1edl24-ntgew left deleting leading space.
shift st_e1edl24-brgew left deleting leading space.
shift st_e1edl24-volum left deleting leading space.
idoc_data-sdata = st_e1edl24
.
modify idoc_data index sy-tabix
initially before passing the data into st_e1edl24-lfimg is 0.000 with right spaces like this 0.000xxxxxxxxx(where x is space) after passing the value becomes XXXXXXXXXXX0(x spaces)
it is filling from right to left after passing the value.
08-12-2013 12:53 PM
I have worked with Idocs for over 10 years and never "PRATTED" around with offset positions.
08-12-2013 1:19 PM
hi martin
thats fine and whatver u suggested is working but i am not able to pass decimal values plse suggest on same
08-12-2013 1:50 PM
What is in the structure e1edl24 at the time it is added to st_e1edl24.
You have not really explained what you are trying to do.
Thanks
Martin.
08-12-2013 5:42 PM
Prasanna Kumar has the correct solution. Move your currency field to a character field and then move that character field to the field in sdata. I have used this method many times.
Regards,
Steve
08-16-2013 12:52 PM
No folks it did not worked but martin solution helped me to ignore place holders which was very good