28 Aralık 2011 Çarşamba
SAP/ABAP: Colorconstants (for coloring a row and column in ALV)
TYPE-POOL ZCOL .
constants:
zcol_greyblue(04) type c value 'C100',
zcol_lightgrey(04) type c value 'C200',
zcol_yellow(04) type c value 'C300',
zcol_bluegreen(04) type c value 'C400',
zcol_green(04) type c value 'C500',
zcol_red(04) type c value 'C600',
zcol_violett(04) type c value 'C700',
zcol_greyblue_int(04) type c value 'C110',
zcol_lightgrey_int(04) type c value 'C210',
zcol_yellow_int(04) type c value 'C310',
zcol_bluegreen_int(04) type c value 'C410',
zcol_green_int(04) type c value 'C510',
zcol_red_int(04) type c value 'C610',
zcol_violett_int(04) type c value 'C710',
zcol_greyblue_inv(04) type c value 'C101',
zcol_lightgrey_inv(04) type c value 'C201',
zcol_yellow_inv(04) type c value 'C301',
zcol_bluegreen_inv(04) type c value 'C401',
zcol_green_inv(04) type c value 'C501',
zcol_red_inv(04) type c value 'C601',
zcol_violett_inv(04) type c value 'C701',
zcol_greyblue_int_inv(04) type c value 'C111',
zcol_lightgrey_int_inv(04) type c value 'C211',
zcol_yellow_int_inv(04) type c value 'C311',
zcol_bluegreen_int_inv(04) type c value 'C411',
zcol_green_int_inv(04) type c value 'C511',
zcol_red_int_inv(04) type c value 'C611',
zcol_violett_int_inv(04) type c value 'C711'.
18 Aralık 2011 Pazar
SAP/ABAP: Import/Export Memory
FORM u922 USING b_result.
DATA: itab TYPE TABLE OF bseg,
jtab TYPE TABLE OF bseg,
wa TYPE bseg,
ls_itab TYPE bseg.
*Varsa memorydeki kayıtları okuyorum...
IMPORT itab TO jtab FROM MEMORY ID 'MEM_BSEG'.
MOVE bseg TO wa.
IF jtab[] IS INITIAL.
APPEND wa TO itab.
EXPORT itab TO MEMORY ID 'MEM_BSEG'.
ELSE.
FREE MEMORY ID 'MEM_BSEG'.
itab[] = jtab[].
CLEAR: ls_itab.
READ TABLE itab INTO ls_itab
WITH KEY bukrs = wa-bukrs
belnr = wa-belnr
gjahr = wa-gjahr
buzei = wa-buzei.
IF sy-subrc NE 0.
APPEND wa TO itab.
ELSE.
MODIFY itab FROM wa.
ENDIF.
EXPORT itab TO MEMORY ID 'MEM_BSEG'.
ENDIF.
IF sy-ucomm EQ 'BP'.
READ TABLE itab INTO wa
WITH KEY koart = 'K'.
IF sy-subrc NE 0.
MESSAGE ID 'ZSP_FI'
TYPE 'E'
NUMBER '424'
DISPLAY LIKE 'W'
WITH bkpf-bukrs.
ENDIF.
ENDIF.
SAP/ABAP: Perform, Tables, Using, Changing
*&---------------------------------------------------------------------*
*& Report ZSILINECEK2
*&
*&---------------------------------------------------------------------*
REPORT ZSILINECEK2.
DATA: BEGIN OF LT_MARA OCCURS 0.
INCLUDE STRUCTURE: MARA.
DATA: NAME(1).
DATA: END OF LT_MARA.
DATA: LV_I TYPE I.
DATA: LV_OK(1).
CLEAR: LV_OK.
SELECT *
FROM MARA
INTO TABLE LT_MARA
UP TO 10 ROWS.
PERFORM CHANGE_LT_MARA TABLES LT_MARA
USING LV_I
CHANGING LV_OK.
*&---------------------------------------------------------------------*
*& Form CHANGE_LT_MARA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_LT_MARA text
*----------------------------------------------------------------------*
FORM CHANGE_LT_MARA TABLES P_LT_MARA STRUCTURE LT_MARA
USING P_LV_I TYPE ANY
CHANGING P_LV_OK TYPE ANY.
DATA: LS_MARA LIKE LINE OF P_LT_MARA.
LOOP AT P_LT_MARA INTO LS_MARA.
LS_MARA-NAME = P_LV_I = P_LV_I + 1.
MODIFY P_LT_MARA FROM LS_MARA.
ENDLOOP.
P_LV_OK = 'X'.
ENDFORM. " CHANGE_LT_MARA
16 Aralık 2011 Cuma
SAP/ABAP: BAPI_MATERIAL_SAVEDATA FM
*&---------------------------------------------------------------------*
*& Report ZPPP_BAPI_MATERIAL_SAVEDATA
*&---------------------------------------------------------------------*
REPORT ZPPP_BAPI_MATERIAL_SAVEDATA.
TABLES:BAPIMATHEAD,
BAPI_MAKT,
BAPI_MARA,
BAPI_MARAX.
DATA:BEGIN OF ITAB OCCURS 0,
MATERIAL TYPE BAPIMATHEAD-MATERIAL,
IND_SECTOR(20),
MATL_TYPE TYPE BAPIMATHEAD-MATL_TYPE,
MATL_GROUP TYPE BAPI_MARA-MATL_GROUP,
MATL_DESC TYPE BAPI_MAKT-MATL_DESC,
END OF ITAB,
IT_RETURN LIKE BAPIRET2,
IT_BAPI LIKE BAPI_MAKT OCCURS 0 WITH HEADER LINE.
DATA: GT_DATA TYPE TABLE OF ZPPT_SAVE_MATER,
GS_DATA TYPE ZPPT_SAVE_MATER.
DATA: GS_QMAT TYPE QMAT.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM CALL_BAPI.
*&---------------------------------------------------------------------*
*& Form CALL_BAPI
*&---------------------------------------------------------------------*
FORM CALL_BAPI.
IF GT_DATA IS NOT INITIAL.
DATA: BEGIN OF LS_MARA,
MTART TYPE MARA-MTART,
MEINS TYPE MARA-MEINS,
END OF LS_MARA.
DATA: LV_MAKTX TYPE MAKT-MAKTX.
LOOP AT GT_DATA INTO GS_DATA.
SELECT SINGLE MTART MEINS
FROM MARA
INTO LS_MARA
WHERE MATNR EQ GS_DATA-MATNR.
SELECT SINGLE MAKTX
FROM MAKT
INTO LV_MAKTX
WHERE MATNR EQ GS_DATA-MATNR
AND SPRAS EQ 'T'.
BAPIMATHEAD-MATERIAL = GS_DATA-MATNR.
BAPIMATHEAD-QUALITY_VIEW = 'X'.
BAPIMATHEAD-IND_SECTOR = 'M'.
BAPIMATHEAD-MATL_TYPE = LS_MARA-MTART.
BAPIMATHEAD-BASIC_VIEW = 'X'.
" BAPI_MARA-MATL_GROUP = ITAB-MATL_GROUP.
BAPI_MARA-BASE_UOM = LS_MARA-MEINS.
" BAPI_MARAX-MATL_GROUP = 'X'.
BAPI_MARAX-BASE_UOM = 'X'.
IT_BAPI-LANGU_ISO = 'TR'."SY-LANGU. "'T'.
IT_BAPI-MATL_DESC = LV_MAKTX.
APPEND IT_BAPI.
CLEAR IT_BAPI.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
HEADDATA = BAPIMATHEAD
" CLIENTDATA = BAPI_MARA
" CLIENTDATAX = BAPI_MARAX
IMPORTING
RETURN = IT_RETURN
TABLES
MATERIALDESCRIPTION = IT_BAPI.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .
PERFORM QMAT_INSERT.
WRITE:
/ 'TYPE: ', IT_RETURN-TYPE,
/ 'MSG.: ', IT_RETURN-MESSAGE,
/ 'ID : ', IT_RETURN-ID,
/ 'NUMB: ', IT_RETURN-NUMBER.
ULINE.
ENDLOOP.
ENDIF.
ENDFORM. " call_bapi
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
FORM GET_DATA .
SELECT *
FROM ZPPT_SAVE_MATER
INTO TABLE GT_DATA
WHERE ZCHECK NE 'X'.
ENDFORM. " GET_DATA
*&---------------------------------------------------------------------*
*& Form QMAT_INSERT
*&---------------------------------------------------------------------*
FORM QMAT_INSERT .
SELECT SINGLE *
FROM QMAT
INTO GS_QMAT
WHERE WERKS EQ '1000'.
GS_QMAT-MATNR = GS_DATA-MATNR.
INSERT QMAT FROM GS_QMAT. COMMIT WORK.
ENDFORM. " QMAT_INSERT
15 Aralık 2011 Perşembe
SAP/ABAP: BAPI_ACC_DOCUMENT_POST FM
DATA: LS_DOCUMENTHEADER LIKE BAPIACHE09,
LV_OBJ_TYPE LIKE BAPIACHE09-OBJ_TYPE,
LV_OBJ_KEY LIKE BAPIACHE09-OBJ_KEY,
LV_OBJ_SYS LIKE BAPIACHE09-OBJ_SYS,
LT_ACCOUNTGL LIKE TABLE OF BAPIACGL09,
LT_ACCOUNTRECEIVABLE LIKE TABLE OF BAPIACAR09,
LT_ACCOUNTPAYABLE LIKE TABLE OF BAPIACAP09,
LT_CURRENCYAMOUNT LIKE TABLE OF BAPIACCR09,
LT_RETURN LIKE TABLE OF BAPIRET2,
LS_ACCOUNTGL LIKE BAPIACGL09,
LS_ACCOUNTRECEIVABLE LIKE BAPIACAR09,
LS_ACCOUNTPAYABLE LIKE BAPIACAP09,
LS_CURRENCYAMOUNT LIKE BAPIACCR09,
LS_RETURN LIKE BAPIRET2 .
LS_DOCUMENTHEADER-COMP_CODE = PA_BUKRS.
LS_DOCUMENTHEADER-DOC_DATE = PA_BLDAT.
LS_DOCUMENTHEADER-PSTNG_DATE = PA_BUDAT.
LS_DOCUMENTHEADER-DOC_TYPE = PA_BLART.
LS_DOCUMENTHEADER-USERNAME = SY-UNAME.
LS_DOCUMENTHEADER-BUS_ACT = 'RFBU'.
LS_DOCUMENTHEADER-ACC_PRINCIPLE = 'TGAP'.
* ACCOUNTGL
LV_ITEMNO_ACC = LV_ITEMNO_ACC + 1.
LS_ACCOUNTGL-ITEMNO_ACC = LV_ITEMNO_ACC.
LS_ACCOUNTGL-GL_ACCOUNT = P_P_GT_OUT-RACCT.
LS_ACCOUNTGL-DOC_TYPE = PA_BLART.
LS_ACCOUNTGL-COMP_CODE = PA_BUKRS.
LS_ACCOUNTGL-REF_KEY_1 = LS_ZFIT_BKY_DUZELT-XREF1.
LS_ACCOUNTGL-REF_KEY_3 = LS_ZFIT_BKY_DUZELT-XREF3.
APPEND LS_ACCOUNTGL TO LT_ACCOUNTGL.
CLEAR: LS_ACCOUNTGL.
LV_ITEMNO_ACC = LV_ITEMNO_ACC + 1.
LS_ACCOUNTGL-ITEMNO_ACC = LV_ITEMNO_ACC.
LS_ACCOUNTGL-GL_ACCOUNT = LS_ZFIT_BKY_DUZELT-HEDEF_HKONT.
LS_ACCOUNTGL-DOC_TYPE = PA_BLART.
LS_ACCOUNTGL-COMP_CODE = PA_BUKRS.
LS_ACCOUNTGL-REF_KEY_1 = LS_ZFIT_BKY_DUZELT-XREF1.
LS_ACCOUNTGL-REF_KEY_3 = LS_ZFIT_BKY_DUZELT-XREF3.
APPEND LS_ACCOUNTGL TO LT_ACCOUNTGL.
CLEAR: LS_ACCOUNTGL.
*--------------------------------------------------------------------*
* CURRENCYAMOUNT
READ TABLE LT_LOG INTO LS_LOG INDEX 1.
CLEAR: LV_ITEMNO_ACC.
LV_ITEMNO_ACC = LV_ITEMNO_ACC + 1.
LS_CURRENCYAMOUNT-ITEMNO_ACC = LV_ITEMNO_ACC.
LS_CURRENCYAMOUNT-CURR_TYPE = '10'.
LS_CURRENCYAMOUNT-CURRENCY = 'TRY'.
LS_CURRENCYAMOUNT-AMT_DOCCUR = P_P_GT_OUT-HSLXX * LV_CARPAN.
LS_CURRENCYAMOUNT-CURRENCY_ISO = 'TRY'.
APPEND LS_CURRENCYAMOUNT TO LT_CURRENCYAMOUNT.
CLEAR: LS_CURRENCYAMOUNT.
IF LV_CURRENCY NE 'TRY'.
LS_CURRENCYAMOUNT-ITEMNO_ACC = LV_ITEMNO_ACC.
LS_CURRENCYAMOUNT-CURR_TYPE = '00'.
LS_CURRENCYAMOUNT-CURRENCY = LV_CURRENCY.
LS_CURRENCYAMOUNT-AMT_DOCCUR = P_P_GT_OUT-TSLXX * LV_CARPAN.
LS_CURRENCYAMOUNT-CURRENCY_ISO = LV_CURRENCY.
APPEND LS_CURRENCYAMOUNT TO LT_CURRENCYAMOUNT.
CLEAR: LS_CURRENCYAMOUNT.
ENDIF.
LS_CURRENCYAMOUNT-ITEMNO_ACC = LV_ITEMNO_ACC.
LS_CURRENCYAMOUNT-CURR_TYPE = '30'.
LS_CURRENCYAMOUNT-CURRENCY = 'EUR'.
LS_CURRENCYAMOUNT-AMT_DOCCUR = P_P_GT_OUT-KSLXX * LV_CARPAN.
LS_CURRENCYAMOUNT-CURRENCY_ISO = 'EUR'.
APPEND LS_CURRENCYAMOUNT TO LT_CURRENCYAMOUNT.
CLEAR: LS_CURRENCYAMOUNT.
LS_CURRENCYAMOUNT-ITEMNO_ACC = LV_ITEMNO_ACC.
LS_CURRENCYAMOUNT-CURR_TYPE = '50'.
LS_CURRENCYAMOUNT-CURRENCY = 'USD'.
LS_CURRENCYAMOUNT-AMT_DOCCUR = P_P_GT_OUT-OSLXX * LV_CARPAN.
LS_CURRENCYAMOUNT-CURRENCY_ISO = 'USD'.
APPEND LS_CURRENCYAMOUNT TO LT_CURRENCYAMOUNT.
CLEAR: LS_CURRENCYAMOUNT.
*--------------------------------------------------------------------*
LV_ITEMNO_ACC = LV_ITEMNO_ACC + 1.
LS_CURRENCYAMOUNT-ITEMNO_ACC = LV_ITEMNO_ACC.
LS_CURRENCYAMOUNT-CURR_TYPE = '10'.
LS_CURRENCYAMOUNT-CURRENCY = 'TRY'.
LS_CURRENCYAMOUNT-AMT_DOCCUR = P_P_GT_OUT-HSLXX.
LS_CURRENCYAMOUNT-CURRENCY_ISO = 'TRY'.
APPEND LS_CURRENCYAMOUNT TO LT_CURRENCYAMOUNT.
CLEAR: LS_CURRENCYAMOUNT.
IF LV_CURRENCY NE 'TRY'.
LS_CURRENCYAMOUNT-ITEMNO_ACC = LV_ITEMNO_ACC.
LS_CURRENCYAMOUNT-CURR_TYPE = '00'.
LS_CURRENCYAMOUNT-CURRENCY = LV_CURRENCY.
LS_CURRENCYAMOUNT-AMT_DOCCUR = P_P_GT_OUT-TSLXX.
LS_CURRENCYAMOUNT-CURRENCY_ISO = LV_CURRENCY.
APPEND LS_CURRENCYAMOUNT TO LT_CURRENCYAMOUNT.
CLEAR: LS_CURRENCYAMOUNT.
ENDIF.
LS_CURRENCYAMOUNT-ITEMNO_ACC = LV_ITEMNO_ACC.
LS_CURRENCYAMOUNT-CURR_TYPE = '30'.
LS_CURRENCYAMOUNT-CURRENCY = 'EUR'.
LS_CURRENCYAMOUNT-AMT_DOCCUR = P_P_GT_OUT-KSLXX.
LS_CURRENCYAMOUNT-CURRENCY_ISO = 'EUR'.
APPEND LS_CURRENCYAMOUNT TO LT_CURRENCYAMOUNT.
CLEAR: LS_CURRENCYAMOUNT.
LS_CURRENCYAMOUNT-ITEMNO_ACC = LV_ITEMNO_ACC.
LS_CURRENCYAMOUNT-CURR_TYPE = '50'.
LS_CURRENCYAMOUNT-CURRENCY = 'USD'.
LS_CURRENCYAMOUNT-AMT_DOCCUR = P_P_GT_OUT-OSLXX.
LS_CURRENCYAMOUNT-CURRENCY_ISO = 'USD'.
APPEND LS_CURRENCYAMOUNT TO LT_CURRENCYAMOUNT.
CLEAR: LS_CURRENCYAMOUNT.
IF RB_TEST EQ 'X'.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
EXPORTING
DOCUMENTHEADER = LS_DOCUMENTHEADER
TABLES
ACCOUNTGL = LT_ACCOUNTGL
CURRENCYAMOUNT = LT_CURRENCYAMOUNT
RETURN = LT_RETURN.
ELSEIF RB_YARD EQ 'X'.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
DOCUMENTHEADER = LS_DOCUMENTHEADER
IMPORTING
OBJ_TYPE = LV_OBJ_TYPE
OBJ_KEY = LV_OBJ_KEY
OBJ_SYS = LV_OBJ_SYS
TABLES
ACCOUNTGL = LT_ACCOUNTGL
* accountreceivable = LT_ACCOUNTRECEIVABLE
* accountpayable = LT_ACCOUNTPAYABLE
CURRENCYAMOUNT = LT_CURRENCYAMOUNT
RETURN = LT_RETURN.
ENDIF.
CLEAR: W_ERROR.
LOOP AT LT_RETURN
INTO LS_RETURN
WHERE TYPE EQ 'E'.
W_ERROR = 'X'.
EXIT.
ENDLOOP.
IF W_ERROR NE 'X'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
MESSAGE 'Belge Kaydedildi' TYPE 'S'.
CLEAR: LT_LOG[].
PERFORM ZFIT_BKY_LOG USING LV_KAYIT_TURU
CHANGING LT_LOG.
ENDIF.
CALL FUNCTION 'RSCRMBW_DISPLAY_BAPIRET2'
TABLES
IT_RETURN = LT_RETURN.
14 Aralık 2011 Çarşamba
SAP/ABAP: SPLIT
DATA: P_PARAM(11) TYPE C,
LV_FIRST(10),
LV_LAST(3).
P_PARAM = 'example.txt'.
SPLIT P_PARAM AT '.' INTO LV_FIRST LV_LAST.
IF LV_LAST NE 'txt'.
MESSAGE 'Yanlış dosya türü!' TYPE 'I'.
ELSE.
MESSAGE 'OK!' TYPE 'S'.
ENDIF.
12 Aralık 2011 Pazartesi
SAP/ABAP: POPUP_TO_CONFIRM FM
IF SY-SUBRC IS INITIAL.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TEXT_QUESTION = 'Question??????????'
IMPORTING
ANSWER = lv_ans.
if lv_ans = '1'.
PERFORM birsey.
elseif lv_ans = '2'.
PERFORM baska_birsey.
endif.
ELSE.
PERFORM other.
ENDIF.
9 Aralık 2011 Cuma
SAP/ABAP: LISTBOX, Selection Screen
PARAMETERS : p_dep(30) AS LISTBOX VISIBLE LENGTH 30.
*----------------------------------------------------------------------*
* AT SELECTION-SCREEN
*----------------------------------------------------------------------*
AT SELECTION-SCREEN OUTPUT.
IF gt_departman[] IS INITIAL.
SELECT a~zdepartman b~ltext FROM zmmt_departman AS a
INNER JOIN zmmt_departmant AS b ON a~zdepartman = b~zdepartman
INTO CORRESPONDING FIELDS OF TABLE gt_departman
WHERE b~spras = sy-langu
.
name = 'P_DEP'.
LOOP AT gt_departman.
value-key = gt_departman-zdepartman.
value-text = gt_departman-ltext.
APPEND value TO list.
ENDLOOP.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = name
values = list.
ENDIF.
7 Aralık 2011 Çarşamba
SAP/ABAP: ABAP4_CALL_TRANSACTION FM
REPORT ZABAP_ABAP4_CALL_TRANSACTION_F .
DATA GS_BDCDATA TYPE BDCDATA.
DATA GT_BDCDATA TYPE TABLE OF BDCDATA.
GS_BDCDATA-PROGRAM = 'SAPLSD_ENTRY'.
GS_BDCDATA-DYNPRO = '1000'.
GS_BDCDATA-DYNBEGIN = 'X'.
APPEND GS_BDCDATA TO GT_BDCDATA.
CLEAR GS_BDCDATA.
GS_BDCDATA-FNAM = 'RSRD1-TBMA_VAL'.
GS_BDCDATA-FVAL = 'SFLIGHT'.
APPEND GS_BDCDATA TO GT_BDCDATA.
CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
EXPORTING
TCODE = 'SE11'
* SKIP_SCREEN = ' '
* MODE_VAL = 'A'
* UPDATE_VAL = 'A'
* IMPORTING
* SUBRC =
TABLES
USING_TAB = GT_BDCDATA
* SPAGPA_TAB =
* MESS_TAB =
EXCEPTIONS
CALL_TRANSACTION_DENIED = 1
TCODE_INVALID = 2
OTHERS = 3
.
IF SY-SUBRC gt 0.
MESSAGE 'bir sikinti var!' TYPE 'E'.
ENDIF.
2 Aralık 2011 Cuma
SAP/ABAP: ‘SPELL_AMOUNT’ FM
TABLES SPELL.
DATA: T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.
DATA: PAMOUNT LIKE SPELL-NUMBER VALUE '1234510' .
PERFORM SPELL_AMOUNT USING PAMOUNT 'TRY'.
WRITE: T_SPELL-WORD,
T_SPELL-DECWORD,
'TRY' .
FORM SPELL_AMOUNT USING PWRBTR PWAERS.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = PAMOUNT
CURRENCY = PWAERS
FILLER = SPACE
LANGUAGE = 'T'
IMPORTING
IN_WORDS = T_SPELL
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.
ENDFORM. " SPELL_AMOUNT
Kaydol:
Kayıtlar (Atom)
İnsdroid
Sabahtan beri çatada çutada çatada çutada… Bitmedi yine de… Neyse, yolumuz uzun, toparlıyorum çantamı, adaptörü falan tıkıştırıyorum bir şe...
-
Why do we need to change status of a request? Let's imagine, you have a workbench request and you already relased linked task in it....
-
Metasploitable is a kind of vulnerable Linux virtual machine image for penetration testing. It is Debian 32bit based operation system, and r...
-
* DATA : * ls_object_identity TYPE borident , * lo_gos TYPE REF TO cl_gos_document_service . * ls_object_identi...