Saturday, February 6, 2016

Master Data Datasources

Datasources

Master Data Datasources

Datasource

Description

Tables

Notes

0GL_ACCOUNT_ATTR G/L Account NumberSKA1 :G/L Account Master (Chart of Accounts)
0EMPLOYEE_ATTREmployeeSAP Help Link

Delta for Master data datasources. : Click here




Selection Screen

Standard Reference Program : CHANGEDOCU_READ

Structure of a program
Report Heading : REPORT  <Zprogram> MESSAGE-ID <ZMessage Class> 
Message Class can be created in SE91
SELECTION-SCREEN
Different blocks of selection screen can be defined here.
INITIALIZATION
AT SELECTION-SCREEN Options like F4 Help for the selection screen options
AT SELECTION-SCREEN OUTPUT
AT SELECTION-SCREEN
here validations, authorizations are done
START-OF-SELECTION
Actual processing of data


Selection Screen block with select options and parameters
SELECTION-SCREEN BEGIN OF BLOCK sel WITH FRAME TITLE text-sel.
SELECT-OPTIONS:
  s_obj          FOR cdhdr-objectclas,
  s_obid         FOR cdhdr-objectid,
  s_chnr         FOR cdhdr-changenr.
PARAMETERS: p_user  LIKE cdhdr-username.
SELECTION-SCREEN END OF BLOCK sel.


Selection screen based on Radio button
type-pools: icon.
data: switch.
selection-screen begin of block b2 with frame title text-001.
parameters: radio radiobutton group rnd user-command test default 'X',
            radio2 radiobutton group rnd.
selection-screen end of block b2.
selection-screen begin of block b1 with frame title text-001.
parameters:
           test type bkpf-belnr modif id sc1.
selection-screen end of block b1.
selection-screen begin of block b3 with frame title text-001.
parameters:
           test1 type bkpf-belnr modif id sc2.
selection-screen end of block b3.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
  IF SCREEN-GROUP1 = 'SC1' AND RADIO EQ 'X'.
    SCREEN-ACTIVE = '0'.
    MODIFY SCREEN.
    CONTINUE.
  ELSEIF SCREEN-GROUP1 = 'SC2' AND RADIO2 EQ 'X'.
    SCREEN-ACTIVE = '0'.
    MODIFY SCREEN.
    CONTINUE.
  ENDIF.
ENDLOOP.

start-of-selection.

Selection screen options in one line / options side - by - side

This option does not work with dynamic selection screen based on radio button
SELECTION-SCREEN BEGIN OF BLOCK func WITH FRAME TITLE text-t06.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : p_dso RADIOBUTTON GROUP g1 USER-COMMAND comm DEFAULT 'X'.
SELECTION-SCREEN COMMENT 5(20) text-t01 FOR FIELD p_dso.
PARAMETERS :    p_wdso RADIOBUTTON GROUP g1.
SELECTION-SCREEN COMMENT 30(20)  text-t02 FOR FIELD p_wdso.
PARAMETERS :    p_md RADIOBUTTON GROUP g1.
SELECTION-SCREEN COMMENT 60(25)  text-t03.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK func.

 CHECK BOX

USING TOP

To have the extra top screen in the output of your ALV output

Data Declaration

DATA: lt_top TYPE slis_t_listheader,
             lw_top TYPE slis_listheader,

Populating Tables
  lw_top-typ = 'S'.
  lw_top-key = '<text>'.
  lw_top-info = <text>.
  APPEND lw_top TO lt_top.

using in ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
   I_CALLBACK_TOP_OF_PAGE            = 'TOP'
Uncomment 'I_CALLBACK_TOP_OF_PAGE ' in the ALV output and have 'TOP' as value

Form
FORM f_top.
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
     it_list_commentary       = lt_top.
ENDFORM.

Have the above form in the system even though it does not have a perform. just have the form copy paste.


Creating documentation 
In SE38 -> Documentation
This should give the documentation maintained for the program. If there is no documentation, you can click on create

You might get the following error when maintaining documentation.
Document is not available in language EN
Check in the program header, if message id is included.
The first line of the program should be
REPORT ZTEST MESSAGE-ID Z001.

You can either add the statement and click on Z001 ( or whatever you named it ) and create the message ID or go to se91 and create it. You need not add any messages over there.
Once the 'Message ID' is included in the code, GoTo Documentation . It open a word document. Edit it and save.

Now on you can see the documentation and can edit it whenever needed.


Table Manipulations



  • Deleting all records from database table
DELETE FROM <ztable-name>.
DELETE FROM <ztable-name> WHERE <field-name> EQ 'condition'.

  • Adding new records to an empty database table
If you are inserting new records, always use insert. When I used update, it didnot work.
LOOP AT lt_equip INTO lw_equip.
  INSERT ZEQUIP_SERNO FROM lw_equip.
CLEAR : lw_equip.
ENDLOOP.
IF sy-subrc EQ 0.
     COMMIT WORK.

  ENDIF.

  • Update and Modify
Update means it is only modify the record.
UPDATE <Table> FROM <work_area>.
Modify means it going to modify the record if it exists. If record is not there it going to add that record. 
  • Commit Work
Commit work is needed to commit the changes to table immediately. The commit can be placed inside the after each insert, but it takes lot more time.
https://scn.sap.com/thread/157718



Friday, February 5, 2016

ALE Delta and Change Pointers

Master data Delta mechanism
Master data delta explained

Change Pointers
ROOSGEN :
MSGTYP will give you the message type for that datasource. Taking an example of 0MAT_PLANT_ATTR : in production it has MSGTYP = RS0011

BD50 Or table TBDA2
we can see if the MSGTYPs are active.

BD52
Here we can see all 'Change document items' which are maintained for this Message Type. Only the fields where 'change document' checked in the dataelement can be present here.[ It also doesn't mean all the fields in the table where the change document is checked will be present. They need to be maintained, I GUESS ].

BD61
Activate Change Pointers Generally

TBD62
'Assignment of change document field to message type' can be seen. [I GUESS it kind of gives the same information as BD52, but in a tabular form . In this table, for the same 'Object Class' and 'Table Name' we find different Message Types.
For example, I am looking for 0MAT_PLANT_ATTR-TRAME and UMLC fields, which are from MARC table. Both of them have Change Documents enabled, but I am not seeing the delta picking up change in the fields. When I look into TBD62, I find entries for TRAME with Object class 'MATERIAL' Table 'MARC' , but they have different Message Class than RS0011. There are no entries for Message Class RS0011 for TRAME.I am ASSUMING that is the reason it is not picking up delta for these fields.

Re-running a failed Master data delta
How to Request a Failed Delta
Because the process indicators have been set to X, and there is nothing in RSA7, how do you request a failed delta.
The solution is to run program RSA1BDCP in the source system.
The ABAP does not validate the selection screen, as such I strongly advise you to validate and fill in all fields.
If a field is left blank, all data will be reset and thus your next delta will be a bit larger than intended!
This ABAP will reset the process indicator field on BDPCS to blank from a given data forward.
The process therefore to request a failed delta is:
  • Set the incorrect infopackage to green
  • Run RSA1BDCP for a date greater than the last successful delta
  • Rerun the delta infopackage




Links to refer




ECC Concepts