Skip to content

Instantly share code, notes, and snippets.

@hugo-dc
hugo-dc / dataset.abap
Created September 28, 2012 22:55
Write File in a remote server
DATA:
file(1023) VALUE '\\192.168.1.42\folder\'.
CONDENSE file.
CONCATENATE file sy-datum '_' sy-uzeit '.txt' INTO file.
OPEN DATASET file IN TEXT MODE FOR OUTPUT ENCODING DEFAULT.
TRANSFER 'Hello World3' TO file.
@hugo-dc
hugo-dc / file_open_dialog.abap
Created August 11, 2012 00:02
file_open_dialog
DATA:
it_file TYPE filetable,
gd_subrc TYPE i.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
PARAMETERS:
p_file LIKE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK b1.
@hugo-dc
hugo-dc / zupdate_ir.abap
Created June 6, 2012 17:37
Update Invoice Reference (REBZG)
* rffms270 is a standard SAP program.
SUBMIT rffms270 USING SELECTION-SCREEN '1000'
WITH p_rebzt = 'V' " Cl.doc.subsiguiente
WITH p_rebzj = '2012'
WITH p_rebzg = '1800100421' " Invoice reference
* WITH P_REBZZ = ''
WITH p_bukrs = 'CDPT'
WITH p_gjahr = '2012'
WITH p_belnr = '1600100455'
@hugo-dc
hugo-dc / icons.abap
Created June 5, 2012 17:41
SAP ICON Codes
Icon_Length ID
Name Quickinfo
ICON_2 ICON_DUMMY '@00@'." PlaceholderIcon
ICON_2 ICON_CHECKED '@01@'." Checked; OK
ICON_2 ICON_INCOMPLETE '@02@'." Incomplete
ICON_2 ICON_FAILURE '@03@'." Failed
ICON_2 ICON_POSITIVE '@04@'." Positive
ICON_2 ICON_NEGATIVE '@05@'." Negative
ICON_2 ICON_LOCKED '@06@'." Locked
ICON_2 ICON_UNLOCKED '@07@'." Free; unlock
@hugo-dc
hugo-dc / fechas.abap
Created May 30, 2012 23:45
Restar días o meses a una fecha
REPORT zexample.
DATA:
v_fecha1 LIKE sy-datum,
v_fecha2 LIKE sy-datum.
v_fecha1 = sy-datum.
CALL FUNCTION 'CALCULATE_DATE'
EXPORTING
@hugo-dc
hugo-dc / first_line_tc.abap
Created March 29, 2012 20:23
Go to the first line of table control
* in a PAI module
PERFORM compute_scrolling_in_tc USING 'TABLE_CONTROL_NAME'
'P--'.
@hugo-dc
hugo-dc / matchcode.abap
Created March 29, 2012 18:12
Matchcode for Dynpro field
* At dynpro logic, after PAI
PROCESS ON VALUE-REQUEST.
FIELD zconcent_k-folio MODULE matchcode_module.
* wherever you want
MODULE matchcode_module INPUT.
DATA: t_return LIKE ddshretval OCCURS 0 WITH HEADER LINE.
@hugo-dc
hugo-dc / assertions.abap
Created March 21, 2012 02:21
ABAP Unit Test Assertions
class:
cl_aunit_assert
methods:
ASSERT_EQUALS
Validates the equality of two data objects
ASSERT_BOUND
Asserts the validity of the reference of a reference variable
ASSERT_NOT_BOUND
Asserts whether the reference of a reference variable is invalid
@hugo-dc
hugo-dc / unit_test_skel.abap
Created March 21, 2012 01:46
ABAP Unit Test
CLASS class_name DEFINITION FOR TESTING.
"#AU Risk_level Harmless
"#AU Duration Short
PRIVATE SECTION.
METHODS test_something FOR TESTING.
METHODS test_something_else FOR TESTING.
ENDCLASS.
CLASS class_name IMPLEMENTATION.
@hugo-dc
hugo-dc / wp_changer.py
Created February 13, 2012 23:33
Change desktop wallpaper on Windows
import ctypes
ctypes.windll.user32.SystemParametersInfoA(20, 0, "myimage.jpg" , 0)