Calling ALV report in BAPI
Hi All There ,
I am calling ALV report in my bapi but it is not gettin called it is not giving screen of parameter selection derectly selectin all parameter
coding is as below
points assured.
Data: MTAB_REPORT_HTML type standard table of W3HTML WITH HEADER LINE.
Submit ZSDRUSHORDERSRPT with SELECTION-TABLE SELTAB
exporting list to Memory and return.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = list_tab
EXCEPTIONS
not_found = 1
OTHERS = 2.
CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
EXPORTING
TEMPLATE_NAME = 'WEBREPORTING_REPORT'
CHARSET = 'UTF8'
TABLES
html = MTAB_REPORT_HTML
listobject = list_tab.
FREE MEMORY.
CLEAR LIST_TAB[].
loop at MTAB_REPORT_HTML.
concatenate htmlstring
MTAB_REPORT_HTML-LINE into htmlstring.
endloop.
No, It is not specific to ALV. If you can give the example of that SUBMIT then it can be analyzed. It can be for other additions that is used in the submit statement.
Like:
1. ... USING SELECTION-SCREEN dynnr
2. ... VIA SELECTION-SCREEN
Effect
The addition USING SELECTION-SCREEN specifies the selection screen, VIA SELECTION-SCREEN specifies whether it is displayed. The additions selscreen_parameters provide values for the parameters, selection criteria, and the free selection of the called selection screen.
The values are transferred to the selection screen between the events INITIALIZATION and AT SELECTION-SCREEN OUTPUT The following hierarchy applies for transferring values:
1. First, the variant of the addition USING SELECTION-SET is transferred, which sets all parameters and selection criteria to the values of the variant. The values previously set in the called program are overwritten.
2. The values of the table of the addition WITH SELECTION-TABLE are then transferred. All parameters and selection criteria specified there are overwritten accordingly.
3. Finally, the values of the additions WITH sel value are transferred. All parameters and selection criteria are overwritten accordingly. If the addition WITH sel value is used more than once for the same parameter, this is overwritten with the last specified value. If the addition WITH sel value is used more than once for the same selection criterion, a selection table with the corresponding number of lines is transferred.
Providing values for free selections is independent of this hierarchy.
Notes
The options for parameter transfer enable a selection screen to be viewed as a parameter interface of an executable program. This applies particularly for background selection screen processing and for parameters and selection criteria that are defined without screen elements using the addition NO-DISPLAY
When transferring data, note that any adjustments made to the screen format, such as abbreviations or the execution of conversion routines, are not executed for fields for which there are no screen elements on the selection screen. This applies for all parameters and selection criteria defined with NO DISPLAY. It also applies for all lines of a selection table with the exception of the first line.
The additions selscreen_parameters only work the first time the called program is executed. If a selection screen is displayed in the called program, the runtime environment calls the program again after it is finished, thereby replacing the values specified in selscreen_parameters with the previous input values.
Addition 1
... USING SELECTION-SCREEN dynnr
Effect
This addition specifies which selection screen is called. dynnr is a data object that must contain the screen number of a selection screen defined in the called program when the SUBMIT statement is called.
If the addition USING SELECTION-SCREEN is omitted or the screen number 1000 is entered, the standard selection screen is called. If no standard selection screen is defined in the called program, no selection screen is called.
If a screen number that is not 1000 is entered in the addition USING SELECTION-SCREEN, the corresponding independent selection screen is called. If no selection screen with this screen number is defined in the called program, this leads to an untreatable exception.
Addition 2
... VIA SELECTION-SCREEN
Effect
If this addition is specified, the selection screen is displayed on the screen. Otherwise, background selection screen processing takes place. In background selection screen processing, the selection screen events are triggered without the selection screen being displayed.
SUBMIT - selscreen_parameters
Syntax
... [USING SELECTION-SET variant]
[USING SELECTION-SETS OF PROGRAM prog]
[WITH SELECTION-TABLE rspar]
[WITH expr_syntax1 WITH expr_syntax2 ...]
[WITH FREE SELECTIONS texpr] ... .
Extras:
1. ... USING SELECTION-SET variant
2. ... USING SELECTION-SETS OF PROGRAM prog
3. ... WITH SELECTION-TABLE rspar
4. ... WITH expr_syntax1 WITH expr_syntax2 ...
5. ... WITH FREE SELECTIONS texpr
Effect
USING-SELECTION-SET supplies all the selection screen components by means of a Variant variant. If you specify USING-SELECTION-SETS OF PROGRAM, you can use a variant from a different program; if you specify WITH SELECTION-TABLE, values for several selection screen components are transferred as the content of an internal table rspar; WITH expr_syntax supplies individual selection screen components with values. The addition WITH FREE SELECTIONS allows you to transfer free selections to the selection screen for alogical database.
Addition 1
... USING SELECTION-SET variant
Effect
If you specify this edition, the parameters and selection criteria for the selection screen are supplied with values from a variant. For variant, you must specify a character-like data object that contains the name of a variant for the program accessed when the statement is executed. If the variant does not exist, the system sends an error message. If the variant belongs to a different selection screen, it is ignored.
Note
You can create and manage variants for every program in which selection screens are defined, either in the ABAP Workbench or during execution of the program by choosing Goto - Variants on a selection screen.
Addition 2
... USING SELECTION-SETS OF PROGRAM prog
Effect
If you specify this addition, the variants of the program prog are used in the program accessed. For prog, you must specify a character-like data object that contains the name of a program when the statement is executed. The addition has the following effect:
If a variant variant is specified with USING SELECTION-SET, the system searches for this variant in the program prog.
If the selection screen is displayed with VIA SELECTION-SCREEN, all the functions that can be accessed by means of the menu path Goto - Variants affect the variants of the program prog. However, these functions are only active if prog is an executable program.
Note
The program prog should contain a selection screen that has the same parameters and selection criteria as the selection screen used in the program accessed.
Addition 3
... WITH SELECTION-TABLE rspar
Effect
If you specify this addition, parameters and selection criteria on the selection screen are supplied from an internal table rspar. You must specify an internal table with the row type RSPARAMS for rspar. The structured data type RSPARAMS is defined in the ABAP Dictionary and has the following components, all of which are data type CHAR:
SELNAME (length 8),
KIND (length 1),
SIGN (length 1),
OPTION (length 2),
LOW (length 45),
HIGH (length 45).
To supply parameters and selection criteria for the selection screen with specific values, the lines in the internal table rspar must contain the following values:
SELNAME must contain the name of a parameter or selection criterion for the selection screen in block capitals
KIND must contain the type of selection screen component (P for parameters, S for selection criteria)
SIGN, OPTION, LOW, and HIGH must contain the values specified for the selection table columns that have the same names as the selection criteria; in the case of parameters, the value must be specified in LOW and all other components are ignored.
If the name of a selection criterion is repeated in rspar, this defines a selection table containing several lines and passes it on to the selection criterion. If parameter names occur several times, the last value is passed on to the parameter.
The contents of the parameters or selection tables for the current program can be entered in the table by the function module RS_REFRESH_FROM_SELECTOPTIONS.
Notes
In contrast to selection tables, the data types of the components LOW and HIGH in table rspar are always of type CHAR and are converted to the type of the parameter or selection criterion during transfer, if necessary.
When entering values, you must ensure that these are entered in the internal format of the ABAP values, and not in the output format of the screen display.
Addition 4
... WITH expr_syntax1 WITH expr_syntax2 ...
Effect
This addition supplies values to individual parameters or selection criteria for the selection screen. Parameters are supplied with single values and selection criteria with selection tables that overwrite values already specified in the program accessed. The selection table to be transferred is compiled from all the expr_syntax additions that address the same selection criterion sel. You can specify the following statements for expr_syntax, where you have to specify the name of a parameter or a selection criterion directly for sel:
sel {EQ|NE|CP|NP|GT|GE|LT|LE} dobj [SIGN sign]
Transfer of a single value.
The operators before dobj correspond to the values specified for column OPTION for selection tables. For dobj, you must specify a data object whose data type can be converted to the data type of the selection screen component sel. For sign, you can specify a character-like field that must contain 'I' or 'E'. The standard value is 'I'.
If sel is a selection criterion, the system appends a line in the selection table to be transferred, placing the operator in column OPTION, the content of dobj in column LOW, and the content of sign in column SIGN.
If sel is a parameter, it is set to the value of dobj in the program accessed. The operator and the value of sign are not taken into account.
sel [NOT] BETWEEN dobj1 AND dobj2 [SIGN sign]
Transfer of an interval.
In this case, sel must be a selection criterion. For dobj, you must specify data objects whose data type can be converted to that of the columns LOW and HIGH for the selection criterion sel. For sign, you can specify a character-like field that must contain 'I' or 'E'. The standard value is 'I'.
A line is appended in the selection table to be transferred. If NOT is specified, the value 'NB' is placed in column OPTION; otherwise, the value entered is 'BT'. The content of the data objects dobj and sign is placed in the columns LOW, HIGH, and SIGN.
sel IN rtab
Transfer of a ranges table.
In this case, sel must be a selection criterion. For rtab, you must specify an internal table that has the same structure as the selection table for selection criterion sel. A table of this type can be created using the addition RANGE OF to the statements TYPES and DATA.
The lines in table rtab are appended to the selection table to be transferred.
You can specify the addition expr_syntax more than once, and you can also specify the same selection screen component more than once.
Notes:
= or INCL can also be used instead of the operator EQ.
When entering values, you must ensure that these have the internal format of the ABAP values, and not the output format of the screen display.
Example
The program report1 has a stand-alone selection screen with the screen number 1100. In the program report2, an internal table with row type RSPARAMS and a ranges table are filled for this selection screen. These are transferred at SUBMIT together with a single condition.
Program accessed
REPORT report1.
DATA text TYPE c LENGTH 10.
SELECTION-SCREEN BEGIN OF SCREEN 1100.
SELECT-OPTIONS: selcrit1 FOR text,
selcrit2 FOR text.
SELECTION-SCREEN END OF SCREEN 1100.
Calling program
REPORT report2.
DATA: text TYPE c LENGTH 10,
rspar_tab TYPE TABLE OF rsparams,
rspar_line LIKE LINE OF rspar_tab,
range_tab LIKE RANGE OF text,
range_line LIKE LINE OF range_tab.
rspar_line-selname = 'SELCRIT1'.
rspar_line-kind = 'S'.
rspar_line-sign = 'I'.
rspar_line-option = 'EQ'.
rspar_line-low = 'ABAP'.
APPEND rspar_line TO rspar_tab.
range_line-sign = 'E'.
range_line-option = 'EQ'.
range_line-low = 'H'.
APPEND range_line TO range_tab.
range_line-sign = 'E'.
range_line-option = 'EQ'.
range_line-low = 'K'.
APPEND range_line TO range_tab.
SUBMIT report1 USING SELECTION-SCREEN '1100'
WITH SELECTION-TABLE rspar_tab
WITH selcrit2 BETWEEN 'H' AND 'K'
WITH selcrit2 IN range_tab
AND RETURN.
Result
After report1 has been accessed by report2, the selection tables for the selection criteria selcrit1 and selcrit2 in the program accessed contain the following entries:
Addition 5
... WITH FREE SELECTIONS texpr
Effect
This addition supplies values to the dynamic selections for the selection screen for a logical database. The program accessed must be linked to a logical database that supports dynamic selections. texpr must be an internal table of the type RSDS_TEXPR from type group RSDS.
In texpr, the selections for the dynamic selections are specified in an internal format (Reverse Polish Notation). You can use function modules FREE_SELECTIONS_INIT, FREE_SELECTIONS_DIALOG, and FREE_SELECTIONS_RANGE_2_EX from the function group SSEL to fill texpr in the calling program. While the first two function modules execute a user dialog, you can transfer ranges tables to FREE_SELECTIONS_RANGE_2_EX for each node in the dynamic selection in an internal table of the type RSDS_TRANGE. These are then converted to a table of the row type RSDS_TEXPR. If the calling program contains a selection screen with the same dynamic selections, you can transfer its content beforehand to a table of the type RSDS_TRANGE using the function module RS_REFRESH_FROM_DYNAMICAL_SEL.
The lines in the internal table type RSDS_TRANGE contain a flat component TABLENAME for each node and a table-like component FRANGE_T of the type RSDS_FRANGE_T for the fields in the node. The lines in RSDS_FRANGE_T contain a flat component FIELDNAME for each field and a table-like component SELOPT_T of the row type RSDSSELOPT from the ABAP Dictionary. RSDSSELOPT contains the four components SIGN, OPTION, LOW, and HIGH and can include the ranges table.
Example
Program report1 is linked to the logical database F1S, which supports dynamic selections for the node SPFLI. Program report2 enters conditions in a nested internal table of the type rsds_trange with selection conditions for field CONNID in node SPFLI; this is then converted to a table of the type rsds_texpr, which is transferred at SUBMIT.
Program accessed
REPORT report1.
NODES: spfli, sflight, sbook.
Calling program
REPORT report2.
TYPE-POOLS rsds.
DATA: trange TYPE rsds_trange,
trange_line
LIKE LINE OF trange,
trange_frange_t_line
LIKE LINE OF trange_line-frange_t,
trange_frange_t_selopt_t_line
LIKE LINE OF trange_frange_t_line-selopt_t,
texpr TYPE rsds_texpr.
trange_line-tablename = 'SPFLI'.
trange_frange_t_line-fieldname = 'CONNID'.
trange_frange_t_selopt_t_line-sign = 'I'.
trange_frange_t_selopt_t_line-option = 'BT'.
trange_frange_t_selopt_t_line-low = '0200'.
trange_frange_t_selopt_t_line-high = '0800'.
APPEND trange_frange_t_selopt_t_line
TO trange_frange_t_line-selopt_t.
trange_frange_t_selopt_t_line-sign = 'I'.
trange_frange_t_selopt_t_line-option = 'NE'.
trange_frange_t_selopt_t_line-low = '0400'.
APPEND trange_frange_t_selopt_t_line
TO trange_frange_t_line-selopt_t.
APPEND trange_frange_t_line TO trange_line-frange_t.
APPEND trange_line TO trange.
CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_EX'
EXPORTING
field_ranges = trange
IMPORTING
expressions = texpr.
SUBMIT report1 VIA SELECTION-SCREEN
WITH FREE SELECTIONS texpr.
Similar Messages
-
How to call ALV Report and SMARTFORMS through Pushbutton
hi,
i have created a report.My task is to create two buttons:
1)ALV Report.
2)SMARTFROMS.
Through these button i have to call ALV Report and SMARTFORMS. i have created both button and when i execute the program,
it shows me the button but not working when i click on it.
this is the coding i have used in my report for calling ALV Report.
''Tables sscrfields,
DATA flag(1) Type c.
selection-screen: begin of screen 500 AS WINDOW TITLE tit,
BEGIN OF LINE,
PUSHBUTTON 2(18) but1 USER-COMMAND cli1,
end of line,
BEGIN OF LINE,
PUSHBUTTON 2(18) but2 USER-COMMAND cli2,
end of line,
end of screen 500.
SET PF-STATUS 'STATUS_0100'.
at selection-screen.
case sscrfields.
WHEN 'cli1'.
flag = '1'.
WHEN 'cli2'.
flag = '2'.
endcase.
at USER-COMMAND.
CASE SY-UCOMM.
WHEN 'Detail'.
select vbakkunnr VBakernam VBAkaudat vbakaufnr vbapKWMENG vbapmatnr vbap~ARKTX
into but1
from vbak inner join vbap
on vbakvbeln = vbapvbeln.
ENDSELECT.
ENDCASE.
START-OF-SELECTION.
tit = 'Format'.
but1 = 'ALV Report'.
but2 = 'SMARTFORMS'.
CALL SELECTION-SCREEN 500.
and i also use in my report
''case sscrfields-ucomm'' and ''submit my_report'' but the still button doesn't show the result.
Thanks & Regards,Hi,
I understood your requirement. What i found is, you are creating screen 500 and call it after START-OF-SELECTION,
at that time your AT USER-COMMAND doesn't work.
So what i would suggest , u should create GUI STATUS named ' PFSTAT'
having one functional key 'EXIT' that is standard u can just name it
and
other two u can assign in Freely assigned Function keys as 'BUT1' & 'BUT2'. and than in Application Toolbar u jst have it in ITEM LIST by typing BUT1 and BUT2.
For 'BUT1' text would be 'ALV' and 'BUT2' text would be 'SMARTFORMS'.
Now in Program you can code,,,
START-OF-SELECTION.
SET PF-STATUS 'PFSTAT'.
WRITE:/ 'TEST'.
at user-command.
case SY-UCOMM.
WHEN 'BUT1'.
WHEN 'BUT2'.
WHEN 'EXIT'.
LEAVE PROGRAM.
endcase.
In Program u set PF STATUS and use at user-command event, whcih gets triggered when u click on button . When u execute program you get two button in application tooldbar.
Please do needful.
Thanks,
Saurin SHah -
Dear all,
I am trying to create a customer from external system through bapi. For this is i have to follow these steps.
1) I am trying to call a report from external system through bapi.
2) I want to pass data from bapi to a bdc program and run it to create a customer.
3) After creating a customer I need to send the ceated customer no again to the bapi from where i passed the data to bdc.
is it possible .
Give me a good idea on this how to work with it.
Regards,
Madhu.Hi Madhu,
SAP has already given standard BAPI to create customer creation "BAPI_CUSTOMER_CREATEFROMDATA". So there is no need for you to create any thing new. Jut test this BAPI first whether this suit your requirement or not. If it satisfy your requirement then call it directly from external system. On how to call this BAPI or other BAPis searc google or SDn you will definetaly find something.
second approach is if nothing works for you( No BAPI satisfy your requirement) then only go for BDC aapproach. To do that, create a RFC function module( BAPi and RFC FM are diff thing, they looks same but they are not ). Inside your RFC FM directly write the BDC code to create customer.
Regards
Anurag -
Calling Alv Report From Mobile
Hi All,
I need some information to cal a alv report from mobile. I created one report ans can see the selection screen in gui after calling. Here the screen is really big i need to adjust the size because it may take more load and time if i call from a mobile . Is it possible to call the same from mobile or do i need any separate application to call this from mobile. Please *** you valuable suggestions.
Regards
Madhu.Hello Madhu,
What is your system details?
Kernel and BASIS?
Device OS & Browser?
What are the GUI Configuration settings of the ITSMobile Service?
What ITSMobile Generation STYLE was used?
Perhaps useful notes:
1037715 ITSmobile: Supported screen elements
1309633 ITSmobile: custom OMRT controls auto-recognized at runtime
1312835 ITSmobile: page navigation in ALV Grid on Windows Mobile
1668784 ITSmobile: new features for ALV Grid
Regards,
Oisin -
Possibility of calling ALV report
hi experts,
i have a requirement that i have to design an entry screen whcih contain pushbuttons (SAVE, CLEAR ,DISPLAY).
whenever user pressed DISPLAY, he wants to call the selection screen of an alv report which is already exists.
is that possible to call an alv report selection screen and execute it.
any suggestions pls.
thanks®ards
maheshlap.
Edited by: Thomas Zloch on Dec 17, 2011 11:07 PMHi,
Follow this code,
*DISPLAY DYNAMIC PUSHBUTTON ON APP TOOLBAR ON USER CLICKS
SELECTION-SCREEN: FUNCTION KEY 1,
FUNCTION KEY 2,
FUNCTION KEY 3.
**EVENT ON SELECTION SCREEN FOR OUTPUT DISPLAY
AT SELECTION-SCREEN OUTPUT.
*CLICK OF FIRST RADIO BUTTON
IF pa = 'X'.
sscrfields-functxt_01 = 'Materials Management'.
WRITE icon_plant AS ICON TO text_001.
*CODE TO GET DYNAMICS BASED ON THE SELECTED RADIO
LOOP AT SCREEN.
IF screen-group1 = 'MOD'.
screen-intensified = '1'.
screen-active = 1.
screen-display_3d = '1'.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'RAD'.
screen-intensified = '0'.
screen-active = 0.
screen-display_3d = '0'.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'CAD'.
screen-intensified = '0'.
screen-active = 0.
screen-display_3d = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
*CLICK OF SECOND RADIO
IF pb = 'X'.
sscrfields-functxt_02 = 'Sales And Distribution'.
WRITE icon_ws_ship AS ICON TO text_001.
LOOP AT SCREEN.
IF screen-group1 = 'RAD'.
screen-intensified = '1'.
screen-active = 1.
screen-display_3d = '1'.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'MOD'.
screen-intensified = '0'.
screen-active = 0.
screen-display_3d = '0'.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'CAD'.
screen-intensified = '0'.
screen-active = 0.
screen-display_3d = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
*CLICK OF THIRD RADIO
IF pc = 'X'.
sscrfields-functxt_03 = 'Human Resources'.
WRITE icon_new_employee AS ICON TO text_001.
LOOP AT SCREEN.
IF screen-group1 = 'RAD'.
screen-intensified = '0'.
screen-active = 0.
screen-display_3d = '0'.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'MOD'.
screen-intensified = '0'.
screen-active = 0.
screen-display_3d = '0'.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'CAD'.
screen-intensified = '1'.
screen-active = 1.
screen-display_3d = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
*CUSTOMISING THE TOOLBARS OF THE SELECTION SCREEN
*WITH F8 BUTTON DISABLED
APPEND : 'PRIN' TO it_ucomm,
'SPOS' TO it_ucomm,
'ONLI' TO it_ucomm.
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
EXPORTING
p_status = sy-pfkey
TABLES
p_exclude = it_ucomm.
Warm Regards,
PavanKumar.G -
Hi..
i have copied and modified standard bapi bapi_quotation_createfromdata.
Ihave got a program in se38 as yragtest4..
i need to call this report in my bapi and should be able to run from bapi..
RaghuThanks for your reply ferry..
what do i need to do here..
plz suggest me.
CALL FUNCTION 'SUBMIT_REPORT'
EXPORTING
RDIR = TRDIR
report = 'zragtest4'
RET_VIA_LEAVE = 'X'
VARIANT = ' '
VARIPROG = ' '
SKIP_SELSCREEN = ' '
EXPRESSIONS =
IMPORTING
VARIANT =
TABLES
SELECTION_TABLE =
EXCEPTIONS
JUST_VIA_VARIANT = 1
NO_SUBMIT_AUTH = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
how to call 2 diff alv reports in 1 custom control dynamically
Hi Naveen,
REPORT ytest .
* Based on: BCALV_GRID_DEMO.
TYPE-POOLS: icon.
TYPES: BEGIN OF ty_s_sflight.
INCLUDE TYPE sflight.
TYPES: button1 TYPE lvc_emphsz.
TYPES: button2 TYPE lvc_emphsz.
TYPES: button3 TYPE lvc_emphsz.
TYPES: button4 TYPE lvc_emphsz.
TYPES: END OF ty_s_sflight.
DATA:
gt_sflight TYPE STANDARD TABLE OF ty_s_sflight,
gt_fcat TYPE lvc_t_fcat.
DATA: ok_code LIKE sy-ucomm,
* gt_sflight TYPE TABLE OF sflight,
g_container TYPE scrfname VALUE BCALV_GRID_DEMO_0100_CONT1′,
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_cnt TYPE i.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender.
ENDCLASS. lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
* define local data
FIELD-SYMBOLS:
TYPE ty_s_sflight,
TYPE ANY.
READ TABLE gt_sflight ASSIGNING INDEX es_row_no-row_id.
CHECK ( IS ASSIGNED ).
* Set all radio buttons unselected
-button1 = ICON_CANCEL.
-button2 = ICON_CANCEL.
-button3 = ICON_CANCEL.
-button4 = ICON_CANCEL.
ASSIGN COMPONENT e_column_id-fieldname OF STRUCTURE
TO .
IF ( IS ASSIGNED ).
* Set selected radio button selected.
= ICON_OKAY.
ENDIF.
* Force PAI followed by refresh of table display in PBO
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = DUMMY
* IMPORTING
* RC =
ENDMETHOD. handle_hotspot_click
ENDCLASS. lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
* MAIN *
PERFORM select_data.
CALL SCREEN 100.
* MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS MAIN100′.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
CREATE OBJECT grid1
EXPORTING i_parent = g_custom_container.
PERFORM build_fieldcatalog.
CALL METHOD grid1->set_table_for_first_display
* EXPORTING
* i_structure_name = SFLIGHT
CHANGING
it_fieldcatalog = gt_fcat
it_outtab = gt_sflight.
* Set event handler for event TOOLBAR
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR grid1.
else.
CALL METHOD grid1->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
FINISHED = 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.
ENDIF.
ENDMODULE. PBO OUTPUT
* MODULE PAI INPUT *
MODULE pai INPUT.
* to react on oi_custom_events:
CALL METHOD cl_gui_cfw=>dispatch.
* CASE ok_code.
CASE sy-ucomm.
WHEN EXIT.
PERFORM exit_program.
WHEN OTHERS.
* do nothing
ENDCASE.
CLEAR ok_code.
ENDMODULE. PAI INPUT
* FORM EXIT_PROGRAM *
FORM exit_program.
* CALL METHOD G_CUSTOM_CONTAINER->FREE.
* CALL METHOD CL_GUI_CFW=>FLUSH.
LEAVE PROGRAM.
ENDFORM. EXIT_PROGRAM
*& Form BUILD_FIELDCATALOG
* text
* > p1 text
* 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DELETE gt_fcat WHERE ( fieldname EMPHASIZE ).
CALL FUNCTION LVC_FIELDCATALOG_MERGE
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = SFLIGHT
* I_CLIENT_NEVER_DISPLAY = X
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE gt_fcat INTO ls_fcat
WITH KEY fieldname = EMPHASIZE.
IF ( syst-subrc = 0 ).
DELETE gt_fcat INDEX syst-tabix.
ENDIF.
ls_fcat-fieldname = BUTTON4′.
ls_fcat-icon = X.
ls_fcat-hotspot = X.
INSERT ls_fcat INTO gt_fcat INDEX 4.
ls_fcat-fieldname = BUTTON3′.
INSERT ls_fcat INTO gt_fcat INDEX 4.
ls_fcat-fieldname = BUTTON2′.
INSERT ls_fcat INTO gt_fcat INDEX 4.
ls_fcat-fieldname = BUTTON1′.
INSERT ls_fcat INTO gt_fcat INDEX 4.
LOOP AT gt_fcat INTO ls_fcat.
ls_fcat-col_pos = syst-tabix.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
ENDLOOP.
ENDFORM. BUILD_FIELDCATALOG
*& Form SELECT_DATA
* text
* > p1 text
Reward pts if found usefull
Regards
Sathish -
Hi friends i am new to abap.i am doing some validation in my report .my program is executing properly but i need some modification.... its alv report on bapi for GOODS MOVEMENT TYPE For tht i am uploading a flat file using gui_upload.but i need some modification on validation..this program is abt goods transfer from one plant to another plant,s location .so in my flat file i am having material,from plant ,from location,to plant,to location and quantity .here is the code:
*& Form VALIDATE_DATA
1.Check Material in Table MARC >> Material Plant Validation
If not found, Fill Remarks with 'Material Not Found in Plant'
2.Check Plant is Assigned to POrg in Table T024W >> Plant POrg Validation
If not found, Fill Remarks with 'Invalid POrg for Plant'
3.Check Location for Plant and Location in Table T001L >> Plant SLoc Validation
If not found, Fill Remarks with 'Invalid Storage Location for Plant'
FORM validate_data .
DATA: lv_ekorg TYPE t024e-ekorg.
Get POrg for CompanyCode
SELECT SINGLE ekorg INTO lv_ekorg FROM t024e
WHERE bukrs EQ p_bukrs.
LOOP AT it_final.
Check-1
SELECT SINGLE * FROM marc
WHERE matnr = it_final-matnr
AND werks = it_final-f_werks.
IF sy-subrc = 4.
it_final-remark = 'Material Not Found in Plant'.
MODIFY it_final.
ELSE.
Check-2
SELECT SINGLE * FROM t024w
WHERE werks = it_final-t_werks
AND ekorg = lv_ekorg.
IF sy-subrc = 4.
it_final-remark = 'Invalid POrg for Plant'.
MODIFY it_final.
ELSE.
Check-3
SELECT SINGLE * FROM t001l
WHERE werks = it_final-t_werks
AND lgort = it_final-t_lgort.
IF sy-subrc = 4.
it_final-remark = 'Invalid Storage Location for Plant'.
MODIFY it_final.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " VALIDATE_DATA
for this code i am getting output as if plant value is wrong then there will be a remark in the output as material is 'Material Not Found in Plant'....and as same for location n purchase organization....
But in my output i want ,if there is plant n location is wrong the then 2 remarks should display in 2 rows but like wise now i am getting only one remark for 2 errors also..........getting remark based on first condition....
can any one help me hw to solve ...*& Report YSG_IM_F2_002 *
*& This object is for goods transfer from one plant to another *
*& plant using FM-BAPI_GOODSMVT_CREATE *
REPORT YSG_IM_F2_002 .
TABLES: marc, t024w, t001l.
TYPE-POOLS:slis.
TYPES: BEGIN OF i_list,
matnr LIKE mard-matnr,
f_werks LIKE mard-werks,
f_lgort LIKE mard-lgort,
t_werks LIKE mard-werks,
t_lgort LIKE mard-lgort,
labst LIKE mard-labst,
remark TYPE c,
END OF i_list.
TYPES: BEGIN OF i_mara,
matnr LIKE mara-matnr,
END OF i_mara.
TYPES:BEGIN OF i_marc,
matnr LIKE marc-matnr,
werks LIKE marc-werks,
END OF i_marc.
TYPES: BEGIN OF i_mard,
matnr LIKE mard-matnr,
f_werks LIKE mard-werks,
f_lgort LIKE mard-lgort,
t_werks LIKE mard-werks,
t_lgort LIKE mard-lgort ,
labst LIKE mard-labst,
END OF i_mard.
TYPES: BEGIN OF i_t001l,
bukrs TYPE t001l-werks,
lgort TYPE t001l-lgort,
END OF i_t001l.
TYPES: BEGIN OF i_t024e,
ekorg TYPE t024e-ekorg,
bukrs TYPE t024e-bukrs,
END OF i_t024e.
TYPES: BEGIN OF i_mkpf,
xblnr type mkpf-xblnr,
END OF i_mkpf.
TYPES: BEGIN OF i_final,
matnr LIKE mard-matnr,
f_werks LIKE mard-werks,
f_lgort LIKE mard-lgort,
t_werks LIKE mard-werks,
t_lgort LIKE mard-lgort,
labst type c ,
remark(50) type c,
END OF i_final.
DATA : filename TYPE string,
title type c.
DATA: it_list TYPE STANDARD TABLE OF i_list WITH HEADER LINE,
it_mara TYPE STANDARD TABLE OF i_mara WITH HEADER LINE,
it_marc TYPE STANDARD TABLE OF i_marc WITH HEADER LINE,
it_mard TYPE STANDARD TABLE OF i_mard WITH HEADER LINE,
it_t001l TYPE STANDARD TABLE OF i_t001l WITH HEADER LINE,
it_t024e TYPE STANDARD TABLE OF i_t024e WITH HEADER LINE,
it_mkpf TYPE STANDARD TABLE OF i_mkpf WITH HEADER LINE,
it_final TYPE STANDARD TABLE OF i_final WITH HEADER LINE.
DATA: fs_fldcat TYPE slis_fieldcat_alv , "Structure for Field catalog
it_fldcat LIKE TABLE OF fs_fldcat,
layout TYPE slis_layout_alv,
V_REPID LIKE sy-repid.
DATA: GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
EVENTS TYPE SLIS_T_EVENT,
GW_EVENT TYPE SLIS_ALV_EVENT,
GI_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA: lv_matnr TYPE mara-matnr,
lv_ekorg TYPE t024e-ekorg.
DATA: BEGIN OF gmhead.
INCLUDE STRUCTURE bapi2017_gm_head_01.
DATA: END OF gmhead.
DATA: BEGIN OF gmcode.
INCLUDE STRUCTURE bapi2017_gm_code.
DATA: END OF gmcode.
DATA: BEGIN OF mthead.
INCLUDE STRUCTURE bapi2017_gm_head_ret.
DATA: END OF mthead.
DATA: BEGIN OF itab OCCURS 100.
INCLUDE STRUCTURE bapi2017_gm_item_create.
DATA: END OF itab.
DATA: BEGIN OF errmsg OCCURS 10.
INCLUDE STRUCTURE bapiret2.
DATA: END OF errmsg.
*data: wmenge like iseg-menge,
errflag.
*Selection Screen Declaration
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text-001.
PARAMETERS: p_bukrs LIKE t024e-bukrs OBLIGATORY,
ekorg LIKE t024e-ekorg,
f_file LIKE ibipparms-path OBLIGATORY,
xblnr like mkpf-xblnr,
Doc_Post type checkbox.
SELECTION-SCREEN END OF BLOCK blk .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR f_file .
CLEAR f_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = .
DYNPRO_NUMBER = SYST-DYNNR
IMPORTING
file_name = f_file.
START-OF-SELECTION.
filename = f_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = filename
filetype = 'ASC'
has_field_separator = 'x'
TABLES
data_tab = it_final
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM validate_data.
PERFORM bapi_goods_mvt.
PERFORM alv_grid_display.
endif.
PERFORM BAPI_GOODS_MVT.
*& Form VALIDATE_DATA
1.Check Material in Table MARC >> Material Plant Validation
If not found, Fill Remarks with 'Material Not Found in Plant'
2.Check Plant is Assigned to POrg in Table T024W >> Plant POrg Validation
If not found, Fill Remarks with 'Invalid POrg for Plant'
3.Check Location for Plant and Location in Table T001L >> Plant SLoc Validation
If not found, Fill Remarks with 'Invalid Storage Location for Plant'
FORM validate_data .
Get POrg for CompanyCode
SELECT SINGLE ekorg INTO lv_ekorg FROM t024e
WHERE bukrs EQ p_bukrs.
LOOP AT it_final.
Check-1
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = it_final-matnr
IMPORTING
output = lv_matnr.
SELECT SINGLE * FROM marc
WHERE matnr = lv_matnr
AND werks = it_final-f_werks.
IF sy-subrc <> 0.
it_final-remark = 'Material Not Found in Plant'.
append it_final .
endif .
SELECT SINGLE * FROM marc
WHERE matnr = lv_matnr
AND werks = it_final-t_werks.
IF sy-subrc <> 0.
it_final-remark = 'Material Not Found in Plant'.
append it_final .
endif.
Check-2
SELECT SINGLE * FROM t024w
WHERE werks = it_final-t_werks
AND ekorg = lv_ekorg.
IF sy-subrc <> 0.
it_final-remark = 'Invalid POrg for Plant'.
append it_final .
Endif.
SELECT SINGLE * FROM t024w
WHERE werks = it_final-f_werks
AND ekorg = lv_ekorg.
IF sy-subrc <> 0.
it_final-remark = 'Invalid POrg for Plant'.
append it_final .
Endif.
Check-3
SELECT SINGLE * FROM t001l
WHERE werks = it_final-t_werks
AND lgort = it_final-t_lgort.
IF sy-subrc <> 0.
it_final-remark = 'Invalid Storage Location for Plant'.
append it_final .
ENDIF.
SELECT SINGLE * FROM t001l
WHERE werks = it_final-f_werks
AND lgort = it_final-f_lgort.
IF sy-subrc <> 0.
it_final-remark = 'Invalid Storage Location for Plant'.
append it_final .
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " VALIDATE_DATA
*& Form ALV_GRID_DISPLAY
text
FORM alv_grid_display.
DATA:l_edit TYPE lvc_s_glay.
PERFORM build_fieldcat.
PERFORM layout_build USING layout.
PERFORM fill_list_header USING gi_listheader.
v_repid = sy-repid.
gw_event-name = slis_ev_top_of_page.
gw_event-form = 'TOP_OF_PAGE'.
APPEND gw_event TO events.
l_edit-edt_cll_cb = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = V_REPID
i_callback_pf_status_set = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
i_grid_title = title
I_GRID_SETTINGS =
is_layout = layout
it_fieldcat = it_fldcat
i_save = 'x'
IS_VARIANT =
IT_EVENTS = events
TABLES
t_outtab = it_final
EXCEPTIONS
program_error = 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. "ALV_GRID_DISPLAY
*& Form build_fieldcat
text
FORM build_fieldcat.
PERFORM fieldcat USING: 'IT_FINAL' "Internal table name
'MATNR' "CREDIT CONTROL AREA
'10' "length
'MATERIAL' "Description
'L' "Dictionary long text
' ' "Database table name
' ' "Database tab' field name
' ' "Justification R/M/L
' ' "To do total
' ' "emphasize
' ' "emphasize
' ' "emphasize
' ' "Data type
' ' "edit.
' '. "round
PERFORM fieldcat USING: 'IT_FINAL' "Internal table name
'F_WERKS' "CREDIT CONTROL AREA
'10' "length
'FROM PLANT' "Description
'L' "Dictionary long text
' ' "Database table name
' ' "Database tab' field name
' ' "Justification R/M/L
' ' "To do total
' ' "emphasize
' ' "emphasize
' ' "emphasize
' ' "Data type
' ' "edit.
' '. "round
PERFORM fieldcat USING: 'IT_FINAL' "Internal table name
'F_LGORT' "CREDIT CONTROL AREA
'10' "length
'LOCATION' "Description
'L' "Dictionary long text
' ' "Database table name
' ' "Database tab' field name
' ' "Justification R/M/L
' ' "To do total
' ' "emphasize
' ' "emphasize
' ' "emphasize
' ' "Data type
' ' "edit.
' '. "round
PERFORM fieldcat USING: 'IT_FINAL' "Internal table name
'T_WERKS' "CREDIT CONTROL AREA
'10' "length
'TO PLANT' "Description
'L' "Dictionary long text
' ' "Database table name
' ' "Database tab' field name
' ' "Justification R/M/L
' ' "To do total
' ' "emphasize
' ' "emphasize
' ' "emphasize
' ' "Data type
' ' "edit.
' '. "round
PERFORM fieldcat USING: 'IT_FINAL' "Internal table name
'T_LGORT' "CREDIT CONTROL AREA
'10' "length
'LOCATION' "Description
'L' "Dictionary long text
' ' "Database table name
' ' "Database tab' field name
' ' "Justification R/M/L
' ' "To do total
' ' "emphasize
' ' "emphasize
' ' "emphasize
' ' "Data type
' ' "edit.
' '. "round
PERFORM fieldcat USING: 'I_FINAL' "Internal table name
'LABST' "CREDIT CONTROL AREA
'10' "length
'QUANTITY' "Description
'L' "Dictionary long text
' ' "Database table name
' ' "Database tab' field name
' ' "Justification R/M/L
' ' "To do total
' ' "emphasize
' ' "emphasize
' ' "emphasize
' ' "Data type
' ' "edit.
' '. "round
PERFORM fieldcat USING: 'I_FINAL' "Internal table name
'REMARK' "CREDIT CONTROL AREA
'50' "length
'REMARK' "Description
'L' "Dictionary long text
' ' "Database table name
' ' "Database tab' field name
' ' "Justification R/M/L
' ' "To do total
' ' "emphasize
' ' "emphasize
' ' "emphasize
' ' "Data type
' ' "edit.
' '. "round
ENDFORM. "build_fieldcat
*& Form fieldcat
text
FORM fieldcat CHANGING value(p_tname)
value(p_fname)
value(p_length)
value(p_ltext)
value(p_typet)
value(p_rtab)
value(p_rfield)
value(p_just)
value(p_dosum)
value(p_emphasize)
value(p_datatype)
value(p_no_zero)
value(p_hotspot)
value(p_edit)
value(p_round).
fs_fldcat-tabname = p_tname.
fs_fldcat-fieldname = p_fname.
fs_fldcat-outputlen = p_length.
fs_fldcat-seltext_l = p_ltext.
fs_fldcat-input = p_typet.
fs_fldcat-edit = p_rtab.
fs_fldcat-ref_fieldname = p_rfield.
fs_fldcat-just = p_just.
fs_fldcat-do_sum = p_dosum.
fs_fldcat-emphasize = p_emphasize.
fs_fldcat-datatype = p_datatype.
fs_fldcat-lzero = p_no_zero.
fs_fldcat-hotspot = p_hotspot.
fs_fldcat-edit = p_edit.
fs_fldcat-decimals_out = p_round.
APPEND fs_fldcat TO it_fldcat.
ENDFORM. "fieldcat
*& Form fill_list_header
text
-->FV_I_LISTHEADER text
FORM fill_list_header USING fv_i_listheader TYPE slis_t_listheader.
DATA: lw_line TYPE slis_listheader,
l_date(10),
l_time(10).
DATA : p_date LIKE sy-datum.
DATA : p_time LIKE sy-uzeit.
DATA : ztext(17).
DATA : ztext1(80).
p_date = sy-datum.
p_time = sy-uzeit.
CLEAR fv_i_listheader.
CONCATENATE p_date6(2) '.' p_date4(2) '.' p_date+0(4) INTO l_date.
CONCATENATE p_time0(2) ':' p_time2(2) ':' p_time+4(2) INTO l_time.
IF doc_post = 'X'.
ztext = 'Execute Mode'.
ELSE.
ztext = 'Update Mode'.
ENDIF.
CLEAR lw_line.
lw_line-typ = 'H'.
lw_line-info = sy-repid.
APPEND lw_line TO fv_i_listheader.
CLEAR lw_line.
lw_line-typ = 'H'.
lw_line-info = l_date.
APPEND lw_line TO fv_i_listheader.
CLEAR lw_line.
lw_line-typ = 'H'.
lw_line-info = l_time.
APPEND lw_line TO fv_i_listheader.
CLEAR lw_line.
lw_line-typ = 'H'.
lw_line-info = sy-uname.
APPEND lw_line TO fv_i_listheader.
CLEAR lw_line.
lw_line-typ = 'H'.
lw_line-info = ztext.
APPEND lw_line TO fv_i_listheader.
endform. "fill_list_header
*& Form top_of_page
text
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gi_listheader.
ENDFORM. "top_of_page
*& Form layout_build
text
-->LAYOUT text
FORM layout_build USING layout TYPE slis_layout_alv.
layout-box_fieldname = 'BOX'.
layout-zebra = 'X'. " STRIPED PATTERN
layout-numc_sum = 'X'. " TOTALS FOR NUMC-FIELDS
layout-no_keyfix = ' '. " DO NOT FIX KEYCOLUMNS
layout-colwidth_optimize = ' ' .
layout-flexible_key = ' '. " KEY COLUMNS MOVABLE,...
layout-detail_popup = ' '. " SHOW DETAIL IN POPUP
ENDFORM. "layout_build
*& Form BAPI_GOODS_MVT
text
FORM bapi_goods_mvt.
DATA: dc_numner TYPE bapi2017_gm_head_ret-mat_doc,
dc_year TYPE bapi2017_gm_head_ret-doc_year.
clear: dc_numner, dc_year.
if doc_post = 'X'.
gmhead-pstng_date = sy-datum.
gmhead-doc_date = sy-datum.
gmhead-pr_uname = sy-uname.
gmhead-REF_DOC_NO = it_mkpf-xblnr.
gmcode-gm_code = '04'. "04 - MB1B - Transfer Posting
LOOP AT it_final.
itab-move_type = '301'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = it_final-matnr
IMPORTING
output = itab-material.
itab-plant = it_final-f_werks .
itab-stge_loc = it_final-f_lgort .
itab-MOVE_PLANT = it_final-t_werks .
itab-move_stloc = it_final-t_lgort .
itab-entry_qnt = it_final-labst .
APPEND itab.
ENDLOOP.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = gmhead
goodsmvt_code = gmcode
TESTRUN = ' '
IMPORTING
goodsmvt_headret = mthead
materialdocument = dc_numner
matdocumentyear = dc_year
TABLES
goodsmvt_item = itab
GOODSMVT_SERIALNUMBER =
return = errmsg.
IF errmsg[] IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
LOOP AT it_final.
it_final-remark = dc_numner.
MODIFY it_final.
ENDLOOP.
endif.
ELSE.
clear errflag.
LOOP AT errmsg.
IF errmsg-type EQ 'E'.
WRITE:/'Error in function', errmsg-message.
errflag = 'X'.
ELSE.
WRITE:/ errmsg-message.
ENDIF.
ENDLOOP.
endif.
ENDFORM. "BAPI_GOODS_MVT -
Hello,
What are my options for reporting tools in a BSP application? In our BSP project, we don't have the option for BW currently (not supported by compnay) so I am looking into ALV reporting. Is there any way we can integrate the two? It seems that using transaction iviews you can call ALV report on portal but that will be running outside your BSP framework. Can I use ALV report withing BSP? It appears that you can use the cl_salv_table (main ALV class) class in BSP. What are my options?
Thanks,
ParthoHi,
I'm in the same situation. I want to display report results in a BSP table using a list viewer component.
I've found some classes for web dynpro that use ALV to print data results. Is there any way to use the same within a BSP application?
(Web Dynpro example that use an ALV table:
'WDR_TEST_DYN_ALV_USAGE'.)
Thanks and regards,
Maria -
How to call an alv report from another program and return back
Hello ,
I am calling one abap program (Prgm B) from another program (Prgrm A).
Here, Prgm B is an ALV report. I have fetch some data from Prgem B that gets stored in an internal table.
Now, I am using below code in Prgrm A,
SUBMIT Prgrm B VIA SELECTION-SCREEN
WITH SELECTION-TABLE rspar
EXPORTING LIST TO MEMORY
AND RETURN.
When Prgrm A executed, it lead me to selection screen of Prgrm B and when I click F8, it shows me the report output, In short, it doesnt return back to Prgrm A. It ends up showing me the alv report if Prgrm B even afetr using RETURN statement.
I want to get back to Prgrm A by fetching some data from Prgrm B.
Please let me know, if i am missing something.
Regards,
SeemaHi Seema,
Refer below code.
DATA: v_matnr LIKE mara-matnr.
DATA: t_listobject TYPE abaplist OCCURS 0 WITH HEADER LINE.
DATA: t_mara TYPE mara OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_ascilist OCCURS 0,
line(200).
DATA: END OF t_ascilist.
data var(3) type c.
SELECT-OPTIONS: s_matnr FOR v_matnr.
var = ' 3'.
START-OF-SELECTION.
SUBMIT ztestaks1 WITH s_matnr IN s_matnr EXPORTING LIST TO MEMORY
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_listobject
EXCEPTIONS
not_found = 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.
ELSE.
CALL FUNCTION 'LIST_TO_ASCI'
* EXPORTING
* LIST_INDEX = -1
* WITH_LINE_BREAK = ' '
TABLES
listasci = t_ascilist
listobject = t_listobject
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
WRITE:/ 'Below are the lines from the submitted program.'.
LOOP AT t_ascilist.
WRITE:/ t_ascilist-line.
ENDLOOP.
SKIP 2.
ENDIF.
ENDIF.
IMPORT t_mara FROM MEMORY ID 'T_MARA'.
WRITE:/
'Here is the output from the table exported from the submitted program.'
LOOP AT t_mara.
WRITE:/ t_mara-matnr.
ENDLOOP.
Submitted program
REPORT ZTESTAKS1.
DATA: v_matnr LIKE mara-matnr,
v_maktx LIKE makt-maktx.
DATA: t_mara TYPE mara OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_makt OCCURS 0,
matnr LIKE makt-matnr.
DATA: END OF t_makt.
SELECT-OPTIONS: s_matnr FOR v_matnr,
s_maktx FOR v_maktx.
START-OF-SELECTION.
SELECT matnr INTO TABLE t_makt
FROM makt
WHERE matnr IN s_matnr
AND maktx IN s_maktx.
if not t_makt[] is initial.
SELECT * FROM mara
INTO TABLE t_mara FOR ALL ENTRIES IN t_makt
WHERE matnr = t_makt-matnr.
endif.
EXPORT t_mara TO MEMORY ID 'T_MARA'.
WRITE:/ 'This list is from the submitted program'.
SKIP 1.
LOOP AT t_mara.
WRITE:/ t_mara-mtart.
ENDLOOP.
Hopes this helps you.
Thanks,
Ashok. -
Call tcode from alv report and passing group of values
hi all .
i want to call tcode from alv report and passing an internal table or group of values to a selection option of that t code ? how
ex. passing group of GL to fbl3n and display the detials of all .
thank youDear,
You have done a small mistake
--> rspar_line-option = 'EQ'.
rspar_line-HIGH = PDATE-HIGH.
u r passing "high" value and in "option u r passing "EQ" so how it will work!!!
So if u r passing only 1 date or more dates like 01.01.2010 , 15.02.2010 , 10.03.2010 then pass
rspar_line-selname = 'SO_BUDAT'.
rspar_line-kind = 'S'.
rspar_line-sign = 'I'.
rspar_line-option = 'EQ'.
rspar_line-LOW = PDATE-HIGH.
APPEND rspar_line TO rspar_tab.
or if u r passing low & high date means in range like 01.01.2010 to 30.01.2010, then pass
rspar_line-selname = 'SO_BUDAT'.
rspar_line-kind = 'S'.
rspar_line-sign = 'I'.
rspar_line-option = 'BT''.
rspar_line-LOW = PDATE-LOW.
rspar_line-HIGH = PDATE-HIGH.
APPEND rspar_line TO rspar_tab.
try above code , hope it helps...
i think u cannot use "call transaction using bdcdata" in ur case bcoz as u said in ur 1st post u want to display the details of all but still if u want to use then u should pass all parameters in loop.
PROGRAM
DYNPRO
DYNBEGIN
FNAM
FVAL
ex:-
LOOP AT GT_TEMP INTO GS_TEMP.
CLEAR bdcdata_wa.
bdcdata_PROGRAM = 'SAPXXXX'.
bdcdata_DYNPRO = '1000'.
bdcdata_DYNBEGIN = 'X'.
bdcdata_wa-fnam = '''.
bdcdata_wa-fval = ''.
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_PROGRAM = ''.
bdcdata_DYNPRO = ''.
bdcdata_DYNBEGIN = ''.
bdcdata_wa-fnam = 'SD_SAKNR'.
bdcdata_wa-fval = GS_TEMP-GLACCOUNT.
APPEND bdcdata_wa TO bdcdata_tab.
CLEAR bdcdata_wa.
bdcdata_PROGRAM = ''.
bdcdata_DYNPRO = ''.
bdcdata_DYNBEGIN = ''.
bdcdata_wa-fnam = 'BDC_OKCODE'.
bdcdata_wa-fval = 'XXX'.
APPEND bdcdata_wa TO bdcdata_tab.
ENDLOOP.
try above code if u r using call transaction...
Edited by: mihir6666 on Jul 9, 2011 3:10 PM
Edited by: mihir6666 on Jul 9, 2011 3:11 PM
Edited by: mihir6666 on Jul 9, 2011 3:13 PM -
Code for Hot spot in ALV report to call transaction
Hi,
I hv never use hot spot to link as a call transaction can u give the link or code how to make hot spot on a particular fields i am working on a ALV report in that report in the belnr coloumn when user click on belnr i want to call FB03 transaction ref. to that belnr number and fisacl year.
regards,
zafarHi,
In the fieldcatalog you will have to write the hotspot as shown below,
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'"----> this is important
i_callback_pf_status_set = 'PFSTATUS'
it_fieldcat = it_fieldcat
is_layout = it_layout
it_event_exit = it_eventexit
i_screen_start_column = 10
i_screen_start_line = 20
i_screen_end_column = 70
i_screen_end_line = 45
i_grid_title = 'Customer-Order Details'
TABLES
t_outtab = it_data.
then you will have to catch the user command as follows,
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: alv_vbeln TYPE vbeln,
mess_text(30) TYPE c,
txt_vbeln(10) TYPE c.
*User clicks a Order No. in ALV it passed to the following transaction.
CASE r_ucomm.
WHEN '&IC1'.
READ TABLE it_data INDEX rs_selfield-tabindex INTO wa_data.
alv_vbeln = wa_data-vbeln..
IF sy-subrc = 0.
CLEAR: mess_text, txt_vbeln.
SUBMIT zprogram
WITH pr_vbeln = alv_vbeln AND RETURN.
put your call transaction logic here
ENDIF.
ENDCASE.
ENDFORM. "user_command
Hope it helps you,
Regards,
Abhijit G. Borkar -
Calling a ALV Report program via a Remote Function module.
H All,
The thing which I am looking out for is ,to know a technique to acheive this,
To start with,
For the transaction MB51-(Material Document List),which is a Report Program "RM07DOCS",I also observed that this uses a ALV to display the output.
Now what I actually require is another extra field (from MARA table ) along with the standard output that is displayed from this report.
Also this needs to be passed to a different UI system(build using VC ).
So I have a RFC eg DisplayList(),where in I need to exeucte this report program ,get the output what it gives ,add my additional information what I want to and pass it as a export parameter,
So this is the structure which I can visualise,
FUNCTION ZFUN_MB51TXN.
I would get all the import parameters here ,from who ever is calling my fun module,
*Call the report program,pass the input parameters required
*get the output from this report program
*send the output to the caller through export parameters
ENDFUNCTION.
So Here I need to know ,Can this be achieved something using Submit report or anything,Any guidelines to move further would be really of great help!Hi All,
It would really be great if you can explain with the reference to the same report program,the same selection screen elemetns or something.
Thanks,
Archies! -
Calling infotype 0002 in ALV report for showing employee photo
Hi all,
The requirment from business side is a report in which employees personal data shuold be shown with employee photo, I had tried for employee photo in ALV report but it didnt sucessed, then I went for other solution like calling transaction in ALV report.
In this case I am calling Infotype 0002 but the issue is that the transaction PA20 is coming with PERNR but I am not able to go directlly to infotype which shows employee Photo,please suggest any solution.
Thaks.
JAYHi Jay,
It is possible. Please refer the syntax for the CALL TRANSACTION
CALL TRANSACTION ta { [AND SKIP FIRST SCREEN]
| [USING bdc_tab [bdc_options]] }.
You can do a recording till the required page comes & call the transaction accordingly. Hope, you are aware about the same.
For example, I just had a solution to go to the roles tab in the user profile and I did as below:
CLEAR wa_bdcdata.
wa_bdcdata-program = 'SAPLSUU5'.
wa_bdcdata-dynpro = '0050'.
wa_bdcdata-dynbegin = k_ok.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_CURSOR'.
wa_bdcdata-fval = 'USR02-BNAME'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'USR02-BNAME'.
wa_bdcdata-fval = g_value.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = 'SHOW'.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-program = 'SAPLSUU5'.
wa_bdcdata-dynpro = '0100'.
wa_bdcdata-dynbegin = k_ok.
APPEND wa_bdcdata TO it_bdcdata.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = 'BDC_OKCODE'.
wa_bdcdata-fval = '=ACTG'.
APPEND wa_bdcdata TO it_bdcdata.
g_opt-dismode = 'E'.
g_opt-defsize = k_ok.
*** if user click on the User Name, call SU01
CALL TRANSACTION 'SU01' USING it_bdcdata
OPTIONS FROM g_opt.
Regards,
Selva K. -
How to resolve the error in bdc call transaction in ALV report
Dear Experts, i am executing the alv report program and in alv report program one bdc is there..
after executing output is showing in alv format but one button is there (update master)..when i am clicking update button the bdc is run but is not updated in the material master..after executing my bdc is not updated in mm02.
how to resove it?
CALL TRANSACTION 'MM02' USING BDCDATA MODE MODE
UPDATE 'S'
MESSAGES INTO MESSTAB.Hi Kaustav,
Looking at the code you attached, it appears to me that your BDC (Form USER_COMMAND) is not executed at all as you haven't passed the 'USER_COMMAND' in FM REUSE_ALV_GRID_DISPLAY for ALV display.
You must pass the importing parameter I_CALLBACK_USER_COMMAND of this FM as 'USER_COMMAND', only then this form will be executed and your BDC will run.
Thereafter, in case your BDC update fails, you can put a break-point in the form (at CALL TRANSACTION statement) and analyze the message table MESSTAB.
Hope it helps.
Regards,
Sapeksh
Maybe you are looking for
-
Hi my DVD 16:9 plays in my MBP but not on two different DVD players (diff.brand) yet the same footage when burnt with Toast plays in both DVD players . What could it be Compressor or DVDSP should I unload DVDSP and re-install , Iam at a loss. I left
-
When Muse website is complete. Preview in internet browser defaults to tablet view.
When Muse website is complete. Preview in browser defaults to tablet view. Preview website in Google Chrome browser: Desktop view defaults in Tablet view Tablet view is default Phone view does not exist yet website is completed Preview website in Go
-
Occasional problem loading JSP page
Sometimes the server cannot load a JSP. This is a problem that comes and goes. One minute it will work, and the next minute it will not. Has any one else seen sporadic behaviour like this?Here is an excerpt from the weblogic.log:Mon Nov 20 09:42:12 E
-
Can't turn off internet sharing
My brand new MacBook Pro has been working perfectly--until out of the blue internet sharing turns on everytime I boot up. I have never used internet sharing and certainly don't want to now, because I can't use my wireless network with it on. My inter
-
I thought I had it this morning with my file. And now I don't it keeps yelling about chapter stuff. My book is very small and doesn't have chapters in them. Is there a way to get around this problem with the chapters?