Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all 8332 articles
Browse latest View live

Encoding error in CL_GUI_INPUT_FIELD

$
0
0

Hi folks,

 

since the SAP GUI 7.4 allows the usage of CL_GUI_INPUT_FIELD, I tried it out, but unfortunately there is some issue with the encoding I just can't get around.

 

lo_input->set_text(
     text = 'HELLO'
).

results in the following:

chinese.png

 

I guess that the HE and the LL are somehow combined to a single character each. Is there a way I have to convert my string before passing it to set_text?

 

Thanks in advance,

David


How call a transaction from a Z report as from command field.

$
0
0

Hi Experts

I'm not a very good Abap programmer, but I can do simple reports.

I'd like to understand why calling a transaction from a Z report, I have not the same  result than calling the same transaction from command-field.

I'll try to clarify my need with 2 examples.

1) I call IE01 transaction (Create Equipment) from command-line, and directly from menù i can switch directly to IA02-Change or IA03-Display. Calling the IA01 using CALL Transaction from a ZReport, the menù option are blocked, so you can use IA01 features only.

2) If you call QE51N from command field, the system set the User-Preferences if set (U_USER variant), if you call the same from a ZReport this is not possible.

I'd like to reach the same result calling these transactions from command-field or from a Zreport. Is it possible ??

Thanks for your help.

Claudio   

Validation of partner change in VA01/VA02

$
0
0

Dear all,

 

I have to implement a kind of validation for the change of the ship-to party in a sales order. Whenever a user changes the ship-to party, a check has to be performed and if conditions have not been met, the ship-to party has to be set back to the old value.

 

I'm trying to place my coding in USEREXIT_MOVE_FIELD_TO_VBAK. However, it doesn't work quite as expected. If the value has to be reset to the old one, I'm entering the old one into the structure xvbpa, but it doesn't seem to have any effect. The value on the screen remains the one entered by the user and not the old value I'm setting it back to.

 

What am I doing wrong!

 

Thank you for any suggestions!

 

Alexander.

PROCEDURE TO MAKE TREE STRUCTURE USING SAP OOPS

$
0
0

We can make tree structure in sap which will make our GUI interface more attractive and easy to interact with transactions with authorization security in it.


Advantage:

1.      Don’t need to remember the TCODES

2.      Attractive GUI

3.      All things are in same pool

4.      Same type of thing is under common folder.

5.      Authorization security is also possible.

 

And many more advantages to use this.

 

     1.      Define the data instances of classes which will come in use to develop the tree pool.

 

******data deceleration for custom container, docket containers and alv display and chooose****
DATA  init.
DATA: docking
TYPE REF TO cl_gui_docking_container,     "class for docket container
splitter
TYPE REF TO cl_gui_splitter_container,   "class for container splitter
lt_exclude 
TYPE ui_functions.                    "to exclude icons from tool baar
DATA picture TYPE REF TO cl_gui_picture.                "class for picture display
DATA: cont1
TYPE REF TO cl_gui_container,
cont2
TYPE REF TO cl_gui_container,
cont3
TYPE REF TO cl_gui_container,
cont4
TYPE REF TO cl_gui_container,
cont5
TYPE REF TO cl_gui_container.
DATA : it_layo   TYPE lvc_s_fcat OCCURS 0,
wa_layo  
LIKE LINE OF it_layo,
wa_layout
TYPE lvc_s_layo.
******end of custom container, docket containers and alv display and chooose deceleration *****

* Fields on Dynpro 100
DATA: g_event(30),
g_node_key
TYPE tv_nodekey,
g_item_name
TYPE tv_itmname.

DATA : g_custom_container TYPE REF TO cl_gui_custom_container,
edit_mod 
TYPE REF TO cl_gui_textedit,
g_tree
TYPE REF TO cl_gui_list_tree.

 

 

 

          2.   Make a sub screen in module pool in se80 and give the name as ‘SCRN’.

 

img1.JPG

 

3.          Define the classes which will use to link transaction in tree structure folder, handle double click event on files, node double click, button click, link click, and check box click.

 

CLASS lcl_application DEFINITION.
PUBLIC SECTION.
METHODS:
handle_node_double_click
FOR EVENT node_double_click
OF cl_gui_list_tree
IMPORTING node_key,
handle_expand_no_children
FOR EVENT expand_no_children
OF cl_gui_list_tree
IMPORTING node_key,
handle_item_double_click
FOR EVENT item_double_click
OF cl_gui_list_tree
IMPORTING node_key item_name,
handle_button_click
FOR EVENT button_click
OF cl_gui_list_tree
IMPORTING node_key item_name,
handle_link_click
FOR EVENT link_click
OF cl_gui_list_tree
IMPORTING node_key item_name,
handle_checkbox_change
FOR EVENT checkbox_change
OF cl_gui_list_tree
IMPORTING node_key item_name checked.
ENDCLASS.                   
"LCL_APPLICATION DEFINITION
*----------------------------------------------------------------------*
*       CLASS LCL_APPLICATION IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_application IMPLEMENTATION.

METHOD  handle_node_double_click.
" this method handles the node double click event of the tree
" control instance

" show the key of the double clicked node in a dynpro field
g_event =
'NODE_DOUBLE_CLICK'.
g_node_key = node_key.
ENDMETHOD.                   
"HANDLE_NODE_DOUBLE_CLICK

METHOD  handle_item_double_click.
" this method handles the item double click event of the tree
" control instance

" show the key of the node and the name of the item
" of the double clicked item in a dynpro field
g_event =
'ITEM_DOUBLE_CLICK'.
g_node_key = node_key.
g_item_name = item_name.
ENDMETHOD.                   
"HANDLE_ITEM_DOUBLE_CLICK

METHOD  handle_link_click.
" this method handles the link click event of the tree
" control instance

" show the key of the node and the name of the item
" of the clicked link in a dynpro field
g_event =
'LINK_CLICK'.
g_node_key = node_key.
g_item_name = item_name.
ENDMETHOD.                   
"HANDLE_LINK_CLICK

METHOD  handle_button_click.
" this method handles the button click event of the tree
" control instance

" show the key of the node and the name of the item
" of the clicked button in a dynpro field
g_event =
'BUTTON_CLICK'.
g_node_key = node_key.
g_item_name = item_name.
ENDMETHOD.                   
"HANDLE_BUTTON_CLICK

METHOD  handle_checkbox_change.
" this method handles the checkbox_change event of the tree
" control instance

" show the key of the node and the name of the item
" of the clicked checkbox in a dynpro field
g_event =
'CHECKBOX_CHANGE'.
g_node_key = node_key.
g_item_name = item_name.
ENDMETHOD.                   
"HANDLE_CHECKBOX_CHANGE

************method which is used to define the transaction and programs are

*****used to link from folder here is one way to link items and we can also

***link it directly in coding of PBO
METHOD handle_expand_no_children.
DATA: node_table
TYPE treev_ntab,
node
TYPE treev_node,
item_table
TYPE item_table_type,
item
TYPE mtreeitm.

* show the key of the expanded node in a dynpro field
g_event =
'EXPAND_NO_CHILDREN'.
g_node_key = node_key.

IF node_key = c_nodekey-child2.
* add the children for node with key 'Child2'
* Node with key 'New3'
CLEAR node.
node-node_key = c_nodekey-new3.
node-relatkey = c_nodekey-child2.
node-relatship = cl_gui_list_tree=>relat_last_child.
APPEND node TO node_table.

* Node with key 'New4'
CLEAR node.
node-node_key = c_nodekey-new4.
node-relatkey = c_nodekey-child2.
node-relatship = cl_gui_list_tree=>relat_last_child.
APPEND node TO node_table.

* Items of node with key 'New3'
CLEAR item.
item-node_key = c_nodekey-new3.
item-item_name =
'1'.
item-class = cl_gui_list_tree=>item_class_text.
item-length =
16.
item-usebgcolor =
'X'. "
item-text =
'Atd Entry Screen'.
APPEND item TO item_table.

CLEAR item.
item-node_key = c_nodekey-new3.
item-item_name =
'2'.
item-class = cl_gui_list_tree=>item_class_text.
item-alignment = cl_gui_list_tree=>align_auto.
item-font = cl_gui_list_tree=>item_font_prop.
item-text =
'Attendance Entry Screen'.
APPEND item TO item_table.

* Items of node with key 'New4'
CLEAR item.
item-node_key = c_nodekey-new4.
item-item_name =
'1'.
item-class = cl_gui_list_tree=>item_class_text.
item-length =
16.
item-usebgcolor =
'X'. "
item-text =
'Atd Transfer'.
APPEND item TO item_table.

CLEAR item.
item-node_key = c_nodekey-new4.
item-item_name =
'2'.
item-class = cl_gui_list_tree=>item_class_text.
item-alignment = cl_gui_list_tree=>align_auto.
item-font = cl_gui_list_tree=>item_font_prop.
item-text =
'Attendance Entry Transfer Screen'.
APPEND item TO item_table.
ENDIF.

CALL METHOD g_tree->add_nodes_and_items
EXPORTING
node_table                     = node_table
item_table                     = item_table
item_table_structure_name      =
'MTREEITM'
EXCEPTIONS
failed                         =
1
cntl_system_error              =
3
error_in_tables                =
4
dp_error                       =
5
table_structure_name_not_found =
6.

ENDMETHOD.                   
"HANDLE_EXPAND_NO_CHILDREN

ENDCLASS.                   
"LCL_APPLICATION IMPLEMENTATION

 

 

DATA: G_APPLICATION TYPE REF TO LCL_APPLICATION.


 

     4.      Now, in PBO of screen having module ‘status_1004’, do initial coding to generate the tree structure.

 

PROCESS BEFORE OUTPUT.

MODULE status_1004.

CALL SUBSCREEN scrn INCLUDING sy-repid v_dynnr1.

PROCESS AFTER INPUT.

CALL SUBSCREEN scrn.

MODULE exitprg AT EXIT-COMMAND.

 

MODULE user_command_1004.


 

     5.      In our case, I am making a docking container which will divide into two parts: one will show the logo of company and another one will contain the folders under which their related transactions will be available.

 

MODULE status_1004 OUTPUT.
SET PF-STATUS 'YCMN'.
SET TITLEBAR 'YRPTL'.

CALL FUNCTION 'RM_SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage =
100
text       = 'Extracting…'.

****here if first time the transaction call the tree instances will initiated ***and will make a structre
IF init IS INITIAL.
v_repid = sy-repid.
v_dynnr = sy-dynnr.

****create the docket container
CREATE OBJECT docking
EXPORTING
repid     = v_repid
dynnr     = v_dynnr
side      = cl_gui_docking_container=>dock_at_left
extension =
269.

****split the docket container
CREATE OBJECT splitter
EXPORTING
link_dynnr        = v_dynnr
link_repid        = v_repid
*        shellstyle        =
*        left              =
*        top               =
*        width             =
*        height            =
*        metric            = cntl_metric_dynpro
*        align             = 15
parent            = docking
rows              = 2
columns           =
1
*        no_autodef_progid_dynnr =
*        name              =

.

"first set type of splitter bar
CALL METHOD splitter->set_row_sash
EXPORTING
id    = 1                                    "first conatiner (actually splitter bar)
type  = cl_gui_splitter_container=>type_movable
value = cl_gui_splitter_container=>false.

"now set its value in % of entire costum control (so here first container will occupy 80% of enitre custom control space).
splitter->set_row_height(
id = 1 height = 36 ).

CALL METHOD splitter->get_container
EXPORTING
row       =
1
column    =
1
RECEIVING
container = cont1.

CALL METHOD splitter->get_container
EXPORTING
row       =
2
column    =
1
RECEIVING
container = cont2.

* create the picture container
CREATE OBJECT picture
EXPORTING
parent = cont1.

*    CALL METHOD cont1->set_height
*      EXPORTING
*        height = '5'.


* Request an URL from the data provider by exporting the pic_data.
DATA url(255).
CLEAR url.
PERFORM load_pic_from_db USING 'ZNUVOLG' CHANGING url.

* load picture
CALL METHOD picture->load_picture_from_url
EXPORTING
url = url.

init =
'X'.

IF g_tree IS INITIAL.
DATA: node_table
TYPE treev_ntab,
item_table
TYPE item_table_type,
events TYPE cntl_simple_events,
event TYPE cntl_simple_event.
" The Tree Control has not been created yet.
" Create a Tree Control and insert nodes into it.

* create a list tree
CREATE OBJECT g_tree
EXPORTING
parent              = cont2
node_selection_mode = cl_gui_list_tree=>node_sel_mode_single
item_selection      =
'X'
with_headers        =
' '.

*********Here define the events which will be accessable on folders*****
* define the events which will be passed to the backend
" node double click
event-eventid = cl_gui_list_tree=>eventid_node_double_click.
event-appl_event =
'X'.                                   "
APPEND event TO events.

" item double click
event-eventid = cl_gui_list_tree=>eventid_item_double_click.
event-appl_event =
'X'.
APPEND event TO events.

" expand no children
event-eventid = cl_gui_list_tree=>eventid_expand_no_children.
event-appl_event =
'X'.
APPEND event TO events.

" link click
event-eventid = cl_gui_list_tree=>eventid_link_click.
event-appl_event =
'X'.
APPEND event TO events.

" button click
event-eventid = cl_gui_list_tree=>eventid_button_click.
event-appl_event =
'X'.
APPEND event TO events.

" checkbox change
event-eventid = cl_gui_list_tree=>eventid_checkbox_change.
event-appl_event =
'X'.
APPEND event TO events.

CALL METHOD g_tree->set_registered_events
EXPORTING
events                    = events
EXCEPTIONS
cntl_error                =
1
cntl_system_error         =
2
illegal_event_combination =
3.

* create the application object
* this object is needed to handle the ABAP Objects Events of
* Controls
CREATE OBJECT g_application.

* assign event handlers in the application class to each desired event
SET HANDLER g_application->handle_node_double_click FOR g_tree.
SET HANDLER g_application->handle_item_double_click FOR g_tree.
SET HANDLER g_application->handle_expand_no_children FOR g_tree.
SET HANDLER g_application->handle_link_click FOR g_tree.
SET HANDLER g_application->handle_button_click FOR g_tree.
SET HANDLER g_application->handle_checkbox_change FOR g_tree.

* add some nodes to the tree control
* NOTE: the tree control does not store data at the backend. If an
* application wants to access tree data later, it must store the
* tree data itself.

PERFORM build_node_and_item_table USING node_table item_table.

CALL METHOD g_tree->add_nodes_and_items
EXPORTING
node_table                     = node_table
item_table                     = item_table
item_table_structure_name      =
'MTREEITM'
EXCEPTIONS
failed                         =
1
cntl_system_error              =
3
error_in_tables                =
4
dp_error                       =
5
table_structure_name_not_found =
6.
ENDIF.
ENDIF.
ENDMODULE.                
" STATUS_1004  OUTPUT

 

*Code: to show picture above in docking container as show in figure below

FORM load_pic_from_db USING p_val
CHANGING p_url.
DATA query_table LIKE w3query OCCURS 1 WITH HEADER LINE.
DATA html_table LIKE w3html OCCURS 1.
DATA return_code LIKE  w3param-ret_code.
DATA content_type LIKE  w3param-cont_type.
DATA content_length LIKE  w3param-cont_len.
DATA pic_data LIKE w3mime OCCURS 0.
DATA pic_size TYPE i.

REFRESH query_table.
query_table-name =
'_OBJECT_ID'.
query_table-value = p_val.
APPEND query_table.

CALL FUNCTION 'WWW_GET_MIME_OBJECT'
TABLES
query_string        = query_table
html                = html_table
mime                = pic_data
CHANGING
return_code         = return_code
content_type        = content_type
content_length      = content_length
EXCEPTIONS
object_not_found    =
1
parameter_not_found =
2
OTHERS              = 3.
IF sy-subrc = 0.
pic_size = content_length.
ENDIF.

CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type     = 'image'
subtype  = cndp_sap_tab_unknown
size     = pic_size
lifetime = cndp_lifetime_transaction
TABLES
data     = pic_data
CHANGING
url      = url
EXCEPTIONS
OTHERS   = 1.

 


ENDFORM.                   
" LOAD_PIC_FROM_DB

 

 

 

img2.JPG

 

 

*********here use to link items directly from PBO code.

 

FORM build_node_and_item_table
USING
node_table
TYPE treev_ntab
item_table
TYPE item_table_type.

DATA: node
TYPE treev_node,
item
TYPE mtreeitm.

* Build the node table.

* Caution: The nodes are inserted into the tree according to the order
* in which they occur in the table. In consequence, a node must not
* must not occur in the node table before its parent node.

* Node with key 'Root'
node-node_key = c_nodekey-root.
" Key of the node
CLEAR node-relatkey.      " Special case: A root node has no parent
CLEAR node-relatship.                " node.

node-hidden =
' '.                   " The node is visible,
node-disabled =
' '.                 " selectable,
node-isfolder =
'X'.                 " a folder.
CLEAR node-n_image.       " Folder-/ Leaf-Symbol in state "closed":
" use default.
CLEAR node-exp_image.     " Folder-/ Leaf-Symbol in state "open":
" use default
CLEAR node-expander.                 " see below.
" the width of the item is adjusted to its content (text)
APPEND node TO node_table.

* Node with key 'Child1'
CLEAR node.
node-node_key = c_nodekey-child1.
" Key of the node
" Node is inserted as child of the node with key 'Root'.
node-relatkey = c_nodekey-root.
node-relatship = cl_gui_list_tree=>relat_last_child.
node-isfolder =
'X'.
APPEND node TO node_table.

* Node with key 'New1'
CLEAR node.
node-node_key = c_nodekey-new1.
node-relatkey = c_nodekey-child1.
node-relatship = cl_gui_list_tree=>relat_last_child.
APPEND node TO node_table.

* Node with key 'New2'
CLEAR node.
node-node_key = c_nodekey-new2.
node-relatkey = c_nodekey-child1.
node-relatship = cl_gui_list_tree=>relat_last_child.
APPEND node TO node_table.

* Node with key 'New5'
CLEAR node.
node-node_key = c_nodekey-new5.
node-relatkey = c_nodekey-child1.
node-relatship = cl_gui_list_tree=>relat_last_child.
APPEND node TO node_table.

* Node with key 'Child2'
CLEAR node.
node-node_key = c_nodekey-child2.
node-relatkey = c_nodekey-root.
node-relatship = cl_gui_list_tree=>relat_last_child.
node-isfolder =
'X'.
node-expander =
'X'. " The node is marked with a '+', although
" it has no children. When the user clicks on the
" + to open the node, the event expand_nc is
" fired. The programmerr can
" add the children of the
" node within the event handler of the expand_nc
" event  (see callback handle_expand_nc).
APPEND node TO node_table.

* The items of the nodes:

* Node with key 'Root'
CLEAR item.
item-node_key = c_nodekey-root.
item-item_name =
'1'.                " Item with name '1'
item-class = cl_gui_list_tree=>item_class_text.
" Text Item
" the with of the item is adjusted to its content (text)
item-alignment = cl_gui_list_tree=>align_auto.
" use proportional font for the item
item-font = cl_gui_list_tree=>item_font_prop.
item-text =
'Reports'(003).
APPEND item TO item_table.


* Node with key 'Child1'
CLEAR item.
item-node_key = c_nodekey-child1.
item-item_name =
'1'.
item-class = cl_gui_list_tree=>item_class_text.
item-alignment = cl_gui_list_tree=>align_auto.
item-font = cl_gui_list_tree=>item_font_prop.
item-text =
'Employee Master Reports'(004).
APPEND item TO item_table.

* Node with key 'Child2'
CLEAR item.
item-node_key = c_nodekey-child2.
item-item_name =
'1'.
item-class = cl_gui_list_tree=>item_class_text.
item-alignment = cl_gui_list_tree=>align_auto.
item-font = cl_gui_list_tree=>item_font_prop.
item-text =
'Attendance'.
APPEND item TO item_table.

* Items of node with key 'New1'
*  CLEAR ITEM.
*  item-node_key = c_nodekey-new1.
*  ITEM-ITEM_NAME = '1'.
*  ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
*  ITEM-LENGTH = 4. " the width of the item is 4 characters
*  ITEM-IGNOREIMAG = 'X'.               " see documentation of Structure
*                                       " TREEV_ITEM
*  ITEM-USEBGCOLOR = 'X'.               " item has light grey background
*  ITEM-T_IMAGE = '@25@'.               " icon of the item
*  APPEND ITEM TO ITEM_TABLE.

CLEAR item.
item-node_key = c_nodekey-new1.
item-item_name =
'1'.
item-class = cl_gui_list_tree=>item_class_text.
item-length =
20.
item-usebgcolor =
'X'.
item-text =
'Employee Detail'.
APPEND item TO item_table.

*  CLEAR ITEM.
*  item-node_key = c_nodekey-new1.
*  ITEM-ITEM_NAME = '2'.
*  ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
*  ITEM-LENGTH = 11.
*  ITEM-USEBGCOLOR = 'X'.                                    "
*  ITEM-TEXT = 'MUELLER'.
*  APPEND ITEM TO ITEM_TABLE.

CLEAR item.
item-node_key = c_nodekey-new1.
item-item_name =
'2'.
item-class = cl_gui_list_tree=>item_class_text.
item-alignment = cl_gui_list_tree=>align_auto.
item-font = cl_gui_list_tree=>item_font_prop.
item-text =
'Emplyee Master Details'.
APPEND item TO item_table.

* Items of node with key 'New2'
*  CLEAR item.
*  item-node_key = c_nodekey-new2.
*  item-item_name = '1'.
*  item-class = cl_gui_list_tree=>item_class_text.
*  item-length = 4. " the width of the item is 2 characters
*  item-ignoreimag = 'X'.               " see documentation of Structure
*  " TREEV_ITEM
*  item-usebgcolor = 'X'.               " item has light grey background
*  item-t_image = '@02@'.               " icon of the item
*  APPEND item TO item_table.

CLEAR item.
item-node_key = c_nodekey-new2.
item-item_name =
'1'.
item-class = cl_gui_list_tree=>item_class_text.
item-length =
20.
item-usebgcolor =
'X'.
item-text =
'Emp Dep & Cnt Dtls'.
APPEND item TO item_table.

*  CLEAR item.
*  item-node_key = c_nodekey-new2.
*  item-item_name = '3'.
*  item-class = cl_gui_list_tree=>item_class_text.
*  item-length = 11.
*  item-usebgcolor = 'X'.                                    "
*  item-text = 'HARRYHIRSCH'.
*  APPEND item TO item_table.

CLEAR item.
item-node_key = c_nodekey-new2.
item-item_name =
'2'.
item-class = cl_gui_list_tree=>item_class_text.
item-alignment = cl_gui_list_tree=>align_auto.
item-font = cl_gui_list_tree=>item_font_prop.
item-text =
'Employee Dependent & Contact Details'(007).
APPEND item TO item_table.



* Items of node with key 'New3'
*  CLEAR item.
*  item-node_key = c_nodekey-new3.
*  item-item_name = '1'.
*  item-class = cl_gui_list_tree=>item_class_text.
*  item-length = 4. " the width of the item is 2 characters
*  item-ignoreimag = 'X'.               " see documentation of Structure
*  " TREEV_ITEM
*  item-usebgcolor = 'X'.               " item has light grey background
*  item-t_image = '@02@'.               " icon of the item
*  APPEND item TO item_table.

CLEAR item.
item-node_key = c_nodekey-new5.
item-item_name =
'1'.
item-class = cl_gui_list_tree=>item_class_text.
item-length =
20.
item-usebgcolor =
'X'.
item-text =
'Atd Recording Report'.
APPEND item TO item_table.

*  CLEAR item.
*  item-node_key = c_nodekey-new2.
*  item-item_name = '3'.
*  item-class = cl_gui_list_tree=>item_class_text.
*  item-length = 11.
*  item-usebgcolor = 'X'.                                    "
*  item-text = 'HARRYHIRSCH'.
*  APPEND item TO item_table.

CLEAR item.
item-node_key = c_nodekey-new5.
item-item_name =
'2'.
item-class = cl_gui_list_tree=>item_class_text.
item-alignment = cl_gui_list_tree=>align_auto.
item-font = cl_gui_list_tree=>item_font_prop.
item-text =
'Employee Attendance Recording Report'.
APPEND item TO item_table.
ENDFORM.                   
" BUILD_NODE_AND_ITEM_TABLE

 

 

     6.    Here, in PBI it is compulsory to free the docking container and tree object while exiting the program. This is called from the PBI code.

 

*&---------------------------------------------------------------------*
*&      Module  EXITPRG  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE exitprg INPUT.
ok_code = sy-ucomm.
CASE ok_code.
WHEN 'BACK'.
PERFORM clrit.
*      LEAVE PROGRAM.
WHEN 'UP'.
PERFORM clrit.
*      LEAVE PROGRAM.
WHEN 'EXIT'.
PERFORM clrit.
*      LEAVE PROGRAM.
ENDCASE.

IF NOT docking IS INITIAL.
" destroy tree container (detroys contained tree control, too)
CALL METHOD docking->free
EXCEPTIONS
cntl_system_error =
1
cntl_error        =
2.
CLEAR docking.
CLEAR g_tree.
ENDIF.
LEAVE PROGRAM.
ENDMODULE.                
" EXITPRG  INPUT

 

  1. 3.      Now to link the transaction and call the code on click event from tree node, do the below code in PBI  module function:MODULE user_command_1004.’

MODULE user_command_1004 INPUT.
DATA: return_code
TYPE i.

* CL_GUI_CFW=>DISPATCH must be called if events are registered
* that trigger PAI
* this method calls the event handler method of an event
CALL METHOD cl_gui_cfw=>dispatch
IMPORTING
return_code = return_code.
IF return_code <> cl_gui_cfw=>rc_noevent.
" a control event occured => exit PAI
IF g_node_key = 'New1'.
v_dynnr1 =
'0801'.
ELSEIF g_node_key = 'New2'.
v_dynnr1 =
'0802'.
ELSEIF g_node_key = 'New3'.
v_dynnr1 =
'0803'.
ELSEIF g_node_key = 'New4'.
PERFORM chkauth USING 'New4'.
REFRESH : it_trnf1, it_trnf1[],
it_trnf,  it_trnf[],
it_tmp, it_tmp[],
it_sftm, it_sftm[],
it_esftm1, it_esftm1[],
it_adent, it_adent[],
it_esftm, it_esftm[].
CLEAR : v_index, yatndent-pchdt, yunitmst-untno, wa_tmp.
CALL SCREEN 1007.
*      v_dynnr1 = '1007'.
ELSEIF g_node_key = 'New5'.

v_dynnr1 =
'0805'.
ENDIF.
CLEAR ok_code.
EXIT.
ENDIF.

ok_code = sy-ucomm.
CASE ok_code.
WHEN 'OK'.
IF g_node_key = 'New1'.
PERFORM chkauth USING 'New1'.
PERFORM empdtlsel.
CALL SCREEN 1005.
ELSEIF g_node_key = 'New2'.
PERFORM chkauth USING 'New2'.
PERFORM empcntdpt.
CALL SCREEN 1005.
ELSEIF g_node_key = 'New3'.
PERFORM chkauth USING 'New3'.
PERFORM atndentry.
ELSEIF g_node_key = 'New5'.
PERFORM chkauth USING 'New5'.
PERFORM atndrep.
CALL SCREEN 1005.
ENDIF.

WHEN 'BACK'. " Finish program
IF NOT docking IS INITIAL.
" destroy tree container (detroys contained tree control, too)
CALL METHOD docking->free
EXCEPTIONS
cntl_system_error =
1
cntl_error        =
2.
CLEAR docking.
CLEAR g_tree.
ENDIF.
LEAVE PROGRAM.
WHEN 'SAVE'.
CALL SCREEN 0701 STARTING AT 10 5.
WHEN 'VARIANT'.
PERFORM load_variant.
IF sy-ucomm EQ 'CANC'.
MESSAGE 'Variant operation terminated' TYPE 'S' DISPLAY LIKE 'E'.
ELSE.
MESSAGE 'Variant selected' TYPE 'S'.
ENDIF.
CALL SCREEN 1004.
ENDCASE.

* CAUTION: clear ok code!
CLEAR ok_code.
ENDMODULE.                
" USER_COMMAND_1004  INPUT

 

img3.JPG

 

 

Here, if you find any error on doing coding for this, then you are free to contact me and I would be very happy to help you..

 

 

Many Thanks / Himanshu Gupta

 




Sales order : VA02 : Manual Validation Check

$
0
0

Hello Experts,

 

Suppose we are changing the amount of any condition type in VA02 of any sales order then from below fields we can cross check whether those are manually changed or not.

KOMV- KMPRS or KOMV- KSTEU

 

Like this suppose user is changing the quantity or UoM of any material manually in VA02 of any sales order then how can we check whether filled has been changed manually or not. Please let me know how to validate this.

 

My requirement is , want to run routine only if quantity of material is changed manually in VA02.

 

Thanks,

Onkar

 

To get the nearby date values from the input.

$
0
0

I am using function module

*   To convert into foreign currency.
        CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
     EXPORTING
       date             = p_date
       foreign_amount   = wa_dat-netwr
       foreign_currency = wa_dat-waerk
       local_currency   = p_curr
       type_of_rate     = p_kurst
     IMPORTING
       local_amount     w_ukur
     EXCEPTIONS
       no_rate_found    = 1
       overflow         = 2
       no_factors_found = 3
       no_spread_found  = 4
       derived_2_times  = 5
       OTHERS           = 6.
       w_ukurs = w_ukur.

Here date is taken from selection screen, when date is given it should be taken from TCURR table with nearby dates. how to calculate the nearby date from the table?


Ex: if i give 05.05.2008, and if table has dates of 2001, 2002, 2006, 2011. it should take 2006

strange abap error

$
0
0

hi,

  there ara so many strange abap errors when i created abap ALV report in 4.6C. I can not find reason for them . I copied a simple program's code which is existing in 4.6C and is active , then i pasted the code into a new abap program,and i clicked "check". then abap error was happened. there are two examples. This program is actually syntactically correct !!!

11.png

22.png

what's reason for them?

 

Regards,

hiphone

How to insert Method of a interface in ABAP code

$
0
0

Hi,

 

Plz tell me how to insert a interface METHOD in ABAP code as we do in the case of inserting function in ABAP code using PATTERN Button.

 

I want insert  'Call method lo_class->zif_acct~get_acct_detail",

 

But when i use ABAP object patterns,Select call method,Then give the instance name , class/interface name and the method name.

 

I only get ' Call method lo_class->get_acct_detail.'


So i have to manually correct it .

 

Please Help.

 

Regards

 

Blue


function-module

$
0
0

hi experts,

i have created a new function group and i copied 1 function module to this group..when i try to activate this function module it was giving error;as below.

 

the main program of 'function module name' does not begin with function-pool.

 

can u give me some idea.

 

Thanks

Gopi

Enchancment in HR Standared infotype 8

$
0
0

I want to enhance standard info type 8 for wage type 1103, on the basis of info type 2001 data for particular personal no, but I couln't find the way to enhance or add the functionality,and restrict the particular user to add or remove the amount of wage type in payroll on the basis of certain information found in infotype 2001,

 

Please guide me P.S I already search google and know how to find badi vice versa and haven't found proper way to add enchamement i.e badi, userexit.

 

Please help

 

 

Regards,

customer exit or BADI for change G/L account while doing GR

$
0
0

HI Friends,

 

I have a requirement such that, I want to change the G/L Account no for particular Vendor, while doing MIGO. For this i checked all user exits and BADI's but i did not found the solution..

 

 

I need to get FI related fields like G/L account number, transaction key.

 

Thanks in advance

Create Long text in IE01 and IE02

$
0
0

Hi All ,

 

Is there any way to create a long text for equipment in tcode IE01 ( create equipment) and IE02 ( change equipment) . I have already tried SAVE_TEXT . It works fine in change mode i.e IE02 but not in IE01 .

 

 

Appreciate if sample code can also be provided

 

regards

SAP PM

How to increasing SAP standard filed length

$
0
0

Hi Experts,

 

I have a requirement to increasing SAP standard filed length , like material class and characteristics maximum  field length  is 30 characters and it should be increased to 70 characters.

 

If it is  possible, will there be  any implication ???

 

Regards,

Naresh M.

IW32 -> print/Fax is not working for shop papers

$
0
0

Hi ,

 

I can print smart form from print preview in IW32 . But , I am not able to print it from print/Fax option. This is happening only for shop papers maintained for  'maintenance Orders' where as both options are working for 'Notification type '.

 

custom print program is being called from print preview but not getting triggered when i click on print/Fax button.


Please kindly suggest , if we can print maintenance order shop papers using print/Fax button in IW32.


Please let me know if I need to change any configuration settings .



Thanks,

Manju

Multiple PDF attachment for multiple customers using CL_BCS

$
0
0

Hello Experts,

 

I have a requirement to send Multiple PDF attachments to multiple customers.

i.e.,  If a customer has 3 Invoices; then one email with 3 attachment should be sent.

 

My code is working for 1 attachment. It is sending 3 separate emails.

 

Please suggest.....!!!!

 

 

Thanks in advance,

Venkat.


Add custom fields for Accounting document header from BKPF

$
0
0

Hi All,

 

I have add new fields in table BKPF so that i can add new field in transaction FV60 through the Badi BADI_FDCB_SUBBAS05.

I have succeed, my new fields are save in table BKPF. and I can post document trough FB60 But when i try to display them throught transaction FB02/FB03 i don't see them in the headers field.

What can i do to see them, is there any BADI to add fields into Header.

 

Thanks in advance...

CL_GUI_ALV_GRID - word wrap functionality

$
0
0

Dear Team,

 

I have a requirement where i need to display the long text in the output table in the last column like the below format:

 

Here is the text1

Line 2

Line 3

Line 4

 

Is it possible to populate the above format in the class CL_GUI_ALV_GRID- >set_table_for_first_display.

 

Currently, I have used the word wrap functionality and populated inside the internal table but not sure how to proceed further in the fieldcatalog,

 

I have checked in the other  threads they mentioned about the Reuse_alv_list_display and Reuse_alv_grid_dispaly.

 

Sorry I am new to this ALV coding. Thanks for your time in advance, Can you please help me.

 

Thanks,

Pavi

update BSEG-SGTXT field in accounting document

$
0
0

Hi,

 

I have a requirement where i need to update SGTXT field in accounting documnet when posting the GR using MIGO ( Accounting document gets created after GR is done using MIGO). The information should come from header text of GR document BKTXT. Is there any BADI/user-exit that I can use.

 

thanks,

sankar.

BAPI's for Insert meter reading and generate Invoice

$
0
0

Hello all,

 

I am new to SAP.

 

For Gas meter reading I need some Standard BAPI with input parameter for below points,

 

1. Standard BAPI to get pending MRO (Meter Reading Orders).

 

2. Insert Meter Reading using standard BAPI and also need to generate invoice for same meter reading.

 

If any one can provide information or BAPI names with details then it would be great help to me.

 

Regards,

Nirmal

Adding leading zero's to a char IOBJ ?

$
0
0

Hi,

 

We are getting only 10 digit numeric value to an infoobject in sap bi from ECC. We need to compare this value with another field which is char 40 length and have " 0000000000000000000000000000000000001234" ( 40 char length). For that we need to add leading 30 zero's through a field routine in sap bi transformations.

 

Can anyone please help me with the code to add leading 30 zero's to the result field. One more doubt. Currently the value is coming as "0000001234" to the result field. Can we compare this with 0000000000000000000000000000000000001234" ( 40 char length). Both are char values but field A has 10 digits and field B has 0000000000000000000000000000000000001234" ( 40 char length).. ..If we do a lookup and compare, will it consider the 10 digit field A with field B or it will not lookup as both are different length. remember both are char fields. But values in them are different.

 

Can we compare without adding zero's to field A.If yes then I dont want to add leading zero's. Please advise.

 

thank you

DR

Viewing all 8332 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>