Wednesday, May 9, 2018

SAP ABAP- MODULE PULL


SAP ABAP- MODULE PULL

REPORT NAME:---SAPMZ_SWRAN.
 INCLUDE MZ_SWRANTOP                             .  " global Data
 
INCLUDE MZ_SWRANO01                             .  " PBO-Modules
 
INCLUDE MZ_SWRANI01                             .  " PAI-Modules
 
INCLUDE MZ_SWRANF01  

TOP.
TYPE-POOLS:SLIS.
TABLES MARA .
DATA :MLOW(18),MHIGH(18).
DATA :MLOW1(18),MHIGH1(18).
DATABEGIN OF T_MARA OCCURS 1,
        MATNR 
TYPE MARA-MATNR,
        ERSDA 
TYPE MARA-ERSDA,
        ERNAM 
TYPE MARA-ERNAM,
        PSTAT 
TYPE MARA-PSTAT,
        MBRSH 
TYPE MARA-MBRSH,
      
END OF T_MARA.
DATA BEGIN OF RANGE OCCURS ,
       
SIGN(1),
       OPTION
(2),
       LOW
(18),
       HIGH
(18),
       
END OF RANGE .
DATA T_FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV ,
       W_FCAT 
TYPE SLIS_FIELDCAT_ALV ,
       W_LAYO 
TYPE SLIS_LAYOUT_ALV .

PBO MODULE
MODULE STATUS_9001 OUTPUT.
  
SET PF-STATUS 'ZGUI_STATUS'.
*  SET TITLEBAR 'xxx'.

ENDMODULE.   
PAI MODULE.
*&---------------------------------------------------------------------*
*&  Include           MZ_SWRANI01
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_9001  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_9001 INPUT.

   
CASE SY-UCOMM.
    
WHEN 'EXECUTE'."FC-CODE OF ENTER BUTTON
      
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT' "CONVERSION ROUTINE FOR MLOW
        
EXPORTING
          
INPUT              MLOW
       
IMPORTING
         
OUTPUT             MLOW1
       
EXCEPTIONS
         LENGTH_ERROR       
1
         
OTHERS             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.
      
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'"CONVERSION ROUTINE FOR MHIGH
        
EXPORTING
          
INPUT              MHIGH
       
IMPORTING
         
OUTPUT             MHIGH1
       
EXCEPTIONS
         LENGTH_ERROR       
1
         
OTHERS             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.
******************************************************************
* LOGICALLY BUILD A INTERNAL TABLE (RANGE)
******************************************************************
      RANGE
-SIGN 'I'" I OR E
      RANGE
-OPTION 'BT'.
      RANGE
-LOW MLOW1 .
      RANGE
-HIGH MHIGH1 .
      
APPEND RANGE ."APPEND DATA IN INTERNAL TABLE
******************************************************************
      
PERFORM FETCH_DATA .
      
PERFORM DISPLAY_DATA .
    
WHEN 'BACK' OR 'EXIT' or 'CANCEL'.
      
LEAVE PROGRAM.

  
ENDCASE.

ENDMODULE.                 " USER_COMMAND_9001  INPUT
*&---------------------------------------------------------------------*
*&      Form  FETCH_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM FETCH_DATA .
           
SELECT MATNR
                  ERNAM
                  ERSDA
                  PSTAT
                  MBRSH
                  
FROM MARA
                  
INTO CORRESPONDING FIELDS OF TABLE T_MARA
                  
WHERE MATNR IN RANGE .

ENDFORM.                    " FETCH_DATA
*&---------------------------------------------------------------------*
*&      Form  DISPLAY_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM DISPLAY_DATA .

  
LEAVE TO LIST-PROCESSING .
  W_FCAT
-TABNAME 'MARA'.
  W_FCAT
-FIELDNAME 'MATNR'.
  W_FCAT
-SELTEXT_M 'Material No'.
  
APPEND w_fcat to t_Fcat .

  W_FCAT
-TABNAME 'MARA'.
  W_FCAT
-FIELDNAME 'ERSDA'.
  W_FCAT
-SELTEXT_M 'Created On'.
  
APPEND w_fcat to t_Fcat .

  W_FCAT
-TABNAME 'MARA'.
  W_FCAT
-FIELDNAME 'ERNAM'.
  W_FCAT
-SELTEXT_M 'Name of Person'.
  
APPEND w_fcat to t_Fcat .

  W_FCAT
-TABNAME 'MARA'.
  W_FCAT
-FIELDNAME 'PSTAT'.
  W_FCAT
-SELTEXT_M 'Maintenance status'.
  
APPEND w_fcat to t_Fcat .

  W_FCAT
-TABNAME 'MARA'.
  W_FCAT
-FIELDNAME 'MBRSH'.
  W_FCAT
-SELTEXT_M 'Industry sector'.
  
APPEND w_fcat to T_FCAT.

  W_LAYO
-ZEBRA 'X'.
  W_LAYO
-COLWIDTH_OPTIMIZE 'X'.

  
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  
EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
*   I_CALLBACK_PROGRAM                = ' '
*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_USER_COMMAND           = ' '
*   I_CALLBACK_TOP_OF_PAGE            = ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*     I_STRUCTURE_NAME             = 'MARA'
*   I_BACKGROUND_ID                   = ' '
     I_GRID_TITLE                      
='MATERIAL REPORT'
*   I_GRID_SETTINGS                   =
   IS_LAYOUT                         
W_LAYO
   IT_FIELDCAT                       
T_FCAT
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           =
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
    
TABLES
      T_OUTTAB                          
T_MARA[]
* EXCEPTIONS
*   PROGRAM_ERROR                     = 1
*   OTHERS                            = 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.

ENDFORM.                    " DISPLAY_DATA

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.