Archive

SAP: Selection-Screen as subscreen in dialog programming

There would be a time that you will have a certain selection-screen that is being used in more than one dynpro in your program. Instead of coding it for each dynpro, you could just create a subscreen on every dynpro and call the same selection-screen. In this way, you only have one code block for your selection-screen but able to display it on any dynpro you want within your program.

To do this, first create a subscreen area through the screen painter. As an example, let’s name this subscreen area as SUB_1. Now let say we want to call the selection-screen below into our subscreen area SUB_101.

  SELECTION-SCREEN BEGIN OF SCREEN 101 AS SUBSCREEN.
    SELECT-OPTIONS: p_comp FOR bseg-bukrs OBLIGATORY,
    p_cust FOR kna1-kunnr.
  SELECTION-SCREEN END OF SCREEN 101.

When calling a subscreen, we must call it in both the PBO and PAI sections of the flow logic of our main screen. The CALL SUBSCREEN statement tells the system to execute the PBO and PAI processing blocks for the subscreen as components of the PBO and PAI of the main screen. Please Refer to the code below.

  PROCESS BEFORE OUTPUT.
    MODULE STATUS_100.
    CALL SUBSCREEN SUB_101 INCLUDING sy-repid ‘101′.

  PROCESS AFTER INPUT.
    CALL SUBSCREEN SUB_1.
    MODULE USER_COMMAND_100.

SAP: Setting Attributes of Screen Objects Dynamically

In visual basic, you could easily change any property of a specific control dynamically. We could also do that in ABAP. The sample code below will show you the basics on how to loop on all objects in a screen and change its property at runtime.

Let say we have a set of textbox in our screen that contains details of a single customer from table KNA1(General Data in Customer Master). Now we want to disable all textboxes that has already a value on it so that empty textboxes are the only editable field in the screen. To do this, we need to create a code on PBO(Process Before Output) module that will loop on all objects in the screen.

But before we proceed with the coding, we have to specify a MODIF ID or Modification Group ID. This will enable us to modify object before the selection screen is displayed, using the statement MODIFY SCREEN. The name of the modification group ID must be directly specified and can have a maximum length of three characters. There are two ways to set the mod ID of an object.

One is through code:

PARAMETERS: p_sample TYPE c LENGTH 10 MODIF ID GR1.

In this sample code, we set the mod ID of p_sample to “GR1″

Another way is through screen painter:

On the screen painter, select a specific object on the screen and then go to its attributes(double click or press F2). A window will appear showing the attributes of the object. You will see 4 textboxes in a row which is indicated as Groups. Type-in GR1 in the first textbox. Close the attributes window and click save.

We could now create the codes that will loop on all objects in a screen. In our case, we only want to loop on all textboxes in a screen so set the mod ID of all textboxes to GR1.

FIELD-SYMBOLS : <FS> TYPE ANY.

LOOP AT SCREEN.
  IF SCREEN-GROUP1 = ‘GR1′.
    ASSIGN (SCREEN-NAME) TO <FS>.
    IF <FS> IS NOT INITIAL.
      SCREEN-INPUT    = ‘0′.
    ENDIF.
  ENDIF.
  MODIFY SCREEN.
ENDLOOP.

Using the code above, one loop pass is executed for every screen element of the current dynpro. SCREEN-NAME is the name of the element, SCREEN-GROUP1 refers to the modification group of the element, and SCREEN-INPUT is the input property of the element. MODIFY SCREEN affects the attributes input, output and invisible.

The table below shows the components of screen and their assignment to the field properties in the dynpro.

Component

Length

Type

Meaning

Attribute

name

132

C

Name of the screen field

Name

group1

3

C

Modification group 1

Group 1

group2

3

C

Modification group 2

Group2

group3

3

C

Modification group 3

Group3

group4

3

C

Modification group 4

Group4

required

1

C

Field input is mandatory

Mandatory field

input

1

C

Field is ready for input

Entry

output

1

C

Field is for display only

The output is as follows:

intensified

1

C

Field is highlighted

Highlighted

invisible

1

C

Field is suppressed

Invisible

length

1

X

Field length

VisLg

active

1

C

Field is active

Input/Output/Invisible

display_3d

1

C

Three-dimensional box

Two-dimensional

value_help

1

C

Input help button display

Input helps

request

1

C

Input exists

-


SAP: Table Pool Inconsistency (ATAB, KAPOL, etc.)

I am trying to perform a copy client when I encountered a pool tables inconsistency error.

The client copy log displays pool tables as incorrect: DDIC Error (See SE14).
These table pools have an inconsistent database object in field VARDATA in transaction SE14.

I tried to google for a solution and found out that this is an SAP known issue (Note 686357 - Table pool length incorrect after Unicode conversion).

Reason

As part of the Unicode migration or the new installation using UNICODE, the program UMG_POOL_TABLE is to be executed, which executes the report RADPOCNV.
The report sets the dictionary length for table pools that have to be converted during the Unicode migration due to the extension of the VARDATA field.
If you run the report repeatedly, the length values of the nametab and dictionary are also extended repeatedly which causes an inconsistency.

Solution

Run the program RATPONTC in transaction code SE38 to reset the dictionary and nametab lengths to the correct values. If this program does not yet exist in your system, import it from the attached archive. It contains the data fiels and co files. Copy them to your local harddisk and import them in accordance with Note 13719.

Click here to view the SAP note 686357. You must have a SAP Service Marketplace username and password.

SQL SERVER - Full Transaction Log (What to do)

Transaction log mechanism enables SQL Server to record all transactions before writing them to the database. This capability enables SQL Server to automatically recover the database to a consistent state when experiencing a power failure, operating system crash, and so forth.

The SQL Server transaction log can become full, which prevents further UPDATE, DELETE, or INSERT activity in the database.

One way to fix this is to back up and truncate the transaction logs.

BACKUP LOG <DbName> WITH TRUNCATE_ONLY

To save more disk space, we could shrink the truncated log file to it’s minimum size.

DBCC SHRINKFILE(<TransactionLogName>, 1)
BACKUP LOG <DbName> WITH TRUNCATE_ONLY
DBCC SHRINKFILE(<TransactionLogName>, 1)

Reliable Source of SAP eBooks and Articles

As a newbie in SAP, I always spend my time looking for a freee ebooks or pdf on SAP. Sure there are so many sites, webpages, blogs that offer information on SAP but not all of them are helpful. If I have any questions on SAP, I go directly at SAP Help to search for the answer. If I did not find what I’m looking for then I go to SDN (SAP Developers Network) to look for the answer, If I still didn’t find what I’m looking for, then I’ll post my problem on under the category that most fits my question.

I also recommend dbebooks as a great source of free SAP ebooks and pdf articles. And also, SAP Material is a great source of information on SAP that helps me in many ways.

Cool SAP Advertisement

I was randomly watching videos on youtube and I stumble upon this cool video ads of SAP.

SAP* Password Reset

When you forgot the password of SAP* user on a certain client on SAP, you could always reset it by deleting its record on your database.

DELETE FROM <db name>.USR02
WHERE BNAME=’SAP*’ AND MANDT=’<client no.>’

On the script above, <db name> is the database name of your system which is usually the same with system id and <client no.> is of course the specific client you want a password reset of SAP* user. Let say my system id is “flq” and i want to reset the password of SAP* on client 100, my script would be like this:

DELETE FROM flq.USR02
WHERE BNAME=’SAP*’ AND MANDT=’100′

Once you successfully run this script on your database, you could now log on to your system on a specific client by using SAP* and password = pass.

Note: SAP* user is activated when parameter login/no_automatic_user_sapstar is set to 0(zero).

SAP client copy

We always use client copy during the initial installation of the R/3 system. We create new clients by copying client 000 which is always available when you install the R/3 system. Other than that, we also use client copy to create test clients, deve clients, playground clients, training clients, production clients, etc. You could initially create new clients through tcode SCC4 and copy a client through tcode SCCL.

When copying a client, you could always select a components you want to be copied with the use of Copy Profiles. I googled for a list of copy profiles and help.sap.com always comes in handy. Here’s a list of common copy profiles for client copy.

SAP_USER - Users, user roles and authorization profiles are copied. The client is not reset.
SAP_UONL - User without authorization profile and role
SAP_PROF - Only authorization profile and roles
SAP_CUST - Client-specific customizing including authorization profile is copied. The application data is deleted, the user data is retained.
SAP_CUSV - SAP_CUST with variants
SAP_UCUS - SAP_CUST with user master data
SAP_UCSV - SAP_UCUS with variants
SAP_ALL - All client data and local data is copied.
SAP_APPL - SAP_ALL without user master data
SAP_AAPX - SAP_ALL without authorization profile and roles

Also remember that copying clients requires a large amount of system resources so always ensure that enough resources and database storage space are available.

ASP.NET: Passing URL Parameter From Hyperlink In Gridview

Setting the NavigateUrl property of a hyperlink control in gridview is very easy. But what if you want to pass the value of a specific field in your gridview as a url parameter of your hyperlink control? Well here’s how to do it.

Let say we have a customer list in a gridview and an edit link on the first column and customer id, name, and address on the following columns shown on the image below. Now we want to set the url of our edit link to customerEdit.aspx and at the same time pass the value of the customer id column as a url parameter.

To do this, create a template field for your first column and create a hyperlink control for your item template (See code below). Don’t forget to set the ID of this control because we will use it as reference. You will notice that we didn’t set the value of its navigateUrl property yet, it is because we want to set it row by row while we populate the gridview.

<Columns>
    <asp:TemplateField>
        <ItemTemplate>
           <asp:HyperLink ID=”EditLink” Text=”Edit…” runat=”server” />
        </ItemTemplate>
    </asp:TemplateField>

If you want your link to be an image instead of a text, you could always use the ImageUrl property of the hyperlink control.

<asp:HyperLink ID=”EditLink” ImageUrl=”~/Image/edit.png” runat=”server” />

In this example, my image “edit.png” is located inside the Image folder of my web application root directory.

Now lets move on to the next step, the setting of NavigateUrl property. We will set this property in each row while our datasource populates our gridview. To do this, we will be writing our code in the RowDataBound event of our gridview.

Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As _ System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound

    If e.Row.RowType = DataControlRowType.DataRow Then
        Dim myLink As HyperLink = CType(e.Row.FindControl(”EditLink”), HyperLink)
        myLink.NavigateUrl = “CustomerEdit.aspx?CustomerId=” & e.Row.Cells(1).Text
    End If

End Sub

The hyperlink control that we created will only be available on datarows, that’s why we have to check the rowtype of each row before we proceed on setting the hyperlink’s navigateUrl property. If we did not put the line If e.Row.RowType = DataControlRowType.DataRow, we will end up searching for a hyperlink control that is not available on the given row.

After we checked the rowtype and confirmed that the row is a datarow, we then now create a hyperlink variable called “myLink”. We use the code CType(e.Row.FindControl(”EditLink”), HyperLink) to search for the control on the current row with ID=”EditLink” and convert it to a hyperlink type control. We then set this control as the value of our hyperlink variable called “myLink”.

We now have access on a hyperlink control in a given row through “myLink” variable. In this example, we set its navigateUrl property to customerEdit.aspx and pass the value of customer id located in the 2nd column of our gridview as a url parameter called “customerID”.

Brain Test

I created my own account in tickle and got interested in their Brain Test. I was really impressed at my own result, never thought my left and right brain are perfectly working together fair and square. Hehe! It’s really fun you should try it.

Richard, you are Balanced-brained

That means you are able to draw on the strengths of both the right and left hemispheres of your brain, depending upon a given situation.

When you need to explain a complicated process to someone, or plan a detailed vacation, the left hemisphere of your brain, which is responsible for your ability to solve problems logically, might kick in. But if you were critiquing an art opening or coming up with an original way to file papers, the right side of your brain, which is responsible for noticing subtle details in things, might take over.

While many people have clearly dominant left- or right-brained tendencies, you are able to draw on skills from both hemispheres of your brain. This rare combination makes you a very creative and flexible thinker.

The down side to being balanced-brained is that you may sometimes feel paralyzed by indecision when the two hemispheres of your brain are competing to solve a problem in their own unique ways.