Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Abap

Former Member
0 Likes
954

Hi

This is vijay

1.what is the difference between select single and select up to 1 row?

2.How check errors in CallTransaction Method?

3.Which purpose to use Commentary in Alv?

8 REPLIES 8
Read only

Former Member
0 Likes
889

hi,

Reuse_ALV_Commentory_write is used to display header for every page. (similar to top of page)

After call transaction method, check sy-subrc. If it is not equal to 0, hten those are error records.

Nice explanation of differences between select single and select up to 1 rows is given in this link

Regards,

Sailaja.

Message was edited by: Sailaja N.L.

Read only

Former Member
0 Likes
889

1. In select single u have to specify the where condition with the key fields where as in select up to 1 rows it will retrieve the first record

2. DATA: ITAB TYPE TABLE OF BDCMSGCOLL.

CALL TRANSACTION 'SE38' USING BDCDATA MODE 'N'

<b>MESSAGES INTO ITAB.</b>

ITAB will contain all the error messages

3.Commentry is used to write the header in ALV and also to display logo

Read only

Former Member
0 Likes
889

Hello,

In SAP/ABAP if any operation fails, the corresponding system variable sy-subrc will have some interger value other than 0.

Check for this sys-subrc and hadle the errors.

ALV_COMMENTARY_WRITE is used to display header in ALV.

Regs,

Venkat

Read only

Former Member
0 Likes
889

hello,

1. select single gets one row from Database depending on some where condition. select up to 1 rows will get u the first row from Database.

2. In call transaction we have to manually handle errors. u declare an internal table like

IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 1 WITH HEADER LINE.

after CALL TRANSACTION , u check the message type

IF IT_BDCMSGCOLL-MSGTYP EQ 'E'.

<now collect details of record into itab>

ENDIF.

later u can process all these error records

3. REUSE_ALV_COMMENTARY_WRITE is mainly for the list headers when we use TOP_OF_PAGE event.

hope it helps.

reward if useful...

Read only

Former Member
0 Likes
889

Hi,

1.Select single and select upto one both fetch single

record but the difference is the select single does

single hit to database for fetching one record whereas

select upto i rows makes 2 hits.For using select

single it is good practice to mention all the primary

keys else the system will throw warning message.

2.For avoiding the error's in BDC it is good practice to

validate the data with master table before sending it

to the transaction.

3. ALV commentary write is used to insert pictures into

the ALV Layout.

Hope this helps.

Read only

Former Member
0 Likes
889

1> select single select any one data from DD table. normally its select first or last data. and slect up to one row select first row from DD table.

2> call transcation 'qs21' using mode 'N' message into itab.

3> Commentry write use for header and footer. trigger event top-of-page & end of page. Normally ppls know Commentry use for header but its also define footer also.

Read only

Former Member
0 Likes
889

HI Vijay,

Select single * from KNA1 where clause

---It fetches single record from the database, based on the condition you specified in the where clause.

Where as select * from kna1 up to 1 row

---Fetches first record if the condition specified in the where clause is satisfied, otherwise it doesn't fetch any record

A lot of people use the SELECT SINGLE statement to check for the existence of a value in a database prior to running a large report. Select singles are also used to look up values from a database where that value is going to be constant for the duration of the program run, or the value is being used to validate some user entry.

Other people prefer to use the 'UP TO 1 ROWS' variant of the SELECT statement.

So what's the difference between using 'SELECT SINGLE' statement as against a 'SELECT .... UP TO 1 ROWS' statement ?

If you're considering the statements

Code:

SELECT SINGLE field

INTO w_field

FROM table.

and

Code:

SELECT field

INTO w_field

FROM table

UP TO 1 ROWS.

ENDSELECT.

then looking at the result, not much apart from the extra ENDSELECT statement. Look at the run time and memeory usage and they may be worlds apart.

Why is this ?? The answer is simple.

The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.

The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause or lack of, applies any aggregate, ordering or grouping functions to them and then returns the first record of the resultant result set.

Get the difference ??

If not, then create a Ztable called ZDifference with 2 fields in it, MANDT of type MANDT and POSNR of type POSNR. Make sure both of these are keys. Also create a table maintenance dialog for it (SE11->Utilities->Table Maintenance Generator). Fill the table with ten rows 000001-000010.

Then run the program shown below:

Code:

  • Program: Z_Difference

  • Purpose: A program that demonstrates the difference

  • between SELECT SINGLE and SELECT UP TO n ROWS.

  • This program requires the data table Z_DIFFERENCE

  • to have been created according to the structure

  • outlined in the text above and populated with

  • at least 10 records.

  • Creation Date: 21/04/2004

  • Requested By:

  • Reference Doc:

  • Author: R Harper

  • Modification History:

  • Date Reason Transport Who

Report Z_Difference

Message-id 38

Line-Size 80

Line-Count 0

No Standard Page Heading.

Start-Of-Selection.

Data: w_Single type Posnr,

t_Rows type standard table of Posnr

initial size 0

with header line.

Select single Posnr

from zDifference

into w_Single.

Select Posnr

into table t_Rows

from zDifference

up to 1 rows

order by Posnr descending.

Write 😕 'Select single:', w_Single.

Skip 1.

Write 😕 'Up to 1 rows :'.

Loop at t_Rows.

Write t_Rows.

EndLoop.

You should see the output:

Code:

Select single: 000001

Up to 1 rows : 000010

The first 'SELECT' statement has selected the first record in the database according to any selection criteria in the 'WHERE' clause. This is what a 'SELECT SINGLE' does. The second 'SELECT' has asked the database to reverse the order of the records before returning the first row of the result.

In order to be able to do this the database has read the entire table, sort it and then return the first record. If there was no ORDER BY clause then the results would have been identical (ie both '000001') but the second select if given a big enough table to look at would be far slower.

Quote:

Program: Z_DIFFERENCE Line : 39

Syntax check warning

This warning is only displayed in SLIN.

Select single Posnr

^

Messages:

In "SELECT SINGLE ...", the WHERE condition for the key field "POSNR" does not test for equality. Therefore, the single record you are searching for may not be unique.

How will we handle the errors in call transaction method?

'/00' is generally the BDC_OKCODE for the ENTER key.

You don't need to know the list of the BDC_OKCODE s.

You go to the transaction SHDB.

You can execute any transaction here.

Then you can replay the execution of the trasaction afterwards.

Select 'display all screens' mode.

BDC_OKCODEs for each one functions you use is displayed on the screen.

Now, regarding the error handling in call transaction.

The BDCMSGCOLL does not have the messages text. It has only the message type, number and message parameters.

You have to read the message text. (recall that the database table T100 stores all the messages.)

There are more than one method of doing this.

Following is the psuedocode for one of the methods.

LOOP for the internal table IT1 which has data value from flat file.

call transcation using....

if SY-SUBRC <> 0.

Read the dictionary table T100 FOR ALL ENTRIES in BDCMSGCOLL.

(also use the condition T100-SPRAS = SY-LANGU (the log on language. This is because you need only the message texts in English if the user is logged in English language)

IF message type is E , then, transfer the contents of this particular error record to file x. (TRANSFER......)

( Ignore all other messages. Only consider type 'E' messages. Ignore other types of messages.)

(You can also store the message text from T100 and the error record in another internal table IT2)

.....

....

ENDLOOP.

Please note that the client might ask you for a file of records which could not be uploaded.

Give him the file created in the above psuedocode. (most often you will have to do this).

Otherwise just display the error messages and the error records in the internal table IT2 in the form of a list.

Thats it.

Alternatively,

Instead of

" Read the dictionary table T100 FOR ALL ENTRIES in BDCMSGCOLL."

you can use the function module

WRITE_MESSAGES to read the messages.

Please refer to the function module for the list of parameters.

REPORT ZTEST1234_ALV_TOP MESSAGE-ID ZZ .

DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.

DATA: L_VALID TYPE C,

V_FLAG,

V_DATA_CHANGE,

V_ROW TYPE LVC_S_ROW,

V_COLUMN TYPE LVC_S_COL,

V_ROW_NUM TYPE LVC_S_ROID.

"The Below Definitions Must.....

DATA:

  • Reference to document

DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT,

  • Reference to split container

DG_SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,

  • Reference to grid container

DG_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER,

  • Reference to html container

DG_HTML_CNTRL TYPE REF TO CL_GUI_HTML_VIEWER,

  • Reference to html container

DG_PARENT_HTML TYPE REF TO CL_GUI_CONTAINER.

"up to here

----


  • CLASS lcl_event_handler DEFINITION

----


CLASS LCL_EVENT_HANDLER DEFINITION .

PUBLIC SECTION .

METHODS:

**Hot spot Handler

HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID

IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,

**Double Click Handler

HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID

IMPORTING E_ROW E_COLUMN ES_ROW_NO,

TOP_OF_PAGE FOR EVENT TOP_OF_PAGE "event handler

OF CL_GUI_ALV_GRID

IMPORTING E_DYNDOC_ID.

ENDCLASS. "lcl_event_handler DEFINITION

----


  • CLASS lcl_event_handler IMPLEMENTATION

----


CLASS LCL_EVENT_HANDLER IMPLEMENTATION.

*Handle Hotspot Click

METHOD HANDLE_HOTSPOT_CLICK .

CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.

V_ROW = E_ROW_ID.

V_COLUMN = E_COLUMN_ID.

V_ROW_NUM = ES_ROW_NO.

MESSAGE I000 WITH V_ROW 'clicked'.

ENDMETHOD. "lcl_event_handler

*Handle Double Click

METHOD HANDLE_DOUBLE_CLICK.

ENDMETHOD. "handle_double_click

METHOD TOP_OF_PAGE. "implementation

  • Top-of-page event

PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.

ENDMETHOD. "top_of_page

ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION

&----


*& Global Definitions

&----


DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1

G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler

DATA: OK_CODE LIKE SY-UCOMM,

SAVE_OK LIKE SY-UCOMM,

G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',

GS_LAYOUT TYPE LVC_S_LAYO.

*- Fieldcatalog for First and second Report

DATA: IT_FIELDCAT TYPE LVC_T_FCAT,

X_FIELDCAT TYPE LVC_S_FCAT,

LS_VARI TYPE DISVARIANT.

*----


  • START-OF_SELECTION

*----


START-OF-SELECTION.

DATA:BEGIN OF ITAB OCCURS 0,

VBELN LIKE LIKP-VBELN,

POSNR LIKE LIPS-POSNR,

CELLCOLOR TYPE LVC_T_SCOL, "required for color

DROP(10),

END OF ITAB.

SELECT VBELN

POSNR

FROM LIPS

UP TO 20 ROWS

INTO CORRESPONDING FIELDS OF TABLE ITAB.

END-OF-SELECTION.

IF NOT ITAB[] IS INITIAL.

CALL SCREEN 100.

ELSE.

MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).

ENDIF.

&----


*& Form CREATE_AND_INIT_ALV

&----


  • text

----


FORM CREATE_AND_INIT_ALV .

DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.

"attention.....from here

"split your container here...into two parts

"create the container

CREATE OBJECT G_CUSTOM_CONTAINER

EXPORTING CONTAINER_NAME = G_CONTAINER1.

"this is for top of page

  • Create TOP-Document

CREATE OBJECT DG_DYNDOC_ID

EXPORTING STYLE = 'ALV_GRID'.

  • Create Splitter for custom_container

CREATE OBJECT DG_SPLITTER

EXPORTING PARENT = G_CUSTOM_CONTAINER

ROWS = 2

COLUMNS = 1.

  • Split the custom_container to two containers and move the reference

  • to receiving containers g_parent_html and g_parent_grid

"i am allocating the space for grid and top of page

CALL METHOD DG_SPLITTER->GET_CONTAINER

EXPORTING

ROW = 1

COLUMN = 1

RECEIVING

CONTAINER = DG_PARENT_HTML.

CALL METHOD DG_SPLITTER->GET_CONTAINER

EXPORTING

ROW = 2

COLUMN = 1

RECEIVING

CONTAINER = DG_PARENT_GRID.

"you can set the height of it

  • Set height for g_parent_html

CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT

EXPORTING

ID = 1

HEIGHT = 5.

"from here as usual..you need to specify parent as splitter part

"which we alloted for grid

CREATE OBJECT G_GRID

EXPORTING I_PARENT = DG_PARENT_GRID.

  • Set a titlebar for the grid control

CLEAR GS_LAYOUT.

GS_LAYOUT-GRID_TITLE = TEXT-003.

GS_LAYOUT-ZEBRA = SPACE.

GS_LAYOUT-CWIDTH_OPT = 'X'.

GS_LAYOUT-NO_ROWMARK = 'X'.

GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.

CALL METHOD G_GRID->REGISTER_EDIT_EVENT

EXPORTING

I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.

CREATE OBJECT G_HANDLER.

SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.

SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.

SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.

DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color

DATA: L_INDEX TYPE SY-TABIX.

"Here i am changing the color of line 1,5,10...

"so you can change the color of font conditionally

LOOP AT ITAB.

L_INDEX = SY-TABIX.

IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.

LS_CELLCOLOR-FNAME = 'VBELN'.

LS_CELLCOLOR-COLOR-COL = '6'.

LS_CELLCOLOR-COLOR-INT = '0'.

LS_CELLCOLOR-COLOR-INV = '1'.

APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.

MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.

LS_CELLCOLOR-FNAME = 'POSNR'.

LS_CELLCOLOR-COLOR-COL = '6'.

LS_CELLCOLOR-COLOR-INT = '0'.

LS_CELLCOLOR-COLOR-INV = '1'.

APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.

MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.

ENDIF.

ENDLOOP.

  • setting focus for created grid control

CALL METHOD CL_GUI_CONTROL=>SET_FOCUS

EXPORTING

CONTROL = G_GRID.

  • Build fieldcat and set editable for date and reason code

  • edit enabled. Assign a handle for the dropdown listbox.

PERFORM BUILD_FIELDCAT.

PERFORM SET_DRDN_TABLE.

  • Optionally restrict generic functions to 'change only'.

  • (The user shall not be able to add new lines).

PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.

**Vaiant to save the layout

LS_VARI-REPORT = SY-REPID.

LS_VARI-HANDLE = SPACE.

LS_VARI-LOG_GROUP = SPACE.

LS_VARI-USERNAME = SPACE.

LS_VARI-VARIANT = SPACE.

LS_VARI-TEXT = SPACE.

LS_VARI-DEPENDVARS = SPACE.

**Calling the Method for ALV output

CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

IT_TOOLBAR_EXCLUDING = LT_EXCLUDE

IS_VARIANT = LS_VARI

IS_LAYOUT = GS_LAYOUT

I_SAVE = 'A'

CHANGING

IT_FIELDCATALOG = IT_FIELDCAT

IT_OUTTAB = ITAB[].

"do these..{

  • Initializing document

CALL METHOD DG_DYNDOC_ID->INITIALIZE_DOCUMENT.

  • Processing events

CALL METHOD G_GRID->LIST_PROCESSING_EVENTS

EXPORTING

I_EVENT_NAME = 'TOP_OF_PAGE'

I_DYNDOC_ID = DG_DYNDOC_ID.

"end }

  • Set editable cells to ready for input initially

CALL METHOD G_GRID->SET_READY_FOR_INPUT

EXPORTING

I_READY_FOR_INPUT = 1.

ENDFORM. "CREATE_AND_INIT_ALV

&----


*& Form EXCLUDE_TB_FUNCTIONS

&----


  • text

----


  • -->PT_EXCLUDE text

----


FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.

  • Only allow to change data not to create new entries (exclude

  • generic functions).

DATA LS_EXCLUDE TYPE UI_FUNC.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.

APPEND LS_EXCLUDE TO PT_EXCLUDE.

ENDFORM. " EXCLUDE_TB_FUNCTIONS

&----


*& Form build_fieldcat

&----


  • Fieldcatalog

----


FORM BUILD_FIELDCAT .

DATA: L_POS TYPE I.

L_POS = L_POS + 1.

X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).

X_FIELDCAT-FIELDNAME = 'VBELN'.

X_FIELDCAT-TABNAME = 'IT_FINAL'.

X_FIELDCAT-COL_POS = L_POS.

X_FIELDCAT-NO_ZERO = 'X'.

X_FIELDCAT-OUTPUTLEN = '10'.

X_FIELDCAT-HOTSPOT = 'X'.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

L_POS = L_POS + 1.

X_FIELDCAT-SCRTEXT_M = 'Item'(025).

X_FIELDCAT-FIELDNAME = 'POSNR'.

X_FIELDCAT-TABNAME = 'IT_FINAL'.

X_FIELDCAT-COL_POS = L_POS.

X_FIELDCAT-OUTPUTLEN = '5'.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

L_POS = L_POS + 1.

X_FIELDCAT-SCRTEXT_M = 'Drop'(025).

X_FIELDCAT-FIELDNAME = 'DROP'.

X_FIELDCAT-TABNAME = 'IT_FINAL'.

X_FIELDCAT-COL_POS = L_POS.

X_FIELDCAT-OUTPUTLEN = '5'.

X_FIELDCAT-EDIT = 'X'.

X_FIELDCAT-DRDN_HNDL = '1'.

X_FIELDCAT-DRDN_ALIAS = 'X'.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

ENDFORM. " build_fieldcat

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'MAIN100'.

SET TITLEBAR 'MAIN100'.

IF G_CUSTOM_CONTAINER IS INITIAL.

**Initializing the grid and calling the fm to Display the O/P

PERFORM CREATE_AND_INIT_ALV.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

CASE SY-UCOMM.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Form SET_DRDN_TABLE

&----


  • text

----


FORM SET_DRDN_TABLE.

DATA:LT_DRAL TYPE LVC_T_DRAL,

LS_DRAL TYPE LVC_S_DRAL.

LOOP AT ITAB .

  • First listbox (handle '1').

IF SY-INDEX = 1.

LS_DRAL-HANDLE = '1'.

LS_DRAL-VALUE = ' '.

LS_DRAL-INT_VALUE = ' '.

ELSE.

LS_DRAL-HANDLE = '1'.

LS_DRAL-VALUE = ITAB-POSNR.

LS_DRAL-INT_VALUE = ITAB-POSNR.

ENDIF.

APPEND LS_DRAL TO LT_DRAL.

ENDLOOP.

**Setting the Drop down table for Reason Code

CALL METHOD G_GRID->SET_DROP_DOWN_TABLE

EXPORTING

IT_DROP_DOWN_ALIAS = LT_DRAL.

ENDFORM. " set_drdn_table

&----


*& Form EVENT_TOP_OF_PAGE

&----


  • text

----


  • -->DG_DYNDOC_ID text

----


FORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.

"this is more clear.....check it

"first add text, then pass it to comentry write fm

DATA : DL_TEXT(255) TYPE C. "Text

  • Populating header to top-of-page

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = 'Test Report'

SAP_STYLE = CL_DD_AREA=>HEADING.

  • Add new-line

CALL METHOD DG_DYNDOC_ID->NEW_LINE.

CLEAR : DL_TEXT.

  • Move program ID

CONCATENATE 'Program Name :' SY-REPID

INTO DL_TEXT SEPARATED BY SPACE.

  • Add Program Name to Document

PERFORM ADD_TEXT USING DL_TEXT.

  • Add new-line

CALL METHOD DG_DYNDOC_ID->NEW_LINE.

CLEAR : DL_TEXT.

  • Move User ID

CONCATENATE 'User ID :' SY-UNAME INTO DL_TEXT SEPARATED BY SPACE

.

  • Add User ID to Document

PERFORM ADD_TEXT USING DL_TEXT.

  • Add new-line

CALL METHOD DG_DYNDOC_ID->NEW_LINE.

CLEAR : DL_TEXT.

  • Move Client

CONCATENATE 'Client :' SY-MANDT INTO DL_TEXT SEPARATED BY SPACE.

  • Add Client to Document

PERFORM ADD_TEXT USING DL_TEXT.

  • Add new-line

CALL METHOD DG_DYNDOC_ID->NEW_LINE.

CLEAR : DL_TEXT.

  • Move date

WRITE SY-DATUM TO DL_TEXT.

CONCATENATE 'Date :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.

  • Add Date to Document

PERFORM ADD_TEXT USING DL_TEXT.

  • Add new-line

CALL METHOD DG_DYNDOC_ID->NEW_LINE.

CLEAR : DL_TEXT.

  • Move time

WRITE SY-UZEIT TO DL_TEXT.

CONCATENATE 'Time :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.

  • Add Time to Document

PERFORM ADD_TEXT USING DL_TEXT.

  • Add new-line

CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  • Populating data to html control

PERFORM HTML.

ENDFORM. " EVENT_TOP_OF_PAGE

&----


*& Form ADD_TEXT

&----


  • To add Text

----


FORM ADD_TEXT USING P_TEXT TYPE SDYDO_TEXT_ELEMENT.

  • Adding text

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = P_TEXT

SAP_EMPHASIS = CL_DD_AREA=>HEADING.

ENDFORM. " ADD_TEXT

&----


*& Form HTML

&----


  • text

----


FORM HTML.

DATA : DL_LENGTH TYPE I, " Length

DL_BACKGROUND_ID TYPE SDYDO_KEY VALUE SPACE. " Background_id

  • Creating html control

IF DG_HTML_CNTRL IS INITIAL.

CREATE OBJECT DG_HTML_CNTRL

EXPORTING

PARENT = DG_PARENT_HTML.

ENDIF.

  • Reuse_alv_grid_commentary_set

CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'

EXPORTING

DOCUMENT = DG_DYNDOC_ID

BOTTOM = SPACE

IMPORTING

LENGTH = DL_LENGTH.

  • Get TOP->HTML_TABLE ready

CALL METHOD DG_DYNDOC_ID->MERGE_DOCUMENT.

  • Set wallpaper

CALL METHOD DG_DYNDOC_ID->SET_DOCUMENT_BACKGROUND

EXPORTING

PICTURE_ID = DL_BACKGROUND_ID.

  • Connect TOP document to HTML-Control

DG_DYNDOC_ID->HTML_CONTROL = DG_HTML_CNTRL.

  • Display TOP document

CALL METHOD DG_DYNDOC_ID->DISPLAY_DOCUMENT

EXPORTING

REUSE_CONTROL = 'X'

PARENT = DG_PARENT_HTML

EXCEPTIONS

HTML_DISPLAY_ERROR = 1.

IF SY-SUBRC NE 0.

MESSAGE I999 WITH 'Error in displaying top-of-page'(036).

ENDIF.

ENDFORM. " HTML

Regards,

Laxmi.

Read only

Former Member
0 Likes
889

hi ,

1.select single is used when all the primary key fields are used.

select upto one row is used if all key fields are not used in th where clause.

3.Inorder to print the text in the header and footer of the ALV report .we use the function module REUSE_ALV_COMMENTARY_WRITE

regards

sudha

Message was edited by: Sudha Vutukuru