[{ALLOW view All}] [{ALLOW edit Authenticated}] [{TableOfContents }] ! Links [SAP ABAP Technology|http://help.sap.com/saphelp_nw2004s/helpdata/en/74/f72707c850b6489e32614108e38ecb/frameset.htm] [New ABAP Keyword Documentation for SAP|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3414800%29ID0451757950DB10507301263077410235End?blog=/pub/wlg/1603] [ABAP-Programmierung|http://lingua-eurana.de/abap.htm] [Program Samples|http://www.guidancetech.com/people/holland/sap/abap/] [Load Excel into table|http://www.sapdev.co.uk/file/file_upexcel.htm] ! Run Time Type Services (RTTS) Types according to CL_ABAP_ELEMDESCR |KIND_CLASS|C |KIND_ELEM|E |KIND_INTF|I |KIND_REF|R |KIND_STRUCT|S |KIND_TABLE|T |TRUE|X |TYPEKIND_ANY|~ |TYPEKIND_CHAR|C|CHAR |TYPEKIND_CLASS|* |TYPEKIND_CLIKE|& |TYPEKIND_CSEQUENCE|? |TYPEKIND_DATA|# |TYPEKIND_DATE|D|DATS |TYPEKIND_DECFLOAT|/ |TYPEKIND_DECFLOAT16|a |TYPEKIND_DECFLOAT34|e |TYPEKIND_DREF|l |TYPEKIND_FLOAT|F |TYPEKIND_HEX|X |TYPEKIND_INT|I |TYPEKIND_INT1|b |TYPEKIND_INT2|s |TYPEKIND_INTF|+ |TYPEKIND_IREF|m |TYPEKIND_NUM|N |TYPEKIND_NUMERIC|% |TYPEKIND_OREF|r |TYPEKIND_PACKED|P|CURR,DEC |TYPEKIND_SIMPLE|$ |TYPEKIND_STRING|g |TYPEKIND_STRUCT1|u |TYPEKIND_STRUCT2|v |TYPEKIND_TABLE|h |TYPEKIND_TIME|T |TYPEKIND_W|w |TYPEKIND_XSEQUENCE|! |TYPEKIND_XSTRING|y |TYPEKIND_BREF|j |TYPEPROPKIND_DBMAXLEN|D |TYPEPROPKIND_HASCLIENT|C |UNDEFINED|- ! Character conversion (codepage) See [here|http://wiki.scn.sap.com/wiki/display/Snippets/ABAP+Code+Page+Conversions] and [here|http://wiki.scn.sap.com/wiki/display/ABAP/Character+encoding+conversion] or [Abap-xstring] |fb.SCP_REPLACE_STRANGE_CHARS|Change German special chars (Umlaute) |CL_XMS_PART_UTIL| |CL_ABAP_CONV_IN_CE|Code Page and Endian Conversion (External -> System Format) |CL_ABAP_CONV_OUT_CE|Converts ABAP data objects to an external binary format |CL_ABAP_CONV_X2X_CE|Converts of ABAP data objects between two external binary formats |CL_ABAP_CHAR_UTILITIES|Various attributes and methods for character sets and byte order |CL_NLS_STRUC_CONTAINER|Corrects alignment of structures in containers of type C (or STRING). You need to make this correction if East-Asian characters ("full-width" characters in Chinese, Japanese, and Korean) are to be copied from a non-Unicode to a Unicode system or vice versa. You do not need to make the correction if you use the method CONVERT_STRUC from this class. {{{ DATA: l_xstring_input TYPE xstring, l_string_output TYPE string, l_encoding TYPE abap_encoding, "see table TCP00 l_r_converter TYPE REF TO cl_abap_conv_in_ce. " Convert file data to string TRY. CALL METHOD cl_abap_conv_in_ce=>create EXPORTING input = l_xstring_input encoding = l_encoding replacement = '#' ignore_cerr = abap_false RECEIVING conv = l_r_converter. CALL METHOD l_r_converter->read IMPORTING data = l_string_output. CATCH cx_root. " Conversion error EXIT. ENDTRY. }}} ! General system information {{{ CL_HRCE_MASTERSWITCHES=>IS_CLIENT_PRODUCTIVE( ) = 'X'/' ' }}} !Shortcuts |Ctrl + <| comment out all marked line |Ctrl + Shift + <| uncomment all mrkes lines !Search in Reports |RPINCL10|Standard |RPR_ABAP_SOURCE_SCAN|Scan ABAP Report Sourcen |x.CODE_SCANNER|ABAP Search (=r.AFX_CODE_SCANNER) |RSRSCAN1| |RKCTSEAR| !Append There is a weird shortcut for APPEND.\\ When you record a session, the code is generated like {{{ CLEAR bdctab. bdctab-program = 'SAPMSSY0'. bdctab-dynpro = '120'. bdctab-dynbegin = 'X'. APPEND bdctab. }}} The first CLEAR and the field assignments refer to a __structure__ bdctab. \\ This structure is the header line (deprecated) from itab bdctab. So bdctab is used in different contexts.\\ If an ABAP command needs a structure, the header line "bdctab" is automatically taken. \\ If an ABAP command need an itab, the table "bcdtab" is taken, you can use {{{ APPEND bdctab[] }}} to indicate that the table should be used. \\ APPEND bdctab is a shortcut and should at least be {{{ APPEND bcdtab to bdctab[] }}} But this is outdated also, though still generated from SAP ECC 6.0. \\ See more explanations [here|http://www.sapdb.info/append-abap-keyword-a-day/]. ! Execute OS commands on the server * function module SXPG_COMMAND_EXECUTE in connection with SM49/SM69 * WS_EXECUTE * CL_GUI_FRONTEND_SERVICES=>EXECUTE * TH_POPUP * call 'SYSTEM' id 'COMMAND' ! Remote Execution {{{ SUBMIT {rep|(name)} ... }}} ! Text Manipulation |class CL_ABAP_CHAR_UTILITIES| |concatenate| |strlen|describe field Note: {{{replace all occurrences of ' ' in p_filen with '_' in character mode.}}} will raise an exception REPLACE_INFINITE_LOOP, use the following: {{{replace all occurrences of regex '\s{1}' in p_filen with '_'.}}} (or use TRANSLATE) ! Using XSTRING see [xstring|abap-xstring] ! File Handling * CL_GUI_FRONTEND_SERVICES=>FILE_* * OPEN/GET DATASET * FB EPS_GET* * FB SCMS* ! Date Handling Vormonat: {{{ DATA: ultimo TYPE d. ultimo = sy-datum. ultimo+6(2) = '01'. " = erster Tag dieses Monats ultimo = ultimo - 1. " = letzter Tag dieses Monats }}} Achtung: Funktioniert nicht beim Jahreswechsel, hier muss extra geprüft werden. ! Import Excel to SAP |f.TEXT_CONVERT_XLS_TO_SAP|Fastest |f.ALSM_EXCEL_TO_INTERNAL_TABLE|Standard |f.KCD_EXCEL_OLE_TO_INT_CONVERT|limited to 9999 rows |f.FILE_READ_AND_CONVERT_SAP_DATA|6x slower |Per OLE|CREATE OBJECT H_EXCEL 'Excel.Application' + CALL METHOD OF H_EXCEL 'Workbooks' = H_WRKBK ... ! Dynamic / Generic SQL Native SQL, see reports |ADBC_DEMO |RSDU_EXEC_SQL Open SQL {{{ REPORT z_bi_blogdyn1. PARAMETERS: p_tab TYPE tabname DEFAULT 'T001'. START-OF-SELECTION. DATA: dref TYPE REF TO data, tref TYPE REF TO data, gt_fcat TYPE lvc_t_fcat. FIELD-SYMBOLS: <wa> TYPE ANY, <itab> TYPE STANDARD TABLE. CREATE DATA dref TYPE (p_tab). ASSIGN dref->* TO <wa>. CALL FUNCTION 'LVC_FIELDCATALOG_MERGE' EXPORTING i_structure_name = p_tab CHANGING ct_fieldcat = gt_fcat[] EXCEPTIONS inconsistent_interface = 1 program_error = 2 OTHERS = 3. CALL METHOD cl_alv_table_create=>create_dynamic_table EXPORTING it_fieldcatalog = gt_fcat IMPORTING ep_table = tref EXCEPTIONS generate_subpool_dir_full = 1 OTHERS = 2. ASSIGN tref->* TO <itab>. SELECT * FROM (p_tab) INTO TABLE <itab>. LOOP AT <itab> INTO <wa>. WRITE: / <wa>. ENDLOOP. }}} !Gray out selection parameters {{{ AT SELECTION-SCREEN OUTPUT. LOOP AT SCREEN. IF SCREEN-NAME = 'STEP080'. " name is upper case always SCREEN-input = 0. " grau out MODIFY SCREEN. ENDIF. ENDLOOP. }}} ! Cluster tables [HR Clusters|http://wiki.sdn.sap.com/wiki/display/ERPHCM/HR+Payroll+Clusters] | [Cluster Discussion|http://scn.sap.com/thread/974261] |x.PECLUSTER|HR-Cluster bearbeiten |v.V_T52RELID|Pflegeview für die Beschreibung der Cluster in PCLx |t.T52RELID|HR: Beschreibung der Cluster in den Tabellen PCLx |p.PCAL|Paket PCAL (all cluster stuff) |t.T52B5|Zuordnung von Werten zu Objekten (CLST,PDP,1) |t.HRDCT_D_TABLES|Index Table for Declustering Transparent Tables !ABAP Objects / Class |t.SEOCLASS|Classes |t.SEOCOMPO|Components (Methods) |v.VSEOCLASS|view on class |t.SEOMETAREL|Meta-Beziehung (see RELTYPE: Interface, Vererbung, Erweiterung) |t.TMDIR|Classes and its methods |cl.CL_OO_CLASS|Class Reflection Helper class Loop through table of objects with keyword TABLE_LINE: {{{ DATA: gt_records type standard table of ref to zhrzxx_mig_tabledata, lo_record type ref to zhrzxx_mig_tabledata. LOOP AT gt_records INTO lo_record WHERE table_line->mv_infty = '0001'. [...] ENDLOOP. }}} Tabellen DD0* !ABAP Dictionary |f.DDIF_FIELDINFO_GET |f.DDIF_FIELDLABEL_GET |fm.DDIF_DOMA_GET |fm.RSD_DTEL_GET |CL_ABAP_TYPEDESCR ! Wildcards | |SQL|Selektion Screen |0 to many|%|* |single char|_|+ !Business Application Log (BAL) |SLG0|Anwendungs-Log: Objektpflege (Objekt+Unterobjekt ist nötig, um auf DB zu sichern) |SLG1|Anwendungs-Log: Protokolle anzeigen |SLG2|Anwendungs-Log: Protokolle löschen |SLGN|Anwendungs-Log: Nummernkreispflege |SLGT|Anmelden zentraler Objektkatalog Für die Protokollierung sollten die von SAP vorgesehenen Funktionsbausteine in der Funktionsgruppe SBAL verwendet werden. Die Beispielprogramme „SBAL_DEMO*“ bieten einen guten Einstieg und Überblick. [SAP Application Log – Leitfaden für Anwender|http://help.sap.com/saphelp_nw70ehp2/helpdata/de/3a/c8263712c79958e10000009b38f936/frameset.htm] |r.SBAL_DOCUMENTATION |CL_HRPAY00_MESSAGE_HANDLER |BAL_AMODAL |Anwendungs-Log: INDX-Tabelle für amodale K |BAL_INDX |Anwendungs-Log: INDX-Tabelle |BALC |Anwendungs-Log: Kontext des Prokolls bzw. |BALDAT |Anwendungs-Log: Daten eines Protokolls |BALHANDLE |Anwendungs-Log: Dummy-Tabelle für Sperrobj |BALHDR |Anwendungs-Log: Protokollkopf |BALHDRP |Anwendungs-Log: Protokollparameter |BALM |Anwendungs-Log: Protokollnachrichten |BALMP |Anwendungs-Log: Nachrichtenparameter |BALOBJ |Anwendungs-Log: Objekte |BALOBJT |Anwendungs-Log: Texte zu den Objekten |BALSUB |Anwendungs-Log: Unterobjekte |BALSUBT |Anwendungs-Log: Unterobjekttexte |CIFBALSEL |Anwendungs-Log: CIF-Erweiterung für Protok