Free text standard exception class
Hi!
Before I create a Z class, I tried to find the standard one which is generic and allows free text entry, like:
RAISE EXCEPTION TYPE cx_free_text EXPORTING e_free_text = 'My own error message'.
Has anyone found such a class?
Thanks!
KR,
Igor
Here's a workaround with CX_T100_MSG and a message 398(00) which contains only placehodlers '& & & &'. This works, but it would still be better to have shorter syntax as in my question.
RAISE EXCEPTION TYPE cx_t100_msg
EXPORTING t100_msgid = '00' "message: '& & & &'
t100_msgno = '398'
t100_msgv1 = 'My error message pt1...'
t100_msgv2 = '...continued with pt2'.
Similar Messages
-
How to Maintain Translation of texts of Exception Class
Hi Experts,
I have an exception class ZCX_CHECK . I have maintained a text in the text tab of the exception class
like No components Exists in Package &PACKAGE_NAME&
PACKAGE_NAME is the Attribute . How do I maintain Translation of the TEXT. When I navigate like Goto->Translation , it is saying Empty Object list.
When I maintain text elements and give text-001 in the text tab of the exception class , the ouptu is coming as text-001 in the Report .
How do I amintain translation , or how can I integrate a message class with an exception class .I know where to metion messsage class . But how do I use it inside exception classLet me rephrase this: When entering a text in your Exception class it will be automatically part of the OTR. You can check this by looking this up in SOTR_EDIT.Press the binoculars button (Find), and search on package (development class).
Now via SE63: Translation->ABAP Objects->Short texts
open node OT on pop-up and double click on Subnode.Enter a * on screen for Object name and press F4. Now enter collection (package / development) class. Select the text to be translated.
BTW: Via SOTR_EDIT you can retrieve the logical key (field concept) which is needed for translation. Select the GUID (logical key / concept) from SOTR_EDIT. -
Get the values from Exception class
Hi all ..
In class i have raised one exception
when i catch this exception in my program i m able to get the
error message but i need to get all the parameters that i pass
when i raise the exception ...
i have raised like this
RAISE EXCEPTION TYPE cx_bapi_error
EXPORTING
textid = cx_bapi_error=>cx_bo_error
class_name = 'ZHS_'
log_no = wa_bapi_return-log_no
log_msg_no = wa_bapi_return-log_msg_no
t100_msgid = wa_bapi_return-id
t100_msgno = wa_bapi_return-number
t100_msgv1 = wa_bapi_return-message_v1
t100_msgv2 = wa_bapi_return-message_v2
t100_msgv3 = wa_bapi_return-message_v3
t100_msgv4 = wa_bapi_return-message_v4
STATUS = lt_status
and caught the exception like this in my program
CATCH cx_bapi_error INTO go_error.
gd_text = go_error->get_text( ).
EXIT.
ENDTRY.
in this i m just getting the class name which i have passed in exception
i need all other parameters that i have passed ..
if u have any idea pls let me know ..
Thanks in advance ...Hello Jayakumar
Usually the attributes of standard exception classes are defines as <b>public</b> and <b>read-only</b>. Thus, you should be able to use the following coding:
DATA:
go_error TYPE REF TO cx_bapi_error. " specific exception class !!!
TRY.
RAISE EXCEPTION TYPE cx_bapi_error
EXPORTING
textid = cx_bapi_error=>cx_bo_error
class_name = 'ZHS_'
log_no = wa_bapi_return-log_no
log_msg_no = wa_bapi_return-log_msg_no
t100_msgid = wa_bapi_return-id
t100_msgno = wa_bapi_return-number
t100_msgv1 = wa_bapi_return-message_v1
t100_msgv2 = wa_bapi_return-message_v2
t100_msgv3 = wa_bapi_return-message_v3
t100_msgv4 = wa_bapi_return-message_v4
STATUS = lt_status.
CATCH cx_bapi_error INTO go_error.
gd_text = go_error->get_text( ).
WRITE: go_error->t100_msgid, " perhaps the attributes have different name
go_error->t100_msgno, " check attribute names in SE24
EXIT.
ENDTRY.
Regards
Uwe -
Class Based Exception Handling involves raising exception (RAISE EXCEPTION TYPE), catching it (CATCH within TRY/ENTRY block) and maybe execute GET_TEXT method to get the text for that exception.
Allowing exception texts be stored as part of exception classes, does that mean that SAP is moving away from using SAP Message Class (transaction SE91 messages) and relying now onwards upon storing texts in respective Exception Clases?
My understanding is that SE91 holds not only the texts for exceptions (or hard errors) but also informational and warning messages, and hence if program condition has to display an informational or warning message, there is not need to create an Exception Class for such a condition (and then get the TEXT for that informational message from that Exception Class). Right?
Pls explain. Thanks much.Hi Chetan,
Sap is not moving away from T100-based (SE91) messages at all.
In fact you do not store exceptions texts in exception classes but in the OTR (Online Text Repository) and still in T100. If an exception class implements the interface IF_T100_MESSAGE (as of Release 6.40), you can use the statement
MESSAGE excref TYPE ...
to display the message after
CATCH INTO excref.
It is recommended to use T100-messages for texts send to the user via MESSAGE and OTR-texts for texts not sent to the user but used internally, e.g. for writing into logs.
Regards
Horst -
ABAP OO Exception Class based processing
Hi there,
Note: In going forward with SAP WAS 6.20, one can handle exceptions using exception-class based handling using RAISE EXCEPTION TYPE abc and then CATCHing it in TRY/ ENDTRY block. Standard method like GET_TEXT can be used to get the text of the exception raised.
Question: If I know the EXCEPTION CLASS and Exception ID of my exception class, is it possible to get the exception text directly from the repository without creating the exception class object?
E.g. Exception class is CX_MY_SECRET_ID
and Exception IDs for this class are
ID_NOT_FOUND,
ID_EXPIRED,
ID_IS_FOR_SPECIAL_ACCESS
E.g. last two exception IDs are my warning conditions, and if such conditions are encountered, all I want to do is collect the warning messages. Whereas first exception ID condition (i.e. ID_NOT_FOUND) is an error for me, in which I have pass the exception back to the calling program. E.g. the source code is like this:
PERFORM.......
If ID is not found
RAISE EXCEPTION TYPE ZCX_MY_SECRET_ID
EXPORTING TEXT_ID = 'ID_NOT_FOUND'.
else if ID has expired
...... then do I have to first raise the exception like raised above and CATCH it before I can get its text? or can I get the exception text directly without raising the exception first (as I know i have to retrieve the text of ZCX_MY_SECRET_ID exception class for Exception ID ID_EXPIRED)?
In other words, if a certain condition is warning for my program, can I get the condition for that exception (from exception class based on exception class name and exception ID), or do I have to RAISE it first explicitely and then CATCH it immediately and execute GET_TEXT to get its text?
Thanks very much!Hello Chetan,
in basic the raise exception type xxx creates an exception object and aborts normal execution continuing in the enclosing try block.
The Abap runtime contains some optimizations regarding the try block has an 'into xxx' clause. But as long you use the same exception you cant take benefit from this.
As far I understand your problem you have two different kind of severities. So I would use 2 differnt exception classes (maybe derived from a common parent type, or one from the other).
So both the code which throws the exception and the one which catches it are aware of the different semantic.
Kind Regards
Klaus -
How to use user defined exception class
Hi all
I just need som help with creating a user defined exception class.
Im writing a small/simple text editor.
My exception class looks like this:
public class myExcp extends Throwable
private String message;
public myExcep(String message)
this.message = message;
public void display()
System.out.println(message);
I would like to use it when a user tries to open a exe-file instead of a txt file.
Here is some code from the editor:
if (e.getSource() == open)
saveOld();
if (fc.showOpenDialog(null)== JFileChooser.APPROVE_OPTION)
readFile(fc.getSelectedFile().getAbsolutePath());
saveas.setEnabled(true);
So, should I use exception here or at the readFile method?
readfile:
private void readFile(String fileName)
try
String tmp = fileName.substring(fileName.length() -4, fileName.length());
if (!tmp.equals(".exe"))
FileReader r = new FileReader(fileName);
textarea.read(r, null);
r.close();
currentFile = fileName;
label.setText(currentFile);
changed = false;
catch (IOException e)
JOptionPane.showMessageDialog (this, "Cannot find the file " + fileName);
Where and how do I use my exception class.
Do I need to create an instance? Where?
Should the exception class extend Exception instead?
Thank you in advance /Extend Exception, not Throwable. It's a checked exception that way.
Follow the Sun coding standards and make that exception class name start with a capital letter.
When you extend Exception, override all four ctors.
What's that display method you added? Isn't getMessage() good enough?
You need to create a new instance just before you throw the exception, of course.
Sounds like a terrible design, by the way. Exceptions shouldn't be used like "go to" for app logic. They should signal unrecoverable conditions. You can easily recover from the situation you've described simply by displaying a pop-up that tells the user to open only text-readable file types. I think that's a better solution.
% -
Each exception class in its own file????
Hi, I am still quite new to java, and I don't fully understand exceptions. Could you please tell me if for each exception class you require do you have to have a a seperate file. e.g. I'm creating my own array exceptions classes.
The following is the structure:
** The base array exceptions class
public class arrayException extends Exception {
public arrayException () { super(); }
public arrayException (String s) { super(s); }
** The outofboundsArrayException
public class outofboundsArrayException extends arrayException {
public outofboundsArrayException ()
{ super("Number entered is out of bounds"); }
public outofboundsArrayException (String s)
{ super(s); }
** The fullArrayExceptiom
public class fullArrayException extends arrayException {
public fullArrayException ()
{ super("The array is full"); }
public fullArrayException (String s)
{ super(s); }
So will the three classes above need their own file.
I wanted to also know what the super does. I thought when the exception was raised, the text message in the super method is outputted, but i've tested that and it doesn't output (e.g. the error message "The array is full" doesn't output). The only thing that outputs is what you put in the catch part.
Thank You very Much!Could you please tell me if
for each exception class you require do you have to
have a a seperate file.Yes. Exception classes are like any other public class in Java, in that it must be in its own file with the standard naming conventions.
I wanted to also know what the super does. I thought
when the exception was raised, the text message in
the super method is outputted, but i've tested that
and it doesn't outputsuper([0,]...[n]) calls a constructor in the superclass of your current class matching the signature super([0,]...[n]). In this particular case, the Exception's message property is being set by the parent constructor. If you were to leave out super([0,]...[n]), the default no-arg constructor of the superclass would be invoked, and the message would not be set.
Use the getMessage() method of the Exception class to return the message value in later references to your object. -
Hi,
I have requirement to display Text and Line item in a GRID (in popup window) ie
In the Screen
Free Text :xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Item No Document Description Quantity Amount
10 xxxxxxxxxxxxxxxxxx 10 1000
20 xxxxxxxxxxxxxxxxxx 20 200
30 xxxxxxxxxxxxxxxxxx 30 400
I am looking for how we generate this using Object Oriented
Any example programs
Thanks
aRsHi,
I am sending the sample coding for the ALV GRID REPORT with header text.
REPORT YMS_EXCISE MESSAGE-ID E4 NO STANDARD PAGE HEADING LINE-SIZE 350. .
TABLES : J_1IEXCHDR, " header table
J_1IEXCDTL, " item table
J_1IPART2, " Excise Part II details
LFA1, " vendor master table
J_1IMOVEND, " vendor excise details table
MSEG, " Document Segment: Material
MKPF, " Header: Material Document
DD07T, " domain text table
T001W. " Plant and Branch Details
DATA : BEGIN OF IT_CHDR OCCURS 100,
DOCNO LIKE J_1IEXCHDR-DOCNO,
DOCYR LIKE J_1IEXCHDR-DOCYR,
EXNUM LIKE J_1IEXCHDR-EXNUM,
EXDAT LIKE J_1IEXCHDR-EXDAT,
WERKS LIKE J_1IEXCHDR-WERKS,
EXBED LIKE J_1IEXCHDR-EXBED,
EXCCD LIKE J_1IEXCHDR-EXCCD,
ECS LIKE J_1IEXCHDR-ECS,
END OF IT_CHDR.
DATA : BEGIN OF IT_CDTL OCCURS 100,
DOCYR LIKE J_1IEXCDTL-DOCYR,
DOCNO LIKE J_1IEXCDTL-DOCNO,
EXNUM LIKE J_1IEXCDTL-EXNUM,
EXDAT LIKE J_1IEXCDTL-EXDAT,
LIFNR LIKE J_1IEXCDTL-LIFNR,
MATNR LIKE J_1IEXCDTL-MATNR,
MAKTX LIKE J_1IEXCDTL-MAKTX,
CHAPID LIKE J_1IEXCDTL-CHAPID,
EXBAS LIKE J_1IEXCDTL-EXBAS,
EXBED LIKE J_1IEXCDTL-EXBED,
ECS LIKE J_1IEXCDTL-ECS,
MENGE LIKE J_1IEXCDTL-MENGE,
MEINS LIKE J_1IEXCDTL-MEINS,
RDOC2 LIKE J_1IEXCDTL-RDOC2,
END OF IT_CDTL.
DATA TEXT(10).
DATA : BEGIN OF IT_OUT OCCURS 0,
SERIALNO LIKE J_1IPART2-SERIALNO,
TEXT1 LIKE TEXT,
EXNUM LIKE J_1IEXCDTL-EXNUM,
EXDAT LIKE J_1IEXCDTL-EXDAT,
NAME LIKE LFA1-NAME1,
DDTEXT LIKE DD07T-DDTEXT,
EXCCD LIKE J_1IEXCHDR-EXCCD,
BUDAT LIKE MKPF-BUDAT,
EXBAS LIKE IT_CDTL-EXBAS,
EXBED LIKE IT_CDTL-EXBED,
ECS LIKE IT_CDTL-ECS,
MATNR LIKE IT_CDTL-MATNR,
MAKTX LIKE IT_CDTL-MAKTX,
CHAPID LIKE IT_CDTL-CHAPID,
MENGE LIKE IT_CDTL-MENGE,
MEINS LIKE IT_CDTL-MEINS,
DEL_IND(1),
END OF IT_OUT.
DATA IT_PART2 LIKE J_1IPART2 OCCURS 0 WITH HEADER LINE.
DATA S_NO(4) .
DATA DB_CNT LIKE SY-TABIX.
DATA EBELN_T LIKE MSEG-EBELN .
TYPE-POOLS : SLIS.
DATA : AFIELD TYPE SLIS_FIELDCAT_ALV.
DATA : LIST_HEADER TYPE SLIS_T_LISTHEADER,
FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
LS_FTCAT TYPE LVC_S_FCAT,
SORTCAT TYPE SLIS_T_SORTINFO_ALV,
SORTCAT_LN LIKE LINE OF SORTCAT,
G_REPID LIKE SY-REPID,
G_BACK_GROUND(70), "like bapibds01-objkey,
GS_VARIANT LIKE DISVARIANT,
G_SAVE ,
GT_EVENTS TYPE SLIS_T_EVENT,
ALV_EVENT TYPE SLIS_ALV_EVENT,
EVENTCAT TYPE SLIS_T_EVENT,
EVENTCAT_LN LIKE LINE OF EVENTCAT,
LAYOUT_IN TYPE SLIS_LAYOUT_ALV,
LAYOUT_IN1 TYPE SLIS_LAYOUT_ALV.
CONSTANTS : GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE
'TOP_OF_PAGE',
GC_FORMNAME_USER_COMMAND TYPE SLIS_FORMNAME VALUE
'USER_COMMAND',
GC_FORMNAME_BEFORE_OUTPUT TYPE SLIS_FORMNAME VALUE
'BEFORE_OUTPUT'.
ALV_EVENT TYPE SLIS_ALV_EVENT,
DATA EX_NO LIKE IT_CHDR-EXNUM VALUE 0.
DATA REGTYP_1 LIKE J_1IPART2-REGTYP.
SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME.
PARAMETERS WERKS TYPE J_1IEXCHDR-WERKS.
SELECT-OPTIONS : BUDAT FOR J_1IEXCHDR-EXDAT.
PARAMETERS : R1 RADIOBUTTON GROUP GRP DEFAULT 'X',
R2 RADIOBUTTON GROUP GRP.
SELECTION-SCREEN END OF BLOCK B.
INITIALIZATION.
G_REPID = SY-REPID.
G_SAVE = 'A'.
PERFORM BUILD_EVENT USING GT_EVENTS[].
PERFORM ALV_EVENT_INIT.
AT SELECTION-SCREEN.
REFRESH LIST_HEADER.
PERFORM TOP_OF_PAGE_LIST_HEADER USING LIST_HEADER.
START-OF-SELECTION.
PERFORM ALV_EVENT_INIT.
G_REPID = SY-REPID.
G_BACK_GROUND = ' ' .
IF R1 = 'X'.
CLEAR R2. CLEAR : REGTYP_1.
REGTYP_1 = 'A'.
set titlebar 'BALAJI' with DB_CNT.
ELSEIF R2 = 'X'.
CLEAR R1.CLEAR : REGTYP_1.
REGTYP_1 = 'C'.
set titlebar 'BALAJI1' with DB_CNT.
ENDIF.
SELECT * FROM J_1IPART2
INTO CORRESPONDING FIELDS OF TABLE IT_PART2
WHERE REGTYP = REGTYP_1 AND
TRNTYP = 'GRPO' AND
BUDAT IN BUDAT.
DOCYR = IT_CDTL-DOCYR AND
DOCNO = IT_CDTL-DOCNO.
LOOP AT IT_PART2.
SELECT SINGLE * FROM J_1IEXCHDR
INTO CORRESPONDING FIELDS OF IT_CHDR
WHERE TRNTYP = 'GRPO' AND
DOCYR = IT_PART2-DOCYR AND
DOCNO = IT_PART2-DOCNO AND
WERKS = WERKS AND
exdat IN BUDAT.
ORDER BY EXDAT.
IF SY-SUBRC = 0.
APPEND IT_CHDR.
ELSE.
CONTINUE.
ENDIF.
IF SY-SUBRC <> 0.
MESSAGE E084.
ENDIF.
ENDLOOP.
LOOP AT IT_CHDR.
SELECT * FROM J_1IEXCDTL
INTO CORRESPONDING FIELDS OF IT_CDTL
FOR ALL ENTRIES IN IT_CHDR
WHERE
TRNTYP = 'GRPO' AND
DOCNO = IT_CHDR-DOCNO AND
DOCYR = IT_CHDR-DOCYR AND
EXNUM = IT_CHDR-EXNUM AND
EXDAT = IT_CHDR-EXDAT AND
WERKS = IT_CHDR-WERKS.
IF SY-SUBRC = 0.
APPEND IT_CDTL.
ELSE.
CONTINUE.
ENDIF.
ENDSELECT.
ENDLOOP.
LOOP AT IT_CDTL.
CLEAR TEXT.
DB_CNT = DB_CNT + 1.
READ TABLE IT_CHDR WITH KEY EXNUM = IT_CDTL-EXNUM.
READ TABLE IT_PART2 WITH KEY DOCNO = IT_CDTL-DOCNO .
IT_OUT-SERIALNO = IT_PART2-SERIALNO.
SELECT SINGLE NAME1 FROM LFA1
INTO IT_OUT-NAME
WHERE LIFNR = IT_CDTL-LIFNR.
SELECT SINGLE * FROM LFA1
WHERE LIFNR = IT_CDTL-LIFNR.
IF LFA1-LAND1 EQ 'IN'.
TEXT = 'INVOICE'.
IT_OUT-TEXT1 = TEXT.
ELSE.
TEXT = 'BOE'.
IT_OUT-TEXT1 = TEXT.
ENDIF.
SELECT SINGLE * FROM J_1IMOVEND
WHERE LIFNR = IT_CDTL-LIFNR.
SELECT SINGLE * FROM DD07T
INTO IT_OUT-DDTEXT
WHERE DOMNAME = 'J_1IVTYP' AND
DDLANGUAGE = 'EN' AND
DOMVALUE_L = J_1IMOVEND-J_1IVTYP.
IF DD07T-DDTEXT = 'First Stage Dealer of indigenous excisable goods'
OR
DD07T-DDTEXT = 'Second Stage Dealer of indigenous excisablegoods'.
DD07T-DDTEXT = 'Dealer'.
ENDIF.
IT_OUT-DDTEXT = DD07T-DDTEXT.
ELSEIF DD07T-DDTEXT = 'Second Stage Dealer of indigenous excisable
*goods'.
DD07T-DDTEXT =
CLEAR EBELN_T.
SELECT SINGLE LFBNR FROM MSEG
INTO EBELN_T
WHERE MBLNR = IT_CDTL-RDOC2 .
SELECT SINGLE * FROM MSEG
WHERE BWART = '106' AND
LFBNR = EBELN_T ."and
ebeln = ebeln_t.
IF SY-SUBRC = 0.
IT_OUT-DEL_IND = 'X'.
ELSE.
IT_OUT-DEL_IND = ' '.
ENDIF.
SELECT SINGLE BUDAT FROM MKPF
INTO IT_OUT-BUDAT
WHERE MBLNR = EBELN_T ."MSEG-LFBNR.
IT_OUT-EXNUM = IT_CDTL-EXNUM.
IT_OUT-EXDAT = IT_CDTL-EXDAT.
IT_OUT-EXCCD = IT_CHDR-EXCCD.
IT_OUT-EXBAS = IT_CDTL-EXBAS.
IT_OUT-EXBED = IT_CDTL-EXBED.
IT_OUT-ECS = IT_CDTL-ECS.
IT_OUT-MATNR = IT_CDTL-MATNR.
IT_OUT-MAKTX = IT_CDTL-MAKTX.
IT_OUT-CHAPID = IT_CDTL-CHAPID.
IT_OUT-MENGE = IT_CDTL-MENGE.
IT_OUT-MEINS = IT_CDTL-MEINS.
APPEND IT_OUT.
EX_NO = IT_CDTL-EXNUM.
ENDLOOP.
Title Portion
IF REGTYP_1 = 'A'.
SET TITLEBAR 'BALAJI' WITH DB_CNT.
ELSEIF REGTYP_1 = 'C'.
SET TITLEBAR 'BALAJI1' WITH DB_CNT.
ENDIF.
AFIELD-COL_POS = 1.
AFIELD-FIELDNAME = 'SERIALNO'.
AFIELD-SELTEXT_L = 'INPUTS'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 2.
AFIELD-FIELDNAME = 'TEXT1'.
AFIELD-SELTEXT_L = 'TYPE OF DOC'.
AFIELD-JUST = 'L'.
AFIELD-DECIMALS_OUT = '0'.
AFIELD-NO_ZERO = 'X'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 3.
AFIELD-FIELDNAME = 'EXNUM'.
AFIELD-SELTEXT_L = 'DOC.NO'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 4.
AFIELD-FIELDNAME = 'EXDAT'.
AFIELD-SELTEXT_L = 'DOC.DATE'.
AFIELD-JUST = 'C'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 5.
AFIELD-FIELDNAME = 'NAME'.
AFIELD-SELTEXT_L = 'NAME OF THE SUPPLIER'.
AFIELD-NO_ZERO = 'X'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 6.
AFIELD-FIELDNAME = 'DDTEXT'.
AFIELD-SELTEXT_L = 'TYPE-OF-SUPPLIER'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 7.
AFIELD-FIELDNAME = 'EXCCD'.
AFIELD-SELTEXT_L = 'ECC OF THE SUPPLIER'.
AFIELD-NO_ZERO = 'X'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 8.
AFIELD-FIELDNAME = 'BUDAT'.
AFIELD-SELTEXT_L = 'INPUT RECV DATE'.
AFIELD-JUST = 'C'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 9.
AFIELD-FIELDNAME = 'EXBAS'.
AFIELD-SELTEXT_L = 'ASSESSABLE-VALUE'.
AFIELD-DO_SUM = 'X'.
AFIELD-JUST = 'R'.
AFIELD-DECIMALS_OUT = '2'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 10.
AFIELD-FIELDNAME = 'EXBED'.
AFIELD-SELTEXT_L = 'DET OF CREDIT TAKEN CENVAT'.
AFIELD-JUST = 'R'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 11.
AFIELD-FIELDNAME = 'ECS'.
AFIELD-SELTEXT_L = 'DET OF CREDIT TAKEN E-CESS'.
AFIELD-JUST = 'R'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 12.
AFIELD-FIELDNAME = 'MATNR'.
AFIELD-SELTEXT_L = 'MATERIAL-CODE'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 13.
AFIELD-FIELDNAME = 'MAKTX'.
AFIELD-SELTEXT_L = 'DESCRIPTION'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 14.
AFIELD-FIELDNAME = 'CHAPID'.
AFIELD-SELTEXT_L = 'TARIFF-ID'.
AFIELD-JUST = 'L'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 15.
AFIELD-FIELDNAME = 'MENGE'.
AFIELD-SELTEXT_L = 'QUANTITY'.
AFIELD-JUST = 'R'.
AFIELD-DO_SUM = ' '.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 16.
AFIELD-FIELDNAME = 'MEINS'.
AFIELD-SELTEXT_L = 'UOM'.
AFIELD-JUST = 'C'.
APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 17.
AFIELD-FIELDNAME = 'DEL_IND'.
AFIELD-SELTEXT_L = 'Deleted'.
AFIELD-JUST = 'C'.
APPEND AFIELD TO FIELDCAT.
* LAYOUT FOR ZEBRA CATLOG
LAYOUT_IN-COLWIDTH_OPTIMIZE = 'X'.
LAYOUT_IN-ZEBRA = 'X'.
LAYOUT_IN-GET_SELINFOS = 'X'.
LAYOUT_IN-CONFIRMATION_PROMPT = 'X'.
LAYOUT_IN-DETAIL_POPUP = 'X' .
SORTCAT-decimals = '0'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_SAVE = G_SAVE
IS_VARIANT = GS_VARIANT
IT_FIELDCAT = FIELDCAT
IT_SORT = SORTCAT
IS_LAYOUT = LAYOUT_IN
IT_EVENTS = EVENTCAT
I_BACKGROUND_ID = g_back_ground
TABLES
T_OUTTAB = IT_OUT.
*& Form TOP_OF_PAGE_LIST_HEADER
text
-->LIST_HEADERtext
FORM TOP_OF_PAGE_LIST_HEADER USING LIST_HEADER TYPE SLIS_T_LISTHEADER.
DATA : HLINE TYPE SLIS_LISTHEADER,
TEXT(60) TYPE C.
CLEAR : HLINE,TEXT.
HLINE-TYP = 'H'.
WRITE 'ROOTS INDUSTRIES LTD' TO TEXT.
HLINE-INFO = TEXT.
APPEND HLINE TO LIST_HEADER.
SELECT SINGLE * FROM T001W WHERE WERKS = WERKS.
CLEAR : HLINE,TEXT.
HLINE-TYP = 'H'.
WRITE 'PLANT :' TO TEXT.
WRITE WERKS TO TEXT+8.
HLINE-INFO = TEXT.
APPEND HLINE TO LIST_HEADER.
CLEAR : HLINE,TEXT.
HLINE-TYP = 'H'.
WRITE T001W-NAME1 TO TEXT.
HLINE-INFO = TEXT.
APPEND HLINE TO LIST_HEADER.
CLEAR : HLINE,TEXT.
HLINE-TYP = 'H'.
WRITE T001W-STRAS TO TEXT.
HLINE-INFO = TEXT.
APPEND HLINE TO LIST_HEADER.
CLEAR : HLINE,TEXT.
HLINE-TYP = 'H'.
WRITE T001W-ORT01 TO TEXT.
HLINE-INFO = TEXT.
APPEND HLINE TO LIST_HEADER.
CLEAR : HLINE,TEXT.
HLINE-TYP = 'H'.
WRITE 'DATE :' TO TEXT.
WRITE BUDAT-LOW TO TEXT+7.
IF BUDAT-HIGH NE ''.
WRITE 'TO' TO TEXT+18.
WRITE BUDAT-HIGH TO TEXT+22.
ENDIF.
HLINE-INFO = TEXT.
APPEND HLINE TO LIST_HEADER.
ENDFORM. "TOP_OF_PAGE_LIST_HEADER
*& Form ALV_EVENT_INIT
text
FORM ALV_EVENT_INIT .
CLEAR ALV_EVENT.
ALV_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
ALV_EVENT-FORM = 'ALV_TOP_OF_PAGE'.
APPEND ALV_EVENT TO EVENTCAT.
CLEAR ALV_EVENT.
ALV_EVENT-NAME = SLIS_EV_TOP_OF_LIST.
ALV_EVENT-FORM = 'ALV_TOP_OF_LIST'.
APPEND ALV_EVENT TO EVENTCAT.
CLEAR ALV_EVENT.
ALV_EVENT-NAME = SLIS_EV_END_OF_LIST.
ALV_EVENT-FORM = 'ALV_END_OF_LIST'.
APPEND ALV_EVENT TO GT_EVENTS.
CLEAR ALV_EVENT.
ALV_EVENT-NAME = SLIS_EV_END_OF_PAGE.
ALV_EVENT-FORM = 'ALV_END_OF_PAGE'.
APPEND ALV_EVENT TO GT_EVENTS.
ENDFORM. "ALV_EVENT_INIT
*& Form ALV_TOP_OF_PAGE
text
FORM ALV_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = LIST_HEADER
I_LOGO = 'ENJOYSAP_LOGO'.
ENDFORM. "ALV_TOP_OF_PAGE
*& Form BUILD_EVENT
text
-->P_GT_EVENTS[] text
FORM BUILD_EVENT USING P_EVENTS TYPE SLIS_T_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = P_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2.
READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND INTO
ALV_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_USER_COMMAND TO ALV_EVENT-FORM.
APPEND ALV_EVENT TO P_EVENTS.
ENDIF.
READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV_BEFORE_LINE_OUTPUT INTO
ALV_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_BEFORE_OUTPUT TO ALV_EVENT-FORM.
APPEND ALV_EVENT TO P_EVENTS.
ENDIF.
ENDFORM. " BUILD_EVENT
Thanks,
Shankar -
hi all,
I would like to use adhoc query to extract free text from an infotype record. However, adhoc only has a 'text exists' field (Pxxxx-ITXEX), which only indicates whether text exists or not.
Does anyone know if a custom field needs to be created in adhoc to extract this, and how I can do this?
many thanks,thanks semvladigo, This error has gone now, great!
However, now i'm getting a short dump in adhoc query instead
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_REF_IS_INITIAL', was not
caught in
procedure "HR_ECM_ADD_MESSAGE" "(FUNCTION)", nor was it propagated by a RAISING
clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
You attempted to use a 'NULL' object reference (points to 'nothing')
access a component.
An object reference must point to an object (an instance of a class)
before it can be used to access components.
Either the reference was never set or it was set to 'NULL' using the
CLEAR statement. -
How to download a text file using classes
Hi Guys
I want to download a text file using classes.
Any idea how to do it ?
Thanks
SameerHI sameer,
It is no different from using a Function module.
example:
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = w_fpath
append = SPACE
write_field_separator = 'X'
CHANGING
data_tab = it_download
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24
Regards,
ravi -
Hi All,
I am using set_text_as_r3table of class cl_gui_textedit after creating a container .This is called from another screen.
Now if I am trying to read the text using either GET_SELECTED_TEXT_AS_R3TABLE and GET_SELECTED_TEXT_AS_STREAM, for the first time its reading fine but if I enter text and then press cancel ( I have save and cancel buttons in the screen ) and goes back to first screen and again come to the screen where there is Free text then it still shows the Text even though i use DELETE_TEXT ...Flush...buffer refresh etc etc....I tried clearing container objects as well b4 creating new objects.Still there is no help.
Is there any thing that I am missing ?
Any help is appreciated.
BR,
krishna.Hi Guys...thanks for the interest .I already tried those but with no luck.I also tried Free method but it gives me a dump for someother reason.
Its really strange as if I read that text it shows the internal table is empty.So potentially it is deleting the text but some how the screen is holding that value.
any help is appreciated.
BR,
Krishna. -
Enforcing free text in Transport request
Hello Experts,
I would like to inquire if there is a possible way to restrict or control the Short description of transport request? We have a naming convention but users are not adharing to standard standard name convension. Standard naming convention is a necessity so that we can identify quickly the ones that needs to be transported, or the ones that needs to be deleted during clean up activities. This should be strictly followed by users, instructors, trainees and developers. This naming convention needs to be strictly followed by developers to avoid their asset objects to be deleted in the system.
For example, Our Standard name convension is <string><md><c><9999999>FREETEXT
String = 2 char alpha numberic charactor
MD = Module
C = One charactor
9999999 = Incident or CR number
Then free text
we want to restrict this. so if the end-user named the TR with anything else that does not follow the naming convention we have established, the end-user should encounter an error stating the he/she must change the name of the TR and follow our naming convention before he/she could proceed.
Looking for good solution which can be easily implemented.
regards
KishoreHi,
Double click the request and change. There is a documentation tab. Enter the text there and save.
Pranav -
Urgent clearing data in container for free text
I HAVE A CONTAINER FOR FREE TEXT.
I HAVE A CREATE BUTTON IN MY SCREEN EWHEN I PRESS CREATE IT ASKD FOR ID AND FREE TEXT THEN I SAVE AND IT GETS SAVED IN A ZTALE TABLE.
WHEN AFTER SAVING IT I GO TO INITIAL SCREEN AND PRESS CREATE AGAIN THEN IT ASKS FOR ID AND IN THE CONTAINER I SEE THE FPREVIOUS TEXT.
CAN YOU GUYS LET ME KNOW AS TO WHAT I NEED TO DO.
I TREID CLEARING AND REFRESHING MYTABLE WHICH I HAVE USED IN THE FOLLOWING CODE.
pbo
if editor is initial.
CREATE OBJECT TEXTEDIT_CUSTOM_CONTAINER
EXPORTING
CONTAINER_NAME = 'TEXTEDITOR1'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
IF SY-SUBRC NE 0.
add your handling
ENDIF.
CREATE OBJECT EDITOR
EXPORTING
PARENT = TEXTEDIT_CUSTOM_CONTAINER
WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>FALSE
EXCEPTIONS
OTHERS = 1.
refresh mytable.
call METHOD editor->SET_TOOLBAR_MODE
EXPORTING TOOLBAR_MODE = 0.
*call METHOD editor->SET_ENABLE
*EXPORTING ENABLE = ' '.
CALL METHOD editor->set_readonly_mode
EXPORTING
readonly_mode = 1.
ENDIF.
CLEAR MYTABLE.
FREE MYTABLE.
endif.
IF SY-SUBRC NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = V_REPID "--> program name
TXT2 = SPACE
TXT1 = 'Error in flush'.
ENDIF.
tHANKS
let me know
swathiFor example, this program works really well with saving long text using the SAVE_TEXT function. Here you need to create the object/id in SE75. For this program you enter the id on the right like 999999 and enter the text on the left, execute and the text is saved, now change the id to 999998 and hit enter, notice the text is blank, now enter 999999 again, notice the text for this id has come back, this is because the program uses READ_TEXT to retrieve the text.
report zrich_0001.
data:
dockingleft type ref to cl_gui_docking_container,
text_editor type ref to cl_gui_textedit,
repid type syrepid.
data: begin of header.
include structure thead.
data: end of header.
data: begin of lines occurs 0.
include structure tline.
data: end of lines.
data: textlines type table of tline-tdline,
wa_text type tline-tdline.
data: xthead type thead.
parameters: p_id(10) type c.
at selection-screen.
if p_id is initial.
message e001(00) with 'Enter an ID'.
endif.
at selection-screen output.
repid = sy-repid.
if dockingleft is initial.
create object dockingleft
exporting repid = repid
dynnr = sy-dynnr
side = dockingleft->dock_at_left
extension = 300.
create object text_editor
exporting
parent = dockingleft.
endif.
if p_id <> space.
xthead-tdobject = 'ZPT_DET'.
xthead-tdid = 'Z001'.
xthead-tdname = p_id.
clear lines. refresh lines.
call function 'READ_TEXT'
exporting
id = xthead-tdid
language = sy-langu
name = xthead-tdname
object = xthead-tdobject
tables
lines = lines
exceptions
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
others = 8.
clear textlines.
loop at lines.
wa_text = lines-tdline.
append wa_text to textlines.
endloop.
endif.
call method text_editor->set_text_as_r3table
exporting
table = textlines
exceptions
others = 1.
start-of-selection.
call method text_editor->get_text_as_r3table
importing
table = textlines
exceptions
others = 1.
* Set SAPscript Header
clear header.
header-tdname = p_id . "Name
header-tdobject = 'ZPT_DET'. "Object
header-tdid = 'Z001'. "Id
header-tdspras = sy-langu.
* Move text from container to function module table
clear lines. refresh lines.
loop at textlines into wa_text .
lines-tdline = wa_text.
append lines .
endloop.
call function 'SAVE_TEXT'
exporting
client = sy-mandt
header = header
tables
lines = lines
exceptions
id = 1
language = 2
name = 3
object = 4
others = 5.
Yes, this is implemented using a selection screen, but the same principals apply and this can be easily converted to a dynpro application.
Regards,
Rich Heilman -
RESULTS RECORDING WITH FREE TEXT IN QUALITY MANAGEMENT
Hi,
How can I give free text of 300 chars In results recording? For a process order with batch number & recipe, (in which master inspection characteristics are mentioned which are linked to general characteristics.)
I created characteristics (type CHAR)(which can be used as free text in results recording ) I have created class, assigned chars to class & finally to material. Also assigned MIC to this class chars.
When I do results recording I need to have these characteristics to be display as free text of 30character width. But since I have to give selected set for this general chars.(which is the system requirement) I have given selected set while creation of characteristics.
Due to this I can only select the codes from the selected set. Is there any process in which I can write free text up to 30 cars during results recording in quality module? & those characteristics I want to assign to MIC so that when process order is executed the first operation of quality can be done for RR.
With Regards,
KareenaHi Kareena,
All of first let me make it clear, if you will assign a Class Characteristic to the MIC, then it will become either Qualitative or QNT.
Now toeards your questions solution.
Option:-1
As suggested by Venkatr, make the control indicator "Docu. Req" in the MIC control indicator set, page:-2. for the line item of MIC in the insepction plan.
So, the system will prompt you a message to insert a text as described by Venkat, where you can enter the Long text also (Check the button available in the lower part of that small window)
Option:-2
Create a document type for this purpose, and assign a file, having 300 char. to the MIC, with the help of the "Object Link" function of SAP, avaialble with RR screen also.
Reagrds,
Shyamal -
Intercompany Exchange of NLAG materials or free text items
Hi,
in my company we have set up the intercompany procurement process according to the SAP standard. Means when one company places a PO with another group company (different comp code) a delivery is created against this PO. Now the companies want to start procuring either NLAG materials or free text items which leads to an error message ME124 "Material not subj. to inventory mgmt. in plant" for NLAG or error 06806 "Procurement w/o material from vendor with plant assignment not defined".
Any ideas how to overcome this?
Regards,
StHello Stefan Teckenbr,
Please do the above necessary customization
Go into IMG > Logistics general > material master > Basic Settings > material type > Define Attributes of Material Types
Select your material type and click Quantity/Value update.
Hope this helps.
Thank,
Swamy H P
Maybe you are looking for
-
How can I use escaped-characters in an option
I have the following code that is used to retrieve city-names including parent-child relations from a database and place them in an array: <%@ page contentType="application/x-javascript" %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
-
Problem with "Call Transaction" which calls a view cluster
Hi Colleagues , I have a rare issue with the call transaction , here is the use case for it : 1> I call a transaction(calls a screen X) in a report , 2> I have a button in the screen , which calls another transaction(calls a screen X2) . 3> On the sc
-
How to change the acounts name e.g. in mail?
Me and my wife are having 2 iCloud accounts. One for my wife. Obviously the creditcards name is used for the name of the account. This means my wife is sending mails with her account and my name is shown. How to change this? Thanks!
-
Password protected JDev10g 9052 build 1618
I downloaded the jdev9052.zip file from otn yesterday since I like to keep up to date on my development tools. When I unpacked it today, I was presented with the message that several files were password protected. What's up with that? The files are:
-
How to automate a cmd-K in a shell script
I want my shell script (.sh file) to clear the screen and buffer before it executes the rest of the script. There doesn't appear to be a command to do this, however I know that the command-k keystroke does this. Is there a way to send a command K to