Pages

Tuesday, December 29, 2009

Creating ALV toolbar

wa_excl = cl_gui_alv_grid=>MC_MB_SUBTOT.
APPEND wa_excl to it_excl.
wa_excl = cl_gui_alv_grid=>MC_FC_FIND_MORE.
APPEND wa_excl to it_excl.


* Call Grid method to display ALV Table
CALL METHOD obj_grid->set_table_for_first_display
EXPORTING
is_layout = wa_layout
it_toolbar_excluding = it_excl
CHANGING
it_outtab = it_main
it_fieldcatalog = it_fcat
it_sort = it_sort
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.

Thursday, December 24, 2009

Display Error/Success/Warning messages at end of ALV report display in POP-UP Window

Use this Fm to display error messages. We can type in the Error type and it will give appropriate icons.

DATA: lwa_display_profile TYPE bal_s_prof,
lwa_log TYPE bal_s_log,
lwa_msg TYPE bal_s_msg.
DATA: lv_mess1 TYPE char50,
lv_mess2 TYPE string,
lv_prog TYPE sy-repid,
lv_title TYPE string.

* Define Grid Title
lv_prog = sy-repid.
lv_title = 'Overtime Equalization Report - Error Log'(044).

IF gv_err_flag IS INITIAL."Control should get inside this IF only
"for the first time user presses the 'Error Log'
"Button the mesages shud be read.It shud not be read repeatedly
"as the LOG HANDLER will be retained in memory and messages can be accessed using that

*****************************************************
* Call Error Log as a Pop-Up display *
*****************************************************
* $1: Create an initial log file
CALL FUNCTION 'BAL_LOG_CREATE'
EXPORTING
i_s_log = lwa_log
IMPORTING
e_log_handle = gv_log_handle
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE 'Error Log could not be displayed'(048) TYPE c_mess_i.
LEAVE LIST-PROCESSING.
ENDIF.
* $2: Add Error messages from Error log table to Message display FM

"Use Message number 000 from Message class ZHPT. This number is reserved
"for custom program message and contains '&&&&'. This will be replaced
"by Text passed in the Variables MSGV1,MSGV2,MSGV3,MSGV4

lwa_msg-msgid = c_msg_zhpt.
lwa_msg-msgno = c_msg_000.
lwa_msg-msgty = c_mess_e.

LOOP AT p_it_error INTO wa_error. "Internal table with error message which has been *collected during program execution.
* Derive message text
lwa_msg-msgv1 = wa_error-person.
lwa_msg-msgv2 = c_dash.
MOVE wa_error-mess TO lv_mess1.
lwa_msg-msgv3 = lv_mess1.
SHIFT wa_error-mess BY 50 PLACES LEFT.
MOVE wa_error-mess TO lv_mess2.
lwa_msg-msgv4 = lv_mess2.

* Add message to log file
CALL FUNCTION 'BAL_LOG_MSG_ADD'
EXPORTING
i_log_handle = gv_log_handle
i_s_msg = lwa_msg
EXCEPTIONS
OTHERS = 1.

ENDLOOP.
gv_err_flag = c_x.

ELSE.
* This when the Error log is displayed more than once i.e. the
* user presses the 'Error Log' button more for the next time.
* This code increases the performance as it reads the messages
* from the LOG_HANDLER which was created at the first time.

CLEAR lwa_msg.

CALL FUNCTION 'BAL_LOG_MSG_ADD'
EXPORTING
i_log_handle = gv_log_handle
i_s_msg = lwa_msg
EXCEPTIONS
OTHERS = 1.

ENDIF.

* $4: Get a prepared profile

CALL FUNCTION 'BAL_DSP_PROFILE_POPUP_GET'
IMPORTING
e_s_display_profile = lwa_display_profile
.

* Use grid for display of Error Messages
lwa_display_profile-use_grid = c_x.

* Set report to allow saving of variants
lwa_display_profile-disvariant-report = lv_prog.
* Set Title
lwa_display_profile-title = lv_title.
* when you use also other ALV lists in your report,
* please specify a handle to distinguish between the display
* variants of these different lists, e.g:
lwa_display_profile-disvariant-handle = c_err_log.

* $5: Call display function module

* We do not specify any filter (like LWA_LOG_FILTER, ...,
* LT_MSG_HANDLE) since we want to display all logs available

CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'
EXPORTING
i_s_display_profile = lwa_display_profile
EXCEPTIONS
profile_inconsistent = 1
internal_error = 2
no_data_available = 3
no_authority = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE 'Error Log could not be displayed'(048) TYPE c_mess_i.
LEAVE LIST-PROCESSING.
ENDIF.

Table maintenace generator events

http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=93454609


http://help.sap.com/saphelp_nw04s/helpdata/EN/91/ca9f0ea9d111d1a5690000e82deaaa/content.htm

Monday, December 21, 2009

ALV with row selection

1:
*
MODULE user_command_0001 INPUT.
CASE sy-ucomm.
WHEN gc_back.
LEAVE TO SCREEN 0.
WHEN gc_exit OR gc_cancel.
LEAVE PROGRAM.
WHEN gc_select.
PERFORM read_selected_row.
WHEN gc_download.
PERFORM download.
ENDCASE. "sy-ucomm
ENDMODULE. " USER_COMMAND_0001 INPUT

2:
FORM read_selected_row .
DATA: li_index TYPE lvc_t_roid,
lwa_index TYPE lvc_s_roid,
lv_line TYPE i.

CALL METHOD lv_alv_grid->get_selected_rows
IMPORTING
* ET_INDEX_ROWS =
et_row_no = li_index
.
* Get the number of lines selected
DESCRIBE TABLE li_index LINES lv_line.

IF lv_line IS INITIAL.
MESSAGE e000(zpp) WITH text-047.
ELSE.
LOOP AT gi_final INTO gwa_final.
READ TABLE li_index INTO lwa_index WITH KEY row_id = sy-tabix.
IF sy-subrc = 0.
SET PARAMETER ID gc_mat FIELD gwa_final-matnr.
SET PARAMETER ID gc_wrk FIELD gwa_final-werks.
SET PARAMETER ID gc_pln FIELD gwa_final-plnnr.
IF gwa_final-plnty = gc_r.
CALL TRANSACTION gc_ca23 AND SKIP FIRST SCREEN.
ELSEIF gwa_final-plnty = gc_n.
CALL TRANSACTION gc_ca03 AND SKIP FIRST SCREEN.
ENDIF.
ENDIF. "sy-subrc = 0
ENDLOOP. "AT gi_final
ENDIF. "lv_line IS INITIAL

ENDFORM. " READ_SELECTED_ROW

Display Internal Table as ALV popup screen




This can be done using normal 'REUSE_ALV_GRID_DISPLAY' by mentioning the 'X' co-ordinate in the Importing parameters of the FM. Following code describes the way:

data:lt_fcat TYPE slis_t_fieldcat_alv,
lwa_fcat TYPE slis_fieldcat_alv.

CONSTANTS: c_fcat_pop TYPE lvc_tname VALUE 'IT_ERROR'.

REFRESH lt_fcat.
CLEAR lwa_fcat.

lwa_fcat-fieldname = 'PERSON'.
lwa_fcat-tabname = c_fcat_pop.
lwa_fcat-seltext_m = 'PERNR/Identifier'.
APPEND lwa_fcat TO lt_fcat.
CLEAR lwa_fcat.

lwa_fcat-fieldname = 'MESS'.
lwa_fcat-tabname = c_fcat_pop.
lwa_fcat-seltext_m = 'Error Message'.
lwa_fcat-outputlen = 100.
APPEND lwa_fcat TO lt_fcat.
CLEAR lwa_fcat.
*****************************************************
* Call ALV POP-UP FM to display table *
*****************************************************
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-repid
* 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 =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
IT_FIELDCAT = lt_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 = 30
I_SCREEN_START_LINE = 10
I_SCREEN_END_COLUMN = 100
I_SCREEN_END_LINE = 20

* 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 = p_it_error
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE i000 WITH 'Error calling Pop-Up screen'.
LEAVE TO TRANSACTION c_tcode.
ENDIF.

Thursday, December 17, 2009

ALV to Excel - number formatting (2.0E + 11)

read a suggestion somewhere to use ' or a single code as shown below.
Not sure if it works or not but just came across so updated it.

constant: c_quote value `'`.

loop at data_tab assigning .

concatentate c_quote -ean into wa_ean.

-ean = wa_ean.

endloop.

Tuesday, December 15, 2009

Restricting Select-option field values check on Selection screen

This FM will restrict any system check on the Select option field on selection screen.
with this we can enter a low HIGH value on the then Select-option field.

*&---------------------------------------------------------------------*
*& Form NO_SEL_OPTION_CHECK
*&---------------------------------------------------------------------*
* This code restricts any check on the DATE field of the Selection
* screen. This is done so that no comparison of dates happen when User
* enters the DATE-HIGH value. DATE-LOW is dependent on DATE-HIGH which
* is calculated after DATE-HIGH is entered.
*----------------------------------------------------------------------*
FORM no_sel_option_check .
DATA: lt_s_option TYPE TABLE OF rsldbselop,
lwa_s_option TYPE rsldbselop.

lwa_s_option-name = 'S_DATE'.
APPEND lwa_s_option TO lt_s_option.


CALL FUNCTION 'RS_SELOPT_NO_INTERVAL_CHECK'
EXPORTING
program = sy-repid
TABLES
selop = lt_s_option
EXCEPTIONS
no_programname = 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. " NO_SEL_OPTION_CHECK

Sending mail from SAP + Attachment as ADOBE form

1: Call form:

TRY .
* First get name of the generated function module
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = p_formname
IMPORTING
e_funcname = lv_form_name.
CATCH cx_fp_api_repository INTO obj_root.
wa_err-person = p_mailtab-perid.
wa_err-desc = obj_root->get_text( ).
APPEND wa_err TO it_err.
CLEAR wa_err.
ENDTRY.


2: Set output params. open Job for processing:


* Set output parameters and open spool job
wa_outputparams-nodialog = c_x. " suppress printer dialog popup
wa_outputparams-preview = space. " launch print preview
wa_outputparams-getpdf = c_x.

CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = wa_outputparams
EXCEPTIONS
cancel = 0
usage_error = 0
system_error = 0
internal_error = 0
OTHERS = 0.
* Processing should continue inspite of errors
* so made Sy-Subrc as 0

* Set form language and country (->form locale)
wa_docparams-langu = lc_language.
wa_docparams-country = lc_country.


3: Call the Form. Also error from an adobe form can be caught in following way:


* Pass Data to the Form Interface
CALL FUNCTION lv_form_name
EXPORTING
/1bcdwb/docparams = wa_docparams
t_stud_data = wa_mailtab1
IMPORTING
/1bcdwb/formoutput = wa_pdfobject
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.

CLEAR wa_err.
* This FM captures any Error which has resulted during
* Form generation
CALL FUNCTION 'FP_GET_LAST_ADS_ERRSTR'
IMPORTING
e_adserrstr = wa_err-desc.


5: Convert PDF to SOLIX:

This is most important for PDF as an attachment


* Convert PDF Object to type SOLIX
CALL METHOD cl_document_bcs=>xstring_to_solix
EXPORTING
ip_xstring = wa_pdfobject-pdf
RECEIVING
rt_solix = it_attachment.


6: Mail sending part:

* Initialize Mail creation
TRY.
obj_send_request = cl_bcs=>create_persistent( ).

* Set sender Email address
obj_sender =
cl_cam_address_bcs=>create_internet_address( lc_id_from ).
obj_send_request->set_sender( i_sender = obj_sender ).

7: set email IDs:


* Get Recipient's Email IDs

MOVE p_mailtab-email TO lv_recv_id.
obj_recipient =
cl_cam_address_bcs=>create_internet_address( lv_recv_id ).
obj_send_request->add_recipient(
i_recipient = obj_recipient
i_express = c_x
).



8: Attaching the Doc and sending mail:


" create documents
obj_document = cl_document_bcs=>create_document(
i_type = lc_type_raw " RAW document format
i_text = it_contents
i_subject = lv_subject
).

obj_document->add_attachment(
i_attachment_type = lc_type_pdf " add PDF attachment
i_attachment_subject = 'Official Notice'(046)
i_att_content_hex = it_attachment
).
obj_send_request->set_document( obj_document ).
**********************************************************************

" send email
obj_send_request->set_send_immediately( c_x ).
lv_ret = obj_send_request->send( ). "#EC NEEDED

CATCH cx_bcs INTO obj_root.
wa_err-person = p_mailtab-perid.
wa_err-desc = obj_root->get_text( ).
APPEND wa_err TO it_err.
CLEAR wa_err.
p_return = 1.
ENDTRY.

COMMIT WORK.


* Close spool job
CALL FUNCTION 'FP_JOB_CLOSE'
EXCEPTIONS
usage_error = 0
system_error = 0
internal_error = 0
OTHERS = 0.
* Should not throw Errors and processing should continue

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

Display ALV Grid as well as List Header using HTML Control

1: Use ALV Split container to create space at Top for header and below it for ALV Grid:
{code}
* First Main Container
CREATE OBJECT obj_container
EXPORTING
container_name = 'CC_CONTAINER'
style = cl_gui_custom_container=>ws_maximizebox.

* Splitter Container
CREATE OBJECT obj_splitter
EXPORTING
parent = obj_container
rows = 2
columns = 1.

* Set the height of Top of page
CALL METHOD obj_splitter->set_row_height
EXPORTING
id = 1
height = 30.

* Place obj_parent_html in First row First column
* for Top_of_page
CALL METHOD obj_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = obj_parent_html.

* Place ALV grid display in Second row First column
CALL METHOD obj_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = obj_parent_grid.

* Create ALV grid Object
CREATE OBJECT obj_grid
EXPORTING
i_parent = obj_parent_grid.
{code}

2:set two diff. events for List display and Grid display
{code}
* Set Event Handler for TOP_OF_PAGE
SET HANDLER obj_event->on_top_of_page FOR obj_grid.
SET HANDLER obj_event->on_grid_top_of_page FOR obj_grid.
{code}

3: define local classes:
{code}
CLASS lcl_event_receiver DEFINITION FINAL.
* event receiver definitions for ALV actions
PUBLIC SECTION.
METHODS:
* Handle List output Top-Of-Page
on_top_of_page
FOR EVENT print_top_of_page OF cl_gui_alv_grid,
*Handle grid Top_Of_Page
on_grid_top_of_page
FOR EVENT top_of_page OF cl_gui_alv_grid
IMPORTING
e_dyndoc_id.

PRIVATE SECTION.
DATA: lv_endda TYPE endda.
ENDCLASS. "lcl_event_receiver DEFINITION

CLASS lcl_event_receiver IMPLEMENTATION.

* Create the Text to be dispalyed at top of page of ALV List Output
METHOD on_top_of_page.
* Will be hit only when ALV List Display is called
PERFORM display_list_top.
ENDMETHOD. "On_top_of_page

* Create Top_Of_Page display for ALV Grid Output
METHOD on_grid_top_of_page.
* top-of-page event
PERFORM event_top_of_page USING obj_dyndoc_id.
e_dyndoc_id = obj_dyndoc_id.
ENDMETHOD. "create_top_of_page

ENDCLASS. "lcl_event_receiver IMPLEMENTATION


4:Make it know to ALV grid about the Top of page event. Code this in MODULE ALV_DISPLAY:
{code}
* Create top-document
CREATE OBJECT obj_dyndoc_id
EXPORTING
style = 'ALV_GRID'.

* Initializing document
CALL METHOD obj_dyndoc_id->initialize_document.

* Processing events
CALL METHOD obj_grid->list_processing_events
EXPORTING
i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = obj_dyndoc_id.
{code}

5: this object "obj_dyndoc_id" will use different methods to decorate the top page.
Like adding gaps:
"Put Header in center
CALL METHOD p_dyndoc_id->add_gap
EXPORTING
width = 200.

Adding text:
"Add Text to Header
CALL METHOD p_dyndoc_id->add_text
EXPORTING
text = lv_text
sap_style = cl_dd_area=>heading.

OR
CALL METHOD p_dyndoc_id->add_text
EXPORTING
text = lv_text
sap_fontsize = cl_dd_area=>large
sap_emphasis = cl_dd_area=>strong.

Use the constructor of class: CL_DD_AREA to define style and colors.

6: Different objects use are:

obj_container TYPE REF TO cl_gui_custom_container,
obj_splitter TYPE REF TO cl_gui_splitter_container,
obj_parent_grid TYPE REF TO cl_gui_container,
obj_grid TYPE REF TO cl_gui_alv_grid,
obj_dyndoc_id TYPE REF TO cl_dd_document,"reference to document
gv_title TYPE lvc_title,
obj_event TYPE REF TO lcl_event_receiver,
obj_parent_html TYPE REF TO cl_gui_container,"reference to html container
obj_html_cntrl TYPE REF TO cl_gui_html_viewer.

Tuesday, December 8, 2009

Table Maintenance Generator / Maintenance Transaction

Table maintenance generator is important for maintaining the values in the Table i.e for entering values, deleting entries , modifying etc. Tcode SM30 can be used for this purpose

General doubts:
1: creating Function Group: Creating a FG from SE37 is not needed. Just mention the name of the FG and while creating the Maint. gen. this FG will be created.

2: Maint. Screem:
case A: On selecting One screen, when new entries are selected, the input space will be created on the 1st screen itself.
case B: when two screen selected, indivizual entries can be created in the SM30 maintenance screen.

3: Creating TCODE for Maint. a table: Use SE93, Transaction for (Parameter option).
mention : skip initial screen.
viewname = table name
update = 'X'

Wednesday, December 2, 2009

split string at length

DO.
move string to lv_char132.
SHIFT string by 132 PLACES left.
wa_tab-string = lv_char132.
APPEND wa_tab to it_tab.

IF string is INITIAL.
exit.
ENDIF.
ENDDO.

Useful Function Module link

http://www.sap-img.com/abap/function-list.htm

Monday, November 30, 2009

POPUP Function modules used in SAP

WS_MSG - Create a dialog box in which you display an one-line message.

POPUP_TO_CONFIRM_STEP - Create a dialog box in which you make a question whether the user wishes to perform the step.

POPUP_TO_CONFIRM_WITH_MESSAGE - Create a dialog box in which you inform the user about a specific decision point during an action.

POPUP_TO_CONFIRM_WITH_VALUE - Create a dialog box in which you make a question whether the user wishes to perform a processing step with a particular object.

POPUP_TO_DECIDE - Provide user with several choices as radio buttons

POPUP_TO_DECIDE_WITH_MESSAGE - Create a dialog box in which you inform the user about a specific decision point via a diagnosis text.

POPUP_TO_DISPLAY_TEXT - Create a dialog box in which you display a two-line message.

POPUP_TO_SELECT_MONTH - Popup to choose a month

POPUP_WITH_TABLE_DISPLAY - Provide a display of a table for user to select one, with the value of the table line returned when selected.

POPUP_TO_CONFIRM - Pop-up dialog confirm an action before it is carried out.

POPUP_TO_DISPLAY_TEXT - Displays a text in a modal screen

POPUP_TO_INFORM - Displays several lines of text. No OK or Cancel buttons.

TH_POPUP - Display a popup system message on a specific users screen.

POPUP_TO_CONFIRM_LOSS_OF_DATA - Create a dialog box in which you make a question whether the user wishes to perform a processing step with loss of data.

POPUP_TO_CONFIRM_STEP - Create a dialog box in which you make a question whether the user wishes to perform the step.

POPUP_TO_CONFIRM_WITH_MESSAGE - Create a dialog box in which you inform the user about a specific decision point during an action.

POPUP_TO_CONFIRM_WITH_VALUE - Create a dialog box in which you make a question whether the user wishes to perform a processing step with a particular object.

POPUP_TO_DECIDE - Provide user with several choices as radio buttons

POPUP_TO_DECIDE_WITH_MESSAGE - Create a dialog box in which you inform the user about a specific decision point via a diagnosis text.

POPUP_TO_DISPLAY_TEXT - Create a dialog box in which you display a two-line message.

POPUP_WITH_TABLE_DISPLAY - Provide a display of a table for user to select one, with the value of the table line returned when selected.

POPUP_TO_CONFIRM_LOSS_OF_DATA - Create a dialog box in which you make a question whether the user wishes to perform a processing step with loss of data.

POPUP_TO_CONFIRM_STEP - Create a dialog box in which you make a question whether the user wishes to perform the step.

POPUP_TO_CONFIRM_WITH_MESSAGE - Create a dialog box in which you inform the user about a specific decision point during an action.

POPUP_TO_CONFIRM_WITH_VALUE - Create a dialog box in which you make a question whether the user wishes to perform a processing step with a particular object.

POPUP_TO_DECIDE - Provide user with several choices as radio buttons

POPUP_TO_DECIDE_WITH_MESSAGE - Create a dialog box in which you inform the user about a specific decision point via a diagnosis text.

POPUP_TO_DISPLAY_TEXT - Create a dialog box in which you display a two-line message.

POPUP_WITH_TABLE_DISPLAY - Provide a display of a table for user to select one, with the value of the table line returned when selected.

Docking container with events. my code

*& -–-------------------------------------------*
*& Title : Report for Garnishing Data (0194)
*& Author : Asinha
*& Description : Functional Description
*& Created : 21/07/2009
*& Modified : ModifiedDate
*& Modification History : Changes made to the code
*& Notes : Miscellaneous Comment (ifany)
*&----------------------------------------------*

REPORT ytestgarn2.
*Tables
TABLES: pernr,pa0194.

INFOTYPES : 0194 NAME gt_garn,
0000.

* Global Includes
INCLUDE ytestgarn2_top.


******************************
* Selection Screen *
******************************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: p_orign FOR pa0194-orign OBLIGATORY DEFAULT 'AL',
p_gprio FOR pa0194-gprio.
SELECTION-SCREEN END OF BLOCK b1.

******************************
* At Selection Screen Events *
******************************

START-OF-SELECTION.

GET pernr.

LOOP AT gt_garn INTO wa_garn WHERE gprio IN p_gprio
AND orign IN p_orign.
IF sy-subrc = 0.

"move to final table
PERFORM get_data USING wa_garn CHANGING wa_outtab.
* gv_cnt_ma = gv_cnt_ma + 1.
* wa_outtab-num = gv_cnt_ma.
APPEND wa_outtab TO gt_outtab1.
CLEAR wa_outtab.

ENDIF.

ENDLOOP.


END-OF-SELECTION.

** For sumation of no. of records
* LOOP AT gt_outtab1 INTO wa_outtab.
* MOVE wa_outtab TO wa_outtab2.
* AT NEW jurs.
* gv_cnt_ma = gv_cnt_ma + 1.
* wa_outtab2-num = gv_cnt_ma.
* APPEND wa_outtab2 TO gt_outtab2.
* CLEAR wa_outtab2.
* ENDAT.
* ENDLOOP.

IF gt_outtab1 IS NOT INITIAL.
PERFORM fcat_build.
PERFORM alv_tree_display.
ELSE.
MESSAGE 'No data to display' TYPE 'I'.
ENDIF.


*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_WA_GARN text
* <--P_WA_OUTTAB text
*----------------------------------------------------------------------*
FORM get_data USING p_wa_garn TYPE p0194
CHANGING p_wa_outtab TYPE ty_outtab.

p_wa_outtab-pernr = p_wa_garn-pernr.
p_wa_outtab-jurs = p_wa_garn-orign.
p_wa_outtab-case_no = p_wa_garn-gcase.
p_wa_outtab-prio = p_wa_garn-gprio.
p_wa_outtab-status = p_wa_garn-gstat.
p_wa_outtab-type = p_wa_garn-orcod.
p_wa_outtab-org_name = p_wa_garn-ornam.
p_wa_outtab-org_city = p_wa_garn-orort.
p_wa_outtab-org_zip = p_wa_garn-orplz.
p_wa_outtab-org_info = p_wa_garn-rulnr.

ENDFORM. " get_data
*&---------------------------------------------------------------------*
*& Form alv_tree_display
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM alv_tree_display .

CALL SCREEN 0001.

ENDFORM. " alv_tree_display
*&---------------------------------------------------------------------*
*& Module STATUS_0001 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0001 OUTPUT.
SET PF-STATUS 'PF_STATUS'.
* SET TITLEBAR 'xxx'.

ENDMODULE. " STATUS_0001 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0001 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0001 INPUT.

CASE sy-ucomm.
WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
LEAVE TO SCREEN 0.
WHEN OTHERS.
* §5. Call dispatch to process toolbar functions
* Toolbar events are registered in constructur method of
* CL_ALV_TREE_BASE as application events. So the dispatch call
* is a must if you want to use the standard toolbar.
CALL METHOD cl_gui_cfw=>dispatch.
ENDCASE.

ENDMODULE. " USER_COMMAND_0001 INPUT
*&---------------------------------------------------------------------*
*& Module ALV_CALL OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE alv_call OUTPUT.
* Perform ALV Tree build
IF g_alv_tree IS INITIAL.
PERFORM init_tree.

CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Automation Queue failure'(801)
txt1 = 'Internal error:'(802)
txt2 = 'A method in the automation queue'(803)
txt3 = 'caused a failure.'(804).
ENDIF.
ENDIF.


ENDMODULE. " ALV_CALL OUTPUT
*&---------------------------------------------------------------------*
*& Form init_tree
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM init_tree .

DATA: l_tree_container_name(30) TYPE c.
DATA:g_conatiner TYPE REF TO cl_gui_custom_container.
l_tree_container_name = 'CC_CONTAINER'.

CREATE OBJECT g_custom_container
EXPORTING
ratio = 95.

* CREATE OBJECT g_custom_container
* EXPORTING
* container_name = l_tree_container_name
* EXCEPTIONS
* cntl_error = 1
* cntl_system_error = 2
* create_error = 3
* lifetime_error = 4
* lifetime_dynpro_dynpro_link = 5.
* IF sy-subrc <> 0.
* MESSAGE x208(00) WITH 'ERROR'(100).
* ENDIF.

* create tree control
CREATE OBJECT g_alv_tree
EXPORTING
parent = g_custom_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
item_selection = 'X'
* no_html_header = 'X'
no_toolbar = ''
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.


* §2. Create Hierarchy-header
* The simple ALV Tree uses the text of the fields which were used
* for sorting to define this header. When you use
* the 'normal' ALV Tree the hierarchy is build up freely
* by the programmer this is not possible, so he has to define it
* himself.
DATA lv_hierarchy_header TYPE treev_hhdr.
PERFORM build_hierarchy_header CHANGING lv_hierarchy_header.
* §3. Create empty Tree Control
* IMPORTANT: Table 'gt_sflight' must be empty. Do not change this table
* (even after this method call). You can change data of your table
* by calling methods of CL_GUI_ALV_TREE.
* Furthermore, the output table 'gt_outtab' must be global and can
* only be used for one ALV Tree Control.

DATA: o_event TYPE REF TO lcl_event_receiver.

PERFORM set_headings CHANGING gt_header.

CALL METHOD g_alv_tree->set_table_for_first_display
EXPORTING
* I_STRUCTURE_NAME =
it_list_commentary = gt_header
is_hierarchy_header = lv_hierarchy_header
CHANGING
it_outtab = gt_empty "table must be empty !
it_fieldcatalog = gt_fcat
.


*CALL METHOD g_alv_tree->create_report_header
* EXPORTING
* it_list_commentary = gt_header
** I_LOGO =
** I_BACKGROUND_ID =
** I_SET_SPLITTER_HEIGHT =
** I_MODEL_MODE =
* .


* call method g_alv_tree->set_table_for_first_display
* exporting
* i_structure_name = 'YDBGARN'
* is_hierarchy_header = l_hierarchy_header
* changing
* it_outtab = gt_YDBGARN. "table must be empty !


* §4. Create hierarchy (nodes and leaves)
PERFORM create_hierarchy.

* §5. Send data to frontend.
CALL METHOD g_alv_tree->frontend_update.

ENDFORM. " init_tree
*&---------------------------------------------------------------------*
*& Form build_hierarchy_header
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_L_HIERARCHY_HEADER text
*----------------------------------------------------------------------*
FORM build_hierarchy_header CHANGING p_l_hierarchy_header
TYPE treev_hhdr.

p_l_hierarchy_header-heading = 'Jurisdiction/Personnel Number'(300).
p_l_hierarchy_header-tooltip = 'PERNR per Jurisdiction'(400).
p_l_hierarchy_header-width = 30.
p_l_hierarchy_header-width_pix = ' '.

ENDFORM. " build_hierarchy_header
*&---------------------------------------------------------------------*
*& Form create_hierarchy
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM create_hierarchy .

DATA: lv_jur_key TYPE lvc_nkey,
lv_pernr_key TYPE lvc_nkey,
lv_case_key TYPE lvc_nkey,
lv_count TYPE i .
data: lv_wa_outtab type ty_outtab.

sort gt_outtab1 stable by jurs.

LOOP AT gt_outtab1 INTO wa_outtab.

* to hold values for At end operation
move wa_outtab to lv_wa_outtab.

* Top level nodes:
* Jurisdiction node
IF wa_outtab-jurs <> gv_jurs_last. "on change of Jurisdiction
gv_jurs_last = wa_outtab-jurs.

*Providing no key means that the node is added on top level:
PERFORM add_jurs USING wa_outtab
''
CHANGING lv_jur_key.
lv_count = 1.

ELSE.
lv_count = lv_count + 1.

ENDIF.

* PERNR nodes:
* (always inserted as child of the last Jurisdiction
* which is identified by 'lv_jur_key')
IF wa_outtab-pernr <> gv_pernr_last. "on change of PERNR
gv_pernr_last = wa_outtab-pernr.
PERFORM add_pernr_line USING wa_outtab
lv_jur_key
CHANGING lv_pernr_key.
ENDIF.

at END OF jurs.

PERFORM add_cases USING lv_count
lv_wa_outtab
lv_jur_key
CHANGING lv_case_key.
endat.

ENDLOOP.

ENDFORM. " create_hierarchy
*&---------------------------------------------------------------------*
*& Form add_jurs
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_WA_OUTTAB_JURS text
* -->P_0381 text
* <--P_LV_JUR_KEY text
*----------------------------------------------------------------------*
FORM add_jurs USING p_wa_outtab TYPE ty_outtab
p_relat_key
CHANGING p_node_key.

DATA: lv_node_text TYPE lvc_value.

lv_node_text = p_wa_outtab-jurs.
* add node:
* ALV Tree firstly inserts this node as a leaf if you do not provide
* IS_NODE_LAYOUT with field ISFOLDER set. In form 'add_carrid_line'
* the leaf gets a child and thus ALV converts it to a folder
* automatically.
*

CALL METHOD g_alv_tree->add_node
EXPORTING
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = lv_node_text
is_outtab_line = wa_empty "pass empty since top node should
IMPORTING
e_new_node_key = p_node_key. "not show data



ENDFORM. " add_jurs
*&---------------------------------------------------------------------*
*& Form add_pernr_line
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_WA_OUTTAB text
* -->P_LV_JUR_KEY text
* <--P_LV_PERNR_KEY text
*----------------------------------------------------------------------*
FORM add_pernr_line USING p_wa_outtab TYPE ty_outtab
p_relat_key
CHANGING p_node_key.

DATA: l_node_text TYPE lvc_value.
data: lwa_layout type LVC_S_LAYN.

* add node
* ALV Tree firstly inserts this node as a leaf if you do not provide
* IS_NODE_LAYOUT with field ISFOLDER set. In form 'add_carrid_line'
* the leaf gets a child and thus ALV converts it to a folder
* automatically.
*
l_node_text = p_wa_outtab-pernr.

PERFORM person_node_layout CHANGING lwa_layout.

CALL METHOD g_alv_tree->add_node
EXPORTING
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = p_wa_outtab
IS_NODE_LAYOUT = lwa_layout
IMPORTING
e_new_node_key = p_node_key.


ENDFORM. " add_pernr_line

*&---------------------------------------------------------------------*
*& Form add_cases
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_WA_OUTTAB text
* -->P_LV_JUR_KEY text
* <--P_LV_PERNR_KEY text
*----------------------------------------------------------------------*
FORM add_cases USING p_lv_count
p_wa_outtab TYPE ty_outtab
p_lv_jur_key
CHANGING p_lv_case_key.

DATA: l_node_text TYPE lvc_value,
lv_leaf TYPE string,
lv_jurs TYPE string,
lv_cnt_leaf TYPE string.
data: lwa_layout type LVC_S_LAYN,
lt_item_layout type LVC_T_LAYI,
lwa_item_layout type LVC_S_LAYI.
* add node
* ALV Tree firstly inserts this node as a leaf if you do not provide
* IS_NODE_LAYOUT with field ISFOLDER set. In form 'add_cases'
* the leaf gets a child and thus ALV converts it to a folder
* automatically.
MOVE p_lv_count TO lv_cnt_leaf.
MOVE p_wa_outtab-jurs TO lv_jurs.
CLEAR p_wa_outtab.
CONCATENATE 'No. of cases under' lv_jurs
'is:'lv_cnt_leaf INTO lv_leaf
SEPARATED BY space.
p_wa_outtab-case_no = lv_leaf.

l_node_text = 'Summation'.

PERFORM sum_node_layout CHANGING lwa_layout.

CALL METHOD g_alv_tree->add_node
EXPORTING
i_relat_node_key = p_lv_jur_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = p_wa_outtab
IS_NODE_LAYOUT = lwa_layout
* IT_ITEM_LAYOUT = lt_item_layout
IMPORTING
e_new_node_key = p_lv_case_key.


ENDFORM. " add_cases

*&---------------------------------------------------------------------*
*& Form node_layout
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_LWA_LAYOUT text
*----------------------------------------------------------------------*
form sum_node_layout changing p_lwa_layout type LVC_S_LAYN.

p_lwa_layout-STYLE = cl_gui_column_tree=>style_intensifd_critical.
p_lwa_layout-n_image = icon_sum.


endform. " node_layout

*&---------------------------------------------------------------------*
*& Form person_node_layout
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_LWA_LAYOUT text
*----------------------------------------------------------------------*
form person_node_layout changing p_lwa_layout type LVC_S_LAYN.

p_lwa_layout-STYLE = cl_gui_column_tree=>STYLE_INTENSIFIED.
p_lwa_layout-n_image = icon_manager.

endform. " person_node_layout


*&---------------------------------------------------------------------*
*& Form fcat_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fcat_build .

CONSTANTS: lc_final TYPE string VALUE 'GT_OUTTAB1'.

wa_fcat-fieldname = 'PERNR'.
wa_fcat-tabname = lc_final.
wa_fcat-coltext = 'Personnel Number'.
wa_fcat-col_pos = 1.
wa_fcat-no_merging = 'X'.
APPEND wa_fcat TO gt_fcat.
CLEAR wa_fcat.

wa_fcat-fieldname = 'JURS'.
wa_fcat-tabname = lc_final.
wa_fcat-coltext = 'Jurisdiction'.
wa_fcat-col_pos = 2.
wa_fcat-no_merging = 'X'.
APPEND wa_fcat TO gt_fcat.
CLEAR wa_fcat.

wa_fcat-fieldname = 'CASE_NO'.
wa_fcat-tabname = lc_final.
wa_fcat-coltext = 'CASE NUM'.
wa_fcat-col_pos = 3.
APPEND wa_fcat TO gt_fcat.
CLEAR wa_fcat.

wa_fcat-fieldname = 'PRIO'.
wa_fcat-tabname = lc_final.
wa_fcat-coltext = 'Priority'.
wa_fcat-col_pos = 4.
APPEND wa_fcat TO gt_fcat.
CLEAR wa_fcat.

wa_fcat-fieldname = 'STATUS'.
wa_fcat-tabname = lc_final.
wa_fcat-coltext = 'Garnishment Status '.
wa_fcat-col_pos = 5.
APPEND wa_fcat TO gt_fcat.
CLEAR wa_fcat.

wa_fcat-fieldname = 'TYPE'.
wa_fcat-tabname = lc_final.
wa_fcat-coltext = 'Garnishment Originator Type'.
wa_fcat-col_pos = 6.
APPEND wa_fcat TO gt_fcat.
CLEAR wa_fcat.

wa_fcat-fieldname = 'ORG_NAME'.
wa_fcat-tabname = lc_final.
wa_fcat-coltext = 'Garnishment Originator Name'.
wa_fcat-col_pos = 7.
APPEND wa_fcat TO gt_fcat.
CLEAR wa_fcat.

wa_fcat-fieldname = 'ORG_CITY'.
wa_fcat-tabname = lc_final.
wa_fcat-coltext = 'Garnishment Originator City'.
wa_fcat-col_pos = 8.
APPEND wa_fcat TO gt_fcat.
CLEAR wa_fcat.

wa_fcat-fieldname = 'ORG_ZIP'.
wa_fcat-tabname = lc_final.
wa_fcat-coltext = 'Garnishment Originator Zip'.
wa_fcat-col_pos = 9.
APPEND wa_fcat TO gt_fcat.
CLEAR wa_fcat.

wa_fcat-fieldname = 'ORG_INFO'.
wa_fcat-tabname = lc_final.
wa_fcat-coltext = 'Garnishment Remittance Info'.
wa_fcat-col_pos = 9.
APPEND wa_fcat TO gt_fcat.
CLEAR wa_fcat.
ENDFORM. " fcat_build
*&---------------------------------------------------------------------*
*& Form set_headings
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_GT_HEADER text
*----------------------------------------------------------------------*
FORM set_headings CHANGING p_gt_header LIKE gt_header.

wa_header-typ = 'H'.
wa_header-key = ''.
wa_header-info = 'Garnishments Information Report'.
APPEND wa_header TO p_gt_header.

wa_header-typ = 'S'.
wa_header-key = ''.
wa_header-info = sy-uname.
APPEND wa_header TO p_gt_header.

wa_header-typ = 'S'.
wa_header-key = ''.
wa_header-info = sy-datum.
APPEND wa_header TO p_gt_header.

ENDFORM. " set_headings






*&---------------------------------------------------------------------*
*& Include YTESTGARN2_TOP
*&---------------------------------------------------------------------*

* Global Types

TYPES: BEGIN OF ty_outtab,
jurs TYPE char3,
pernr TYPE char8,
num TYPE i,
case_no TYPE char35,
prio TYPE char3,
status TYPE char1,
type TYPE char1,
org_name TYPE char30,
org_city TYPE char30,
org_zip TYPE char10,
org_info TYPE char5,
END OF ty_outtab.
TYPES: BEGIN OF ty_empty,
empty TYPE string,
END OF ty_empty.

* Global Internal tables
DATA: gt_outtab1 TYPE STANDARD TABLE OF ty_outtab,
gt_outtab2 TYPE STANDARD TABLE OF ty_outtab,
wa_outtab TYPE ty_outtab,
wa_outtab2 TYPE ty_outtab,
wa_garn TYPE p0194.
DATA: gt_empty TYPE STANDARD TABLE OF ty_outtab,
wa_empty TYPE ty_outtab,
gt_fcat TYPE lvc_t_fcat,
wa_fcat TYPE lvc_s_fcat,
gt_fcat1 TYPE lvc_t_fcat, "created for empty tables
wa_fcat1 TYPE lvc_s_fcat. "created for empty tables

* Global variables
DATA: gv_cnt_ma TYPE i, " Counter for MA ecords
gv_cnt_il TYPE i. " Counter for IL ecords
DATA: g_alv_tree TYPE REF TO cl_gui_alv_tree,
g_custom_container TYPE REF TO cl_gui_docking_container.
* g_custom_container type ref to cl_gui_custom_container.

DATA:w_toolbar TYPE stb_button."For toolbar
DATA: gt_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader.
* Global Constants
CONSTANTS: gc_ma TYPE char2 VALUE 'MA',
gc_il TYPE char2 VALUE 'IL'.

DATA: gv_jurs_last TYPE char3,
gv_pernr_last TYPE char8.
*
* Global Class declaration
CLASS lcl_event_receiver DEFINITION.
* event receiver definitions for ALV actions
PUBLIC SECTION.
METHODS:
* Node double click
handle_node_double_click
FOR EVENT node_double_click OF cl_gui_alv_tree
IMPORTING NODE_KEY,
* Tool bar
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object
e_interactive,
* Status bar
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS. "lcl_event_receiver DEFINITION

* Global Class implementation

CLASS lcl_event_receiver IMPLEMENTATION.
* Create the relevant Text to be dispalyed at top of page
METHOD handle_node_double_click.
check node_key is not initial.
PERFORM node_click CHANGING NODE_KEY wa_outtab.
ENDMETHOD. "handle_top_of_page
* create the relevant buttons on the toolbars
METHOD handle_toolbar.
* This method handles the user interaction with the tool bar.
* PERFORM toolbar.
APPEND w_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
METHOD handle_user_command.
* In event handler method for event USER_COMMAND: Query your
* function codes defined in step 2 and react accordingly.
PERFORM user_command USING e_ucomm.
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_receiver IMPLEMENTATION

Select-option: no value check

If a value has been entered in the entry field for the upper interval high, the system checks whether this value is greater than the lower interval limit low following each transport and conversion routine (if performed). If necessary, an error message is sent. This check can be switched off before the selection screen is sent, using the function module RS_SELOPT_NO_INTERVAL_CHECK.

Sunday, November 29, 2009

ALV split container

DATA: container1 TYPE REF TO cl_gui_container,
container2 TYPE REF TO cl_gui_container,
main1 TYPE REF TO cl_gui_custom_container,
splitter1 TYPE REF TO cl_gui_splitter_container,
grid1 TYPE REF TO cl_gui_alv_grid,
grid2 TYPE REF TO cl_gui_alv_grid,
ls_layo TYPE lvc_s_layo,
count TYPE i VALUE 0,
g_okcode LIKE sy-ucomm,
r1,r2.

DATA: alv_fcat TYPE lvc_t_fcat WITH HEADER LINE.

* First Main Container
CREATE OBJECT main1
EXPORTING container_name = 'MAIN_CONTAINER'.

* First Splitter Container
CREATE OBJECT splitter1
EXPORTING parent = main1
rows = 2
columns = 1.

* Place Container1 in First row First column
CALL METHOD splitter1->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = container1.

* Place Container2 in Second row First column
CALL METHOD splitter1->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = container2.


* Create grids
CREATE OBJECT grid1
EXPORTING i_parent = container1.

CREATE OBJECT grid2
EXPORTING i_parent = container2.

Relational Operators for Bit Patterns

The table below shows the relational operators for comparisons of operands with bit patterns in byte-like operands. The data type of the right operand operand2 must be byte-like (x or xstring). It contains the bit pattern to which the left operand operand1 is compared. If operand1 is shorter than operand2, hexadecimal zeroes are appended to the right of operand1 to lengthen it appropriately. However, no conversion takes place.

In Unicode programs, the data type of operand1 must also be byte-like (x or xstring). Outside of Unicode programs, operand1 can be of any elementary data type or have a flat structure.

The logical expression in the IF statement is false, because before the comparison, hex1 is lengthened to the right with 00. If the content of hex2 was 111100, then the comparison would be true.

DATA: hex1 TYPE xstring,
hex2 TYPE xstring.

hex1 = 'FFFF'.
hex2 = '111111'.

IF hex1 O hex2.
...
ENDIF.

Operator Meaning
O Ones: True if the bits that are 1 in operand2, are also 1 in operand1. If operand2 contains only zeroes, the logical expression is always true.
Z Zeros: True, if the bits that are 1 in operand2 are 0 in operand1. If operand2 contains only zeroes, the logical expression is always true.
M Mixed: True, if of the bits that are 1 in operand2, at least one is 1 and one is 0 in operand1. If operand2 contains only zeroes, the logical expression is always false.