ABAP/4 Code - Last update Monday, November 15, 2010

Description
  ABAP/4 Keywords
  System Fields
275 Edit a table : run SE16N and type in the command box : &sap_edit
274 How to enforce an index on a table when doing a select ?

%_hints ORACLE 'INDEX("VBAP" "VBAP~Z06")' : this will read table VBAP with index Z06

273 How to transport variants ? -> run program RSTRANSP
272

If you need to read a text (READ_TEXT) but you don't know exactly the language, normally you'll have to loop. But with the following

function you can read the text in several languages at one time :
SSFRT_READ_INCLUDE_TEXT

271 Translate a transaction code :
SE63 -> transport object

R3TR  TRAN  <transaction code>
270 Conversion Unit of Measure :
suppose unit of measure in NL = ST
when you logon in FR -> ST=> PC

call function CONVERSION_EXIT_CUNIT_OUTPUT
INPUT = ST
LANGUAGE = FR

-> OUTPUT = PC
269 Search for a data element ?
for example : 4 length & 2 decimals
se16 table DD04L -> field LEN = 4, field DECIMALS = 2 -> complete list of all data elements (you need the field ROLLNAME)
268 Convert language to ISO-language:
CALL FUNCTION 'CONVERSION_EXIT_ISOLA_OUTPUT'
267 Run a program after a transport :

R3TR XPRA program name

266 character ß in a smartform : copy/paste from Word
265 Dynamic columns for Business Workplace (Workflow/Inbox) : SWL1
264 ABAP and Excel Transformations (XML) : transaction XSLT_TOOL
263 Function ALV BLOCK LIST (several layouts)
report BALVBT01
Transaction FBL3N for example of LIST_DISPLAY with groups
262 /nPFAL : HR : ALE distribution of HR Master Data

report :
RHALECPS : display ALE change pointers for HR Master Data
RHALESMD : Evaluate ALE change pointers for HR Master Data
261 Set the status of an IDOC
260 Do a Mass Update : transaction MASS
259 Translate WorkItem description :
Via transaction SE63 : R3TR PDTS 90100124 (= number of task)
Translate WorkItem text :
Logon in the language you want to tranlate, and change the WorkItem text
258 When changing requirements, pricing procedures... with transaction VOFM, always add to your transport request the following entry :
R3TR XPRA RV80HGEN : this regenerates the procedures
257 update IDOC status : RC1_IDOC_SET_STATUS (as from release 6.0)
256 Mass maintenance material master - MM17
255 Reset/Refresh ALV buffer : Run program BALVBUFDEL
254 MS Word as editor for smartforms : I18N
253 view all conditions for output control => transaction NACE
252 translate all messages from a message class

SE63
choose : Transport object

fill in :
R3TR MSAG ZBM0_SD_A640

251 Program to process inbound IDOC's : RBDAPP01
250

Enhancements & user-exits

table MODSAP

Vb. user exit : EXIT_SAPLV50E_004

-> modsap-member = EXIT_SAPLV50E_004 ->name = V50EPROP (= enhancement)

249 Table with developper keys : DEVACCESS
248 Parameter-ID's : Table = TPARA
247 Scan ABAP programs : RPR_ABAP_SOURCE_SCAN
246 Conditions in a Sales Order
SELECT SINGLE knumv INTO l_knumv
FROM vbak
WHERE vbeln = g_docnum.

SELECT kposn kschl stunr zaehk INTO CORRESPONDING FIELDS OF TABLE lit_konv
FROM konv
WHERE knumv = l_knumv.

245 generate ALE interface for BAPI : transaction BDBG
244 inbound processing of IDOCs ready for transfer (status 64) : program RBDAPP01
243

Show icons :


DATA : ICON TYPE CHAR4.

icon = '@0A@'. "icon red light.
icon = '@09@'. "icon yellow light
icon = '@08@'. "icon green light

242 Show for all fields -> fieldgroups -> screens,... : transaction OMSR
241 How to transport sapscripts ? Program : RSTXR3TR
240 Program to find all user exits for a transaction code.
239 IDOC user exits
238 ALV popup to select
237 Work with Classes
236 Defining a BADI (Business Add-In)
235 Work with BADI's :
SE18 = SMOD
SE19 = CMOD
234 Convert an XML message to an internal table
233

How to use push buttons in a subscreen ?
You don't have the OK-code, and it is a user-exit.
Add the program, code to tables T185 and T185V

232 Change Move-in date for a contract ? (SAP-ISU)
Transaction EC51E
231
table : DFKKLOCKS
FI-CA: Bedrijfseconomische blokkeringen 
call function ' FKK_S_LOCK_CREATE_RFC'
-> om locks te zetten op de tabel FKKVKP
230 Get Workitem from the Business Workplace (Workflow)

call function 'RH_INBOX_VIEW_CREATE'
exporting
search_date = sy-datum
inbox_user = sy-uname
tables
wi_head = wi_head
exceptions
no_active_plvar = 1
no_tasks_found = 2
user_not_defined = 3
no_workitem_found = 4
others = 5.

229 Get the root from a Workitem (Workflow)
call function 'SWI_GET_ROOT_WORKITEM'
exporting
wi_id = gs_wi-wi_id
importing
root_item = root_item
exceptions
workitem_does_not_exist = 1
others = 2.
228 Drildown ALV
227 ALV with Hotspots
226 How to Archive customers & vendors ?
SAPF056 & SAPF058
Mark for deletion : XK02 & XK06
Archive via SARA (for vendors object = FI_ACCPAYB)
225 Delete a Workflow Logically
224 How to change the priority of a WorkItem ? (Workflow)
SAP_WAPI_CHANGE_WORKITEM_PRIO
223 If you have a program, how can you find the jobs for it ?
TBTCP veld PROGNAME -> JOBNAME
222 Table for version management : VRSD
221 Start a WorkItem from within ABAP (Workflow)
220 Generate an instance of an object : (Workflow)
219 Set a status to a Switchdocument (Workflow) :
object :
ISUIDESWD
methode :
SETSTATUS
218 Set an activity in a Switchdocument (Workflow) :
object
ISUSWITCHD
method
SETSTATUSACTIVITY
217 Send and Receive an IDOC in the same system
216 User decision in a Workflow
215 Application Logging (via SLG0 and SLG1)
214 Show fields on a screen or not
213 Add an IDOC status (WE47)
212 Read complete IDOC structure :
call function IDOCTYPE_READ
211 Re-start a specific workflow item :
vanaf 4.7
 
Put this in the TOP of the function-group :

include rswwincl.
include lswwaf01.
data: return_code like syst-subrc.

211 Search in an IDOC for segments/fields/values : transaction-code WE09
210 Do a Call Transaction, but continue after the COMMIT
209 Get a filename (input) :

parameters: p_file like rlgrap-filename.
at selection-screen on value-request for p_file.
perform get_file changing p_file.
form get_file changing filename.
call function 'KD_GET_FILENAME_ON_F4'
changing
file_name = filename
exceptions
mask_too_long = 1
others = 2.
endform. " get_file

208 Delete some Workitems out of the Business Place : transaction-code SWWL
207 How to stop a Workflow for a Switchdocument (SAP-ISU) ?
206 Stop a Workflow : Transaction-code : SWW_WI_ADMIN_CANCEL
Read all objects of a container : Function SWW_WI_CONTAINER_READ_OBJECTS
Read all attributes : Function SWW_WI_CONTAINER_READ
Example program...
205 Update an IDOC-status
204 Download ABAP-program code, TABLE-definition
203

Show an IDOC :

PARAMETERS : p_idocnr TYPE edidc-docnum.

RANGES range_credat FOR edidc-credat.

CLEAR range_credat.

REFRESH range_credat.

SUBMIT rseidoc2 WITH docnum = p_idocnr

WITH credat IN range_credat

AND RETURN.

202 Get the value of an attribute of a copied object :
* Get the property of the Requisitioneruser.                            
SWC_CREATE_OBJECT REF_BUS2121 'BUS2121' object-key-REQUIREMENTREQUEST.  
SWC_GET_PROPERTY REF_BUS2121                                            
                       'REQUISITIONERUSER'                              
                        w_requisitioneruser.                            
* it_users is filled with all the users for the org units              
* check if requisitioner is in user table                              
   read table it_users into wa_users                                      
    with key uname = w_requisitioneruser.    
201 Call an external command :
SM69 contains the list (or create new ones)  
call function 'SXPG_CALL_SYSTEM'
exporting
commandname = 'ZBATCHCREATION'
additional_parameters = ls_param
importing
status = ls_execstatus
exitcode = ls_exitcode
tables
exec_protocol = it_btcxpm
exceptions
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
others = 12.
200 Check in an ALV-grid if a field has changed :
cl_gui_alv_grid->check_changed_data
199 Get characteristics of a material :
First select in table INOB with key :

        klart = 'Class type'  (example ZZ1)
         OBTAB = 'MARA'
        OBJEK = material number

then select in table AUSP withkey :
        objek = inob-cuobj
        atinn = number for characteristic name (atnam -> tablle CABN with key atnam = characteristic name)
        klart = 'Class type' (example ZZ1)

field ATWRT from table AUS¨P contains the value.

198 Show own logical system :
data : p_sndprn like edidc-sndprn.

call function 'PARTNER_LOGICAL_SYSTEM_GET'
importing
p_logsys = p_sndprn
exceptions
own_logical_system_not_defined = 1
others = 2.

197 Number Range for WorkItems : SWW_WIID
196

Send a DOS command via ABAP

parameters: p_text(60) type c default 'Coucou SAP' lower case,

data: doscmd(90) value 'h:\data\alex.bat'.
concatenate doscmd p_text into doscmd separated by space.
call function 'GUI_EXEC'
exporting
command = doscmd.

195

If an IDOC has errors, this workflow is started automatically :

object = IDOCAPPL
methode = ERRORPROCESS
Default workflow = WS30000483

194 Check serialnumber via user-exit :
 
EXIT_SAPLIPW1_008
  SAP Component = IQSM0008 voor de CMOD
193 How to send a mail to the general map with submaps (Business Workplace) :

Do not forget to add user WF-BATCH to table TSOUX = add user as a system user for the authorization of the mailboxes !!!
192 Add a 'green light' to a listing :
--> INCLUDE <ICON>.
   move ICON_GREEN_LIGHT to i_print-icon.
   append i_print.
   clear i_print.

i_print --> data: begin of i_print occurs 0,
                   icon(4).
          data: end of i_print.

191 Synchronise buffers : SWU_OBUF
190 Get all fields from a table :
DATA : li_dfies_tab TYPE STANDARD TABLE OF dfies
           WITH HEADER LINE.

  CALL FUNCTION 'DDIF_NAMETAB_GET'
    EXPORTING
      tabname           = 'the tablename'
   TABLES
     dfies_tab         = li_dfies_tab
   EXCEPTIONS
     not_found         = 1
     OTHERS            = 2

189 Sync the buffers in SAP : transactioncode = /$sync
188

Put icon's on screen :

v_icon = '@08\QAnnulering OK@'.
v_icon = '@0A\QAnnulering niet mogelijk@'.

v_icon(132)   type  c.

 

187 Change a workitem in error (Workflow)
186 Number ranges for an object : transactioncode = /nSNRO
185

Read an IDOC :

DOCUMENTNUMBER TYPE       EDIDC-DOCNUM
w_idoccontrol  TYPE       edidc
EDIDD          STRUCTURE  EDIDD

******** LEES DE IDOC ********

  CALL FUNCTION 'IDOC_READ_COMPLETELY'
    EXPORTING
      document_number         = documentnumber
    IMPORTING
      idoc_control            = w_idoccontrol
    TABLES
      int_edidd               = edidd
    EXCEPTIONS
      document_not_exist      = 01
      document_number_invalid = 02
      OTHERS                  = 03

 

184

Search an internal POD (SAP-ISU) :

  SELECT * FROM  euitrans
         WHERE
          ( dateto >= sy-datum AND datefrom <= sy-datum )
          AND    ext_ui    = w_place_id.
  ENDSELECT

 

183

Search an installation for a POD (SAP-ISU) :

  select * from  euiinstln
           where  int_ui    = euitrans-int_ui
           and    ( dateto >= sy-datum and datefrom <= sy-datum ).

182 Send an e-mail via Outlook...
181 Open an application on the PC (Word, Excel,...)
180

Show a directory on the PC :

data: dir type string.
        dir = 'W:\09BE001\13_Project Soclev\03_Ice soclev\'.

call method cl_gui_frontend_services=>execute
  exporting
    application = dir
  exceptions
    cntl_error             = 1
    error_no_gui           = 2
    bad_parameter          = 3
    file_not_found         = 4
    path_not_found         = 5
    file_extension_unknown = 6
    error_execute_failed   = 7
    synchronous_failed     = 8
    not_supported_by_gui   = 9
    others                 = 10

 

179 Status of an equipment (SAP-ISU) :
DATA : w_objnr  TYPE itob-objnr,
      w_equnr  TYPE v_eger-equnr. "equipment number

    CONCATENATE 'IE' w_equnr
         INTO w_objnr.

    CALL FUNCTION 'STATUS_TEXT_EDIT'
      EXPORTING
        objnr            = w_objnr
        flg_user_stat    = 'X'
        spras            = sy-langu
      IMPORTING
        line             = w_sttxt
        user_line        = w_sttxu
      EXCEPTIONS
        object_not_found = 1
        OTHERS           = 2.

-> status in w_sttxt

178 A general form for error handling...
177 Number ranges for IDOC's :
/nSNUM
object = EDIDOC
176 Use SAP Standard Texts : transactioncode SO10
175 IDOC's between 2 SAP systems
1) create RFC-destination type R3
2) use WE14 on existing idoc in system A to send to system B, and use RFC-destination created in 1)
174 Matchcode table for Business Partners :
M_BUPAA
SAP-ISU
173 Play a WAV-file
172 SAP ISU : Business Partner change :

1) CALL FUNCTION 'BAPI_ISUPARTNER_CHANGE'
2) CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
3)
DATA: BUSINESSPARTNER TYPE BUT000-PARTNER.
SWC_GET_ELEMENT CONTAINER 'BusinessPartner' BUSINESSPARTNER.
call function 'ISU_S_PARTNER_DISPLAY'
        exporting
                x_partner     = BUSINESSPARTNER

171 Convert SAPscript spool to PDF file : RSTXPDF4
170
Get the shortdumps (ST22)
 
CALL FUNCTION '/SDF/EWA_GET_ABAP_DUMPS'
169
How to download a listing automatically (with popup for filepath)
 
CALL FUNCTION 'LIST_DOWNLOAD'
      EXPORTING
            list_index = sy-lsind
            method     =      'RTF' -> Rich Text Format
                        'DAT' -> Spreadsheet
                        'NOCO' -> Unconverted
168 View SAP parameters, settings,... -> report RSPARAM
167 Table TKA01 -> controlling area, contains the dummy profit center (for example SAPF181)
166 View table changes -> report RSTBPROT
165 Link between COBK and COEP -> View COVP
164
BDC INSERT, internal data area for screen && too small...

-> See OSS Note 11842
163 The variant name of a program is stored in : sy-slset
162 Change the SAP logon screen :
SAPMSYST 0020
161 Read IDOC's
1) EDI_DOCUMENT_OPEN_FOR_READ
      EXPORTING
            document_number         = w_docnum (w_docnum LIKE edidc-docnum)
 
2) EDI_SEGMENT_GET
      EXPORTING
            document_number         = w_docnum
            segment_name            = c_segnam_e1knvvm ( LIKE edidd-segnam value 'E1KNVVM')
      IMPORTING
            idoc_container          = w_edidd (INCLUDE STRUCTURE edidd)
 
      if OK
            w_e1knvvm = w_edidd-sdata (w_e1knvvm LIKE e1knvvm)
 
3) EDI_DOCUMENT_CLOSE_READ
 
4) EDI_DOCUMENT_TREE_DISPLAY
160

BOM explosion

CS_BOM_EXPL_MAT_V2
      capid = PP01
      datuv = 07.09.2004
      ehndl = 1
      mtnrv = 121641
      mehrs = X
      werks = 0t00
 
returns 2 tables :
 
1) MATCAT
      contains the main material and the 'sub' BOMS
 
2) STB
      contains all the materials from the BOM
 
      -> you can delete all the records where STB-IDNRK = MATCAT-MATNR
 
      -> take field MNGKO for the quantity, and MMEIN for the Unit of Measure
 
      

-> take field OJTXP for the description

report = RCS13001
159 Report RATSTDEL = Delete Data From a Company Code in Asset Accounting
158 STORAGE_PARAMETERS_WRONG_SET
-> SELECT is too big for the internal table
-> already too much data in the system with 'maloc'...
157

Print to your Local Printer :
in SAP set the printer to 'LOCL'.
this sends the output to your default printer...

156 CO tables like GLT0 :
COSP CO Object: Cost Totals - External Postings
COSS CO Object: Cost Totals - Internal Postings
155 RSQL error 23 = output area too small -> check your internal table
154 Wait for a BDC Job
153 Service Entry Sheets : (SES)
ESSR (=Service Entry Sheet Header Data) + ESLL (=Lines of Service Package)
ESKN = Account Assignment in Service Package
Links :
ESKN -> ESLH -> ESKL -> ESLL
152 Tables for Goods Receipt : (GR)
EKBE + EKKO
151 convert to year 4 digits

CONVERSION_EXIT_GJAHR_INPUT
CONVERSION_EXIT_GJAHR_OUTPUT
150 Convert language from 2 digit ISO to 1 digit SAP

CONVERSION_EXIT_ISOLA_INPUT
CONVERSION_EXIT_ISOLA_OUTPUT
149 How to update a record in a table when SE16 is disabled ?
148 V1 update = synchronous update
V2 update = asynchronous update
147 Randomizer :
Number between 0 and 10 :

DATA: number LIKE datatype-integer2.

CALL FUNCTION 'RANDOM_I2'
EXPORTING
rnd_min = 0
rnd_max = 10
IMPORTING
rnd_value = number.
146 TSV_TNEW_PAGE_ALLOC_FAILED

-> too many records in an internal table (or too much data)
145 How to use Sets ?
144
Define an Internal Table :
TYPES : BEGIN OF tt_<type name>,
<fields>.
TYPES : END OF tt_<type name>.

DATA : t_<internal table name> TYPE STANDARD TABLE OF tt_<type name>
INITIAL SIZE 0 WITH HEADER LINE.
143 Get printer information :
Transaction : SPAD
table : TSP03D
142 Program authorizations table : TPGPT
141 How much lines in an internal table ?
DESCRIBE TABLE <internal table> LINES SY-TFILL.
IF SY-TFILL = 0.
give message.
STOP.
ENDIF.
140 Display a table via SM30
DATA: t_dba_sellist LIKE vimsellist OCCURS 0.

CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
EXPORTING
action = 'S'
view_name = 'here the table name'
TABLES
dba_sellist = t_dba_sellist
139 Allowed posting periods
Table T001B.

fields FRYE2/FRPE2 = beginning of allowed fiscal year and fiscal period
fields TOYE2/TOPE2 = end of allowed fiscal year and fiscal period

for G/L accounts use field MKOAR = S
138 In table CATSDB/PRPS the field RPROJ/PSPNR shows on the screen a projectnumber, but
internally it holds a number.

Use routine 'CONVERSION_EXIT_KONPR_OUTPUT' to show the projectnumber...
137 Example of 2D graphics and 3D graphics
136 ALV example with refresh and input field
135 Read field GDATU in table TCURR
use function CONVERSION_EXIT_INVDT_OUTPUT
134

Get the first day of a fiscal year :

1) read table T001 with the company code, and get the field PERIV (fiscal
year variant)

2) CALL FUNCTION 'G_POSTING_DATE_OF_YEAR_GET'
with VARIANT = t001-periv
YEAR = the fiscal year

-> returns ; FROM_DATE = first day of fiscal year

133 Internal dates in table TCURR

CONVERSION_EXIT_INVDT_OUTPUT

vb. 79968869 = 30.11.2003

CONVERSION_EXIT_INVDT_INPUT

vb. 30.11.2003 = 79968869
132 If checked on in the dictionary all changes are logged in table DBTABLOG
131

Create a macro in ABAP


DATA : w_countm TYPE i.

DEFINE fill_string.
w_countm = 0.
do &2 times.
&1+w_countm(1) = &3.
w_countm = w_countm + 1.
enddo.
END-OF-DEFINITION.

-> the variable w_countm must be declared globally

fill_string <string> <number of characters> <fill character>.

130 BAPI example
129 Refresh a report : for example you click on a button, and the same list must be shown sorted...
128 Run Notepad
CONCATENATE 'C:\WINDOWS\NOTEPAD.EXE C:\WINDOWS\DESKTOP\NAIMESH.TXT' INTO
FILE.

CALL FUNCTION 'WS_EXECUTE'
EXPORTING
PROGRAM = FILE
EXCEPTIONS
FRONTEND_ERROR = 1
NO_BATCH = 2
PROG_NOT_FOUND = 3
ILLEGAL_OPTION = 4
OTHERS = 5.
127 ABAP certification questions + answers
126 How to use coding block/field status groups ?
125 View the external path of a logical file name :
ex. Y_0000_SOM_DATA
table PATH
-> PATHEXTERN = \\<V=Y_SERVER>\<SYSID>\<SYSID>\SOM\<FILENAME>

Table FILENAMECI contains the filename in field FILEEXTERN :
SomCNTLlist.txt, the format in field FILEFORMAT : ASC
124 Get a list of fixed values for a domain (the value table).
Read table DD01L with the domain name.
If the field VALEXI has an X -> there is a value table
Read table DD07L with the domain name.
The field DOMVALUE_L holds the value.
123 Get user profiles :
CALL FUNCTION 'SUSR_USER_PROFS_PROFILES_GET'
122 Get partner information (Table VBPA)
121 Search a string in programs
120 CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
signum = '-' or '+'
-> you can add/subtract days, months and years.
119 Total numerics and characters in a string
118 To have all the names of the months in a certain language :
CALL FUNCTION 'MONTH_NAMES_GET'
117 Create a button on the selection screen of a report
116 program : RSABTPGP
table : TPGP (ABAP/4 Authorization Groups)
115 In data dictionary for tables :
flag => Table Maintenance Allowed
If yes -> you can create data via SE16 !!!!
Is not needed to set on, to do 'Table Maintenance Generator'. The table
maintenance is linked via SM30
114 Get the user list (program help-request)
113 Get the user name :
CALL FUNCTION 'SUSR_USER_ADDRESS_READ'
112 READ_TEXT -> read texts
INIT_TEXT before the SAVE_TEXT
111 To be able to allow an '*' as input for a field :
attributes of the field = click on '* entry'
110 Fill all fields of a structure with the same value
109 >From 4.6 you can display an internal table, do a find, download,...

In the debugger :
menu goto -> display data object -> Structure editor
108 If you delete a record in 1 table via SM30 -> check if an entry exists in another table. If yes, you may NOT delete !
107 SELECT SINGLE....

with not all the key fields does NOT work

-> SELECT * FROM ...
UP TO 1 ROWS
WHERE...
106 Table COBK has a field TIMESTMP :
= Time created (Greenwich Meantime)

How to convert ?

RKE_TIMESTAMP_CONVERT_OUTPUT -> show date and time
RKE_TIMESTAMP_CONVERT_INPUT -> give timestmp

You need :
- SY-DAYST
- SY-TZONE
105 Example of a tree program
104 How to scan an ABAP/4 program for statements,...
103 Lock a table
102 Get fieldname of a variable when you select a line.
DATA : w_field(30) TYPE c.

AT LINE-SELECTION.
GET CURSOR FIELD w_field.
101 Examples of SET/GET PARAMETER ID + CALL TRANSACTION xxx AND SKIP FIRST SCREEN
100

Standard SAP program for creating a BDC for characteristics
RCCTBI01
Display and change the data created by that program
RCCTBISC

99 Show the variants of a program in a popup-screen (like the default SAP)
Call function RS_VARIANT_CATALOG
Uses tables VARIS and VARID
98 Fill in an Excel spreadsheet (several sheets !)
97 Insert a button on the selection-screen
96

Read balance of an GL-account
Table GLT0 read with

RLDNR = 00
RRCTY = 0
RVERS = 001
BUKRS = the company code
RYEAR = the year
RACCT = the account (with leading zeros)


in group currency columns KSLxx
in local currency (EUR) columns HSLxx

95 Calculate date conversions : add days, months, last day of month,...
94 Authority check for company code
AUTHORITY-CHECK OBJECT 'F_SKA1_BUK'
ID 'BUKRS' FIELD s_bukrs-low
ID 'ACTVT' FIELD '03'.

-> check to see if you may display the company code

Check table TACTZ for the field ACTVT

03 = display

93 Example program for downloading characteristics in general
92 Run a transaction and skip first screen
91 Get a user parameter
90 Show a grid in a screen
flow logic
89 Function to invert a string of characters (max. 256 length)
88 Get characteristics of a class for batches
87 Show an internal table in a window to make a choise
86 Example of INNER JOIN
85 Put in upper case
Translate <variable> to upper case.
84 Texts types for SD (via IMG - Text determination - text types) of VOTX

Then you get for example billing text = 9902
This is the ID needed for 'READ_TEXT'.

83 Check change pointers after a data upload
82 FI Document ranges -> FBN1 and function RF_GET_DOCUMENT_NUMBER
81 Write system log messages -> SE92 and function RSLG_WRITE_SYSLOG_ENTRY
80 Loop at screen -> Make a parameter output only
79 Check wether a unit of measure can be used for a material ?
78 Change documents for FI
BKPF-TCODE

= FBD1 -> objectclass = BELEGD
= FB01 -> objectclass = BELEG

77 Read change documents
CDHDR and CDPOS

CHANGEDOCUMENT_READ_HEADERS
CHANGEDOCUMENT_READ_POSITIONS

76 How to run in LSMW a Direct Input ?
75 Convert date in user format
74 List of all LSMW Tables
73 Get the correct Unit Of Measurement
Main table = T006
But display on screen and internal UoM (MSEHI) can be different....

-> read table T006 with SPRAS = SY-LANGU and MSEH3 = displayed UoM to find
the internal UoM

72 Call FB03 - Display FI document
suppose t_data contains the data needed, and displayed with HIDE...

AT LINE-SELECTION.
CHECK t_data-belnr NE space.
SET PARAMETER ID 'BLN' FIELD t_data-belnr.
SET PARAMETER ID 'BUK' FIELD t_data-bukrs.
SET PARAMETER ID 'GJR' FIELD t_data-gjahr.

CALL TRANSACTION 'FB03'
AND SKIP FIRST SCREEN.

71 Need to have all letters and numbers in constants ?
include INCLF124
70 How to play solitaire in ABAP ?
69 Send a general message in SAP : message e398(00)

-> contains & & & &

68

Change a select-option to a range (to have all the values of the select-option)

RANGES : r_bukrs for t001-bukrs.


SELECT bukrs
from t001
INTO TABLE t_t001
WHERE bukrs IN s_bukrs.

CLEAR r_bukrs. REFRESH r_bukrs.
LOOP AT t_t001.
MOVE 'IEQ' TO r_bukrs.
MOVE t_t001-bukrs TO r_bukrs-low.
MOVE space TO r_bukrs-high.
APPEND r_bukrs.
CLEAR r_bukrs.
ENDLOOP.

67 Get a list of all the company codes in a select-option
SELECT bukrs FROM t001
INTO TABLE t_t001
WHERE bukrs IN s_send.
IF sy-subrc NE 0.
MESSAGE e306.
ENDIF.

-> t_t001

DATA : BEGIN OF t_t001 OCCURS 20,
bukrs LIKE bkpf-bukrs. "Company code
DATA : END OF t_t001.

66 Reset the password for all users in a client to initpass
DATA: CODE(8) VALUE 'initpass'.
data: retruncode.
TABLES: USR02.
SELECT * FROM USR02.
PERFORM SET_NEW_PASS IN PROGRAM SAPMS01J USING USR02-BNAME CODE CODE
CHANGING RETRUNCODE.
ENDSELECT.
65 Reset the users password history, so he/she can use the same password
TABLES: USR02.
PARAMETERS: USER LIKE USR02-BNAME.
SELECT * FROM USR02 WHERE BNAME = USER. ENDSELECT.
IF SY-SUBRC = 0.
USR02-OCOD1 = USR02-OCOD2 = USR02-OCOD3 =
USR02-OCOD4 = USR02-OCOD5 = USR02-BCODE.
MODIFY USR02.
ELSE.
WRITE: / 'User does not exist'.
ENDIF.
64

How to use MODIFY...TRANSPORTING ?

FORM 0000_init.

DATA: BEGIN OF t_reqtype_werks OCCURS 0,
zzreqtype(4) TYPE c,
END OF t_reqtype_werks.

SELECT werks FROM t001w INTO TABLE t_reqtype_werks.

t_reqtype_werks-zzreqtype+0(1) = 'O'.

MODIFY t_reqtype_werks TRANSPORTING zzreqtype+0(1)
WHERE NOT ( zzreqtype IS INITIAL ).

ENDFORM. " 0000_INIT

63 Read IDOC and download
62 How to call a BAPI with Visual Basic (example in Excel)
61 ALV example with header and line items...
60 Simple ALV example
59 Show all variants for a program
58 Common routines for printing a report
top
57 Read from archive
56 Direct input programs
55 View the ABAP/4 statements ?
Report RSABAPIV
54 How to check/print/... dynamic selections (not the parameters, select-options) ?
53 Copy Favorites to another client/system
52 How to set the first letter of each word in capitals
51 Professional uploading input file
50 Need to write a batch input ???
First have a look at transaction SXDB : Data Transfer Workbench for a standard program
49 Show table dictionary (fields, description, length,...) in HTML format
48 Show all variants for a report : parameters, select-options, description,...
47 How to check if a field is numeric or character ?
46 Function to let the computer wait for n seconds
45 Check if a country is an EMU country ? -> is there an EURO conversion ?
44 How to update an IDOC status ?
43 How to find an FI document for an Billing document ? (or the document flow)
42 Download an ABAP/4 program with all text elements, selections,...
41 To check for any numeric data in a string
If field-name ca '1234567890'
write / 'Field is numeric'.
Endif.
40 Show user selections for a report
39 Up and download a transport request
38 Show help for a field (eg. PF4 on a PARAMETER) ; simple way
37 How to add months to the date
36 How to de-select buttons on a screen ?
35 How to print out page 1 of 8, page 2 of 8,... on a listing
34 How to suppress a parameter/select-option
33 Send a report/listing as an attachment
32 Send a listing to a file in HTML format
31 Read the password for an RFC destination with a CPIC-user !
30 Reset user password history
29 Swith off the editor lock for an ABAP/4 program (eg. when user is on holiday)
28 Send e-mail (very very simple)
27 Create a 3D-graph from data
26 An empty skeleton for ABAP/4 Code
25 Send a message to all on-line users
24 Upload an Excel file into an internal table
23 Read all text-elements, parameters & select-option names + descriptions
22 Start a batch input via a job
21 Send e-mail
20 Create own PF4 for a field/parameter
19 Open/Read file
18 Get logical filename
17 Get user defaults
16 Show help to input file-name (PF4)
15 Show help for field (PF4) -> see also 38
14 Make a download (file)
13

Convert date to user defaults

12 Create a backup file
11 User defaults : point or comma
10 Batch Input skeleton
9

How to create a progressbar

8 Read the date in table TCURR (Julian date)
7 How to round up/down an amount
6

How to get leading zeros

5 How to work with currencies in an ABAP program
4 How to split up a tab-delimited file into fields
3 Start a UNIX command or Shell script
2 Fill a field in a segment that is now not filled
1 Create an IDOC segment + fill the segment via a user-exit