Tuesday, April 15, 2014

Get maximum number of data sets for selection from user-specific configuration

When selecting data from db into internal tables it is often wise to work with an upper limit, like in SE16.

This upper limit can be configured per user: Goto SE16, Settings--> User's Parameters


parameter p_mxsel type tbmaxsel obligatory default '1000'.

initialization.
  select single tbmaxsel 

    from rseumod into p_mxsel 
    where uname sy-uname.

[...]

  select [...]
    up to iv_tbmaxsel rows
    where [...] .

Differenzen von Zeitstempeln in ABAP berechnen - viele SAP-Standard-Funktionen dumpen!

data lv_dd type i" difference of two dates in days
data lv_ds type i" difference of two times in seconds

lv_dd <aoext>-duedate <aoext>-astad.
lv_ds <aoext>-duetime <aoext>-astat.

try.
    lv_duration 86400 * lv_dd + lv_ds.
  catch cx_root.
    lv_duration 2147483647" max for signed 4-byte-integer
endtry.

ABAP 7.40 - VALUE - Value Operator

Calling a Transaction using BDC as an example for ABAP's new VALUE operator 

data(lt_bdc) = value bdcdata_tab(
  ( program = '...' dynpro = '1000' dynbeg = 'X' )
  ( fnam = 'BDC_CURSOR'  fval= 'S_MATNR-LOW' )
  ( fnam = 'S_MATNR-LOW' fval = ls_mat-matnr )
  ( fnam = 'BDC_OKCODE'  fval = '=ONLI' )
).

data(ls_opt) = value ctu_param( dismode = 'E' defsize = 'X' ).

try.
    call transaction '...' with authority-check
      using lt_bdc options from ls_opt.
  catch cx_sy_authorization_error.
    message i002.
endtry. 



Wednesday, April 9, 2014

SAP APO Auftragstypen im liveCache



DEC HEX Konstante Beschreibung
11 0B gc_om_stock_unrestricted Stock disposable without restrictions
12 0C gc_om_stock_blocked Blocked stock
13 0D gc_om_stock_restricted Stock disposable with restrictions
14 0E gc_om_stock_quality_insp Quality inspection
15 0F gc_om_stock_in_transit Stock in transit
16 10 gc_om_stock_transf_loc Stock in transfer between plants ("location to location")
17 11 gc_om_stock_transf_subloc Stock in transfer between storage locations within a plant ("subloc to subloc")
21 15 gc_om_external_procurement External procurement
22 16 gc_om_scheduling_agreement Scheduling agreement
23 17 gc_om_scheduling_agr_calloff Calloff for scheduling agreement
24 18 gc_om_mm_sched_confirmation MM confirmations
25 19 gc_om_sd_sched_agr_calloff Calloff for SD
26 1A gc_om_sd_sched_confirmation SD confirmations
31 1F gc_om_inhouse_production Inhouse production
32 20 gc_om_matrix_production_order Matrix production order
33 21 gc_om_slot_order Order type for slot planning
34 22 gc_om_check_order Check order
35 23 gc_om_safety_stock Safety stock
36 24 gc_om_project_order Project order
37 25 gc_om_maintenance_order Maintenance order (as of APO 4. 1)
41 29 gc_om_transfer_order Transfer order
42 2A gc_om_substitution order Substitution order
43 2B gc_om_bulk_shipment Bulk shipment order (Oil & Gas)
51 33 gc_om_forecast_order Forecast
52 34 gc_om_sales_order_consumption Sales order with consumptio
53 35 gc_om_sales_order_no_cons Sales order without consumption
54 36 gc_om_temp_demand Temporary customer demand used for multi level ATP
61 3D gc_om_transport_order Transport order
71 47 gc_om_spp_forecast SPP forecast order (Spare Parts Planning)
72 48 gc_om_spp_pur_req SPP purchase requisition (as of APO 4. 1
73 49 WFM order (CRM Work Force Management)

SAP ABAP: Determine Timezone for Plant

    DATA:       lt_tzone TYPE STANDARD TABLE OF tznzone WITH DEFAULT KEY,       l_tzone  TYPE tznzone.     " get time zone for plant   ...