Message with internal table
Hi,
How am i gonna show the error generated here using the message class? Thanks a lot!
LOOP AT i_messages WHERE type = c_error.
*Show errors generated from i_messages
EXIT.
ENDLOOP.
Try using the below code to show the error message on the message screen.
p_screen = '0999'.
* set a default message of space in with three &&&
IF v_msg_number = ' '.
v_msg_id = 'OO'.
v_msg_number = '000'.
ENDIF.
IF v_devty(5) = '16X20'.
v_msg_line = 18.
v_msg_nln = 13.
ELSE.
v_msg_line = 40.
v_msg_nln = 4.
ENDIF.
v_msg_lang = sy-langu.
* error or message screen
CALL FUNCTION 'CALL_MESSAGE_SCREEN'
EXPORTING
i_msgid = v_msg_id
i_lang = v_msg_lang
i_msgno = v_msg_number
i_msgv1 = v_msg_var1
i_msgv2 = v_msg_var2
i_msgv3 = v_msg_var3
i_msgv4 = v_msg_var4
i_message_screen = p_screen
i_line_size = v_msg_line
i_lines = v_msg_nln
i_non_lmob_envt = c_x
IMPORTING
o_answer = v_msg_answ
EXCEPTIONS
OTHERS = 99.
Similar Messages
-
Collect message into internal table
Hi,
does any one knows how BAPIs or CALL TRANSACTIONs collect messages into internal table.
My problem is that some BI with CALL TRANSACTION doesn't collect right message into return table and I would like to collect this last message after CALL TRANSACTION and therefore be sure that everything went OK.....
thx
mariohi
good
check this
Call Transaction p_trans using ZBDC_Table
Mode p_mode
Update p_update
Messages into p_messages.
Move sy-subrc to w__subrc.
Scan the messages in YDCRAISES to see if we need to
change the message class.
Loop at p_messages.
Select single msgtyp
into w__msgtp
from zdcraise
where tcode = p_messages-tcode and
msgid = p_messages-msgid and
msgnr = p_messages-msgnr.
If sy-subrc = 0.
Move w__msgtp to p_messages-msgtyp.
Modify p_messages.
EndIf.
EndLoop.
Dump the message table ?
If w__ydcset-dumpmsg = True.
thanks
mrutyun^ -
I am getting problem with internal table & work area declaration.
I am working with 'makt' table ..with the table makt i need to work with styles attributes ..so i declared like this
TYPES : BEGIN OF ty_makt,
matnr TYPE makt-matnr,
spras TYPE makt-spras,
maktx TYPE makt-maktx,
maktg TYPE makt-maktg,
celltab TYPE lvc_t_styl,
END OF ty_makt.
DATA : i_makt TYPE TABLE OF ty_makt.
DATA : wa_makt TYPE ty_makt .
But end of program i need to update dbtable "makt"...i am getting problem with internal table & work area declaration.
i think makt table fields mapping and internal table/work area mapping is not correct. so please help me to get out from this.Hi Nagasankar,
TYPES : BEGIN OF TY_MATNR,
MATNR TYPE MAKT-MATNR,
SPRAS TYPE MAKT-SPRAS,
MAKTX TYPE MAKT-MAKTX,
MAKTX TYPE MAKT-MAKTG,
CELLTAB TYPE LVC_T_STYL, " Its Working perfectly fine..
END OF TY_MAKT.
DATA: IT_MAKT TYPE STANDARD TABLE OF TY_MAKT,
WA_MAKT TYPE TY_MAKT.
Its working perfectly fine. if still you are facing any issue post your complete code.
Thanks,
Sandeep -
Unable to process message with internal message
I am trying to find more information about this error I see in the App log. There are thousands of entries with different message IDs.
I have searched Google/Technet and cannot find anything that references this error message. Does anyone have any pointers on where to go to find the account causing this?
Source: MSExchange Messaging Policies
Event ID: 8208
Task Category: RedirectionAgent
Unable to process message with internal message ID: XXXXXX. Mailbox System.Object[]'s ForwardingSmtpAddress %3 isn't valid. Active Directory may have been damaged.I have just started and taken over for the previous admin so am still learning the setup as well.
We have 3 Exchange 2010 servers (2 in the same location and one remote), all 3 have the same errors in event logs with varying message ids. Only 2 transport rules (One for large attachments and one to add a disclaimer) and both appear to be working correctly.
I was hoping to find a way to track down more information about the message based on the ID to see if I can find any similarities but have not found a way. I have found how to find the message ID based on sender/recipient/etc. but not the other way. -
Issue with internal table in object oriented ABAP.
Hello Gurus,
I am having trouble defining internal table in Object oriented ABAP. for following:
DATA: BEGIN OF IT_TAB OCCURS 0.
INCLUDE STRUCTURE ZCUSTOM.
DATA tot_sum TYPE char40.
DATA END OF IT_TAB.
Can someone help ?
Regards,
Jainam.
Edited by: Jainam Shah on Feb 5, 2010 8:33 PM
Edited by: Jainam Shah on Feb 5, 2010 8:33 PM
Moderator message - Please post in the correct forum. You can easily find out for yourself by looking at SAP help for internal tables using OOP - thread locked
Edited by: Rob Burbank on Feb 5, 2010 2:49 PMNo, you can not declare internal table with header line in OO context. You have to declare the work are/header line separately
Example:
TYPES: BEGIN OF ty_it_tab.
INCLUDE STRUCTURE mara.
TYPES: tot_sum TYPE char40.
TYPES: END OF ty_it_tab.
DATA: it_tab TYPE STANDARD TABLE OF ty_it_tab.
DATA: wk_tab TYPE ty_it_tab.
LOOP AT it_tab INTO wk_tab.
ENDLOOP.
Edited by: Dean Q on Feb 5, 2010 8:50 PM -
How to save message into internal table?
Hi,everyone!
I have a problem when I'm coding.I want to store messages into a internal table.Can you help me?
Thanks!Hello Feng
If you are already working on SAP basis release >= 6.20 I would recommend the most versatile message handler of all: interface <b>IF_RECA_MESSAGE_LIST</b>
Perhaps you will find the following sample report ZUS_SDN_APOLLO_13
(see also: <a href="https://wiki.sdn.sap.com/wiki/display/profile/2007/07/09/MessageHandling-FindingtheNeedleintheHaystack">Message Handling - Finding the Needle in the Haystack</a>) useful.
*& Report ZUS_SDN_APOLLO_13
REPORT zus_sdn_apollo_13
LINE-SIZE 200.
TYPE-POOLS: abap.
TYPES: BEGIN OF ty_s_outtab.
TYPES: status TYPE exception.
INCLUDE TYPE bapiret2 AS msg.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
DATA:
gs_layout TYPE lvc_s_layo,
gt_outtab TYPE ty_t_outtab.
DATA:
gd_title TYPE lvc_title,
gd_msgv TYPE symsgv,
gd_msg TYPE bapi_msg,
gs_msg TYPE recamsg,
gs_return TYPE bapiret2,
gt_return TYPE bapirettab,
go_msglist TYPE REF TO if_reca_message_list,
go_random TYPE REF TO cl_random_number,
gif_random TYPE REF TO if_random_number.
PARAMETERS:
p_opt1 RADIOBUTTON GROUP radi DEFAULT 'X',
p_opt2 RADIOBUTTON GROUP radi,
p_opt3 RADIOBUTTON GROUP radi.
SELECTION-SCREEN ULINE.
PARAMETERS:
p_opt4 RADIOBUTTON GROUP radi,
p_opt5 RADIOBUTTON GROUP radi,
p_opt6 RADIOBUTTON GROUP radi.
SELECTION-SCREEN ULINE.
PARAMETERS:
p_count TYPE numc3 DEFAULT '4',
p_level TYPE ballevel DEFAULT '7'.
DEFINE mac_build_msg.
clear: gs_msg.
gs_msg-msgty = &5.
gs_msg-msgid = '00'.
gs_msg-msgno = '398'.
gs_msg-msgv1 = &1.
gs_msg-msgv2 = &2.
gs_msg-msgv3 = &3.
gs_msg-msgv4 = &4.
gs_msg-detlevel = &6.
END-OF-DEFINITION.
* msgty
* msgid
* msgno
* msgv1
* msgv2
* msgv3
* msgv4
* msgv1_src
* msgv2_src
* msgv3_src
* msgv4_src
* detlevel
* probclass
* alsort
* time_stmp
* msg_count
* context
* params
START-OF-SELECTION.
" Create message handler
go_msglist = cf_reca_message_list=>create( ).
" Create random number instance
CREATE OBJECT go_random TYPE cl_random_number.
gif_random ?= go_random.
gif_random->init( ).
PERFORM message_handling_1.
PERFORM message_handling_2.
PERFORM message_handling_3.
PERFORM message_handling_4.
END-OF-SELECTION.
*& Form MESSAGE_HANDLING_1
* text
* --> p1 text
* <-- p2 text
FORM message_handling_1 .
CHECK ( p_opt1 = abap_true ).
gd_title = 'Information System 1 (IS1)'.
SET TITLEBAR 'TITLE' WITH gd_title.
WRITE: / 'Apollo 13 Mission'.
WRITE: / syst-uline.
WRITE: / 'Take-Off -> ok'.
WRITE: / 'Leaving Orbit -> ok'.
WRITE: / 'Trajectory -> ok'.
WRITE: /.
FORMAT COLOR COL_NEGATIVE.
WRITE: / 'Explosion happened -> not ok'.
WRITE: / 'Command and Service module (CSM) -> damaged'.
FORMAT RESET.
WRITE: / 'Lunar module (LM) -> not affected, ok'.
MESSAGE text-hou TYPE 'S'.
ENDFORM. " MESSAGE_HANDLING_1
*& Form message_handling_2
* text
* --> p1 text
* <-- p2 text
FORM message_handling_2 .
* define local data
DATA:
ld_success(6) TYPE n,
ld_warning(6) TYPE n,
ld_failure(6) TYPE n,
ld_total(6) TYPE n.
CHECK ( p_opt2 = abap_true ).
gd_title = 'Information System 2 (IS2)'.
SET TITLEBAR 'TITLE' WITH gd_title.
PERFORM generate_messages. " simulation of messages
CALL METHOD go_msglist->get_list_as_bapiret
IMPORTING
et_list = gt_return.
" Calculate message types and total
ld_total = 0.
ld_success = 0.
ld_warning = 0.
ld_failure = 0.
" Print messages as WRITE list
LOOP AT gt_return INTO gs_return.
IF ( gs_return-type = 'E' ).
ADD 1 TO ld_failure.
ELSEIF ( gs_return-type = 'W' ).
ADD 1 TO ld_warning.
ELSE.
ADD 1 TO ld_success.
ENDIF.
ENDLOOP.
ld_total = ld_success + ld_warning + ld_failure.
WRITE: / 'Total Message =', ld_total.
WRITE: / 'Failures =', ld_failure.
WRITE: / 'Warnings =', ld_warning.
WRITE: / 'Successes =', ld_success.
WRITE: / syst-uline.
SKIP.
" Colouring depending on message type
LOOP AT gt_return INTO gs_return.
IF ( gs_return-type = 'E' ).
FORMAT COLOR COL_NEGATIVE.
ELSEIF ( gs_return-type = 'W' ).
FORMAT COLOR COL_TOTAL.
ELSE.
FORMAT RESET.
ENDIF.
WRITE: / gs_return-type, gs_return-message+0(100).
ENDLOOP.
ENDFORM. " message_handling_2
*& Form message_handling_3
* text
* --> p1 text
* <-- p2 text
FORM message_handling_3 .
* define local data
DATA:
ls_outtab TYPE ty_s_outtab.
DATA:
ld_success(6) TYPE n,
ld_warning(6) TYPE n,
ld_failure(6) TYPE n,
ld_total(6) TYPE n.
CHECK ( p_opt3 = abap_true ).
gd_title = 'Information System 3 (IS3)'.
SET TITLEBAR 'TITLE' WITH gd_title.
PERFORM generate_messages. " simulation of messages
CALL METHOD go_msglist->get_list_as_bapiret
IMPORTING
et_list = gt_return.
REFRESH: gt_outtab.
" Calculate message types and total
ld_total = 0.
ld_success = 0.
ld_warning = 0.
ld_failure = 0.
" Define the logic for setting exception status (LED)
LOOP AT gt_return INTO gs_return.
CLEAR: ls_outtab.
ls_outtab-msg = gs_return.
IF ( gs_return-type = 'E' ).
ls_outtab-status = '1'. " red
ADD 1 TO ld_failure.
ELSEIF ( gs_return-type = 'W' ).
ls_outtab-status = '2'. " yellow
ADD 1 TO ld_warning.
ELSE.
ls_outtab-status = '3'. " green
ADD 1 TO ld_success.
ENDIF.
APPEND ls_outtab TO gt_outtab.
ENDLOOP.
ld_total = ld_failure + ld_warning + ld_success.
CLEAR: gs_layout.
gs_layout-cwidth_opt = abap_true.
gs_layout-zebra = abap_true.
gs_layout-excp_fname = 'STATUS'.
gs_layout-excp_led = abap_true.
gs_layout-smalltitle = abap_true.
CONCATENATE 'T(' ld_total ') '
'E(' ld_failure ') '
'W(' ld_warning ') '
'S(' ld_success ') '
INTO gd_title SEPARATED BY space.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_structure_name = 'BAPIRET2'
i_grid_title = gd_title
is_layout_lvc = gs_layout
TABLES
t_outtab = gt_outtab
EXCEPTIONS
OTHERS = 1.
ENDFORM. " message_handling_3
*& Form message_handling_4
* text
* --> p1 text
* <-- p2 text
FORM message_handling_4 .
* define local data
CHECK ( p_opt4 = abap_true OR
p_opt5 = abap_true OR
p_opt6 = abap_true ).
IF ( p_opt4 = abap_true ).
gd_title = 'Information System 4 (IS4)'.
SET TITLEBAR 'TITLE' WITH gd_title.
ELSEIF ( p_opt5 = abap_true ).
gd_title = 'Information System 5 (IS5)'.
SET TITLEBAR 'TITLE' WITH gd_title.
ELSE.
gd_title = 'Information System 6 (IS6)'.
SET TITLEBAR 'TITLE' WITH gd_title.
ENDIF.
PERFORM generate_messages. " simulation of messages
PERFORM display_log.
ENDFORM. " message_handling_4
*& Form GENERATE_MESSAGES
* text
* --> p1 text
* <-- p2 text
FORM generate_messages .
* define local data
mac_build_msg 'Apollo 13 Mission: Spacecraft'
space space space 'I' '1'.
** DEFINE mac_build_msg.
** clear: gs_msg.
** gs_msg-msgty = &5.
** gs_msg-msgid = '00'.
** gs_msg-msgno = '398'.
** gs_msg-msgv1 = &1.
** gs_msg-msgv2 = &2.
** gs_msg-msgv3 = &3.
** gs_msg-msgv4 = &4.
** gs_msg-detlevel = &6.
** END-OF-DEFINITION.
go_msglist->add( is_message = gs_msg ).
DO 6 TIMES.
CASE syst-index.
WHEN '1'.
mac_build_msg 'Command and Service Module (CSM)'
space space space 'I' '2'.
WHEN '2'.
mac_build_msg 'Lunar Module (LM)' space space space 'I' '2'.
WHEN '3'.
mac_build_msg 'Additional Module (M-1)'
space space space 'I' '2'.
WHEN '4'.
mac_build_msg 'Additional Module (M-2)'
space space space 'I' '2'.
WHEN '5'.
mac_build_msg 'Additional Module (M-3)'
space space space 'I' '2'.
WHEN '6'.
mac_build_msg 'Additional Module (M-4)'
space space space 'I' '2'.
WHEN OTHERS.
EXIT.
ENDCASE.
go_msglist->add( is_message = gs_msg ).
" recursive call of routine
PERFORM generate_messages_1 USING syst-index 'Modul' '3'.
ENDDO.
ENDFORM. " GENERATE_MESSAGES
*& Form GENERATE_MESSAGES_1
* text
* --> p1 text
* <-- p2 text
FORM generate_messages_1
USING
value(ud_index) TYPE i
value(ud_msgv) TYPE symsgv
value(ud_detlevel) TYPE ballevel.
* define local data
DATA:
ld_integer TYPE i,
ld_msgty TYPE symsgty,
ld_msgv TYPE symsgv,
ld_detlevel TYPE ballevel.
DO p_count TIMES.
WRITE syst-index TO ld_msgv NO-ZERO LEFT-JUSTIFIED.
IF ( ud_detlevel = '3' ).
CONCATENATE ud_msgv ld_msgv INTO ld_msgv
SEPARATED BY space.
ELSE.
CONCATENATE ud_msgv ld_msgv INTO ld_msgv
SEPARATED BY '.'.
ENDIF.
CONDENSE ld_msgv.
gd_msgv = ld_msgv.
IF ( ud_index = 1 ).
ld_integer = gif_random->get_random_int( 300 ).
IF ( ld_integer = 1 ).
ld_msgty = 'E'.
CONCATENATE gd_msgv 'failed' INTO gd_msgv SEPARATED BY ' -> '.
ELSEIF ( ld_integer BETWEEN 1 AND 10 ).
ld_msgty = 'W'.
CONCATENATE gd_msgv 'check(?)' INTO gd_msgv SEPARATED BY ' -> '.
ELSE.
ld_msgty = 'S'.
CONCATENATE gd_msgv 'OK' INTO gd_msgv SEPARATED BY ' -> '.
ENDIF.
ELSE.
ld_msgty = 'S'.
CONCATENATE gd_msgv 'OK' INTO gd_msgv SEPARATED BY ' -> '.
ENDIF.
mac_build_msg gd_msgv space space space ld_msgty ud_detlevel.
go_msglist->add( is_message = gs_msg ).
IF ( ud_detlevel < p_level ).
ld_detlevel = ud_detlevel + 1.
PERFORM generate_messages_1 USING ud_index ld_msgv ld_detlevel.
ENDIF.
ENDDO.
ENDFORM. " GENERATE_MESSAGES_1
*& Form DISPLAY_LOG
* text
* --> p1 text
* <-- p2 text
FORM display_log .
* define local data
DATA:
ld_handle TYPE balloghndl,
lt_log_handles TYPE bal_t_logh,
ls_profile TYPE bal_s_prof.
" Get log handle of collected message list
ld_handle = go_msglist->get_handle( ).
APPEND ld_handle TO lt_log_handles.
IF ( p_opt4 = 'X' ).
* get a display profile which describes how to display messages
CALL FUNCTION 'BAL_DSP_PROFILE_DETLEVEL_GET'
IMPORTING
e_s_display_profile = ls_profile. " tree & ALV list
ELSEIF ( p_opt5 = 'X' ).
* get standard profile to display one log
CALL FUNCTION 'BAL_DSP_PROFILE_SINGLE_LOG_GET'
IMPORTING
e_s_display_profile = ls_profile.
ELSE.
CALL FUNCTION 'BAL_DSP_PROFILE_NO_TREE_GET'
IMPORTING
e_s_display_profile = ls_profile.
ENDIF.
* set report to allow saving of variants
ls_profile-disvariant-report = sy-repid.
* 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:
ls_profile-disvariant-handle = 'LOG'.
CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'
EXPORTING
i_s_display_profile = ls_profile
i_t_log_handle = lt_log_handles
EXCEPTIONS
profile_inconsistent = 1
internal_error = 2
no_data_available = 3
no_authority = 4
OTHERS = 5.
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. " DISPLAY_LOG
Regards
Uwe -
Problem with internal table declaration in function gui_upload
hi friends,
can u tell me how should i define internal table when i use this function?
i get error that in oo my declaration not good.
thanks,
dana.see this example:-
DATA: BEGIN OF itab OCCURS 0,
tdname TYPE mara-matnr,
tdline1 TYPE tline-tdline,
tdline2 TYPE tline-tdline,
tdline3 TYPE tline-tdline,
tdline4 TYPE tline-tdline,
tdline5 TYPE tline-tdline,
END OF itab.
DATA: BEGIN OF itab_error OCCURS 0,
tdname TYPE mara-matnr,
error TYPE string,
END OF itab_error.
DATA: lines TYPE STANDARD TABLE OF tline WITH HEADER LINE.
DATA: temp TYPE string.
DATA: tdspras TYPE thead-tdspras.
DATA: tdname TYPE thead-tdname.
DATA: tdobject TYPE thead-tdobject.
DATA: tdid TYPE thead-tdid.
DATA :flag TYPE c.
At Selection Screen Event
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p1.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p1.
At Start of Selection Event
START-OF-SELECTION.
PERFORM upload_data.
PERFORM upload_text.
*& Form upload_data
text
--> p1 text
<-- p2 text
FORM upload_data .
temp = p1.
**& Upload Data from Excel
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = temp
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = itab.
ENDFORM. " upload_data
*& Form upload_text
text
--> p1 text
<-- p2 text
FORM upload_text .
tdspras = 'EN'.
tdid = 'BEST'.
tdobject = 'MATERIAL'.
LOOP AT itab.
REFRESH lines.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = itab-tdname
IMPORTING
output = itab-tdname.
TRANSLATE itab-tdname TO UPPER CASE.
tdname = itab-tdname.
PERFORM check_material.
lines-tdline = itab-tdline1.
APPEND lines.
CLEAR lines.
lines-tdline = itab-tdline2.
APPEND lines.
CLEAR lines.
lines-tdline = itab-tdline3.
APPEND lines.
CLEAR lines.
lines-tdline = itab-tdline4.
APPEND lines.
CLEAR lines.
lines-tdline = itab-tdline5.
APPEND lines.
CLEAR lines.
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid = tdid
flanguage = tdspras
fname = tdname
fobject = tdobject
TABLES
flines = lines.
ENDLOOP.
IF itab_error[] IS NOT INITIAL.
WRITE : / 'PO Text For Following Material is not Uploaded'.
WRITE : / .
WRITE : / 'Material', ' Error'.
LOOP AT itab_error.
WRITE : / itab_error-tdname, ' ', itab_error-error.
ENDLOOP.
ELSE.
MESSAGE s001(38) WITH 'Data Uploaded Succcesfully'.
ENDIF.
ENDFORM. " upload_text
*& Form check_material
text
--> p1 text
<-- p2 text
FORM check_material .
DATA : w_matnr TYPE mara-matnr.
SELECT SINGLE matnr
INTO w_matnr
FROM mara
WHERE matnr = itab-tdname.
IF sy-subrc = 0.
flag = 'X'.
ELSE.
MOVE-CORRESPONDING itab TO itab_error.
itab_error-error = 'Material does not exist'.
APPEND itab_error.
ENDIF.
ENDFORM. " check_material -
Problem with internal table initialisation in EBP system
Hi
I work in EBP system, and i made a specific work in LBBP_POCF0o program. It is in the displaying items of a purchase order.
This is what i done:
LOOP AT t_screen_items WHERE del_ind NE 'X'.
w_old_total = w_old_total + t_screen_items-value.
CLEAR:t_screen_items.
ENDLOOP.
loop at gt_item where del_ind ne 'X'.
w_new_total = w_new_total +
( gt_item-GROSS_PRICE * gt_item-quantity ).
clear: gt_item.
endloop.
if w_new_total GT w_old_total.
MESSAGE I001(ZBBP_PO) WITH
'elle possède un montant supérieur'
' à celui déterminé intialement.'
'Veuillez modifier la commande.'.
MOVE 'X' TO w_checksum_flag.
endif.
My problem is that if i use the elevator at the screen, the system is looping only at the first element visible on the screen, so the "LOOP AT t_screen_items" is wrong. i don't understand why the sytem doesn't count all the elements of the internal table t_screen_items...
Thank you for your help.Well, i will try to be more clearly...
My problem is very suprising..In the purchase order screen, if there's more than 10 items, there's an elevator (or ascencor) to permit displaying the items which are hidden. And so, when i use the elevator, and when i want to see the details of the item, the "loop at t_item_screens" only begins at the first item visible. For exemple, if i have 13 items, i want to see the 11th item, i have to use the elevator, and then in the "loop at t_item_screens", the loop will do only 3 times the loop, it will begin only from the 11th item... The loop won't begin at the first element.... I really don't understand.
Sorry if i'm not clearly... Anyway, thank you for your help. -
SAP script linking with internal table
Hi all,
This is my program to print invoices
REPORT z_g_test.
TABLES: sbook.
DATA sflights_wa TYPE sflights.
DATA: itcpo LIKE itcpo.
DATA itcpp LIKE itcpp.
DATA sflights_itab TYPE TABLE OF sflights WITH HEADER LINE.
DATA sbook_itab TYPE TABLE OF sbook WITH HEADER LINE.
*SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE text-001.
*SELECT-OPTIONS: s_carrid FOR sflights-carrid,
* s_fldate FOR sflights-fldate.
*SELECTION-SCREEN END OF BLOCK 1.
SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME TITLE text-002.
SELECTION-SCREEN COMMENT 1(79) text-004.
SELECT-OPTIONS: s_custid FOR sbook-customid,
s_bookid FOR sbook-bookid.
SELECTION-SCREEN END OF BLOCK 2.
INITIALIZATION.
s_custid-low = 00001721.
APPEND s_custid.
START-OF-SELECTION.
SELECT * FROM sbook INTO sbook_itab WHERE customid IN s_custid.
* APPEND sbook TO sbook_itab.
APPEND sbook_itab.
ENDSELECT.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
* APPLICATION = 'TX'
* ARCHIVE_INDEX =
* ARCHIVE_PARAMS =
device = 'PRINTER'
dialog = 'X'
form = 'ZG_SCRIPT'
language = sy-langu
OPTIONS = itcpo
* MAIL_SENDER =
* MAIL_RECIPIENT =
* MAIL_APPL_OBJECT =
* RAW_DATA_INTERFACE = '*'
* SPONUMIV =
* IMPORTING
* LANGUAGE =
* NEW_ARCHIVE_PARAMS =
* RESULT =
EXCEPTIONS
canceled = 1
device = 2
form = 3
OPTIONS = 4
unclosed = 5
mail_options = 6
archive_error = 7
invalid_fax_number = 8
more_params_needed_in_batch = 9
spool_error e = 10
codepage = 11
OTHERS = 12
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'MY_ELEMENT'
function = 'SET'
type = 'BODY'
window = 'MAIN'
* IMPORTING
* PENDING_LINES =
EXCEPTIONS
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
bad_pageformat_for_print = 7
spool_error = 8
codepage = 9
OTHERS = 10
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = itcpp
* RDI_RESULT =
* TABLES
* OTFDATA =
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
codepage = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
My question is! i am not passing the internal table any where. Now i am trying to print the values which is already existed in internal table,so iam not getting the out put. Now what shall i do in order to get output.
Regards,
LisaHi all,
the modified code is like this.
REPORT z_g_test.
TABLES: sbook.
DATA sflights_wa TYPE sflights.
DATA: itcpo LIKE itcpo.
DATA itcpp LIKE itcpp.
DATA sflights_itab TYPE TABLE OF sflights WITH HEADER LINE.
DATA sbook_itab TYPE TABLE OF sbook WITH HEADER LINE.
*SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE text-001.
*SELECT-OPTIONS: s_carrid FOR sflights-carrid,
* s_fldate FOR sflights-fldate.
*SELECTION-SCREEN END OF BLOCK 1.
SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME TITLE text-002.
SELECTION-SCREEN COMMENT 1(79) text-004.
SELECT-OPTIONS: s_custid FOR sbook-customid,
s_bookid FOR sbook-bookid.
SELECTION-SCREEN END OF BLOCK 2.
INITIALIZATION.
s_custid-low = 00001721.
APPEND s_custid.
START-OF-SELECTION.
SELECT * FROM sbook INTO sbook_itab WHERE customid IN s_custid.
* APPEND sbook TO sbook_itab.
APPEND sbook_itab.
ENDSELECT.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
* APPLICATION = 'TX'
* ARCHIVE_INDEX =
* ARCHIVE_PARAMS =
device = 'PRINTER'
dialog = 'X'
form = 'ZG_SCRIPT'
language = sy-langu
OPTIONS = itcpo
* MAIL_SENDER =
* MAIL_RECIPIENT =
* MAIL_APPL_OBJECT =
* RAW_DATA_INTERFACE = '*'
* SPONUMIV =
* IMPORTING
* LANGUAGE =
* NEW_ARCHIVE_PARAMS =
* RESULT =
EXCEPTIONS
canceled = 1
device = 2
form = 3
OPTIONS = 4
unclosed = 5
mail_options = 6
archive_error = 7
invalid_fax_number = 8
more_params_needed_in_batch = 9
spool_error e = 10
codepage = 11
OTHERS = 12
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT sbook_itab.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'MY_ELEMENT'
function = 'SET'
type = 'BODY'
window = 'MAIN'
* IMPORTING
* PENDING_LINES =
EXCEPTIONS
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
bad_pageformat_for_print = 7
spool_error = 8
codepage = 9
OTHERS = 10
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = itcpp
* RDI_RESULT =
* TABLES
* OTFDATA =
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
codepage = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
even though i am not getting the output.
The question is with out passing the internal table how we will get the output from it?. -
Performance with internal tables
Hi everybody,
I'm having trouble with the performance of a report.
The reports selects data out of many different tables and merges them together in one extraction file. (I would really like it to be executable in dialog task, because I don't want to write the file on the application sever)
I've done what I could using runtime analysis to improve performance of the db accesses. Now 97% of runtime is consumed by abap.
I'm using several internal tables which will have many entries, and at the moment I'm using nested loops to gather the information out of the internal tables into one extraction file. (Reading the internal tables with key is not always possible, I do this whenever possible)
I've tried to use loop... assigning <fs> instead of loop... into, but it doesn't really help too much.
Any other suggestions?
Thank you for your help, regards, Kathrin!Hi,
Some of these might be able to help for improving the performance.
1. Read table with key using binary search.
2. While comparing two internal tables, user Kernal
method. Eg: If I_TAB1[] = I_TAB2[]. Enfif.
3. Instead of appending records within loop/endloop,
use 'Append lines of'.
4. When populate different internal tables, try to create
with key field which will make a big difference while
accessing the data.
5. Sort the internal tables.
6. Use Case/Endcase in place of If/Endif.
7. While making values negative, use 0 - <field>, in
place of <field> * -1.
8. If the field structures are similar in two internal
tables, for appending records use I_TAB2[] = I_TAB1[].
9. After the complete usage of internal tables, release
the resources using FREE/FREFRESH <internal table>.
10. For data extraction, use field by field selection
from database.
11. Try to avoid using 'ALL ENTRIES'. If using and make
sure that the ref.internal table have entries.
12. Try using Inner Join using Foriegn key fields.
13. To get sum or count use Aggregate functions.
14. Try to use Views if need appropriately.
Hope this helps.
Gopakumar -
ABAP transformation to XML for sap chart engine with internal table
Hello.
I am new to the SAP chart engine, XML and transformations so please be patient with me from an ABAP-program I am trying to call a Z-transformation and attach an internal table with two columns. In the ST program I want to loop through the table and for each row insert the two values from the table in the XML.
In an ABAP-program I have an internal table containing datacoordinates for a scattered chart.
The table looks like this:
DATA: BEGIN OF coordinate,
x_value TYPE f,
y_value TYPE f,
END OF coordinate,
polygon_data LIKE STANDARD TABLE OF coordinate with header line.
As a prototype I just add a few coordinates like this:
polygon_data-x_value = '700'.
polygon_data-y_value = '8'.
APPEND polygon_data.
polygon_data-x_value = '1400'.
polygon_data-y_value = '3'.
APPEND polygon_data.
polygon_data-x_value = '1400'.
polygon_data-y_value = '10'.
APPEND polygon_data.
polygon_data-x_value = '700'.
polygon_data-y_value = '10'.
APPEND polygon_data.
polygon_data-x_value = '700'.
polygon_data-y_value = '3'.
APPEND polygon_data.
I have created a Z-transformation and I call it like this (I also have a separate transformation for all the customizing generated with SAP chart designer but that one works fine):
DATA: data_xml TYPE xstring.
CALL TRANSFORMATION ztest_ce_tables2xml
SOURCE polygon_data = polygon_data
RESULT XML data_xml.
Since I am trying to create a scattered chart I need to insert an X and Y value for each coordinate.In the manual SAP Chart engine - XML format description it looks like this:
<ChartData>
<Series>
<Point>
<Value type="x">1</Value>
<Value type="y">1</Value>
</Point>
<Point>
<Value type="x">2</Value>
<Value type="y">2</Value>
</Point>
My ST-program that I cannot get to work looks like below. How can I loop through my internal table and get the X and thy Y value for each row in my internal table?
BR Tommy (Sweden)
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="POLYGON_DATA"/>
<tt:template>
<ChartData>
<Series>
<tt:loop ref=".POLYGON_DATA">
<Point>
<Value type="x"><tt:copy ref=".POLYGON_DATA.X_VALUE"/></Value>
<Value type="y"><tt:copy ref=".POLYGON_DATA.Y_VALUE"/></Value>
</Point>
</tt:loop>
</Series>
</ChartData>
</tt:template>
</tt:transform>Hello again.
I found the solution and would like to share it with the forum, maybe it could help someone.
My first error was in the call transformation statement:
CALL TRANSFORMATION ztest_ce_tables2xml
SOURCE polygon_data = polygon_data [] <----
Do not forget these
RESULT XML data_xml.
I also had an error in the ST program, it should look like this:
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="POLYGON_DATA"/>
<tt:template>
<ChartData>
<Series>
<tt:loop ref=".POLYGON_DATA">
<Point>
<Value type="x"><tt:value ref="$ref.X_VALUE"/></Value>
<Value type="y"><tt:value ref="$ref.Y_VALUE"/></Value>
</Point>
</tt:loop>
</Series>
</ChartData>
</tt:template>
</tt:transform> -
GUI_DOWNLOAD with Internal table column names
Hi!
I am using FM 'GUI_DOWNLOAD' to download internal table to excel sheet. But, I am finding internal tables values only into excel sheet. I want Internal Table's column name as well. Please help me. and guide me.
Thanks in advance.
-Rupesh kayasth.Hi Rupesh,
You have two tables in the Tables parameter. One is DATA_TAB where you have to provide the internal table name which data you want to download. Second one is Field Names where you can provide the column names for the internal table fields. Concatenate the column names in a string and pass it to Fields names table.
Regards,
Jayaram...
Message was edited by:
Jayarama Sarma Mudda -
HI,
I need to DMBE2 value as with respective of Month, Year and Inception date.
I need the output to be like
HKONT BLART PRCTR DMBE2(Month) DMBE2 (Year) DMBE3 (Year)
Below is my code
DATA : BEGIN OF gt_lkorr OCCURS 0,
hkont LIKE bsis-hkont,
prctr LIKE bsis-prctr,
bewar LIKE bsis-bewar,
dmbe2 LIKE bsis-dmbe2,
belnr LIKE bsis-belnr,
budat LIKE bsis-budat,
monat LIKE bsis-monat,
gjahr LIKE bsis-gjahr,
blart LIKE bsis-blart,
shkzg like bsis-shkzg,
END OF gt_lkorr.
*DATA : wa_lkorr LIKE gt_lkorr OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF wa_lkorr OCCURS 0,
hkont LIKE bsis-hkont,
prctr LIKE bsis-prctr,
bewar LIKE bsis-bewar,
dmbe2 LIKE bsis-dmbe2,
belnr LIKE bsis-belnr,
budat LIKE bsis-budat,
monat LIKE bsis-monat,
gjahr LIKE bsis-gjahr,
blart LIKE bsis-blart,
dmbe2_2 LIKE bsis-dmbe2,
dmbe2_3 LIKE bsis-dmbe2,
END OF wa_lkorr.
DATA : gt_final_lkorr LIKE wa_lkorr OCCURS 0 WITH HEADER LINE.
FORM f_get_t030hb_tr.
SELECT hkont lkorr FROM t030hb INTO CORRESPONDING FIELDS OF
TABLE gt_tr_t030hb
WHERE ktopl = 'KCOA'
AND bwber = 'TR'
AND hkont IN so_hkont.
IF gp_pprct IS INITIAL.
SELECT hkont prctr bewar dmbe2 belnr budat monat gjahr blart
FROM bsis INTO CORRESPONDING
FIELDS OF TABLE gt_lkorr FOR ALL ENTRIES
IN gt_tr_t030hb
WHERE bukrs IN so_bukrs
AND gjahr IN so_gjahr
AND prctr IN so_prctr
AND hkont = gt_tr_t030hb-lkorr
AND vbund IN so_vbund.
ELSE.
LOOP AT gt_prctr.
SELECT hkont prctr bewar dmbe2 belnr budat monat gjahr blart
FROM bsis INTO CORRESPONDING
FIELDS OF TABLE gt_lkorr FOR ALL ENTRIES
IN gt_tr_t030hb
WHERE bukrs IN so_bukrs
AND gjahr IN so_gjahr
AND prctr = gt_prctr-prctr
AND hkont = gt_tr_t030hb-lkorr
AND vbund IN so_vbund.
ENDLOOP.
ENDIF.
DELETE ADJACENT DUPLICATES FROM gt_lkorr COMPARING ALL FIELDS.
ENDFORM. "f_get_t030hb_tr
*& Form f_get_yearwise_data
text
FORM f_get_yearwise_data.
DATA : lv_period LIKE t009b-poper.
DATA : lv_year LIKE bsis-gjahr,
lv_dmbe2 LIKE bsis-dmbe2.
LOOP AT gt_lkorr.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = sy-datum
I_MONMIT = 00
i_periv = 'K4'
IMPORTING
e_buper = lv_period
E_GJAHR =
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4
IF gt_lkorr-monat EQ lv_period.
wa_lkorr-hkont = gt_lkorr-hkont.
wa_lkorr-prctr = gt_lkorr-prctr.
wa_lkorr-bewar = gt_lkorr-bewar.
wa_lkorr-dmbe2 = gt_lkorr-dmbe2.
wa_lkorr-blart = gt_lkorr-blart.
if gt_lkorr-shkzg = 'H'.
wa_lkorr-dmbe2 = - wa_lkorr-dmbe2.
endif.
COLLECT wa_lkorr.
endif.
ENDLOOP.
LOOP AT wa_lkorr INTO gt_final_lkorr.
write : / gt_final_lkorr-hkont,
gt_final_lkorr-prctr,
gt_final_lkorr-bewar,
gt_final_lkorr-dmbe2,
gt_final_lkorr-blart.
ENDLOOP.
write : ' Inception to date'.
LOOP AT gt_lkorr.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = sy-datum
I_MONMIT = 00
i_periv = 'K4'
IMPORTING
e_buper = lv_period
e_gjahr = lv_year
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4
IF gt_lkorr-gjahr EQ lv_year.
wa_lkorr-hkont = gt_lkorr-hkont.
wa_lkorr-prctr = gt_lkorr-prctr.
wa_lkorr-bewar = gt_lkorr-bewar.
wa_lkorr-dmbe2 = gt_lkorr-dmbe2.
wa_lkorr-blart = gt_lkorr-blart.
if gt_lkorr-shkzg = 'H'.
wa_lkorr-dmbe2 = - wa_lkorr-dmbe2.
endif.
COLLECT wa_lkorr.
endif.
ENDLOOP.
LOOP AT wa_lkorr into gt_final_lkorr.
WRITE : / gt_final_lkorr-hkont,
gt_final_lkorr-prctr,
gt_final_lkorr-bewar,
gt_final_lkorr-dmbe2,
gt_final_lkorr-blart.
move : wa_lkorr-dmbe2_2 to gt_final_lkorr-dmbe2_2.
modify gt_final_lkorr.
clear gt_final_lkorr.
ENDLOOP.
loop at gt_lkorr.
wa_lkorr-hkont = gt_lkorr-hkont.
wa_lkorr-prctr = gt_lkorr-prctr.
wa_lkorr-bewar = gt_lkorr-bewar.
wa_lkorr-dmbe2 = gt_lkorr-dmbe2.
wa_lkorr-blart = gt_lkorr-blart.
if gt_lkorr-shkzg = 'H'.
wa_lkorr-dmbe2 = - wa_lkorr-dmbe2.
endif.
COLLECT wa_lkorr.
ENDLOOP.
LOOP AT wa_lkorr into gt_final_lkorr.
WRITE : / gt_final_lkorr-hkont,
gt_final_lkorr-prctr,
gt_final_lkorr-bewar,
gt_final_lkorr-dmbe2,
gt_final_lkorr-blart.
ENDLOOP.
Please let me know how to do it?
Thanks,
Pavan.I think you need to insert a field in your wa_lkorr internal table for key which you should populate as M for month data, Y2 for Year data and Y3 for dmbe3 data.
So when you want to display they are three different records. -
Finding duplicates:Minus set operator in dealing with internal tables
Dear experts,
I am newbie to ABAP developement,i have been given an assignment to find the duplicate list of vendors in lfa table.
Now duplicate list doesnot means that text tokens will be just exact to conclude them as duplicate ,it could also be like
1111 Vendor ABC
1222 ABC Vendor
If anybody has clue ,how to work on such a problem ,plz come forward.
Right now i just tried initially how to find exact duplicates,i found on change command,it do works.
Then i am trying a new way which should just do the same thing.
I did as per this algorithm
1.Compute wholesome list in one internal table itab1
2.Used delete adjacent duplicates in itab2.
3.I feel itab3=itab1-itab2 will contain all duplicates in itab3.
Can anyone give me a hint.How can i do A-B ?.Hi Arul,
There is no special aided SET operations upon internal tables in ABAP. Concerning your particular task I would say that you can try INSERT statement for each record in your internal table without preliminary comparing them with DB table. If there is a record in DB table with the same key then sy-subrc after INSERT will be non zero (actually 4) and no real insert would occur. So, only those records would be inserted which have no counterpart in DB table.
Best regards, Sergei -
LEFT OUTER with internal tables
hi all,
I have a query to execute,
SELECT SKATSAKNR SKATTXT20
SUM( GLT0~HSLVT ) AS HSLVT
INTO CORRESPONDING FIELDS OF TABLE ITAB_ZSTMGLRACC
FROM SKAT
LEFT OUTER JOIN GLT0 ON GLT0RACCT = SKATSAKNR
AND GLT0~RYEAR = I_GJAHR
AND GLT0~BUKRS = 'comp1'
WHERE SKAT~KTOPL = 'EICA'
GROUP BY SKATSAKNR SKATTXT20.
here i want to replace GLT0~BUKRS = 'comp1' with multiple values from Internal table ITAB_T001
since i used SUM ......FOR ALL ENTRIES IN ITAB_T001 cant be used .
any one have options??
thx
Josehi all,
I have a query to execute,
SELECT SKATSAKNR SKATTXT20
SUM( GLT0~HSLVT ) AS HSLVT
INTO CORRESPONDING FIELDS OF TABLE ITAB_ZSTMGLRACC
FROM SKAT
LEFT OUTER JOIN GLT0 ON GLT0RACCT = SKATSAKNR
AND GLT0~RYEAR = I_GJAHR
AND GLT0~BUKRS = 'comp1'
WHERE SKAT~KTOPL = 'EICA'
GROUP BY SKATSAKNR SKATTXT20.
here i want to replace GLT0~BUKRS = 'comp1' with multiple values from Internal table ITAB_T001
since i used SUM ......FOR ALL ENTRIES IN ITAB_T001 cant be used .
any one have options??
thx
Jose
Maybe you are looking for
-
So I downloaded the new yosemite software onto my macbook pro 13 inch and every time I try to get onto the safari page it says Safari quit unexpectedly and gives an option to reopen If I click reopen the same error message pops up Then if I click the
-
Problem with "carriage Return" or "Line Feed" in a table
Hello, I need help with the function Zeichen(), so called it in german, I'm not sure if it is char() in english. In Pages Version 4.0.1 (746) I've created a table in Pages with this function to make an "carriage Return" in a cell. Here an example: {
-
I have no clue as to what my security question answers are and since this is my first purchase from my mac book it is asking for these. What do i do?
-
Security tab no longer showing in System Prefs.
Hi I have a white Macbook aprox 18 months old. Yesterday I opened system prefs and there was no longer a Security button. I just changed ISP and went in to the firewall the other day, but now it isn't there. Any help would be much appreciated. Thanks
-
Problem in ALV grid download to excel
Hello Gurus, I have a ALV report which has 40 columns but at a time it will only display 100 records(max). when I am trying to download it into excel (by using standard funcationality) only headings are getting downloaded. I checked out standard tabl