SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Data Dictionary | Словарь данных



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Tue Sep 11, 2007 9:20 pm    Post subject: Data Dictionary | Словарь данных Reply with quote

RFC_GET_TABLE_ENTRIES - is used to fetch all the data present in the databse table.
You can give table name start and end condition.

RFC_READ_TABLE - is used to get the structure of the databse table. that is it returns all the fields present in databse table there size offset etc.

GET_COMPONENT_LIST - возвращает список полей структуры, внутренней таблицы

GET_GLOBAL_SYMBOLS - возвращает список глобаных полей программы

RS_SHORTTEXT_GET - возвращает текстовое описание объекта.

ABL_CHECK_REFERENCE - проверка ссылки

CHECK_DOMAIN_VALUES - Checks if a fixed value is valid for domain
Exceptions: WRONG_VALUE, DOM_NOT_FOUND

GET_DOMAIN_VALUES - Read out fixed values of a domain
With text descriptions:
Code:

report zworkflw line-size 255.
*---- Selection Screen -------------------------------------------------
parameters: vbeln like vbuk-vbeln memory id aun obligatory,
posnr like vbap-posnr memory id pid.
*---- Variables --------------------------------------------------------
data: w_comwa like vbco6,
it_doc like vbfa occurs 0 with header line,
it_txt like dd07v occurs 0 with header line,
begin of it_type occurs 0,
vbtyp like vbuk-vbtyp,
text like dd07v-ddtext,
end of it_type.
*-----------------------------------------------------------------------
start-of-selection.
w_comwa-mandt = sy-mandt.
w_comwa-vbeln = vbeln.
w_comwa-posnr = posnr.
call function 'RV_ORDER_FLOW_INFORMATION'
exporting
comwa = w_comwa
tables
vbfa_tab = it_doc
exceptions
no_vbfa = 1
no_vbuk_found = 2
others = 3.
case sy-subrc.
when 1. write: / 'No VBFA found.'.
when 2. write: / 'No VBUK found. Check selection criteria...'.
when 3. write: / 'Unknown Error!'.
when 0. perform write_docs.
endcase.
*-----------------------------------------------------------------------
form write_docs.
call function 'GET_DOMAIN_VALUES'
exporting
domname = 'VBTYP'
tables
values_tab = it_txt
exceptions
no_values_found = 1
others = 2.
case sy-subrc.
when 1. write: / 'Warning: No texts found for Sales Docs types!'.
when 2. write: / 'Warning: Cannot retrieve SD types descriptions!'.
when 0. perform sort_texts.
endcase.

write: / 'Order Flow Information:'.
loop at it_doc.
write: / it_doc-stufe,
it_doc-vbelv,
it_doc-posnv.
perform write_type using it_doc-vbtyp_v.
write: it_doc-vbeln,
it_doc-posnn.
perform write_type using it_doc-vbtyp_n.
write: it_doc-matnr,
it_doc-rfmng unit it_doc-meins,
it_doc-meins.
endloop.
endform.
*-----------------------------------------------------------------------
form sort_texts.
loop at it_txt.
it_type-vbtyp = it_txt-domvalue_l.
it_type-text = it_txt-ddtext.
append it_type.
clear it_type.
endloop.
sort it_type.
endform.
*-----------------------------------------------------------------------
form write_type using value(p_vbtyp) like vbuk-vbtyp.
data w_txt(30) type c.
read table it_type with key vbtyp = p_vbtyp binary search.
case sy-subrc.
when 0. w_txt = it_type-text.
when others. w_txt = '?'.
endcase.
write w_txt intensified off.
endform.
*-----------------------------------------------------------------------


Code:

report zworkflw line-size 255.
*---- Selection Screen -------------------------------------------------
parameters: ebeln like ekko-ebeln memory id bes obligatory,
ebelp like ekpo-ebelp memory id bsp.
*---- Variables --------------------------------------------------------
data: w_comwa like vbco6,
it_doc like ekbe occurs 0 with header line,
it_txt like dd07v occurs 0 with header line,
begin of it_type occurs 0,
vgabe like ekbe-vgabe,
text like dd07v-ddtext,
end of it_type.
*-----------------------------------------------------------------------
start-of-selection.
call function 'ME_READ_HISTORY'
exporting
ebeln = ebeln
ebelp = ebelp
webre = 'X'
tables
xekbe = it_doc.
perform write_docs.
*-----------------------------------------------------------------------
form write_docs.
call function 'GET_DOMAIN_VALUES'
exporting
domname = 'VGABE'
tables
values_tab = it_txt
exceptions
no_values_found = 1
others = 2.
case sy-subrc.
when 1. write: / 'Warning: No texts found for',
'transaction/event type, purchase order history!'.
when 2. write: / 'Warning: Cannot retrieve descriptions for',
'transaction/event type, purchase order history!'.
when 0. perform sort_texts.
endcase.

write: / it_doc-ebeln,it_doc-ebelp,'- Purchasing Document History:'.
loop at it_doc.
perform write_type using it_doc-vgabe.
write: it_doc-belnr,
it_doc-buzei,
it_doc-budat.
endloop.
endform.
*-----------------------------------------------------------------------
form sort_texts.
loop at it_txt.
it_type-vgabe = it_txt-domvalue_l.
it_type-text = it_txt-ddtext.
append it_type.
clear it_type.
endloop.
sort it_type.
endform.
*-----------------------------------------------------------------------
form write_type using value(p_vgabe) like ekbe-vgabe.
data w_txt(30) type c.
read table it_type with key vgabe = p_vgabe binary search.
case sy-subrc.
when 0. w_txt = it_type-text.
when others. w_txt = '?'.
endcase.
write / w_txt intensified off.
endform.
*-----------------------------------------------------------------------

DD_DOMVALUES_GET External interface for reading the domain fixed values
Called from GET_DOMAIN_VALUES. Allows use of any Language for text descriptions.

DDIF_FIELDINFO_GET - DD: Interface for retrieving information about DD field
Length, Texts etc.
Example - print current values of the system fields (SY-...)
Code:

REPORT ZVVSYST .
* ----------------------------------------------------------------------
* This report prints current values of the system fields.
* ----------------------------------------------------------------------
PERFORM PRINT_SY_VALUES.

FORM PRINT_SY_VALUES.
  DATA: IT_DFIES LIKE DFIES OCCURS 0 WITH HEADER LINE,
  W_NAME(10) TYPE C,
  W_INFO(80) TYPE C.

CALL FUNCTION 'DDIF_FIELDINFO_GET'
  EXPORTING
    TABNAME = 'SYST'
*   FIELDNAME = ' '
*   LANGU = SY-LANGU
  IMPORTING
*   X030L_WA =
  TABLES
    DFIES_TAB = IT_DFIES
    EXCEPTIONS
    NOT_FOUND = 1
    INTERNAL_ERROR = 2
    OTHERS = 3.
LOOP AT IT_DFIES.
  CONCATENATE 'SY-' IT_DFIES-FIELDNAME INTO W_NAME.
  WRITE (W_NAME) TO W_INFO.
  WRITE: / W_NAME COLOR COL_KEY INTENSIFIED OFF,
        12 IT_DFIES-FIELDTEXT,
         / W_INFO.
  ENDLOOP.
ENDFORM.


DDIF_TABL_GET - DD: Interface to Read a Table from the ABAP Dictionary
Length, Texts etc.

DDIF_NAMETAB_GET - DD: Interface to Read a Runtime Object from the ABAP Dictionary
Length etc., but not Texts (called from GET_FIELDTAB).

DDIF_DTEL_GET - DD: Interface to Read a Data Element from the ABAP Dictionary
Lengths, Domain etc. for the Data Element (see also table DD04V)

DDIF_DOMA_GET - DD: Interface to Read a Domain from the ABAP Dictionary
Lengths etc. for the Domain (see also table DD01V)

GET_FIELDTAB - Read fields of a table in the format DFIES Obsolete.
Length, Texts etc.
Code:

report z_get_fieldtab.

data: it_t001 type t001 occurs 0,
it_fields type dfies occurs 0 with header line,

begin of it_fnames occurs 0,
reptext like dfies-reptext,
end of it_fnames.
* The structure definition required for this internal table.
* The following definition is not working:
* it_fnames like dfies-reptext occurs 0 with header line.
* because Function Module will use the following:
* ASSIGN COMPONENT 1 OF STRUCTURE FIELDNAMES TO .

select * from t001 into table it_t001.

CALL FUNCTION 'GET_FIELDTAB'
  EXPORTING
*   LANGU = SY-LANGU
*   ONLY = ' '
  TABNAME = 'T001'
*   WITHTEXT = 'X'
*   IMPORTING
*   HEADER =
*   RC =
  TABLES
    FIELDTAB = it_fields
    EXCEPTIONS
    INTERNAL_ERROR = 1
    NO_TEXTS_FOUND = 2
    TABLE_HAS_NO_FIELDS = 3
    TABLE_NOT_ACTIV = 4
    OTHERS = 5
    .
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

loop at it_fields.
  it_fnames-reptext = it_fields-reptext.
  append it_fnames.
endloop.

CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
  EXPORTING
    FILE_NAME = 'C:\T001'
*   CREATE_PIVOT = 0
    DATA_SHEET_NAME = 'Companies'
*   PIVOT_SHEET_NAME = ' '
*   PASSWORD = ' '
*   PASSWORD_OPTION = 0
  TABLES
*   PIVOT_FIELD_TAB =
    DATA_TAB = it_t001
    FIELDNAMES = it_fnames
  EXCEPTIONS
    FILE_NOT_EXIST = 1
    FILENAME_EXPECTED = 2
    COMMUNICATION_ERROR = 3
    OLE_OBJECT_METHOD_ERROR = 4
    OLE_OBJECT_PROPERTY_ERROR = 5
    INVALID_FILENAME = 6
    INVALID_PIVOT_FIELDS = 7
    DOWNLOAD_PROBLEM = 8
    OTHERS = 9
    .
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
  EXPORTING
    FILE_NAME = 'C:\T001_2'
*   CREATE_PIVOT = 0
    DATA_SHEET_NAME = 'Companies 2'
*   PIVOT_SHEET_NAME = ' '
*   PASSWORD = ' '
*   PASSWORD_OPTION = 0
  TABLES
*   PIVOT_FIELD_TAB =
    DATA_TAB = it_t001
    FIELDNAMES = it_fnames
  EXCEPTIONS
    FILE_NOT_EXIST = 1
    FILENAME_EXPECTED = 2
    COMMUNICATION_ERROR = 3
    OLE_OBJECT_METHOD_ERROR = 4
    OLE_OBJECT_PROPERTY_ERROR = 5
    INVALID_FILENAME = 6
    INVALID_PIVOT_FIELDS = 7
    DOWNLOAD_PROBLEM = 8
    OTHERS = 9
    .
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


VIEW_AUTHORITY_CHECK - Check authority for table/view.
Check Authorization Objects S_TABU_DIS (for whole table class according to the table TDDAT) and S_TABU_CLI (if client-independent table).

VIEW_ENQUEUE - Lock/Unlock data in table/view.
Whole table or selection

DEQUEUE_E_TABLES - Lock/Unlock data in table.
ENQUEUE_E_TABLEE
DEQUEUE_E_TABLEE
ENQUEUE_E_TABLES
Whole table or selection (called from VIEW_ENQUEUE)
Exclusive | Shared

ENQUEUE_E_TABLE - Whole table or selection
DEQUEUE_E_TABLE

CLOI_PUT_SIGN_IN_FRONT - Put sign in front.
And condense result

KCD_SFELD_OUTPUT_LENGTH_GET - Returns output length for the table field or for the ABAP type (C,N,D,T,P).
Note. Add 1 if P (FM doesn't provide place for sign +/-)

ABAP_DOCU_DOWNLOAD - Download ABAP documentation in HTML format.

SCROLLING_IN_TABLE - If you are coding a module pool and using a table control, you can use this function SCROLLING_IN_TABLE to handle any scrolling. (provided by Paul Kjaer)

RH_STRUC_GET - Returns all related org info

DB_GET_TABLE_FIELDS
Code:
DATA : it_itab TYPE TABLE OF dbfield WITH HEADER LINE.
DATA : it_string TYPE TABLE OF string.
DATA : v_subrc TYPE sy-subrc.
DATA : v_string TYPE string.

CALL FUNCTION 'DB_GET_TABLE_FIELDS'
  EXPORTING
    field_info = 'N'
    tabname = 'VBAK'
  IMPORTING
    subrc = v_subrc
  TABLES
    dbfields = it_itab.

IF v_subrc = 0.
  LOOP AT it_itab.
    IF sy-tabix = 1.
      v_string = it_itab-name.
    ELSE.
      CONCATENATE v_string it_itab-name INTO v_string SEPARATED BY c_tab.
    ENDIF.
  ENDLOOP.
  APPEND v_string TO it_string.
ENDIF.

IF v_string IS NOT INITIAL.
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename = 'C:\temp.xls'
    TABLES
      data_tab = it_string
    EXCEPTIONS
      file_write_error = 1
      no_batch = 2.
  IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDIF.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.