Saturday, 22 June 2013

Using Perform of one program in Another program

Example :

  PERFORM f_add_ser_cond IN PROGRAM znm_sc_r_qn_erro_disp IF FOUND
                            TABLES    i_cond2
                                      t_serialno
                                      lt_sernr
                            USING     matnr
                                      vwerk
                                      aufart
                                      repos
                             CHANGING lv_flag.

Tuesday, 18 June 2013

User Exit Table MODSAP

1. MODSAP is the table which has Exit name .
2. When you have a include of an exit, use the where used list and find the EXIT name.
3. Pass the Exit name to the MODSAP , then you can find the Enhancement name.

Wednesday, 12 June 2013

Disable Fields in Selection Screen of Report Program based on Authority Check.

1.  First check for Required condition ( Checking authorization in  current example) in INITIALIZATION . Based on condition use LOOP AT SCREEN to disable or make the field invisible.

Example       
  INITIALIZATION.
gv_readonly_flag 'X' .
 LOOP AT SCREEN.

      IF screen-name EQ 'P_R1'.
        break mavb.
        screen-invisible '1'.
        screen-active '0' .
        MODIFY SCREEN.
      ENDIF.

    ENDLOOP.



2. Keep a flag when you run the above code and copy the same code in  AT SELECTION-SCREEN OUTPUT.  as initially the field will be invisible in the selection screen but when the user press ENTER, the field will become visible as INITIALIZATION will be executed only once in the life of program, so when the user press enter the field will become visible. So we have to write the same code in  AT SELECTION-SCREEN OUTPUT.
Example

  AT SELECTION-SCREEN OUTPUT.
  IF gv_readonly_flag 'X' .
    LOOP AT SCREEN.

      IF screen-name EQ 'P_R1'.
        break mavb.
        screen-invisible '1'.
        screen-active '0' .
        MODIFY SCREEN.
      ENDIF.

    ENDLOOP.

  ENDIF.



Example with a scenario for Authorisation check :

  SELECTION-SCREEN  BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

PARAMETERS p_r1  RADIOBUTTON GROUP g1 ,
             p_r2  RADIOBUTTON GROUP g1 .

SELECTION-SCREEN END OF BLOCK b2.



  INITIALIZATION.

  CALL FUNCTION 'AUTHORITY_CHECK'
    EXPORTING
      user                sy-uname
      object              'ZQMCERTMGR'
      field1              'ZQMCRTACVT'
      value1              '01'
    EXCEPTIONS
      user_dont_exist     1
      user_is_authorized  2
      user_not_authorized 3
      user_is_locked      4
      OTHERS              5.

  IF sy-subrc NE 2.

    CALL FUNCTION 'AUTHORITY_CHECK'
      EXPORTING
        user                sy-uname
        object              'ZQMCERTMGR'
        field1              'ZQMCRTACVT'
        value1              '03'
      EXCEPTIONS
        user_dont_exist     1
        user_is_authorized  2
        user_not_authorized 3
        user_is_locked      4
        OTHERS              5.
    IF sy-subrc EQ .
      gv_readonly_flag 'X' .
    ELSEIF sy-subrc NE .
      MESSAGE 'User is not Authorised'(019TYPE 'E' .
      LEAVE TO LIST-PROCESSING.
      EXIT.
    ENDIF.
  ENDIF.

  IF gv_readonly_flag 'X' .

    LOOP AT SCREEN.

      IF screen-name EQ 'P_R1'.
        break mavb.
        screen-invisible '1'.
        screen-active '0' .
        MODIFY SCREEN.
      ENDIF.

    ENDLOOP.

  ENDIF.

AT SELECTION-SCREEN OUTPUT.
  IF gv_readonly_flag 'X' .
    LOOP AT SCREEN.

      IF screen-name EQ 'P_R1'.
        break mavb.
        screen-invisible '1'.
        screen-active '0' .
        MODIFY SCREEN.
      ENDIF.

    ENDLOOP.

  ENDIF.



Explanation : P_R1 and P_R2 are radion buttons. P_R1 is for write access and P_R2 is for read only report. So when we check for authorisation using the Authority_check function module, if user has authorisation for write access, authority FM with field value '01' will pass, if the user doesn't have write access , then we check for read access.If user has read access then we make the radio button P_R1 invisible as per above code.

Friday, 31 May 2013

OOPS ABAP Training Videos

oops website :-




below one is online tutorial of thomas jung:-


RM tiwary interesting blogs:-



Above links have been received from Pallav

Change Document CDHDR and CDPOS tables .

We can check the log in CDHDR and CDPOS tables or in transaction RSSCD100.



Below is to create a log in tables CDHDR and CDPOS for any table.

http://wiki.sdn.sap.com/wiki/display/ABAP/Change+Document

copy the below data from above link here.



CHANGE DOCUMENT:
This document briefly describes how to create a 'Change Document' for a business object.
Let us start with an example for clear understanding and to know the importance of the 'Change Document'.
  • Consider MM01 transaction, here MATNR is a primary key as well as 'Change Document Object'.
  • Now we try to create a Material in the MM01.
  • Now once we finish creating a material, we can find that a new material has been inserted not only from the MARA table or any other material related table but also from the tables 'CDHDR' or 'CDPOS'.The material we have created in 'CDHDR' table will be something like this.

Wednesday, 29 May 2013

Module Pool Normal Screen Length

Module Pool Normal Screen Length

height 200
width 255

i.e., Maintenance 200  255
Without Application tool bar check box should be checked.

Thursday, 23 May 2013

AT SELECTION-SCREEN ON SELECT_OPTIONS .

  SELECT-OPTIONS s_matnr FOR mara-matnr.       
OR
  SELECT-OPTIONS s_matnr FOR mara-matnr           NO INTERVALS.



  AT SELECTION-SCREEN ON s_matnr.
  PERFORM f_validate_matnr.



  *&---------------------------------------------------------------------*
*&      Form  F_VALIDATE_MATNR
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_validate_matnr .
  DATA lv_matnr TYPE matnr.
  CHECK s_matnr[] IS NOT INITIAL.
  SELECT SINGLE matnr                                       "#EC *
             INTO lv_matnr
             FROM mara
            WHERE matnr IN s_matnr.

  CHECK sy-subrc IS NOT INITIAL.
  MESSAGE 'Enter a valid Material'(021TYPE 'E'.

ENDFORM.                    " F_VALIDATE_MATNR