Warning with DECIMAL field
hi ,
I have created an extractor using a Ztable. The extractor is available in RSA6 transaction. When i doubl click on the extractor from RSA6, it takes me to the extractor and when i click on BACK icon from the extrcator, it takes me back to RSA6 screen with a info window " warnings have occured . See Log "...
the log says,
"The even-numbered length of the DEC field ZHOURLY_RT can lead to problems".
how to get rid of this......
regards,
Balaji
Hi Balaji,
The reason for the error will be clear for you when you check the following link
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21f2f2446011d189700000e8322d00/content.htm
And check your table if you put the even number for the decimal field.
With regards
Chandru
Similar Messages
-
Problem with decimal fields using BADI For PD Infotypes
Hi,
I'm implementing BADI HRBAS00INFTY.
For reading the fields of infotype , I'm using the substring
of the field NEW_INNNN-VDATA .
I have a problem with fields of type DEC.
In field NEW_INNNN-VDATA it looks like this : '####'
I believe that the possible reason for this is conversion from DEC to CHAR
But I don't know how to fix it.
Thank you .
Message was edited by: Alon LozinskyHi Alon,
We had same issue. Use following code.
data: hri1011_str type hri1011.
move new_innnn-vdata to hri1011_str.
HRI1011_STR fields will have decimal values.
Let me know if you still have any issues. If solution works, kindly do Point Recognition.
-Bharat -
Create InfoType with decimal field
Hi,
I would like to create an InfoType with some numeric, char and currency type in the structure
Then I run PM01, create the structure
http://img119.imageshack.us/my.php?image=ps9080ze4.jpg
activate it and go back to PM01 but when I click on GENERATE button, il get the following message :
msg type error : The infotype must not include an integer type or floating point no.field
I dont realy understand why this error occurs and why an IT couldn't have integer type in his structure...
Any idea ?
Thanks,
Ant.Instead of INT use DEC or NUMC data types.
To know why INT cannot be used try searching with Hardware Restriction in terms of general computing. -
What I've found so far is that the only way to get the % symbol into a numeric/decimal field at all is to set the "display pattern" to display the % symbol after numbers have been entered into the field.
The reason I want the field to be numeric and not text is because I have to run a FormCalc caculation that populates a third field.
(NumericField1 * Numeric Field2*) + NumericField1Thanks for the reply Niall.
I ended up chanigng the numeric field to a decimal field instead, and added the following display pattern: num{zzzz9.99'%'}
So although the user can't enter a % symbol into the field, a % symbol automaticaly populates when the user enters a number.
My criteria involved ensuring that a user could not enter a number with more than two numbers after the decimal, so I also set a trailing digits max of 2 (in the Obect > Field settings)
This is the FormCalc formula I used in the "calculate" event to calculate the salary increase amount request: (DecimalField1 * NumericField2) *.01 + NumericField2
This formula is meant to calculate the salary amount a manager is requesting their employee's salary be increased to. -
How to avoid zeros in output for a field with Decimal type
Hi Friends
In a Report one output field is declared with decimal type.
Whenver that field is not filled with any values zeros will be displayed in the output.
I tried to change the data type to char but i am facing some issues in calculations and shwoing only 2 decimal places.
So is there any way to hide the zeros in the output if we the field is not filled with any value.Hi Sandeep,
If required field type is declared as type p decimals 2 , if for that field in internal table there is no value - then automatically output will get display in ALV as 0.00.
To remove 0.00 in the output screen and to be displayed in blank then in the field catalogue add wa_fieldcat-no_zero = 'X'. in that particular field. then if no value for that field then it will display space in the output.
wa_fieldcat-fieldname = 'ZQUAN'.
wa_fieldcat-seltext_l = 'Quantity'.
wa_fieldcat-outputlen = '13'.
wa_fieldcat-no_out = ' '.
wa_fieldcat-no_zero = 'X'. wa_fieldcat-hotspot = ' '.
wa_fieldcat-key = ' '.
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-qfieldname = ' '.
wa_fieldcat-ref_tabname = ' '.
wa_fieldcat-just = ' '.
Regards,
Priya -
Pleas help with rounding decimal field
I have a totals field that is summing several fields. I wish to have this totals field provide a rounded sum. I've tried setting the trailing digits to 0 but it will not round up, only round down. I have a display pattern for the field of num{($z,zzz,zz9.99)} . Example 162.59 is displaying 162.00 in total field instead of 163.00. Is there something I'm missing or am I missunderstanding how a decimal field works?
code in "calculate" event:
var test=xfa.form.topmostSubform.personnel_page.person_1.salary_cost1.rawValue+
xfa.form.topmostSubform.personnel_page.person_2.salary_cost2.rawValue+
xfa.form.topmostSubform.personnel_page.person_3.salary_cost3.rawValue+
xfa.form.topmostSubform.personnel_page.person_4.salary_cost4.rawValue+
xfa.form.topmostSubform.personnel_page.person_5.salary_cost5.rawValue+
xfa.form.topmostSubform.personnel_page.person_6.salary_cost6.rawValue+
xfa.form.topmostSubform.personnel_page.person_7.salary_cost7.rawValue+
xfa.form.topmostSubform.personnel_page.person_8.salary_cost8.rawValue+
xfa.form.topmostSubform.personnel_page.person_9.salary_cost9.rawValue+
xfa.form.topmostSubform.personnel_page.person_10.salary_cost10.rawValue;
//this rounds the value upon exit of field
var result = MATH.round(test.value);
this.value = result;In FormCalc you have a function which do just what you are looking for..
Ceil(162.59)
Put it in a messageBox and see the output..
form1.#subform[0].Button1::click - (FormCalc, client)
$host.messageBox(Ceil(162.59));
OR
You can use the Ceil function of the MATH object in Java Script.
form1.#subform[0].Button1::click - (JavaScript, client)
xfa.host.messageBox("" + Math.ceil(162.59));
Thanks
Srini -
Download file with fields with decimal values.
Hi,
I need to download infotype records to a file.
I need a comma deleimited file.
I have got all the details from Infotype to my internal table 'IT_OUTPUT_OPR'
my code is as follows:
LOOP AT IT_OUTPUT_OPR.
CLEAR IT_FILE_OPR.
NUM = 0.
DO.
Get name of next structure field into <f>
ASSIGN COMPONENT SY-INDEX OF STRUCTURE IT_OUTPUT_OPR TO <F>.
IF SY-SUBRC <> 0. EXIT. ENDIF. " No more fields in structure
LEN = STRLEN( <F> ).
IT_FILE_OPR+NUM = <F>. " Write field to output table
NUM = NUM + LEN.
WRITE: ',' TO IT_FILE_OPR+NUM(DELIMIT_LEN).
NUM = NUM + DELIMIT_LEN.
ENDDO.
APPEND IT_FILE_OPR.
ENDLOOP.
my internal table contains 'decimal' fields too.
so I am getting the following runtim error: 'OBJECTS_NOT_CHARLIKE'
at the position:
LEN = STRLEN( <F> ).
Please could anyone tell me how could this issue be resolved?
any pointers in this regard would be helpful.
Thanks,
SaherTry something like following
LOOP AT IT_OUTPUT_OPR.
CLEAR IT_FILE_OPR.
NUM = 0.
DO.
* Get name of next structure field into <f>
ASSIGN COMPONENT SY-INDEX OF STRUCTURE IT_OUTPUT_OPR TO <F>.
IF SY-SUBRC <> 0. EXIT. ENDIF. " No more fields in structure
* LEN = STRLEN( <F> ). "DELETE
DESCRIBE FIELD <F> OUTPUT-LENGTH LEN. "INSERT
IT_FILE_OPR+NUM = <F>. " Write field to output table
NUM = NUM + LEN.
WRITE: ',' TO IT_FILE_OPR+NUM(DELIMIT_LEN).
NUM = NUM + DELIMIT_LEN.
ENDDO.
APPEND IT_FILE_OPR.
ENDLOOP. -
XML Publisher report ends in Warning with java.lang.OutOfMemoryError
Hi,
We are modifying the standard report Account Analysis Report (in Subledger Accounting) to create a custom report.
When run wide open, it is ending in Warning with the error java.lang.OutOfMemoryError in OPP Log.
We are on EBS 12.1.3. DB 11.2.0.3 and XML Publisher 5.6.3
We have set the below parameters in the data definition:
Use XML Publishers XSLT processor: True
Enable Scalable feature of XSLT processor: True
Enable XSLT Runtime optimization: True
Also we have added these to the Data template:
<property name="db_fetch_size" value="20" />
<property name="scalable_mode" value="on" />
On the concurrent program, we have this option set:
-ms1024m -mx2048m
Still, the program is ending in Warning and not producing output. Any pointers here?
We can also see that the Temporary Directory is not able to be set on the data definition. Why is this?
After setting the Temporary Directory from Administration page, we were able to set the temporary directory for this data definition, but that did not solve the iseue.Glad you have sorted this - note that the fnd_concurrent_requests table has the fields pp_Start_date and pp_end_date which will show how long post processing is taking.
Good to a good idea to monitor this in relation to the setting you have made in the profile option Concurrent:OPP Timeout profile option though 3 hours should cover most things!!!! -
Data flow fails on packed decimal field moving iSeries DB2 data from one iSeries DB to another
I' trying to use SSIS to move table content from one iSeries DB2 database to another. I'm using the .Net providers for OleDb\IBM DB2 for i5/OS IBMDA400 OLE DB Provider in the connection managers for the source and destination and the test connection
works fine. When I try to run the data flow task however it fails on the first packed decimal field it encounters with the exceptions ...
[select from hydro520 hydroweb2 blpmstr [16]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "component "select from hydro520 hydroweb2 blpmstr" (16)" failed because error code 0x80004002 occurred, and the error
row disposition on "output column "MSPRIB" (55)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
[select from hydro520 hydroweb2 blpmstr [16]] Error: The component "select from hydro520 hydroweb2 blpmstr" (16) was unable to process the data. Pipeline component has returned HRESULT error code 0xC0209029 from a method call.
[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "select from hydro520 hydroweb2 blpmstr" (16) returned error code 0xC02090F5. The component returned a failure code when the pipeline
engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
...in the progress tab. Can someone kindly tell me what I need to do to get the connection manager to work with DB2 packed decimal fields? Or is it a different issue all together? Thanks tonnes for any help, RoscoeHi rpfinn,
From the Data Types mapping rules between SSIS and DB2, we can see that both the NUMERIC and DECIMAL data types in DB2 are mapped to DT_NUMBERIC data type in SSIS. Now that the source data in your DB2 database is NUMERIC data type, changing the DT_NUMBRIC
data type to DT_DECIMAL is invalid. Besides, if we check the data types of the target External column and Output column from the Advanced Editor for ADO NET Source adapter, the data type should be defined as DT_NUMERIC with Precision as 9 and Scale as 2. I
am not clear where you see the DT_NUMBERIC(9,0) e.g. DT_NUMERIC with Precision as 9 and Scale as 0, but it may be the cause of the issue. You need to make sure the DT_NUMERIC data type also has Scale 2 instead of 0.
If you don’t know how to modify the data type, please elaborate the Data Flow Task of the package so that we can make further analysis. Besides, the error messages you posted are incomplete, it will be helpful if you post the complete error message.
Regards,
Mike Yin
If you have any feedback on our support, please click
here
Mike Yin
TechNet Community Support -
Format of a numeric/decimal field
Can we set the format of a decimal field to display zzz.999 without rounding off the value. For example,I have a decimal field with display & Edit pattern set as "zzz.999" and trailing digits limited to 3. If I enter a value 123.456, its ok. But if I put 123.4567 the value is rounded off and displayed as 123.457. Can we limit it somehow to truncate anything extra than 3 trailing digits.
Thanks
ShwetaMaybe not automatically, but you should be able to do this with a little JavaScript in the form.
Mike -
Can I know the precision and scale of a decimal field using ACEDAO?
Using ACEDAO in VC++, I am trying to retrieve the field details of an Access database (.accdb file) table of which one field is of decimal type. I am able to get the details using the functions of
DAO::_FieldPtr field;
as follows:
fieldName = field->GetName().GetBSTR();
nType = field->GetType() // returns DAO::dbDecimal
lSize = field->GetSize(); // returns 16
lAttr = field->GetAttributes(); // returns 0x000002H
nOrdinal = field->GetOrdinalPosition(); // returns 11
bAutoIncrement = ((lAttr & DAO::dbAutoIncrField) > 0);
DAO::PropertiesPtr props;
DAO::PropertyPtr prop;
int k, nProp;
std::wstring propName, propNames;
props = field->GetProperties();
if(props)
nProp = props->GetCount(); // returns 33
for(k = 0; k < nProp; k++)
prop = field->GetProperties()->GetItem((short) k);
if(prop)
propName = prop->GetName().GetBSTR();
propNames += propName;
propNames += L"\n";
// After exiting the loop, propNames contain 33 properties as:
// Value
// Attributes
// CollatingOrder
// Type
// Name
// OrdinalPosition
// Size
// SourceField
// SourceTable
// ValidateOnSet
// DataUpdatable
// ForeignName
// DefaultValue
// ValidationRule
// ValidationText
// Required
// AllowZeroLength
// AppendOnly
// Expression
// FieldSize
// OriginalValue
// VisibleValue
// GUID
// ColumnWidth
// ColumnOrder
// ColumnHidden
// Description
// DecimalPlaces
// DisplayControl
// TextAlign
// AggregateType
// ResultType
// CurrencyLCID
//But does not have any property named "Scale" or "Precision"
I could not find any function for retrieving the value for precision and scale for the decimal field.
Though I am able to retrieve the field value as a decimal number and get the required information from the structure, I think it is not the right way. Because, what will happen if the data for field is not available in the table?
Is there any other method to retrieve the precision and scale of a decimal type field using ACEDAO?
Thanks.I cannot find a method or property in ACEDAO to retrieve the precision and scale of a field. Maybe you could try get the number of a decimal type and use some mathematical methods to get the precision.
I find there are some way to get the precision by ADO or OLEDB.
For ADO way, you could check this thread:
https://social.msdn.microsoft.com/Forums/office/en-US/883087ba-2c25-4571-bd3c-706061466a11/how-can-i-programmatically-access-scale-property-of-a-decimal-data-type-field?forum=accessdev
For OLE DB , you could use IColumnsInfo::GetColumnInfo to get DBCOLUMNINFO::bPrecision.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms722704(v=vs.85).aspx
Also people in C++ may not familiar with access development, the
Access for Developers forum is good place for access develop issue. You could try there.
Hope this helps some.
Shu
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Hi Experts,
I'm having a problem with decimal.
I have a alv data grid that can be edited.Once I press enter the value for the decimal fields are changed.
Example: If i input 5.00 in the field then I press enter it converts it to 0.05
And If I input 2.01 in the field it shows an error Too many decimal places(Maximum 0)
DATA INPUT for my internal table:
DATA: BEGIN OF it_data OCCURS 0,
docno LIKE zit_haul_line-docno,
line LIKE zit_haul_line-line,
eqpno LIKE zit_haul_line-eqpno,
rpt LIKE zit_haul_line-rpt,
notrip LIKE zit_haul_line-notrip,
trc LIKE zit_haul_line-trc,
escfee LIKE zit_haul_line-escfee,
tollfee LIKE zit_haul_line-tollfee,
repr LIKE zit_haul_line-repr,
others LIKE zit_haul_line-others,
tba LIKE zit_haul_line-tba,
dik LIKE zit_haul_line-dik,
locorg LIKE zit_haul_line-locorg,
locdes LIKE zit_haul_line-locdes,
END OF it_data.
DATA: wa_data LIKE it_data.
Here is my code in change ALV Change.
FORM data_changed USING ir_data_changed TYPE REF TO cl_alv_changed_data_protocol.
DATA ls_modi TYPE lvc_s_modi.
DATA: ratepertrip LIKE zit_haul_line-rpt,
nooftrip LIKE zit_haul_line-notrip,
lv_value TYPE lvc_value ,
totalrent LIKE zit_haul_line-trc,
escortfee LIKE zit_haul_line-escfee,
tollfee LIKE zit_haul_line-tollfee,
represent LIKE zit_haul_line-repr,
others LIKE zit_haul_line-others,
lv_value1 TYPE lvc_value,
totalbill LIKE zit_haul_line-tba.
DATA: eqpno LIKE equi-equnr,
gv_equnr LIKE equi-equnr.
* Check each modification:
LOOP AT ir_data_changed->mt_mod_cells INTO ls_modi.
CASE ls_modi-fieldname.
WHEN 'EQPNO'.
CONDENSE ls_modi-value.
SELECT SINGLE equnr
INTO gv_equnr
FROM equi
WHERE equnr EQ ls_modi-value.
IF sy-subrc NE 0.
CALL METHOD ir_data_changed->add_protocol_entry
EXPORTING
i_msgid = '00'
i_msgty = 'E'
i_msgno = '398'
i_msgv1 = 'Equipment Number does not exist:'
i_msgv2 = ls_modi-value
i_msgv3 = ''
i_msgv4 = ''
i_fieldname = ls_modi-fieldname
i_row_id = ls_modi-row_id.
ENDIF.
ENDCASE.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = 'RPT'
IMPORTING e_value = ratepertrip.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = 'NOTRIP'
IMPORTING e_value = nooftrip.
CLEAR totalrent.
ls_modi-fieldname = 'TRC'.
IF ratepertrip = ''.
ratepertrip = 1.
ELSEIF nooftrip = ''.
nooftrip = 1.
ENDIF.
totalrent = ratepertrip * nooftrip.
CALL METHOD ir_data_changed->modify_cell
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = ls_modi-fieldname
i_value = totalrent.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = 'ESCFEE'
IMPORTING e_value = escortfee.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = 'TOLLFEE'
IMPORTING e_value = tollfee.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = 'REPR'
IMPORTING e_value = represent.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = 'OTHERS'
IMPORTING e_value = others.
CLEAR totalbill.
ls_modi-fieldname = 'TBA'.
totalbill = escortfee + tollfee + represent + others.
totalbill = totalrent + totalbill.
CALL METHOD ir_data_changed->modify_cell
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = ls_modi-fieldname
i_value = totalbill.
ENDLOOP.
ENDFORM. "data_changedHi,
Can you check my code. I've tried changing the data types of my internal table and my output is stll same when I press enter.
The output should be 2.00 3.00 5.00 7.00
Also if I enter 12345.00 the output should be 12,345.00.
Thank you so much for the help.
* ALV required data objects.
TYPE-POOLS: sdydo, icon, slis.
DATA: w_title TYPE lvc_title,
w_repid TYPE sy-repid,
w_comm TYPE slis_formname,
w_status TYPE slis_formname,
x_layout TYPE slis_layout_alv,
ls_events TYPE LINE OF slis_t_event,
t_events TYPE slis_t_event,
t_fieldcat TYPE slis_t_fieldcat_alv,
x_sort type LINE OF slis_t_sortinfo_alv,
t_sort TYPE slis_t_sortinfo_alv,
ls_heading TYPE slis_listheader,
t_heading TYPE slis_t_listheader,
ls_fieldcat TYPE slis_fieldcat_alv,
gs_variant LIKE disvariant,
gt_events TYPE slis_t_event,
gs_events TYPE slis_alv_event.
DATA:
wa_layout TYPE slis_layout_alv,
wa_events TYPE slis_alv_event,
wa_sort TYPE slis_sortinfo_alv.
TYPES: BEGIN OF t_header,
line01(555) TYPE c,
line02(555) TYPE c,
END OF t_header.
DATA: is_print TYPE slis_print_alv,
gset TYPE lvc_s_glay,
%runmode TYPE aqlimode.
data: it_sortcat type slis_sortinfo_alv occurs 1.
DATA: gw_header TYPE t_header.
" END OF ALV DATA
"========================================================================================================================
DATA: BEGIN OF it_data OCCURS 0,
docno LIKE zit_haul_line-docno,
line LIKE zit_haul_line-line,
eqpno LIKE zit_haul_line-eqpno,
rpt TYPE p DECIMALS 2, "LIKE zit_haul_line-rpt,
notrip TYPE p DECIMALS 2,
trc TYPE p DECIMALS 2,
escfee TYPE p DECIMALS 2,
tollfee TYPE p DECIMALS 2,
repr TYPE p DECIMALS 2,
others TYPE p DECIMALS 2,
tba TYPE p DECIMALS 2,
dik LIKE zit_haul_line-dik,
locorg LIKE zit_haul_line-locorg,
locdes LIKE zit_haul_line-locdes,
END OF it_data.
DATA: wa_data LIKE it_data.
DATA: it_modified TYPE STANDARD TABLE OF zit_haul_line WITH HEADER LINE.
DATA: wa_modified TYPE STANDARD TABLE OF zit_haul_line WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: r_create RADIOBUTTON GROUP rad1 USER-COMMAND a DEFAULT 'X'.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
PARAMETERS: r_proj RADIOBUTTON GROUP rad2 MODIF ID A.
PARAMETERS: r_cost RADIOBUTTON GROUP rad2 MODIF ID A.
SELECTION-SCREEN END OF BLOCK b2.
PARAMETERS: r_post RADIOBUTTON GROUP rad1.
PARAMETERS: r_rev RADIOBUTTON GROUP rad1.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME.
PARAMETERS: p_docno LIKE mseg-belnr MODIF ID B,
p_post LIKE sy-datum MODIF ID B.
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME.
PARAMETERS: p_trand LIKE sy-datum,
p_cost LIKE csks-kostl,
p_proj TYPE string,
p_wbs TYPE string,
p_nwa TYPE string.
SELECTION-SCREEN END OF BLOCK b4.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF r_create = 'X'.
IF screen-group1 = 'A'.
screen-active = 1.
ENDIF.
ELSE.
IF screen-group1 = 'A'.
screen-active = 0.
ENDIF.
ENDIF.
IF r_post = 'X' OR r_rev = 'X'.
IF screen-group1 = 'B'.
screen-active = 1.
ENDIF.
ELSE.
IF screen-group1 = 'B'.
screen-active = 0.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
START-OF-SELECTION.
PERFORM get_data.
PERFORM display_report.
FORM get_data.
it_data-line = '001'.
APPEND it_data.
it_data-line = '002'.
APPEND it_data.
it_data-line = '003'.
APPEND it_data.
it_data-line = '004'.
APPEND it_data.
it_data-line = '005'.
APPEND it_data.
it_data-line = '006'.
APPEND it_data.
it_data-line = '007'.
APPEND it_data.
it_data-line = '008'.
APPEND it_data.
it_data-line = '009'.
APPEND it_data.
it_data-line = '010'.
APPEND it_data.
ENDFORM.
"ALV DISPLAY ====================================================================================================================================
"& Form PF_WRITE_FIELDCAT
*& Form pf_write_fieldcat
* text
* -->FNAME text
* -->TNAME text
* -->TEXT text
* -->LEN text
FORM pf_write_fieldcat USING fname
tname
text
len
edt.
* key
* sum.
ls_fieldcat-fieldname = fname.
ls_fieldcat-tabname = tname.
ls_fieldcat-seltext_l = text.
ls_fieldcat-outputlen = len.
* ls_fieldcat-key = key.
* ls_fieldcat-do_sum = sum.
ls_fieldcat-edit = edt.
IF len = '0'.
ls_fieldcat-outputlen = '1'.
ls_fieldcat-no_out = 'X'.
ENDIF.
APPEND ls_fieldcat TO t_fieldcat.
CLEAR ls_fieldcat.
* To set ENTER Event!
gs_events-name = 'CALLER_EXIT'.
gs_events-form = 'CALLER_EXIT'.
APPEND gs_events TO gt_events.
* To change the ALV Changed Protocoll
gs_events-name = 'DATA_CHANGED'.
gs_events-form = 'DATA_CHANGED'.
APPEND gs_events TO gt_events.
ENDFORM. " PF_WRITE_FIELDCAT
*& Form display_report
FORM display_report.
is_print-no_print_selinfos = 'X'.
is_print-no_print_listinfos = 'X'.
is_print-print_ctrl = 'X'.
PERFORM pf_write_fieldcat USING:
* 'DOCNO' 'IT_DATA' 'Line' ' ' '',
'LINE' 'IT_DATA' 'Line' ' ' '',
'EQPNO' 'IT_DATA' 'Equipment No.' ' ' 'X',
'RPT' 'IT_DATA' 'Rate per Trip' ' ' 'X',
'NOTRIP' 'IT_DATA' 'No of Trip' ' ' 'X',
'TRC' 'IT_DATA' 'Total Rental Charges' ' ' '',
'ESCFEE' 'IT_DATA' 'Escort Fee' ' ' 'X',
'TOLLFEE' 'IT_DATA' 'Toll Fee' ' ' 'X',
'REPR' 'IT_DATA' 'Representation' ' ' 'X',
'OTHERS' 'IT_DATA' 'Others' ' ' 'X',
'TBA' 'IT_DATA' 'Total Billable Amount' ' ' '',
'DIK' 'IT_DATA' 'Distance in KM' ' ' 'X',
'LOCORG' 'IT_DATA' 'Location Origin' ' ' 'X',
'LOCDES' 'IT_DATA' 'Location Destination' ' ' 'X'.
* Layout
x_layout-zebra = 'X'.
x_layout-no_keyfix = ' '.
x_layout-colwidth_optimize = 'X'.
* GUI Status
w_status = 'SET_PF_STATUS'.
w_repid = sy-repid.
* User commands
w_comm = 'USER_COMMAND'.
* gs_variant-variant = p_var1.
* gs_variant-handle = space.
* gs_variant-report = sy-repid.
gs_variant-report = sy-repid.
gs_variant-username = sy-uname.
gset-no_colwopt = 'X'.
* Displays the ALV grid
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = t_fieldcat
is_layout = x_layout
"it_sort = t_sort
it_sort = it_sortcat
* i_callback_pf_status_set = w_status
"i_callback_user_command = w_comm
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
* i_callback_html_top_of_page = 'TOP_OF_PAGE'
i_callback_top_of_page = 'TOP-OF-PAGE'
* i_callback_html_end_of_list = 'END-OF-PAGE'
is_variant = gs_variant
i_save = 'A'
is_print = is_print
it_events = gt_events
* i_grid_title = w_title
TABLES
t_outtab = IT_DATA
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. " display_report
FORM data_changed USING ir_data_changed TYPE REF TO cl_alv_changed_data_protocol.
DATA ls_modi TYPE lvc_s_modi.
DATA: ratepertrip LIKE zit_haul_line-rpt,
nooftrip LIKE zit_haul_line-notrip,
lv_value TYPE lvc_value ,
totalrent LIKE zit_haul_line-trc,
escortfee LIKE zit_haul_line-escfee,
tollfee LIKE zit_haul_line-tollfee,
represent LIKE zit_haul_line-repr,
others LIKE zit_haul_line-others,
lv_value1 TYPE lvc_value,
totalbill LIKE zit_haul_line-tba.
DATA: eqpno LIKE equi-equnr,
gv_equnr LIKE equi-equnr.
* Check each modification:
LOOP AT ir_data_changed->mt_mod_cells INTO ls_modi.
CASE ls_modi-fieldname.
WHEN 'EQPNO'.
CONDENSE ls_modi-value.
SELECT SINGLE equnr
INTO gv_equnr
FROM equi
WHERE equnr EQ ls_modi-value.
IF sy-subrc NE 0.
CALL METHOD ir_data_changed->add_protocol_entry
EXPORTING
i_msgid = '00'
i_msgty = 'E'
i_msgno = '398'
i_msgv1 = 'Equipment Number does not exist:'
i_msgv2 = ls_modi-value
i_msgv3 = ''
i_msgv4 = ''
i_fieldname = ls_modi-fieldname
i_row_id = ls_modi-row_id.
ENDIF.
ENDCASE.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = 'RPT'
IMPORTING e_value = ratepertrip.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = 'NOTRIP'
IMPORTING e_value = nooftrip.
CLEAR totalrent.
ls_modi-fieldname = 'TRC'.
IF ratepertrip = ''.
ratepertrip = 1.
ELSEIF nooftrip = ''.
nooftrip = 1.
ENDIF.
totalrent = ratepertrip * nooftrip.
CALL METHOD ir_data_changed->modify_cell
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = ls_modi-fieldname
i_value = totalrent.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = 'ESCFEE'
IMPORTING e_value = escortfee.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = 'TOLLFEE'
IMPORTING e_value = tollfee.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = 'REPR'
IMPORTING e_value = represent.
CALL METHOD ir_data_changed->get_cell_value
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = 'OTHERS'
IMPORTING e_value = others.
CLEAR totalbill.
ls_modi-fieldname = 'TBA'.
totalbill = escortfee + tollfee + represent + others.
totalbill = totalrent + totalbill.
CALL METHOD ir_data_changed->modify_cell
EXPORTING i_row_id = ls_modi-row_id
i_fieldname = ls_modi-fieldname
i_value = totalbill.
ENDLOOP.
ENDFORM. "data_changed
FORM caller_exit USING is_data TYPE slis_data_caller_exit.
* Switch to OO_ALV:
DATA: lr_alv TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lr_alv.
* Register ENTER as edit event:
CALL METHOD lr_alv->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
* pls. use MC_EVT_MODIFIED if leaving the cell should trigger the edit event!
ENDFORM. "CALLER_EXIT
*& Form TOP-OF-PAGE
* text
FORM top-of-page.
*ALV Header declarations
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.
DATA: text TYPE sdydo_text_element,
a_right TYPE REF TO cl_dd_area.
DATA: tran TYPE string,
send TYPE string,
wbs TYPE string,
nwa TYPE string.
text = 'Create Hauling Charges for Project'.
wa_header-typ = 'S'.
wa_header-info = text.
APPEND wa_header TO t_header.
CLEAR: wa_header.
gw_header-line01 = text.
CONCATENATE 'Transaction Date: ' p_trand INTO tran SEPARATED BY space.
text = tran.
wa_header-typ = 'S'.
wa_header-info = text.
APPEND wa_header TO t_header.
CLEAR: wa_header.
gw_header-line01 = text.
CONCATENATE 'Sender Cost Center: ' p_cost INTO send SEPARATED BY space.
text = send.
wa_header-typ = 'S'.
wa_header-info = text.
APPEND wa_header TO t_header.
CLEAR: wa_header.
gw_header-line01 = text.
CONCATENATE 'Receiver WBS: ' p_wbs INTO wbs SEPARATED BY space.
text = wbs.
wa_header-typ = 'S'.
wa_header-info = text.
APPEND wa_header TO t_header.
CLEAR: wa_header.
gw_header-line01 = text.
CONCATENATE 'Receiver Network and NWA: ' p_nwa INTO nwa SEPARATED BY space.
text = nwa.
wa_header-typ = 'S'.
wa_header-info = text.
APPEND wa_header TO t_header.
CLEAR: wa_header.
gw_header-line01 = text.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
ENDFORM. "top-of-page
FORM pf_set_top_page_heading USING typ
key
info.
ls_heading-typ = typ.
ls_heading-key = key.
ls_heading-info = info.
APPEND ls_heading TO t_heading.
ENDFORM. " PF_SET_TOP_PAGE_HEADING
*& Form PF_SET_TOP_PAGE_EVENTS
FORM pf_set_top_page_events USING name
form.
ls_events-name = name.
ls_events-form = form.
APPEND ls_events TO t_events.
CLEAR ls_events.
ENDFORM. " PF_SET_TOP_PAGE_EVENTS
*& Form REUSE_ALV_GET_VARIANT
FORM reuse_alv_get_variant
USING value(iv_repid) TYPE sy-repid
value(iv_handle) TYPE slis_handl
CHANGING iv_variant TYPE disvariant-variant.
DATA: lv_exit(1) TYPE c,
ls_variant TYPE disvariant. " Structure for Variant
MOVE: iv_variant TO ls_variant-variant,
iv_handle TO ls_variant-handle,
iv_repid TO ls_variant-report.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = ls_variant
i_save = 'A'
IMPORTING
e_exit = lv_exit
es_variant = ls_variant
EXCEPTIONS
not_found = 1
program_error = 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.
IF lv_exit = space.
MOVE ls_variant-variant TO iv_variant.
ENDIF.
ENDFORM. " REUSE_ALV_GET_VARIANT "
FORM user_command USING w_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE w_ucomm.
WHEN '&DATA_SAVE'.
* READ TABLE it_data INTO wa_data." INDEX rs_selfield-tabindex.
DELETE it_data WHERE eqpno IS INITIAL.
LOOP AT it_data INTO wa_data.
CONDENSE wa_data-eqpno.
MOVE-CORRESPONDING wa_data TO wa_modified.
APPEND wa_modified TO it_modified.
ENDLOOP.
MODIFY zit_haul_line FROM TABLE it_modified.
ENDCASE.
ENDFORM. "user_command -
Problem with decimal point in Korea and Japan
Hi all,
I have one problem with decimal points.
I need to change in my out put cuurency values as per japan or korea standards.
Please help me is there any function module for this one.
program using alv grid display.
i use write statement but it is not working. Because
data: L_AMT type glpca-hsl,
G_AMT TYPE CHAR15.
CURR this value is 'JPY'.
WRITE L_AMT CURRENCY CURR TO G_AMT.
here i need to do
L_AMT = G_AMT. "" going to runtime error.
if i taken like
data: L_AMT TYPE CHAR15,
G_AMT TYPE CHAR15.
CURR this value is 'JPY'.
WRITE L_AMT CURRENCY CURR TO G_AMT. "" it is not working
Regards
marganiHello,
This is pretty basic, whenever you've currency & quantity fields you need to pass the corres. reference fields.
In your case you need to populate the cfieldname & ctabname fields of the FieldCat.
BR,
Suhas -
Hi,
I'm using ADO (Oracle Provider for OLEDB) to connect Oracle 9. If the type of any field in table is Number(9) and I open query with this field, all negative values are displayed as positive values. For example: If I write -1 value to this field and then post the dataSet (Delphi7 - TADOQuery) value is refreshed to 1. Real value in database is -1.
Could anybody help me with this problem?
Regards Jan.Once again :)
I finally foud out that Deplhi does support (varDecimal), but delphi TCustomADODataSet (ADO recordSet wrapper) component incorrecltly treats such field type. It regards Decimal(<9,0) as integer (TIntegerField) but when it gets value from underlying ADO recordset it expects integer variant. So it's delphi problem. I hat to fix this problem in source code of this component.
Regards Jan. -
Smartforms - dealing with decimal and thousand separators
Hi,
trying to reuse one of the standard SAP Smartforms - LB_BIL_INVOICE in an ECC 6.0 Unicode system I faced a problem with decimal and thousand separators for currency/quantity fields. In fact, default settings in User profile are not taken in consideration when printing this form. I have changed all the possible settings in the user profife and (after logoff/logon) nothing changes in my output.
Just to be sure I tried to output the invoice with the original SAP smartform LB_BIL_INVOICE and the things were the same - means output takes wrong settings for decimal/thousand separators.
For clarity I created a simple form with a single currency field and everything behaves well as expected. So this points me to the direction fo find out what is wrong with the LB_BIL_INVOICE. I downloaded the form into XML and checked the code, further uploaded it into a new one - no success.
My question is:
Is there a way to manipulate or overwrite default settings for decimal/thousand separators within smartform, and if yes - how to do this?
I almost finished my quite complex form and wouldn't like to rewrite it from scratch.
FYI: I'm not a Smartform expert, by have created/overwiten more than 15 different forms accros different systems - 4.6 C/D, 4.7, ECC 6.0 non-Unicode/Unicode, and never faced such an issue.
I faced significant smartform 'improvement' in the ECC 6.0 release - especialy for text elements. The new integrated MS word control gives me a lot of throubles. According to this - is there an up-to-date documentation (even link to SAP course is acceptable) according to Smartform development in ECC 6.0?
Thanks in advance.
Regards,
Ivaylo Mutafchiev
Senior SAP Abap ConsultantHi,
I took a quick glance into the print program, and the print program do a set country setting to reciving country. This will give you the separators that are confugured for this country.
But if you change the print program and clear parameter country, the smartform will use the users settings instead.
Regards
Åsa Thenstedt
Maybe you are looking for
-
I am running adobe photoshop cc on windows 8. when i go to use the horizontal text tool my image goes black. any help would be much appreciated. thank you
-
Mid 2010 Macbook Pro to a Samsung Tv. (Mode not supported)
Hi, I have a macbook pro mid 2010, when connected to an external tv, i get the mirroring option, however when i uncheck the mirroring option (cause i need 2 desktops screen instead of one), my external monitor shows " Mode not supported ". I have a s
-
do i need to reformat my external drive if i am planning on using superduper for my bootable backups or does superduper do that for me? thanks
-
Opening c file in xcode from terminal
Hi, I know this can be done, I've done it before but can't remember how or where I found it, searches have led nowhere. How do I open my c file in xcode from terminal? As in, to open in emacs I type emacs (filename)? Cheers
-
The iphone could not be updated. An unknown error (occured 4005)
I have a problem with updating my iPhone 5 to IOS7. Everytime I go to update the iPhone to IOS7, I get this "The iphone could not be updated. An unknown error (occured 4005)" error. It stays stuck at "waiting for iphone" then the 4005 error pops up a