Tuesday, May 8, 2018

SAP ABAP-DDIC OBJECT TWO IN SAP ABAP.


SAP ABAP DDIC DETAILS

37) What are Workbench objects/tools?
Ans: It is a collection of tools which can be used to develop the applications, change the existing applications & implement the customer specific business requirements.

38) What is Object Navigator?
Ans: It is the central point of entry to work with any kind of work bench objects such as Programs,DDIC objects, Function groups etc. The T-code is: SE80.

39)  What is Foreign Key?
Ans: A key field is defined as a table field & is primary key of another table is called foreign key.
Ø  The Check table field should be a primary key.
Ø  The Domain name of the Check table & foreign key table should be same but field name is different.
Ø  A search help is displayed to see the possible entries of a check table on the foreign key field when the foreign key table is executed.

40) What is a Client Dependent & Client Independent table?
Ans: The table which have the field MANDT field (Client no) is called Client Dependent table.The table which don’t have the MANDT field (Client no) is called Client Independent table.

41)  What are Key field & Non-key fields?
Ans: The key fields don’t allow duplicates. It contains unique data. The key field check boxes are  checked to make the fields as primary key.
The non-key fields may/mayn’t allow duplicates. The key field check boxes are unchecked.

42)  What is Initial Value Check box?
Ans: The Initial Value Check box is checked to take the default field values of the key fields for the 1st time.

43) Differences between the tables created using Data elements & Pre-defined types?
Data elements
Pre-defined types
1. Data elements can be reused
1.Reusabilty is not possible
2. Foreign key relationship can be created since
    it contains domains.
2. Foreign key relationship in not be created.
3. Field labels(Headings) are displayed while 
    maintain the table.
3. ‘+’ symbols are appeared while maintaining the table instead of field labels.

44)  What is a Logical Database?
Ans: Logical Databases are ABAP programs that retrieve data and make it available to application programs. Use of LDB – is used to read data from database tables by linking  them to executable ABAP programs.

45) What is Hotkey?
Ø  This is used to select the elementary search help from the collective search help.
Ø  To enter the restrictions in the dialog box for restricting values directly from the entry field.
Advantage: If the user often searches for values using the same search help, this procedure can save time.

46) What are the Important Tables to store the Definitions of DDIC?
Table
Short Text
DD01L
Domains
DD01T
Domain Texts
DD02L
SAP Tables
DD02T
SAP Table Texts – To find table names using Short Description
DD03L
Table Fields
DD03T
Texts for fields
DD04L
Data Elements
DD04T
Data Element Texts
DD05S
Foreign Key Fields
TSTC
Transaction Codes
TFDIR
Function Modules


47) Explain about Currency or Quantity fields in DDIC?
Ø  In SAP the currency & quantity fields are required currency key & quantity unit. Hence, the reference table & the reference field must be specified for currency & quantity fields.
Ø  The data type for the currency field is ‘CURR’ & the data type for the currency key is ‘CUKY’.
Ø  The data type for the quantity field is ‘QUAN’ & the data type for the quantity key is ‘QUAN’.
Ø  The reference table could be any table which has the currency key & quantity unit fields.
Ø  The same table can also be used as a reference table if it has the currency key or quantity unit fields

48) What are different types of Data Dictionary Objects?
1.    Database Tables
2.    Domains
3.    Data types
a.    Data element
b.    Structure
c.    Table type
4.    Search helps
a.    Elementary search help
b.    Collective search help
5.    Views
a.    Database view
b.    Maintenance view
c.    Help view
d.    Projection view
6.    Lock objects
a.    Write/Exclusive Lock
b.    Read/Shared Lock
c.    Exclusive But not Cumulative
7.    Type groups
Ø  The Objects Views, Match Code and Lock objects are called Aggregate Objects because they are formed from several related table.

49) What is Client & Server?
Ø  Client: It is a software/hardware combination which can send the requests for services from  the central system.
Ø     Server: It is a software/hardware combination which can provide the services to a group of clients.

SAP ABAP -SELECTION SCREEN DETAILS .HOW CREATE BLOCK RADIO BUTTON ETC.

Q.SELECTION SCREEN DETAILS .HOW CREATE BLOCK RADIO BUTTON ETC

REPORT  ZSELECTION_SCREEN.
SELECTION-SCREEN BEGIN OF BLOCK B5 WITH FRAME TITLE TEXT-004.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
*  PARAMETERS P_VENDER AS CHECKBOX USER-COMMAND UC1.
  PARAMETERSP_VEN RADIOBUTTON GROUP RG1 user-command test default 'X',
*  SELECTION-SCREEN COMMENT (25) TEXT-RC1  FOR FIELD P_VEND.
              P_CUS RADIOBUTTON GROUP RG1,
              P_STU RADIOBUTTON GROUP RG1.
  SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
*  PARAMETERS P_VEND AS CHECKBOX USER-COMMAND UC1.
  PARAMETERSP_VNAME TYPE CHAR20 MODIF ID RB1,
              P_VID TYPE CHAR30 MODIF ID RB1,
              P_VADD TYPE CHAR30 MODIF ID RB1,
              P_VMOB TYPE CHAR20 MODIF ID RB1.
  SELECTION-SCREEN END OF BLOCK B2.
  SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-002.
  PARAMETERSP_CNAME TYPE CHAR20 MODIF ID SC1,
              P_CID TYPE CHAR20 MODIF ID SC1,
              P_CADD TYPE CHAR20 MODIF ID SC1,
              P_CMOB TYPE CHAR20 MODIF ID SC1.
    SELECTION-SCREEN END OF BLOCK B3.
  SELECTION-SCREEN BEGIN OF BLOCK B4 WITH FRAME TITLE TEXT-003.
*    PARAMETERS P_STUD AS CHECKBOX USER-COMMAND UC3.
    PARAMETERSP_SNAME TYPE CHAR20 MODIF ID SU1 ,
                P_SID TYPE CHAR20 MODIF ID SU1,
                P_SADD TYPE CHAR20 MODIF ID SU1,
                P_SMOB TYPE CHAR20 MODIF ID SU1.
    SELECTION-SCREEN END OF BLOCK B4.
    SELECTION-SCREEN END OF BLOCK B5.
    AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
  IF SCREEN-GROUP1 'RB1'.
    IF P_CUS 'X' OR P_STU 'X'.
      SCREEN-ACTIVE 0.
      ELSEIF P_VEN 'X'.
        SCREEN-ACTIVE 1.
        ENDIF.
    MODIFY SCREEN.
    ENDIF.
     IF SCREEN-GROUP1 'SC1'.
   IF P_VEN 'X' OR P_STU 'X'.
     SCREEN-ACTIVE 0.
     ELSEIF P_CUS 'X'.
       SCREEN-ACTIVE 1.
  ENDIF.
  MODIFY SCREEN.
  ENDIF.
  IF SCREEN-GROUP1 'SU1'.
    IF P_VEN 'X' OR P_CUS 'X'.
      SCREEN-ACTIVE 0.
      ELSEIF P_STU 'X'.
        SCREEN-ACTIVE 1.
        ENDIF.
        MODIFY SCREEN.
        ENDIF.
ENDLOOP.

SAP ABAP-BAPI MATERIAL CREATION


BAPI MATERIAL CREATION


REPORT zbapi_material.

*&---------------------------------------------------------------------*
*& INCLUES FOR ALL EVENTS                                              *
*&---------------------------------------------------------------------*
INCLUDE zbapi_mat_data_declaration.
INCLUDE zbapi_mat_data_selec_screen.
INCLUDE zbapi_mat_data_logic.

*&---------------------------------------------------------------------*
*& Start of Selection Event                                            *
*&---------------------------------------------------------------------*
START-OF-SELECTION.
  
PERFORM gui_upload.
  
PERFORM bapi.

TOP
*&---------------------------------------------------------------------*
*&  Include           ZBAPI_MAT_DATA_DECLARATION
*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*
*& External Table Declaration                                          *
*&---------------------------------------------------------------------*
TABLES bapimatheadbapi_marabapi_maraxbapi_makt.

*&---------------------------------------------------------------------*
*& Internal Table Declaration                                          *
*&---------------------------------------------------------------------*
DATA BEGIN OF it_bapi OCCURS 0,
          material   
TYPE bapimathead-material,
          ind_sector 
TYPE bapimathead-ind_sector,
          matl_type  
TYPE bapimathead-matl_type,
          matl_group 
TYPE bapi_mara-matl_group,
          base_uom   
TYPE bapi_mara-base_uom,
          matl_desc  
TYPE bapi_makt-matl_desc,
        
END OF it_bapi,

       it_return 
LIKE bapiret2,
       it_makt_bapi 
like bapi_makt OCCURS WITH HEADER LINE.

SELECTION SCREEN
*&---------------------------------------------------------------------*
*&  Include           ZBAPI_MAT_DATA_SELEC_SCREEN
*&---------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
"IBIPPARMS-PATH is a export structure of f4 help fm.
*PARAMETERS : p_file TYPE ibipparms-path OBLIGATORY.
PARAMETERS p_file TYPE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.

*&---------------------------------------------------------------------*
*&  At Selection Screen Event                                          *
*&---------------------------------------------------------------------*

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  
PERFORM f4_help.
SUB***************************************************
*&---------------------------------------------------------------------*
*&  Include           ZBAPI_MAT_DATA_LOGIC
*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*
*&  Form F4_HELP                                                       *
*&---------------------------------------------------------------------*

FORM f4_help.
  
CALL FUNCTION 'F4_FILENAME'
    
EXPORTING
      program_name  
syst-cprog
      dynpro_number 
syst-dynnr
*     FIELD_NAME    = ' '
    
IMPORTING
      file_name     
p_file.
ENDFORM.                    "f4_help

*&---------------------------------------------------------------------*
*&  Form GUI_UPLOAD                                                    *
*&---------------------------------------------------------------------*
FORM gui_upload.
************************************************************************
***** For Notepad File

*  DATA:v_file TYPE string.
*  MOVE p_file TO v_file.

*  CALL FUNCTION 'GUI_UPLOAD'
*    EXPORTING
*     filename                      = v_file
*     filetype                      = 'DAT'
*     has_field_separator           = 'X'
**   HEADER_LENGTH                 = 0
**   READ_BY_LINE                  = 'X'
**   DAT_MODE                      = ' '
**   CODEPAGE                      = ' '
**   IGNORE_CERR                   = ABAP_TRUE
**   REPLACEMENT                   = '#'
**   CHECK_BOM                     = ' '
**   VIRUS_SCAN_PROFILE            =
**   NO_AUTH_CHECK                 = ' '
** IMPORTING
**   FILELENGTH                    =
**   HEADER                        =
*    TABLES
*      data_tab                      = it_bapi.

************************************************************************
***** For EXcel File
  
DATA lv_file TYPE rlgrap-filename,
         lv_raw  
TYPE truxs_t_text_data"truxs_xml_table.
  
MOVE   p_file TO lv_file.

  
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    
EXPORTING
      i_field_seperator    
'X'
*     I_LINE_HEADER        =
      i_tab_raw_data       
lv_raw
      i_filename           
lv_file
    
TABLES
      i_tab_converted_data 
it_bapi.
* EXCEPTIONS
*   CONVERSION_FAILED          = 1
*   OTHERS                     = 2

  
IF sy-subrc <> 0.
* Implement suitable error handling here
  
ENDIF.

ENDFORM.                    "gui_upload

*&---------------------------------------------------------------------*
*&      Form  bapi
*&---------------------------------------------------------------------*
FORM bapi.
  
LOOP AT it_bapi.
    bapimathead
-material   it_bapi-material.
    bapimathead
-ind_sector it_bapi-ind_sector.
    bapimathead
-matl_type  it_bapi-matl_type.
    bapimathead
-basic_view 'X'.

    bapi_mara
-matl_group   it_bapi-matl_group.
    bapi_mara
-base_uom     it_bapi-base_uom.
    bapi_marax
-matl_group  'X'.
    bapi_marax
-base_uom    'X'.

    it_makt_bapi
-matl_desc it_bapi-matl_desc.
    
APPEND it_makt_bapi.
    
CLEAR it_makt_bapi.

    
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
      
EXPORTING
        headdata            
bapimathead
        clientdata          
bapi_mara
        clientdatax         
bapi_marax
      
IMPORTING
        
return              it_return
      
TABLES
        materialdescription 
it_makt_bapi.

    
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      
EXPORTING
        
wait 'X'.
    
WRITE / it_return-type.

  
ENDLOOP.
ENDFORM.                    "bapi