Checkbox issue in module pool program
Hi all,
I have a small issue in a module pool program using checkboxes. The requirement is that my basic list should contain the data with checkboxes and as per the selection by the user, the selected records should appear in the next screen (secondary list). But after selection, all the records barring the last record is appearing in my secondary list. Below are the screenshots of my program:
These are the global variables I declared:
The layout for the basic list is as shown. The function code is cbox for checkbox.
The flow logic :
The code for user-command:
Now on executing the program,
As you can see, sales orders 4970,4972,4974 and 4975 are selected. So after clicking NEXT, in the secondary list , the data for these selected sales orders from VBAP table should come up. But instead, the records from 4970, 4972 and 4974 are displayed except the last sales order which is 4975.
This is happening for all the records. The last selected sales order is not getting selected. Why is it so?
Thanks.
Manish
Hi Ali,
I have modified the code but there are still a couple of things which are confusing me. In the below screenshot you can see the modified version of the code:
Now to see what is going wrong, I tried to debug the code. I placed the breakpoint on 'NEXT' as shown. Then I selected the following sales orders and pressed NEXT.
In the debugger, IT_VBAK1 correctly holds the 2 selected values:
IT_VBAP displays the values correctly as well.
Now, this is where the issue is. On clicking the BACK button and selecting another sales order (4974):
IT_VBAK1 holds the additional sales order 4974 along with the previous ones as well:
IT_VBAP also displays the values accordingly as per the debugger:
But in the table control, the sales order 4974 is not displayed. Only the initial sales orders are displayed.
1) There is nothing wrong with the code as the debugger shows the records are held and displayed correctly by the internal tables. So what could be the reason for the data not to be displayed correctly in the table control? I also tried refreshing IT_VBAP after the BACK button, but still it isnt working.
2) Also, another thing I've seen that is after clicking the BACK button, when I select the sales orders, only data from 2 sales orders are displayed in the secondary list.
For example, if I select any number of sales orders and press NEXT, then all the data are displayed correctly in the secondary list. Once I click the BACK button and deselect all of them and then I checkbox 3 sales orders (more than 2), then only the records for 2 sales orders are displayed, not the 3rd one. Why is this happening?
Regards
Manish.
Similar Messages
-
Checkbox positioning issue in module pool program screen
Hello All,
I am facing one issue with the checkbox positioning in module pool program.I have designed the screen in 'SAP Signature Theme' and the checkbox position looks fine (while tested the screen in SE80) as shown below.
Test Result from 'SAP Signature Theme':
But the lead has a different theme in his SAP system and he got the below result where the checkbox automatically shifts right with the same code and screen design as shown below.
Test Result from'Enjoy' theme :
Could you please help me resolve this strange issue as soon as possible.
Thanks in advance!!!
Thanks & Regards,
HafizulHi Bhaskar,
Sure , in fact this is has been created by dragging and dropping of the the standard checkbox template availabe in the layout,no custom code has been written for this.
Please find the layout properties for this checkbox below.
P9021-COMPLI_CONF is one character field.
Please let me know if you need any other details on the same.
Thanks & Regards,
Hafizul -
Table controlls in module pool programming
Hi all.
I have an issue in module pool program.
I created a table controll in the screen through table controll wizard.
In that if I enter the data for 10 records(more than 1),then I(pressed)clicked on ENTER . then only first record is staying in the table controll.all other recods are
going(disappering) from the table controll.
Can any body help me to solve this problem.
Thanks in Advance,
Regards.
Eswaryou are not storing the entries given in the table control.
i can give you an idea.
declare an internal table which has the same structure as of the table control.
in the PAI event, refresh the internal talbe.
loop at the table control. move all the entries of the table control to the internal table.
in the PBO event, refresh the table control. count the number of lines in table control. insert all the lines of internal table to the table control one after another.
hope this helps you.
thanks
pavan -
How to call a "Z"module pool program in a "z"report
Hi Guys,
I have two reports .
1. Report : uploads a tab delimited " .Txt1" file and update the "z1" table
".TXT1" : File contains 4 fields
2. Module pool. :Uploads a a tab delimited " .Txt2" file and update another "z2" table
".TXT2" file contains the 4 fileds of ".TXT1" and also 2 extra fields.
I want to merge (call) the module pool program in the Report and perform the upload function using only one ".TXT" file.Please do guide me precisely .
*Report:*
REPORT zrswbgcs009 NO STANDARD PAGE HEADING MESSAGE-ID zwb
LINE-SIZE 185.
TABLES: zgcs_foc. "FOC Parts Table
*data count buffer
DATA: read_cnt(6) TYPE p, "Find read record
update_cnt(6) TYPE p, "OK record
error_cnt(6) TYPE p. "Error record
*file buffer(FOC)
DATA: BEGIN OF FOC_inrec OCCURS 0,
CUSTOMER(10), "Customer
PART_CODE(18), "Parts Code
REF_NO(35), "Ref No.
REF_DATE(10), "Ref Date
QTY(12), "Parts Qty
TEXT(100), "Remark
END OF FOC_inrec.
*file buffer
DATA: BEGIN OF inrec OCCURS 0,
CUSTOMER(10), "Customer
PART_CODE(18), "Parts Code
REF_NO(35), "Ref No.
REF_DATE(10), "Ref Date
QTY(12), "Parts Qty
PRICE(15), "Parts Price
WAERK(5), "Parts Currency
TEXT(100), "Remark
END OF inrec.
DATA : v_file LIKE rlgrap-filename.
DATA gt_zgcs_foc LIKE zgcs_foc OCCURS 0 WITH HEADER LINE.
DATA gs_zgcs_foc LIKE zgcs_foc.
*File name ACCEPT--------------------------------------------------
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
*Company code
PARAMETERS: p_comp LIKE zgcs_imei-company OBLIGATORY.
PARAMETERS: pcfile LIKE rlgrap-filename OBLIGATORY LOWER CASE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
PARAMETERS: HQfile RADIOBUTTON GROUP b2.
SELECTION-SCREEN COMMENT 7(20) text-101 FOR FIELD HQfile.
SELECTION-SCREEN POSITION 31.
PARAMETERS: SUBfile RADIOBUTTON GROUP b2.
SELECTION-SCREEN COMMENT 37(20) text-102 FOR FIELD SUBfile.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK box WITH FRAME.
SELECTION-SCREEN: COMMENT /2(40) text-011, COMMENT 42(40) text-001,
ULINE,
COMMENT /2(40) text-012, COMMENT 42(40) text-002,
COMMENT /2(40) text-013, COMMENT 42(40) text-003,
COMMENT /2(40) text-014, COMMENT 42(40) text-004,
COMMENT /2(40) text-015, COMMENT 42(40) text-005,
COMMENT /2(40) text-016, COMMENT 42(40) text-006,
COMMENT /2(40) text-017, COMMENT 42(40) text-007,
COMMENT /2(40) text-018, COMMENT 42(40) text-008,
COMMENT /42(40) text-009.
SELECTION-SCREEN END OF BLOCK box.
* -- AT SELECTION SCREEN ON
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pcfile.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = space
def_path = 'C:\'
mask = ',*.txt,*.TXT.'
mode = 'O'
title = ' '
IMPORTING
filename = pcfile
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
*-----------------------------start--------------------------------
START-OF-SELECTION.
CLEAR: read_cnt, update_cnt, error_cnt.
REFRESH gt_zgcs_foc. CLEAR gs_zgcs_foc.
PERFORM file_upload_from_pc.
SORT gt_zgcs_foc.
DELETE ADJACENT DUPLICATES FROM gt_zgcs_foc
COMPARING COMPANY CUSTOMER PART_CODE REF_NO REF_DATE.
*// customer code check
DATA: LT_ZESTD LIKE ZESTD OCCURS 0 WITH HEADER LINE.
IF NOT gt_zgcs_foc[] IS INITIAL.
SELECT COMPANY CUSTOMER CURRENCY
INTO CORRESPONDING FIELDS OF TABLE LT_ZESTD
FROM ZESTD
FOR ALL ENTRIES IN gt_zgcs_foc
WHERE COMPANY = gt_zgcs_foc-COMPANY
AND CUSTOMER = gt_zgcs_foc-CUSTOMER.
ENDIF.
SORT LT_ZESTD BY COMPANY CUSTOMER.
*// part code check
DATA: LT_MARA LIKE MARA OCCURS 0 WITH HEADER LINE.
IF NOT gt_zgcs_foc[] IS INITIAL.
SELECT *
INTO TABLE LT_MARA
FROM MARA
FOR ALL ENTRIES IN gt_zgcs_foc
WHERE MATNR = gt_zgcs_foc-PART_CODE.
ENDIF.
SORT LT_MARA BY MATNR.
LOOP AT gt_zgcs_foc.
*// customer code check
READ TABLE LT_ZESTD WITH KEY
COMPANY = gt_zgcs_foc-COMPANY
CUSTOMER = gt_zgcs_foc-CUSTOMER.
IF SY-SUBRC <> 0.
WRITE:/'Invalid Customer code ',
gt_zgcs_foc-COMPANY, ' ',
gt_zgcs_foc-CUSTOMER.
STOP.
ENDIF.
*// part code check
READ TABLE LT_MARA WITH KEY MATNR = gt_zgcs_foc-PART_CODE
BINARY SEARCH.
IF SY-SUBRC <> 0.
WRITE:/ 'Invalid part code ', gt_zgcs_foc-PART_CODE.
STOP.
ENDIF.
*// REF_NO
TRANSLATE gt_zgcs_foc-REF_NO TO UPPER CASE.
SHIFT gt_zgcs_foc-REF_NO LEFT DELETING LEADING SPACE.
IF gt_zgcs_foc-REF_NO = SPACE.
WRITE:/'Ref No. is blank'.
STOP.
ENDIF.
*// REF_DATE
IF gt_zgcs_foc-REF_DATE = 0.
WRITE:/'Invalid Ref Date'.
STOP.
ENDIF.
*// QTY
* IF gt_zgcs_foc-QTY CO ' 0123456789'.
* ELSE.
* WRITE:/ gt_zgcs_foc-QTY, ' Invalid Qty value'.
* STOP.
* ENDIF.
ENDLOOP.
* Insert/Update table
* MODIFY zgcs_foc FROM TABLE gt_zgcs_foc.
INSERT zgcs_foc FROM TABLE gt_zgcs_foc.
IF sy-subrc EQ 0.
COMMIT WORK.
DESCRIBE TABLE gt_zgcs_foc LINES update_cnt.
error_cnt = read_cnt - update_cnt.
ELSE.
ROLLBACK WORK.
error_cnt = read_cnt - update_cnt.
ENDIF.
ULINE.
FORMAT COLOR 3.
WRITE: / 'Read count :', read_cnt.
WRITE: / 'Insert/Update count :', update_cnt.
WRITE: / 'Error count :', error_cnt.
FORMAT COLOR OFF.
*end-of-selection--------------------------------------------------
END-OF-SELECTION.
*& Form FILE_UPLOAD_FROM_PC
FORM file_upload_from_pc.
IF pcfile IS INITIAL.
WRITE: / 'SELECT UPLOAD FILE !'.
ELSE.
MOVE pcfile TO v_file.
* HQ file upload
IF HQfile EQ 'X'.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = v_file
filetype = 'DAT'
TABLES
data_tab = FOC_inrec
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
WRITE: / 'FILE UPLOAD :', sy-subrc.
ENDIF.
LOOP AT FOC_inrec.
ADD 1 TO read_cnt.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = FOC_inrec-customer
importing
output = FOC_inrec-customer.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = FOC_inrec-part_code
importing
output = FOC_inrec-part_code.
MOVE-CORRESPONDING FOC_inrec TO gs_zgcs_foc.
MOVE p_comp TO gs_zgcs_foc-company.
MOVE gs_zgcs_foc-qty TO gs_zgcs_foc-balan.
MOVE sy-uname TO gs_zgcs_foc-ERNAM.
MOVE sy-datum TO gs_zgcs_foc-ERDAT.
MOVE sy-UZEIT TO gs_zgcs_foc-ERZET.
* Source(1:HQ,2:SUB,0:Etc)
MOVE '1' TO gs_zgcs_foc-source.
APPEND gs_zgcs_foc TO gt_zgcs_foc.
ENDLOOP.
* SGE file upload
ELSE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = v_file
filetype = 'DAT'
TABLES
data_tab = inrec
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
WRITE: / 'FILE UPLOAD :', sy-subrc.
ENDIF.
LOOP AT inrec.
ADD 1 TO read_cnt.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = inrec-customer
importing
output = inrec-customer.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = FOC_inrec-part_code
importing
output = FOC_inrec-part_code.
MOVE-CORRESPONDING inrec TO gs_zgcs_foc.
MOVE p_comp TO gs_zgcs_foc-company.
MOVE gs_zgcs_foc-qty TO gs_zgcs_foc-balan.
MOVE sy-uname TO gs_zgcs_foc-ERNAM.
MOVE sy-datum TO gs_zgcs_foc-ERDAT.
MOVE sy-UZEIT TO gs_zgcs_foc-ERZET.
* Source(1:HQ,2:SUB,0:Etc)
MOVE '2' TO gs_zgcs_foc-source.
APPEND gs_zgcs_foc TO gt_zgcs_foc.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM.
*MODULE POOL::*
*& Module Name : Warranty Bill
*& Sub-Module : W/B
*& Description : Parts Q'ty Adjust(Sales & Warranty)
*& Program Name : ZRSWBP004
*& History
*& Date Author Reason
*& 2007.05.08 Song, Ji-Hyun Initial Coding Req.by WH.Song
*& Logic Process
* - CONDITIONS
* Company, Customer, Material
* - PROCESS
* Display,Insert,Update data in the T/B ZESP04
REPORT zrswbp004 NO STANDARD PAGE HEADING
MESSAGE-ID 00
LINE-SIZE 250
LINE-COUNT 50.
* G L O B A L V A R I A B L E S *
TABLES : zesp04.
DATA : BEGIN OF itab_list OCCURS 0,
company LIKE zesp04-company,
customer LIKE zesp04-customer,
material LIKE zesp04-material,
adj_date LIKE zesp04-adj_date,
adjust LIKE zesp04-adjust,
reason LIKE zesp04-reason,
reason_code LIKE zesp04-reason_code,
doc_no LIKE zesp04-doc_no,
in_date LIKE zesp04-in_date,
create_id LIKE zesp04-create_id,
END OF itab_list.
DATA : itab_upload LIKE TABLE OF zesp04 WITH HEADER LINE.
DATA : s_mode(10).
DATA : table_name(10) VALUE 'ZESP04'.
DATA : tot_cnt TYPE i.
DATA : ref_flag(1).
* M A C R O D E F I N E *
DEFINE conversion_kunnr.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = &1
importing
output = &1.
END-OF-DEFINITION.
DEFINE conversion_material.
call function 'CONVERSION_EXIT_MATN1_INPUT'
exporting
input = &1
importing
output = &1.
END-OF-DEFINITION.
* S E L E C T I O N S C R E E N *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE title1.
PARAMETERS : company LIKE zesp04-company MEMORY ID buk MODIF ID v1
OBLIGATORY.
SELECT-OPTIONS : customer FOR zesp04-customer MEMORY ID kun
MODIF ID v1.
SELECT-OPTIONS : material FOR zesp04-material MEMORY ID mat
MODIF ID v1.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 3.
SELECTION-SCREEN COMMENT 3(12) text-002 MODIF ID v2.
PARAMETERS : up_flag AS CHECKBOX MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(12) text-001 MODIF ID v2.
PARAMETERS : p_fname(300) LOWER CASE MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE title2.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(53) text-003 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(10) text-004 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(12) text-005 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(12) text-006 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(15) text-007 MODIF ID v2.
PARAMETERS : df1 TYPE c RADIOBUTTON GROUP grp1.
SELECTION-SCREEN COMMENT 24(13) text-012 MODIF ID v2.
PARAMETERS : df2 TYPE c RADIOBUTTON GROUP grp1.
SELECTION-SCREEN COMMENT 41(11) text-013 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(14) text-008 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(11) text-009 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(14) text-010 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(10) text-011 MODIF ID v2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b2.
INCLUDE zrswbp004_pbo.
INCLUDE zrswbp004_pai.
INITIALIZATION.
title1 = ' Parts Quantity Adjustment '.
title2 = ' Text File Layout '.
* S T A R T O F S E L E C T I O N *
TOP-OF-PAGE.
PERFORM write_header.
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM write_header.
START-OF-SELECTION.
IF up_flag = 'X'.
PERFORM upload_data.
ELSE.
PERFORM select_data.
SET PF-STATUS 'PF01' EXCLUDING 'SAVE'.
PERFORM display_data.
ENDIF.
AT USER-COMMAND.
PERFORM user_command.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
PERFORM get_filename.
*& Form SELECT_DATA
* Select Data for Display
FORM select_data.
SELECT * FROM (table_name)
INTO CORRESPONDING FIELDS OF TABLE itab_list
WHERE company = company
AND customer IN customer
AND material IN material.
CHECK sy-subrc <> 0.
WRITE: 'No data found with your option.'.
ENDFORM. " SELECT_DATA
*& Form DISPLAY_DATA
* Display Data following Condition
FORM display_data.
LOOP AT itab_list.
FORMAT COLOR 2 INTENSIFIED.
WRITE : / '|' NO-GAP.
WRITE : (07) itab_list-company CENTERED NO-GAP, '|' NO-GAP,
(10) itab_list-customer CENTERED NO-GAP, '|' NO-GAP,
(20) itab_list-material CENTERED NO-GAP, '|' NO-GAP,
(10) itab_list-adj_date CENTERED NO-GAP, '|' NO-GAP,
(15) itab_list-adjust RIGHT-JUSTIFIED NO-GAP, '|'
NO-GAP,
(55) itab_list-reason LEFT-JUSTIFIED NO-GAP, '|' NO-GAP,
(11) itab_list-reason_code CENTERED NO-GAP, '|' NO-GAP,
(10) itab_list-doc_no CENTERED NO-GAP, '|' NO-GAP,
(10) itab_list-in_date CENTERED NO-GAP, '|' NO-GAP,
(12) itab_list-create_id CENTERED NO-GAP, '|' NO-GAP.
FORMAT INTENSIFIED OFF.
HIDE itab_list.
ENDLOOP.
WRITE : / sy-uline(171).
ENDFORM. " DISPLAY_DATA
*& Form WRITE_HEADER
* Write Report Header
FORM write_header.
DATA : line(1024).
CLEAR line WITH '-'.
DESCRIBE TABLE itab_list LINES tot_cnt.
FORMAT INTENSIFIED ON.
WRITE : 15 'Parts Quantity Adjustment'.
SKIP.
WRITE : / 'Total Count : ', tot_cnt.
WRITE : /.
WRITE : (171) sy-uline.
WRITE : / '|' NO-GAP.
WRITE : (07) 'Company' CENTERED NO-GAP, '|' NO-GAP,
(10) 'Customer' CENTERED NO-GAP, '|' NO-GAP,
(20) 'Material' CENTERED NO-GAP, '|' NO-GAP,
(10) 'Adj. Date' CENTERED NO-GAP, '|' NO-GAP,
(15) 'Adjust' CENTERED NO-GAP, '|' NO-GAP,
(55) 'Reason' CENTERED NO-GAP, '|' NO-GAP,
(11) 'Reason Code' CENTERED NO-GAP, '|' NO-GAP,
(10) 'Doc No' CENTERED NO-GAP, '|' NO-GAP,
(10) 'IN DATE' CENTERED NO-GAP, '|' NO-GAP,
(12) 'CREATE ID' CENTERED NO-GAP, '|' NO-GAP.
WRITE : /(171) sy-uline.
FORMAT INTENSIFIED OFF.
ENDFORM. " WRITE_HEADER
*& Form UPLOAD_DATA
* Data Upload from File
FORM upload_data.
DATA : l_filename LIKE rlgrap-filename,
temp_dateformat TYPE dateformat.
IF df1 = 'X'.
temp_dateformat = 'YYYY.MM.DD'.
ELSE.
temp_dateformat = 'DD.MM.YYYY'.
ENDIF.
MOVE p_fname TO l_filename.
CHECK l_filename NE space.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = l_filename
filetype = 'DAT'
dat_d_format = temp_dateformat
TABLES
data_tab = itab_list
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9.
IF sy-subrc NE 0.
MESSAGE s000 WITH 'File upload is failed!'.
STOP.
ELSE.
CLEAR : itab_upload, itab_upload[].
LOOP AT itab_list.
MOVE-CORRESPONDING itab_list TO itab_upload.
conversion_kunnr itab_upload-customer.
conversion_material itab_upload-material.
itab_upload-mandt = sy-mandt.
itab_upload-in_date = sy-datum.
itab_upload-create_id = sy-uname.
*>>>>Insert by GSCHOI 2007.11.08
IF itab_list-adj_date+0(6) NE sy-datum+0(6).
MESSAGE i368 WITH 'Adjust month must same as current month!'.
ROLLBACK WORK.
STOP.
ENDIF.
*<<<<End
APPEND itab_upload.
INSERT INTO (table_name) VALUES itab_upload.
IF sy-subrc EQ 0.
CONTINUE.
ELSEIF sy-subrc EQ 4.
MESSAGE s368 WITH 'Duplicated Data Error!'.
ROLLBACK WORK.
STOP.
ELSE.
MESSAGE s368 WITH 'File Error!'.
ROLLBACK WORK.
STOP.
ENDIF.
ENDLOOP.
ENDIF.
IF sy-subrc EQ 0.
MESSAGE s368 WITH 'Uploaded Successfully!'.
ENDIF.
ENDFORM. " UPLOAD_DATA
*& Form USER_COMMAND
* User Command Execution in Screen 1000
FORM user_command.
MOVE-CORRESPONDING itab_list TO zesp04.
CASE sy-ucomm.
WHEN 'INSERT'.
PERFORM insert_item.
WHEN 'UPDATE'.
PERFORM update_item.
WHEN 'DISPLAY'.
PERFORM display_item.
WHEN 'REFRESH'.
PERFORM refresh_list.
ENDCASE.
IF ref_flag = 'Y'.
PERFORM refresh_list.
CLEAR ref_flag.
ENDIF.
ENDFORM. " USER_COMMAND
*& Form INSERT_ITEM
* When Clicking Insert Button
FORM insert_item.
CLEAR : s_mode.
CLEAR : zesp04.
s_mode = 'INSERT'.
CALL SCREEN '100'.
ENDFORM. " INSERT_ITEM
*& Form UPDATE_ITEM
* When Clicking Update Button
FORM update_item.
CLEAR : s_mode.
s_mode = 'UPDATE'.
CALL SCREEN '100'.
ENDFORM. " UPDATE_ITEM
*& Form DISPLAY_ITEM
* When Clicking Display Button
FORM display_item.
CLEAR : s_mode.
s_mode = 'DISPLAY'.
CALL SCREEN '100'.
ENDFORM. " DISPLAY_ITEM
*& Form REFRESH_LIST
* When Clicking Refresh Button or Returning Display Screen
FORM refresh_list.
CLEAR : itab_list, itab_list[].
PERFORM select_data.
sy-lsind = sy-lsind - 1.
PERFORM display_data.
ENDFORM. " REFRESH_LIST
*& Form GET_FILENAME
* Get Filename
FORM get_filename.
DATA: l_fname LIKE ibipparms-path .
DATA : p_name LIKE sy-repid.
p_name = sy-repid.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = p_name
dynpro_number = sy-dynnr
field_name = ''
IMPORTING
file_name = l_fname.
p_fname = l_fname.
ENDFORM. " GET_FILENAME
Edited by: Matt on Nov 24, 2008 11:24 AM - surrounded the ABAP with tagsHi,
Use SUBMIT statement in your first Report zrswbgcs009 at the end, to call the Modulepool program zrswbp004.
do a search in SDN you will get lot of threads on SUBMIT statement with selection screen.
SUBMIT... [VIA SELECTION-SCREEN]
[USING SELECTION-SET <var>]
[WITH <sel> <criterion>]
[WITH FREE SELECTIONS <freesel>]
[WITH SELECTION-TABLE <rspar>].
http://help.sap.com/saphelp_nw04/Helpdata/EN/9f/dba51a35c111d1829f0000e829fbfe/content.htm
Regards
Bala Krishna -
How to use one module pool program in another module pool programming?
Hi
I have one moodule pool program.
In one of my screen i want to use some code which already developed in another module pool program.
Is there any direct way for using one module pool programcode in another module pool program.
If there any approaches for this plz help me in this issue.Dear,
If you want to use the code.
first you can write your code in a subroutine in module pool program 1
and then you can use it from module pool program 2 by
perform subroutine_name(program_name)
using P_1
changing C_1
if you wan to use one module pool data into other module pool.
so that is another requirement. -
How to take backup of an entire module pool program with code,screen,etc.
Hi experts,
I have some important data in the ides server for which i want to take backup of them.
I have some question regarding the same.
1.How to take backup/download of an entire module pool program with code,screen,etc.
2.How can we take backup/download for a DB table with its structure?
3.How can we take backup of a search help?
Please give some suggestions abt the same.
Regards,
Ashesh.Hi,
May be just for viewing, try downloading from SE80 transaction from the others option.
Here just try issuing the print, it will generate the spool.
Now using the spool, download to your desktop as required. It will have all the information regarding the attributes, fields, elements everything.
The only issue is, may be you need to take all the screens separately.
Regards,
Santhosh. -
In module pool program - i want to control size of screen.
Hi,
In module pool program , I am handling 2 screen . while calling the 2 nd screen , i want to display the window size as i required.
Plz help me.
Regards,
Rani.Hi,
Specify the positions as
CALL SCREEN dynnr
[STARTING AT col1 lin1
[ENDING AT col2 lin2]].
By default, the screens of all dynpros of the called dynpro sequence are displayed in the current window. Use addition STARTING AT to open a modal dialog window.
Addition
... STARTING AT col1 lin1 [ENDING AT col2 lin2]
Effect
Use addition STARTING AT to open a new popup level and to display all screens of the called dynpro sequence in a modal dialog window. The upper left corner of the dialog window is determined by the values col1 and lin1 for column and line. The values refer to the window with popup level 0. The lower right corner is set automatically or you can use col2 and lin2 to specify it after ENDING AT. For col1, lin1, col2 and lin2, data objects of type i are expected. The values of col1, lin1 should be smaller than those of col2, lin2, because otherwise the behavior is undefined. The maximum popup level is 9.
Pls reward points if solved your issue.
Regards,
Renjith Michael. -
How to Use F4 help in Module Pool Programming??????
Hi Friends,
This is Jagadeesh, I have an issue Module Pool Programming. Any of you can go through on this and can give an required answer.
Issue is as follows,
I have an Input/Output field for that i need to give f4 help, based on that field the related data should sit in to my table control. The thing is there is no relation between the input/output field and the table control fields.
Is this possible? If so how can i do this.Hi Jagadeesh,
For F4 Values on Screen:
PROCESS ON VALUE_REQUEST
using module call starting with FIELD i.e FIELD field MODULE module
There are number of function modules that can be used for the purpose, but these
can fullfill the task easily or combination of them.
DYNP_VALUE_READ
F4IF_FIELD_VALUE_REQUEST
F4IF_INT_TABLE_VALUE_REQUEST
POPUP_WITH_TABLE_DISPLAY
DYNP_VALUE_READ
This function module is used to read values in the screen fields. Use of this
FM causes forced transfer of data from screen fields to ABAP fields.
There are 3 exporting parameters
DYNAME = program name = SY-CPROG
DYNUMB = Screen number = SY-DYNNR
TRANSLATE_TO_UPPER = 'X'
and one importing TABLE parameter
DYNPFIELDS = Table of TYPE DYNPREAD
The DYNPFIELDS parameter is used to pass internal table of type DYNPREAD
to this FM and the values read from the screen will be stored in this table.This
table consists of two fields:
FIELDNAME : Used to pass the name of screen field for which the value is to
be read.
FIELDVALUE : Used to read the value of the field in the screen.
e.g.
DATA: SCREEN_VALUES TYPE TABLE OF DYNPREAD ,
SCREEN_VALUE LIKE LINE OF SCREEN_VALUES.
SCREEN_VALUE-FIELDNAME = 'KUNNR' . * Field to be read
APPEND SCREEN_VALUE TO SCREEN_VALUES. * Fill the table
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TRANSLATE_TO_UPPER = 'X'
TABLES
DYNPFIELDS = SCREEN_VALUES.
READ TABLE SCREEN_VALUES INDEX 1 INTO SCREEN_VALUE.Now the screen value for field KUNNR is in the SCREEN_VALUE-FIELDVALUE and can be used for further processing like using it to fill the internal table to be used as parameter in F4IF_INT_TABLE_VALUE_REQUEST ETC.
F4IF_FIELD_VALUE_REQUEST
This FM is used to display value help or input from ABAP dictionary.We have to pass the name of the structure or table(TABNAME) along with the field name(FIELDNAME) . The selection can be returned to the specified screen field if three
parameters DYNPNR,DYNPPROG,DYNPROFIELD are also specified or to a table if RETRN_TAB is specified.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
TABNAME = table/structure
FIELDNAME = 'field name'
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNR
DYNPROFIELD = 'screen field'
IMPORTING
RETURN_TAB = table of type DYNPREAD
F4IF_INT_TABLE_VALUE_REQUEST
This FM is used to dsiplay values stored in an internal table as input
help.This FM is used to program our own custom help if no such input help
exists in ABAP dictionary for a particular field. The parameter VALUE_TAB is used to pass the internal table containing input values.The parameter RETFIELD
is used to specify the internal table field whose value will be returned to the screen field or RETURN_TAB.
If DYNPNR,DYNPPROG and DYNPROFIELD are specified than the user selection is passed to the screen field specified in the DYNPROFIELD. If RETURN_TAB is specified the selectionis returned in a table.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = field from int table whose value will be returned
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = 'screen field'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = internal table whose values will be shown.
RETURN_TAB = internal table of type DDSHRETVAL
EXCEPTIONS
parameter_error = 1
no_values_found = 2
others = 3.
POPUP_WITH_TABLE_DISPLAY
This FM is used to display the contents of an internal table in a popup window.The user can select a row and the index of that is returned in the CHOISE
parameter.The VALUETAB is used to pass the internal table.
A suitable title can be set using TITLETEXT parameter. The starting and end position of the popup can be specified by the parameters STARTPOS_COL / ROW and ENDPOS_ROW / COL .
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL =
ENDPOS_ROW =
STARTPOS_COL =
STARTPOS_ROW =
TITLETEXT = 'title text'
IMPORTING
CHOISE =
TABLES
VALUETAB =
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
e.g.
DATA: w_choice TYPE SY-TABIX.
DATA: BEGIN OF i_values OCCURS 0 WITH HEADER LINE,
values TYPE I,
END OF i_values.
PARAMETRS : id TYPE I.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR id
i_values-values = '0001'.
APPEND i_values.
i_values-values = '0002'.
APPEND i_values.
i_values-values = '0003'.
APPEND i_values.
i_values-values = '0004'.
APPEND i_values.
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL = 40
ENDPOS_ROW = 12
STARTPOS_COL = 20
STARTPOS_ROW = 5
TITLETEXT = 'Select an ID'
IMPORTING
CHOISE = w_choice
TABLES
VALUETAB = i_values
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
CHECK w_choice > 0.
READ TABLE i_values INDEX w_choice....now we can process the selection as it is contained
...in the structure i_values.
Other FM that may be used to provide input help is HELP_START .
regards,
Dj
reward for all useful answers. -
How to DOWNLOAD a whole module pool program????
Hi..
can anybody tell me how to download a <b>whole module pool program</b> into my desktop with .sap extension???
Actually i want to download a whole module pool program from a server so that i can upload the same program into another sap server instead of writing the whole code.
Thanx in advance......the program is exits..
i don't y it is not for ur.....
i am sending d code for the same....
create a program and check...
*& Report REPTRAN *
*& This report allows to display and save complete programs and *
*& function modules. *
*& This report was originally written by Frank Wolf, Xaption GmbH. *
*& Its original name was ZREPTRAN (see www.abaps.de). *
REPORT reptran LINE-SIZE 170 .
TABLES: d010inc, trdir, eudb, title, d020t, trkey, tfdir, tmdir, tadir,
seoclass, seoclassdf, seoclassex, seoclasstx, seometarel,
seocompo, seocompodf, seocompoex, seocompotx, seoimplrel,
seomapatt, seomapcls, seoredef, seofriends, seotypepls,
seosubco, seosubcodf, seosubcoex, seosubcotx.
TYPES: abapline(255).
TYPES: BEGIN OF ty_tit,
code TYPE rsoldleng-title,
text TYPE title-text_line,
END OF ty_tit.
TYPES: BEGIN OF ty_reptxt,
id TYPE textpool-id,
key TYPE textpool-key,
entry TYPE textpool-entry,
length(4) TYPE n,
END OF ty_reptxt.
TYPES: BEGIN OF ty_d020t,
prog TYPE d020t-prog,
dynr TYPE d020t-dynr,
dtxt TYPE d020t-dtxt,
END OF ty_d020t.
TYPES: BEGIN OF dynp_rel_type, "Dynpro-Releases
rel(1),
dot(1),
version(2),
END OF dynp_rel_type.
TYPES: BEGIN OF ty_seocompodf_t.
INCLUDE STRUCTURE seocmpkey.
TYPES: version TYPE seocompodf-version,
alias TYPE seocompodf-alias,
redefin TYPE seocompodf-redefin,
exposure TYPE seocompodf-exposure,
state TYPE seocompodf-state,
editorder(4) TYPE n,
locked TYPE seocompodf-locked,
dispid(4) TYPE n.
INCLUDE STRUCTURE seochange.
INCLUDE STRUCTURE seomtdapx.
INCLUDE STRUCTURE seoevtapx.
INCLUDE STRUCTURE seotypapx.
TYPES: typtype TYPE seocompodf-typtype,
type TYPE seocompodf-type,
tableof TYPE seocompodf-tableof,
srcrow1(4) TYPE n,
srccolumn1(2) TYPE n,
srcrow2(4) TYPE n,
srccolumn2(2) TYPE n.
INCLUDE STRUCTURE seocmpref.
TYPES: END OF ty_seocompodf_t.
TYPES: BEGIN OF ty_seosubcodf_t.
INCLUDE STRUCTURE seoscokey.
TYPES: version TYPE seosubcodf-version,
editorder(4) TYPE n,
dispid(4) TYPE n.
INCLUDE STRUCTURE seochange.
TYPES: pardecltyp TYPE seosubcodf-pardecltyp,
parpasstyp TYPE seosubcodf-parpasstyp,
typtype TYPE seosubcodf-typtype,
type TYPE seosubcodf-type,
tableof TYPE seosubcodf-tableof,
srcrow1(4) TYPE n,
srccolumn1(2) TYPE n,
srcrow2(4) TYPE n,
srccolumn2(2) TYPE n,
parvalue TYPE seosubcodf-parvalue,
paroptionl TYPE seosubcodf-paroptionl.
INCLUDE STRUCTURE seoexcapx.
TYPES: END OF ty_seosubcodf_t.
Release bis 3.1
*INCLUDE mseuxcom.
DATA: eu_key TYPE rseu1_key.
Titel
DATA: tit TYPE STANDARD TABLE OF ty_tit WITH HEADER LINE.
Release from 4.6
DATA: fun4 TYPE STANDARD TABLE OF rsmpe_funt WITH HEADER LINE.
DATA: ctx4 TYPE STANDARD TABLE OF rsmpe_ctx WITH HEADER LINE.
DATA: mtx4 TYPE STANDARD TABLE OF rsmpe_mnlt WITH HEADER LINE.
DATA: men4 TYPE STANDARD TABLE OF rsmpe_men WITH HEADER LINE.
DATA: act4 TYPE STANDARD TABLE OF rsmpe_act WITH HEADER LINE.
DATA: doc4 TYPE STANDARD TABLE OF rsmpe_atrt WITH HEADER LINE.
DATA: sta4 TYPE STANDARD TABLE OF rsmpe_stat WITH HEADER LINE.
DATA: set4 TYPE STANDARD TABLE OF rsmpe_staf WITH HEADER LINE.
DATA: pfk4 TYPE STANDARD TABLE OF rsmpe_pfk WITH HEADER LINE.
DATA: but4 TYPE STANDARD TABLE OF rsmpe_but WITH HEADER LINE.
DATA: tit4 TYPE STANDARD TABLE OF rsmpe_titt WITH HEADER LINE.
DATA: stx4 TYPE STANDARD TABLE OF rsmptexts WITH HEADER LINE.
DATA: adm4 TYPE rsmpe_adm.
Release from 4.6c
DATA: biv46c TYPE STANDARD TABLE OF rsmpe_buts WITH HEADER LINE.
DATA: reports TYPE STANDARD TABLE OF trdir-name WITH HEADER LINE,
reportname TYPE string.
DATA: i_repsrc TYPE STANDARD TABLE OF abapline WITH HEADER LINE.
DATA: i_reptx TYPE STANDARD TABLE OF textpool WITH HEADER LINE.
DATA: i_reptxt TYPE STANDARD TABLE OF ty_reptxt WITH HEADER LINE.
DATA: i_adm4 TYPE STANDARD TABLE OF rsmpe_adm WITH HEADER LINE.
DATA: i_tmd TYPE STANDARD TABLE OF tmdir.
DATA: i_tfd TYPE STANDARD TABLE OF tfdir.
DATA: i_cls TYPE STANDARD TABLE OF seoclass.
DATA: i_cdf TYPE STANDARD TABLE OF seoclassdf.
DATA: i_clx TYPE STANDARD TABLE OF seoclassex.
DATA: i_clt TYPE STANDARD TABLE OF seoclasstx.
DATA: i_cmr TYPE STANDARD TABLE OF seometarel.
DATA: i_cmp TYPE STANDARD TABLE OF seocompo.
DATA: i_cmd TYPE STANDARD TABLE OF seocompodf WITH HEADER LINE.
DATA: i_cmd_t TYPE STANDARD TABLE OF ty_seocompodf_t WITH HEADER LINE.
DATA: i_cmx TYPE STANDARD TABLE OF seocompoex.
DATA: i_cmt TYPE STANDARD TABLE OF seocompotx.
DATA: i_irl TYPE STANDARD TABLE OF seoimplrel.
DATA: i_mat TYPE STANDARD TABLE OF seomapatt.
DATA: i_mac TYPE STANDARD TABLE OF seomapcls.
DATA: i_red TYPE STANDARD TABLE OF seoredef.
DATA: i_frd TYPE STANDARD TABLE OF seofriends.
DATA: i_tpl TYPE STANDARD TABLE OF seotypepls.
DATA: i_sco TYPE STANDARD TABLE OF seosubco.
DATA: i_scd TYPE STANDARD TABLE OF seosubcodf WITH HEADER LINE.
DATA: i_scd_t TYPE STANDARD TABLE OF ty_seosubcodf_t WITH HEADER LINE.
DATA: i_scx TYPE STANDARD TABLE OF seosubcoex.
DATA: i_sct TYPE STANDARD TABLE OF seosubcotx.
DATA: i_inc TYPE STANDARD TABLE OF d010inc-include WITH HEADER LINE.
DATA: i_d020t TYPE STANDARD TABLE OF ty_d020t WITH HEADER LINE.
DATA: hdr TYPE d020s,
fld TYPE STANDARD TABLE OF d021s WITH HEADER LINE,
src TYPE STANDARD TABLE OF d022s WITH HEADER LINE,
mat TYPE STANDARD TABLE OF d023s WITH HEADER LINE.
CONSTANTS:
stars(64) VALUE
"#EC NOTEXT
comment1(64) VALUE
'* THIS FILE IS GENERATED BY THE SCREEN PAINTER. *',
"#EC NOTEXT
comment2(64) VALUE
'* NEVER CHANGE IT MANUALLY, PLEASE ! *',
"#EC NOTEXT
dynpro_text(8) VALUE '%_DYNPRO', "#EC NOTEXT
header_text(8) VALUE '%_HEADER', "#EC NOTEXT
params_text(8) VALUE '%_PARAMS', "#EC NOTEXT
descript_text(13) VALUE '%_DESCRIPTION', "#EC NOTEXT
fields_text(8) VALUE '%_FIELDS', "#EC NOTEXT
kreuz(1) VALUE 'x', "#EC NOTEXT
flowlogic_text(11) VALUE '%_FLOWLOGIC'. "#EC NOTEXT
DATA: header_char TYPE scr_chhead.
DATA: fields_char TYPE STANDARD TABLE OF scr_chfld WITH HEADER LINE.
DATA: dynp_char TYPE STANDARD TABLE OF scr_chfld WITH HEADER LINE.
DATA: prog_len TYPE p.
DATA: BEGIN OF dynp,
prog TYPE d020s-prog,
dnum TYPE d020s-dnum,
END OF dynp.
DATA:
scrp_rel TYPE dynp_rel_type VALUE '4.02'. "Rel. Scrp. 4.02
scrp_rel TYPE dynp_rel_type VALUE '4.60'. "Rel. Scrp. 4.6A
DATA dynp_rel TYPE dynp_rel_type. "akt. Rel. Dynpro
DATA: dynpro_rel(4).
DATA status.
DATA prog_len_akt TYPE p.
DATA release.
DATA rows LIKE sy-curow.
DATA lines LIKE sy-cucol.
DATA: filename TYPE string.
DATA: subrc LIKE sy-subrc.
DATA: os(10).
DATA: delux VALUE '/'.
DATA: delwn VALUE '\'.
DATA: delim.
DATA: dirux(250) VALUE '-l>dir.tmp'.
DATA: dirwn(250) VALUE '/Q /Cdir>dir.tmp'.
DATA: command(250).
DATA: shellux(250) VALUE 'bash'.
DATA: shellwn(250) VALUE 'cmd.exe'.
DATA: shell(250).
DATA: file TYPE rlgrap-filename.
DATA: answer.
DATA: incname TYPE d010inc-include.
DATA: repname TYPE d010inc-include.
DATA: rest1 TYPE d010inc-include.
DATA: rest2 TYPE d010inc-include.
DATA: kz_renam.
DATA: classname TYPE seoclsname.
DATA: classtype(2).
DATA: offset TYPE i.
DATA: savepath(250).
SELECT-OPTIONS: report FOR trdir-name.
SELECTION-SCREEN: SKIP.
SELECT-OPTIONS: cnam FOR trdir-cnam MATCHCODE OBJECT user_addr,
unam FOR trdir-unam MATCHCODE OBJECT user_addr,
devclass FOR tadir-devclass,
subc FOR trdir-subc,
rstat FOR trdir-rstat,
cdat FOR trdir-cdat,
udat FOR trdir-udat.
SELECTION-SCREEN: SKIP.
PARAMETERS: path(250).
SELECTION-SCREEN: SKIP.
PARAMETERS: display RADIOBUTTON GROUP func,
save RADIOBUTTON GROUP func,
savedspl RADIOBUTTON GROUP func.
SELECTION-SCREEN: SKIP.
PARAMETERS: codeonly AS CHECKBOX.
SELECTION-SCREEN: SKIP.
*PARAMETERS: suffix(80) LOWER CASE.
DATA: suffix(80) TYPE c.
LOAD-OF-PROGRAM.
AUTHORITY-CHECK OBJECT 'S_DEVELOP'
ID 'DEVCLASS' DUMMY
ID 'OBJTYPE' FIELD 'PROG'
ID 'OBJNAME' FIELD 'REPTRAN'
ID 'PGROUP' DUMMY
ID 'ACTVT' FIELD '03'.
IF sy-subrc <> 0.
MESSAGE e059(EU) WITH 'REPTRAN'.
ENDIF.
INITIALIZATION.
GET PARAMETER ID 'REPTRAN_PATH' FIELD path.
IF path IS INITIAL.
path = 'C:\ABAPS\'.
ENDIF.
save = 'X'.
codeonly = 'X'.
CALL FUNCTION 'WS_QUERY'
EXPORTING
ENVIRONMENT = ' '
FILENAME = ' '
query = 'OS'
WINID = ' '
IMPORTING
return = os
EXCEPTIONS
inv_query = 1
no_batch = 2
frontend_error = 3
OTHERS = 4.
IF sy-subrc = 0 AND
( os CS 'OS2' OR os CS 'DOS' OR os CS 'NT' ).
delim = delwn.
command = dirwn.
shell = shellwn.
ELSE.
delim = delux.
command = dirux.
shell = shellux.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR path.
GET CURSOR FIELD path VALUE path.
filename = path.
PERFORM fileselector.
AT SELECTION-SCREEN.
IF report[] IS INITIAL.
IF NOT reports[] IS INITIAL.
report = 'IEQ'.
report-low = reports.
APPEND report.
MESSAGE i208(00)
WITH 'Report/BSP application was also identified'(009).
ELSE.
MESSAGE e208(00)
WITH 'Enter report or BSP application or enter path'(011).
ENDIF.
ENDIF.
START-OF-SELECTION.
offset = strlen( path ) - 1.
IF path+offset(1) <> '\'.
CONCATENATE path '\' INTO path.
ENDIF.
SET PARAMETER ID 'REPTRAN_PATH' FIELD path.
FORMAT COLOR COL_BACKGROUND INTENSIFIED OFF.
eu_key-sprsl = sy-langu.
IF NOT save IS INITIAL OR
NOT display IS INITIAL OR
NOT savedspl IS INITIAL.
DOWNLOAD PROGRAMS
SELECT name FROM trdir
INTO TABLE reports
WHERE name IN report
AND cnam IN cnam
AND unam IN unam
AND subc IN subc
AND rstat IN rstat
AND cdat IN cdat
AND udat IN udat.
IF sy-subrc <> 0.
LOOP AT report.
CONCATENATE report(3) 'SAPL' report+3 INTO report.
MODIFY report.
ENDLOOP.
SELECT name FROM trdir
INTO TABLE reports
WHERE name IN report
AND cnam IN cnam
AND unam IN unam
AND subc IN subc
AND rstat IN rstat
AND cdat IN cdat
AND udat IN udat.
ENDIF.
IF sy-subrc <> 0.
MESSAGE i208(00)
WITH 'The program/function name entered does not exist!'(082).
ENDIF.
LOOP AT reports.
Check if report is in development class
classtype = reports+30.
IF reports(5) NE 'CL_O2'.
IF classtype = 'CP'.
tadir-obj_name = reports.
SHIFT tadir-obj_name RIGHT DELETING TRAILING space.
SHIFT tadir-obj_name RIGHT BY 2 PLACES.
SHIFT tadir-obj_name RIGHT DELETING TRAILING '='.
SHIFT tadir-obj_name LEFT DELETING LEADING space.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'CLAS'
AND obj_name = tadir-obj_name
AND devclass IN devclass.
ENDIF.
IF classtype <> 'CP' OR sy-subrc <> 0.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = reports
AND devclass IN devclass.
IF sy-subrc <> 0.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'FUGR'
AND obj_name = reports
AND devclass IN devclass.
ENDIF.
IF sy-subrc <> 0 AND
( reports(4) = 'SAPL' OR reports(4) = 'sapl' ).
reportname = reports+4.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'FUGR'
AND obj_name = reportname
AND devclass IN devclass.
ENDIF.
ENDIF.
IF sy-subrc <> 0.
CONTINUE.
ENDIF.
ENDIF.
reportname = reports.
PERFORM makepath USING reportname
path
CHANGING savepath.
PERFORM writeinfo USING reportname
savepath.
REFRESH: i_repsrc, i_reptx, i_reptxt, i_inc,
sta4, ctx4, fun4, mtx4, doc4, tit4, men4, act4, but4,
pfk4, set4, stx4, biv46c,
i_d020t, i_adm4,
i_tmd, i_tfd, i_cls, i_cdf, i_clx, i_clt, i_cmr, i_cmp,
i_cmd, i_cmx, i_cmt, i_irl, i_mat, i_mac, i_red, i_frd,
i_tpl, i_sco, i_scd, i_scx, i_sct, i_cmd_t, i_scd_t.
CLEAR: adm4.
eu_key-name = reports.
READ REPORT reports INTO i_repsrc.
IF codeonly <> 'X'.
READ TEXTPOOL reports INTO i_reptx.
ENDIF.
LOOP AT i_reptx.
MOVE-CORRESPONDING i_reptx TO i_reptxt.
APPEND i_reptxt.
ENDLOOP.
IF NOT display IS INITIAL OR
NOT savedspl IS INITIAL.
PERFORM show_rep.
ENDIF.
IF classtype = 'CP' OR classtype = 'IP'.
classname = reports(30).
TRANSLATE classname USING '= '.
SELECT * FROM tmdir INTO TABLE i_tmd
WHERE classname = classname.
SELECT * FROM seoclass INTO TABLE i_cls
WHERE clsname = classname.
SELECT * FROM seoclassdf INTO TABLE i_cdf
WHERE clsname = classname.
SELECT * FROM seoclassex INTO TABLE i_clx
WHERE clsname = classname.
SELECT * FROM seoclasstx INTO TABLE i_clt
WHERE clsname = classname.
SELECT * FROM seometarel INTO TABLE i_cmr
WHERE clsname = classname.
SELECT * FROM seocompo INTO TABLE i_cmp
WHERE clsname = classname.
SELECT * FROM seocompodf INTO TABLE i_cmd
WHERE clsname = classname.
LOOP AT i_cmd.
MOVE-CORRESPONDING i_cmd TO i_cmd_t.
APPEND i_cmd_t.
ENDLOOP.
SELECT * FROM seocompoex INTO TABLE i_cmx
WHERE clsname = classname.
SELECT * FROM seocompotx INTO TABLE i_cmt
WHERE clsname = classname.
SELECT * FROM seoimplrel INTO TABLE i_irl
WHERE clsname = classname.
SELECT * FROM seomapatt INTO TABLE i_mat
WHERE clsname = classname.
SELECT * FROM seomapcls INTO TABLE i_mac
WHERE clsname = classname.
SELECT * FROM seoredef INTO TABLE i_red
WHERE clsname = classname.
SELECT * FROM seofriends INTO TABLE i_frd
WHERE clsname = classname.
SELECT * FROM seotypepls INTO TABLE i_tpl
WHERE clsname = classname.
SELECT * FROM seosubco INTO TABLE i_sco
WHERE clsname = classname.
SELECT * FROM seosubcodf INTO TABLE i_scd
WHERE clsname = classname.
LOOP AT i_scd.
MOVE-CORRESPONDING i_scd TO i_scd_t.
APPEND i_scd_t.
ENDLOOP.
SELECT * FROM seosubcoex INTO TABLE i_scx
WHERE clsname = classname.
SELECT * FROM seosubcotx INTO TABLE i_sct
WHERE clsname = classname.
ELSE.
CLEAR classtype.
ENDIF.
IF codeonly <> 'X'.
SELECT * FROM tfdir INTO TABLE i_tfd
WHERE pname = reports.
CALL FUNCTION 'RS_CUA_INTERNAL_FETCH'
EXPORTING
program = reports
LANGUAGE =
STATE = 'A'
IMPORTING
adm = adm4
LANGU =
AUTHOR =
DATE =
TIME =
CAUTHOR =
CDATE =
CTIME =
GDATE =
GTIME =
TABLES
sta = sta4
fun = fun4
men = men4
mtx = mtx4
act = act4
but = but4
pfk = pfk4
set = set4
doc = doc4
tit = tit4
biv = biv46c
EXCEPTIONS
not_found = 1
unknown_version = 2
OTHERS = 3.
SELECT ddnr text_line FROM title INTO TABLE tit
WHERE ddlanguage = eu_key-sprsl AND
progname = eu_key-name.
SELECT * FROM rsmptexts INTO TABLE stx4
WHERE progname = eu_key-name AND
sprsl = eu_key-sprsl.
SELECT prog dynr dtxt FROM d020t INTO TABLE i_d020t
WHERE prog = reports AND
NOT dtxt LIKE 'SEL_SCREEN%'.
ENDIF.
IF NOT classtype IS INITIAL.
reports = classname.
ENDIF.
TRANSLATE reports TO LOWER CASE.
TRANSLATE reports USING '/.'.
IF NOT save IS INITIAL OR
NOT savedspl IS INITIAL.
CONCATENATE savepath reports suffix '.txt' INTO filename.
PERFORM download TABLES i_repsrc USING filename
'Source'(003).
IF NOT i_reptxt[] IS INITIAL.
CONCATENATE savepath reports suffix '_txt.txt' INTO filename.
PERFORM download TABLES i_reptxt USING filename
'Text elements'(004).
ENDIF.
ENDIF.
SELECT include FROM d010inc INTO TABLE i_inc
WHERE master = eu_key-name.
DELETE i_inc WHERE table_line(1) = '<'.
DELETE i_inc WHERE table_line(1) = '>'.
DELETE i_inc WHERE table_line = 'DB__SSEL'.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_inc[] IS INITIAL.
CONCATENATE savepath reports suffix '_inc.txt' INTO filename.
PERFORM download TABLES i_inc USING filename
'Include List'(033).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_tmd[] IS INITIAL.
CONCATENATE savepath reports suffix '_tmd.txt' INTO filename.
PERFORM download TABLES i_tmd USING filename
'Methods List'(048).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_cls[] IS INITIAL.
CONCATENATE savepath reports suffix '_cls.txt' INTO filename.
PERFORM download TABLES i_cls USING filename
'Class Entry'(050).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_cdf[] IS INITIAL.
CONCATENATE savepath reports suffix '_cdf.txt' INTO filename.
PERFORM download TABLES i_cdf USING filename
'Class Definition'(051).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_clx[] IS INITIAL.
CONCATENATE savepath reports suffix '_clx.txt' INTO filename.
PERFORM download TABLES i_clx USING filename
'Class Remote Info'(052).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_clt[] IS INITIAL.
CONCATENATE savepath reports suffix '_clt.txt' INTO filename.
PERFORM download TABLES i_clt USING filename
'Class Description'(053).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_cmr[] IS INITIAL.
CONCATENATE savepath reports suffix '_cmr.txt' INTO filename.
PERFORM download TABLES i_cmr USING filename
'Class Meta Relations'(054).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_cmp[] IS INITIAL.
CONCATENATE savepath reports suffix '_cmp.txt' INTO filename.
PERFORM download TABLES i_cmp USING filename
'Class Components'(055).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_cmd_t[] IS INITIAL.
CONCATENATE savepath reports suffix '_cmd.txt' INTO filename.
PERFORM download TABLES i_cmd_t USING filename
'Class Components Definitions'(056).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_cmx[] IS INITIAL.
CONCATENATE savepath reports suffix '_cmx.txt' INTO filename.
PERFORM download TABLES i_cmx USING filename
'Class Components Remote Infos'(057).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_cmt[] IS INITIAL.
CONCATENATE savepath reports suffix '_cmt.txt' INTO filename.
PERFORM download TABLES i_cmt USING filename
'Class Components Descriptions'(058).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_irl[] IS INITIAL.
CONCATENATE savepath reports suffix '_irl.txt' INTO filename.
PERFORM download TABLES i_irl USING filename
'Class Components Relation Types'(059).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_mat[] IS INITIAL.
CONCATENATE savepath reports suffix '_mat.txt' INTO filename.
PERFORM download TABLES i_mat USING filename
'Class Mapping Attributes'(060).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_mac[] IS INITIAL.
CONCATENATE savepath reports suffix '_mac.txt' INTO filename.
PERFORM download TABLES i_mac USING filename
'Class Mapping Classes'(061).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_red[] IS INITIAL.
CONCATENATE savepath reports suffix '_red.txt' INTO filename.
PERFORM download TABLES i_red USING filename
'Class Redefinitions'(062).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_frd[] IS INITIAL.
CONCATENATE savepath reports suffix '_frd.txt' INTO filename.
PERFORM download TABLES i_frd USING filename
'Class Friends'(063).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_tpl[] IS INITIAL.
CONCATENATE savepath reports suffix '_tpl.txt' INTO filename.
PERFORM download TABLES i_tpl USING filename
'Class Type-Pools'(064).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_sco[] IS INITIAL.
CONCATENATE savepath reports suffix '_sco.txt' INTO filename.
PERFORM download TABLES i_sco USING filename
'Class Sub Components'(065).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_scd_t[] IS INITIAL.
CONCATENATE savepath reports suffix '_scd.txt' INTO filename.
PERFORM download TABLES i_scd_t USING filename
'Class Sub Components Definitions'(066).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_scx[] IS INITIAL.
CONCATENATE savepath reports suffix '_scx.txt' INTO filename.
PERFORM download TABLES i_scx USING filename
'Class Sub Components Remote Infos'(067).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_sct[] IS INITIAL.
CONCATENATE savepath reports suffix '_sct.txt' INTO filename.
PERFORM download TABLES i_sct USING filename
'Class Sub Components Descriptions'(068).
ENDIF.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_tfd[] IS INITIAL.
CONCATENATE savepath reports suffix '_tfd.txt' INTO filename.
PERFORM download TABLES i_tfd USING filename
'Function List'(049).
ENDIF.
IF NOT i_inc[] IS INITIAL.
LOOP AT i_inc.
REFRESH: i_reptx, i_reptxt.
READ REPORT i_inc INTO i_repsrc.
IF codeonly <> 'X'.
READ TEXTPOOL i_inc INTO i_reptx.
ENDIF.
LOOP AT i_reptx.
MOVE-CORRESPONDING i_reptx TO i_reptxt.
APPEND i_reptxt.
ENDLOOP.
IF NOT display IS INITIAL OR
NOT savedspl IS INITIAL.
PERFORM show_inc.
ENDIF.
TRANSLATE i_inc TO LOWER CASE.
TRANSLATE i_inc USING '/.'.
IF NOT save IS INITIAL OR
NOT savedspl IS INITIAL.
CONCATENATE savepath i_inc suffix '.txt' INTO filename.
PERFORM download TABLES i_repsrc USING filename
'Include Source'(032).
IF NOT i_reptxt[] IS INITIAL.
CONCATENATE savepath i_inc suffix '_txt.txt'
INTO filename.
PERFORM download TABLES i_reptxt USING filename
'Text elements'(004).
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
IF NOT i_d020t[] IS INITIAL.
LOOP AT i_d020t.
IMPORT DYNPRO hdr fld src mat ID i_d020t.
CALL FUNCTION 'RS_SCRP_UPGRADE_DYNPRO'
TABLES
f = fld
m = mat
CHANGING
h = hdr.
IF src[] IS INITIAL.
DELETE i_d020t.
CONTINUE.
ENDIF.
CLEAR src.
READ TABLE src INDEX 1.
IF src-line CS 'Do not change'.
DELETE i_d020t.
CONTINUE.
ENDIF.
CALL FUNCTION 'RS_SCRP_GET_SCREEN_INFOS'
EXPORTING
dynnr = hdr-dnum
progname = hdr-prog
with_fieldlist = 'X'
IMPORTING
lines = lines
columns = rows
TABLES
fieldlist = fld
EXCEPTIONS
dynpro_does_not_exist = 01
no_field_list = 02.
hdr-bzmx = lines.
hdr-bzbr = rows.
IF NOT display IS INITIAL OR
NOT savedspl IS INITIAL.
PERFORM show_dyn.
ENDIF.
IF NOT save IS INITIAL OR
NOT savedspl IS INITIAL.
PERFORM dynpro_download.
ENDIF.
ENDLOOP.
IF ( NOT save IS INITIAL OR
NOT savedspl IS INITIAL ) AND
NOT i_d020t[] IS INITIAL.
CONCATENATE savepath reports suffix '_dyn.txt' INTO filename.
PERFORM download TABLES i_d020t USING filename
'Dynpro List'(040).
ENDIF.
ENDIF.
IF NOT save IS INITIAL OR
NOT savedspl IS INITIAL.
IF NOT sta4[] IS INITIAL.
CONCATENATE savepath reports suffix '_sta.txt' INTO filename.
PERFORM download TABLES sta4 USING filename
'GUI Status'(013).
ENDIF.
IF NOT ctx4[] IS INITIAL.
CONCATENATE savepath reports suffix '_ctx.txt' INTO filename.
PERFORM download TABLES ctx4 USING filename
'Object Codes'(045).
ENDIF.
IF NOT fun4[] IS INITIAL.
CONCATENATE savepath reports suffix '_fun.txt' INTO filename.
PERFORM download TABLES fun4 USING filename
'Function Texts'(014).
ENDIF.
IF NOT men4[] IS INITIAL.
CONCATENATE savepath reports suffix '_men.txt' INTO filename.
PERFORM download TABLES men4 USING filename
'Menus'(015).
ENDIF.
IF NOT tit4[] IS INITIAL.
CONCATENATE savepath reports suffix '_sti.txt' INTO filename.
PERFORM download TABLES tit4 USING filename
'Title Codes'(042).
ENDIF.
IF NOT mtx4[] IS INITIAL.
CONCATENATE savepath reports suffix '_mtx.txt' INTO filename.
PERFORM download TABLES mtx4 USING filename
'Menu Texts'(016).
ENDIF.
IF NOT act4[] IS INITIAL.
CONCATENATE savepath reports suffix '_act.txt' INTO filename.
PERFORM download TABLES act4 USING filename
'Menu Bars'(047).
ENDIF.
IF NOT but4[] IS INITIAL.
CONCATENATE savepath reports suffix '_but.txt' INTO filename.
PERFORM download TABLES but4 USING filename
'Push Buttons'(018).
ENDIF.
IF NOT pfk4[] IS INITIAL.
CONCATENATE savepath reports suffix '_pfk.txt' INTO filename.
PERFORM download TABLES pfk4 USING filename
'PF Keys'(019).
ENDIF.
IF NOT adm4 IS INITIAL.
APPEND adm4 TO i_adm4.
CONCATENATE savepath reports suffix '_adm.txt' INTO filename.
PERFORM download TABLES i_adm4 USING filename
'Management Information'(043).
ENDIF.
IF NOT set4[] IS INITIAL.
CONCATENATE savepath reports suffix '_set.txt' INTO filename.
PERFORM download TABLES set4 USING filename
'Function Sets'(020).
ENDIF.
IF NOT stx4[] IS INITIAL.
CONCATENATE savepath reports suffix '_stx.txt' INTO filename.
PERFORM download TABLES stx4 USING filename
'Status Texts'(023).
ENDIF.
IF NOT doc4[] IS INITIAL.
CONCATENATE savepath reports suffix '_doc.txt' INTO filename.
PERFORM download TABLES doc4 USING filename
'Status Short Texts'(024).
ENDIF.
IF NOT biv46c[] IS INITIAL.
CONCATENATE savepath reports suffix '_biv.txt' INTO filename.
PERFORM download TABLES biv46c USING filename
'Invariant Functions'(048).
ENDIF.
IF NOT tit[] IS INITIAL.
CONCATENATE savepath reports suffix '_tit.txt' INTO filename.
PERFORM download TABLES tit USING filename
'Title Bars'(030).
ENDIF.
ENDIF.
ULINE.
ENDLOOP.
ENDIF.
REFRESH reports.
*& Form DOWNLOAD
FORM download TABLES tabelle
USING value(filename)
component.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
filename = filename
filetype = 'ASC'
IMPORTING
FILELENGTH =
TABLES
data_tab = tabelle
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
OTHERS = 5.
IF reports IS INITIAL.
WRITE: / appls.
ELSE.
WRITE: / reports.
ENDIF.
WRITE: /(20) component.
IF sy-subrc = 0.
WRITE: 'successfully downloaded'(001).
PERFORM getfilename USING filename
CHANGING filename.
WRITE: '->', filename.
ELSE.
WRITE: 'not downloaded, RC ='(002), sy-subrc.
ENDIF.
ENDFORM. " DOWNLOAD
*& Form FILESELECTOR
FORM fileselector.
DATA: repname(250).
DATA: fdpos(2) TYPE p.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = ' '
def_path = path
mask = ',.txt,.txt.'
mode = 'O'
TITLE = ' '
IMPORTING
filename = file
RC =
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
subrc = sy-subrc.
path = file.
CLEAR: sy-fdpos, sy-subrc.
fdpos = 1.
WHILE sy-subrc = 0.
fdpos = fdpos + sy-fdpos + 1.
SEARCH path FOR delim STARTING AT fdpos.
ENDWHILE.
fdpos = fdpos - 1.
path = path(fdpos).
repname = file.
CLEAR sy-subrc.
WHILE sy-subrc = 0.
SHIFT repname LEFT.
SHIFT repname LEFT UP TO delim.
ENDWHILE.
SHIFT repname RIGHT UP TO '.'.
SHIFT repname RIGHT.
SHIFT repname LEFT DELETING LEADING space.
TRANSLATE repname TO UPPER CASE.
reports = repname.
APPEND reports.
ENDFORM. " FILESELECTOR
*& Form LS
FORM ls.
TYPES: c80(80).
DATA: dirtab TYPE STANDARD TABLE OF c80 WITH HEADER LINE.
DATA: datei TYPE string.
DATA: i LIKE sy-tabix.
DATA: endtime LIKE sy-uzeit.
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
DOCUMENT = ' '
cd = path
commandline = command
INFORM = ' '
program = shell
STAT = ' '
WINID = ' '
OSMAC_SCRIPT = ' '
OSMAC_CREATOR = ' '
WIN16_EXT = ' '
EXEC_RC = ' '
IMPORTING
RBUFF =
EXCEPTIONS
frontend_error = 1
no_batch = 2
prog_not_found = 3
illegal_option = 4
OTHERS = 5.
IF sy-subrc NE 0.
MESSAGE e001(pc).
Error when executing the WS program
ENDIF.
CONCATENATE path 'dir.tmp' INTO datei.
GET TIME.
endtime = sy-uzeit + 3.
WHILE sy-uzeit < endtime.
GET TIME.
ENDWHILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = datei
filetype = 'ASC'
IMPORTING
FILELENGTH =
TABLES
data_tab = dirtab
EXCEPTIONS
file_read_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
OTHERS = 5.
IF sy-subrc NE 0.
MESSAGE e001(pc).
Error when executing the WS program
ENDIF.
REFRESH reports.
i = 1.
DO.
SEARCH dirtab FOR '.txt' STARTING AT i.
IF sy-subrc NE 0.
EXIT.
ENDIF.
READ TABLE dirtab INDEX sy-tabix.
i = sy-tabix + 1.
CHECK dirtab NS 'txt_.txt'.
SHIFT dirtab LEFT UP TO space.
SHIFT dirtab LEFT DELETING LEADING space.
SHIFT dirtab LEFT UP TO space.
SHIFT dirtab LEFT DELETING LEADING space.
SHIFT dirtab LEFT UP TO space.
SHIFT dirtab RIGHT UP TO '.'.
SHIFT dirtab RIGHT.
SHIFT dirtab LEFT DELETING LEADING space.
IF NOT dirtab IS INITIAL.
TRANSLATE dirtab TO LOWER CASE.
APPEND dirtab TO reports.
ENDIF.
ENDDO.
SORT reports.
DELETE ADJACENT DUPLICATES FROM reports.
ENDFORM. " LS
*& Form SHOW_DYN
FORM show_dyn.
Printing Dynpro data
Header for Dynpro
FORMAT COLOR COL_TOTAL.
WRITE: / 'Dynpro header', AT sy-linsz ''.
FORMAT COLOR COL_NORMAL.
WRITE: / 'Program:', 30 hdr-prog, AT sy-linsz '',
/ 'Dynpro:', 30 hdr-dnum, AT sy-linsz '',
/ 'Follow-up dynpro:', 30 hdr-fnum, AT sy-linsz ''.
ULINE.
Print field list
FORMAT COLOR COL_TOTAL.
WRITE: / 'Field list' COLOR COL_TOTAL, AT sy-linsz ''.
FORMAT COLOR COL_HEADING.
WRITE: / 'Field',
25 'Line',
30 'Column',
37 'TYPE',
42 'LOOPTyp',
50 'DDIC',
55 'FormByte', AT sy-linsz ''.
CALL FUNCTION 'RS_SCRP_FIELDS_RAW_TO_CHAR'
TABLES
fields_int = fld
fields_char = fields_char
EXCEPTIONS
OTHERS = 1.
FORMAT COLOR COL_NORMAL.
LOOP AT fields_char.
WRITE: /(24) fields_char-feldname,
25 fields_char-line,
30 fields_char-coln,
37 fields_char-feldformat,
42 fields_char-looptype,
50 fields_char-inttyp,
55 fields_char-fmb1,
58 fields_char-fmb2.
ENDLOOP.
ULINE.
Display logic
FORMAT COLOR COL_TOTAL.
WRITE: / 'Logic', AT sy-linsz ''.
FORMAT COLOR COL_NORMAL.
LOOP AT src.
WRITE: / src-line.
ENDLOOP.
ULINE.
SKIP.
Display matchcode data
FORMAT COLOR COL_TOTAL.
WRITE: / 'Matchcode data', AT sy-linsz ''.
FORMAT COLOR COL_NORMAL.
LOOP AT mat.
WRITE: /(80) mat.
ENDLOOP.
IF sy-subrc NE 0.
WRITE / ' no matchcode files available ' COLOR COL_NEGATIVE.
ENDIF.
NEW-PAGE.
ENDFORM. " SHOW_DYN
*& Form SHOW_REP
FORM show_rep.
FORMAT COLOR COL_TOTAL.
WRITE: / 'Program:', reports, AT sy-linsz ''.
FORMAT COLOR COL_BACKGROUND.
LOOP AT i_repsrc.
WRITE: / i_repsrc.
ENDLOOP.
ULINE.
FORMAT COLOR COL_TOTAL.
WRITE: / 'Text elements for program:', reports, AT sy-linsz ''.
FORMAT COLOR COL_HEADING.
WRITE: / 'Type',
5 'Key',
20 'Length',
30 'Text', AT sy-linsz ''.
FORMAT COLOR COL_NORMAL.
LOOP AT i_reptxt.
WRITE: / i_reptxt-id,
5 i_reptxt-key,
20(4) i_reptxt-length,
30(80) i_reptxt-entry.
ENDLOOP.
NEW-PAGE.
ENDFORM. " SHOW_REP
*& Form SHOW_INC
FORM show_inc.
FORMAT COLOR COL_TOTAL.
WRITE: / 'Include:', i_inc, AT sy-linsz ''.
FORMAT COLOR COL_BACKGROUND.
LOOP AT i_repsrc.
WRITE: / i_repsrc.
ENDLOOP.
ULINE.
FORMAT COLOR COL_TOTAL.
WRITE: / 'Text elements for include:', i_inc, AT sy-linsz ''.
FORMAT COLOR COL_HEADING.
WRITE: / 'Type',
5 'Key',
20 'Length',
30 'Text', AT sy-linsz ''.
FORMAT COLOR COL_NORMAL.
LOOP AT i_reptxt.
WRITE: / i_reptxt-id,
5 i_reptxt-key,
20(4) i_reptxt-length,
30(80) i_reptxt-entry.
ENDLOOP.
NEW-PAGE.
ENDFORM. " SHOW_INC
*& Form DYNPRO_DOWNLOAD
& -
Online Background job for Module pool program
Hi,
I need to process the dialog program in background. Normally for any executable report programs by default we will have that functionality. But i need the same functionality for my module pool program. User needs 2 execute buttons - one is for direct excute (foreground execute) and the other one is for back ground processing.
I tried with the 3 function modules job_open, job_submit & job_close. But i am keep on getting some issues and i am not sure how those will work because i wrote all the validations in direct exucte user command, now if user clicks on Background how that logic will be called and how it will be processed.
Can any one give your valuable suggestions.
regards
JayaHi
Create a Transaction code for this Program.
Then implement the BDC Code to Process the SCreens with the Required input Values.
Schedule this BDC Session in Backgound using RSBDCSUB.
Reward if usefull -
Table Control in Module Pool Programming
In my Module Pool program I have created a Table Control on my screen. In my Table one column is the Checkbox. When I make changes in any of the Checkbox and scroll the Table or scroll with mouse,the data is lost.I am updating the database table and for that I have created a 'SAVE' button.But to make the changes I have to Scroll the Table on the screen and the changed data is lost.
Please guide me or if possible then tell me the Flow Logic of Module Pool with Table Control??
Thanks for the Help....PROCESS BEFORE OUTPUT.
MODULE INITIALIZE.
*&spwizard: pbo flow logic for tablecontrol 'TBLALLOC_CYC'
module TBLALLOC_CYC_change_tc_attr.
*&spwizard: module TBLALLOC_CYC_change_col_attr.
loop at GT_NEW_ALLOC
into GT_NEW_ALLOC_WA
with control TBLALLOC_CYC
cursor TBLALLOC_CYC-current_line.
module TBLALLOC_CYC_get_lines.
*&spwizard: module TBLALLOC_CYC_change_field_attr
endloop.
MODULE STATUS_9003.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_9003.
*MODULE USER_COMMAND_9003.
*&spwizard: pai flow logic for tablecontrol 'TBLALLOC_CYC'
loop at GT_NEW_ALLOC.
chain.
field GT_NEW_ALLOC_WA-/BIC/ZALLOCCYC.
field GT_NEW_ALLOC_WA-/BIC/UFACT_FLG.
field GT_NEW_ALLOC_WA-CHANGEDBY.
field GT_NEW_ALLOC_WA-CH_ON.
field GT_NEW_ALLOC_WA-/BIC/ECHAT.
module TBLALLOC_CYC_modify on chain-request.
endchain.
endloop.
module TBLALLOC_CYC_user_command.
*&spwizard: module TBLALLOC_CYC_change_tc_attr.
*&spwizard: module TBLALLOC_CYC_change_col_attr.
module TBLALLOC_CYC_user_command.
MODULE USER_COMMAND_9003.
MODULE INITIALIZE OUTPUT.
At the time of initialization of the screen data is to be displayed
by calling Function Module ZUFACTS_FETCH_ALLOC_CYC.
CALL FUNCTION 'ZUFACTS_FETCH_ALLOC_CYC'
TABLES
T_ALLOC = GT_NEW_ALLOC
Pass the value displayed in Internal Table GT_OLD_ALLOC.
GT_OLD_ALLOC[] = GT_NEW_ALLOC[].
MOVE GT_OLD_ALLOC TO GT_OLD_ALLOC.
*****Initialize the ok_code.
CLEAR OK_CODE .
ENDMODULE. " INITIALIZE OUTPUT
MODULE USER_COMMAND_9003 INPUT.
CASE : OK_CODE.
WHEN 'SAVE'.
CALL FUNCTION 'ZUFACTS_UPDATE_ALLOC_CYC'
TABLES
T_OLD_ALLOC = GT_OLD_ALLOC
T_NEW_ALLOC = GT_NEW_ALLOC
EXCEPTIONS
NO_FIELD_UPDATED = 1
UNSUCCESSFUL_UPDATION = 2
OTHERS = 3
IF SY-SUBRC = 1.
MESSAGE I005 .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF SY-SUBRC = 2.
MESSAGE E006.
ENDIF.
WHEN 'CANCEL' OR 'BACK' OR '%EX' OR 'RW'.
LEAVE TO SCREEN 0.
ENDCASE.
CLEAR OK_CODE.
ENDMODULE. " USER_COMMAND_9003 INPUT -
CURRENCY FIELD IN TABLE CONTROLLS OF MODULE POOL PROGRAM
Hi All.
I am fasing an issue in module pool.
I am using a table controll to display the data on the screen.
There is one field of currency type .
the amount in that field is -ve(Negative) then the program giving a short dump by saying that the problem is in the conversion.
if the field is + ve(means no sign) it's executing fine.
Can any body help me to solve this issue,
Thanks in advance,
regards,
venkatHi Venkat,
Open the screen painter (SE51) and go to the currency field in the table control on the screen. In the "TEXT" field in the toolbar, delete a character (_) and type in "V" as the last character. The issue should be solved.
Regards,
Manoj -
Hi Experts,
I have developed a Module Pool Program in IDES. Unfortunately the ides system is crashed. But I took the back up of the program. But I dont have any idea of how to upload the program into ides again. Please let me know how to download and upload the code . Please suggest me or provide any links related to this issue.
Thanking you,
Regards,
Murali Krishna THi Murali,
no option to upload directly module pool program
but we have a option to upload report program right same way u need to upload the program and
in case of screen there is a option to download /upload screen in screen painter after going to screen click utilities and in that click upload or down load
this way can upload module pool program
Regards
Surendra P -
Tutorial for Screen programming & Module-Pool programming
Hi Experts,
I have no previous knowledge of Screen programming & Module-pool programming.
Please provide me good tutorials on those so that I can master those in a couple of days as I need to use those in my current assignment.
I require those badly.
Rewards assured.
Thanks.
Anirban.
Moderator message: please do not ask for documents or tutorials, search for available information, do not use terms that assign a higher priority to your issue compared to all others, do not promise rewards.
[Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
Edited by: Thomas Zloch on Nov 15, 2010 2:14 PMhai guru,
use abapdocu----- tcode give ur keyword and search it.
or
sap technical .
search in sap sdn ok.
thanks.
anji -
How to write module pool program
hai,
what is the module -pool program ?
what are the procedures to write the module-pool program.
plz give the simple program for module-pool programs?
regards
surenderHi
This component though is not attached to the screen painter, plays important role in transaction. Normally, for reports, on line executable programs are written but for transaction, Module Pool Programs are written. The module pool program contains only modules to handle various events associated with screen and data declaration statements.
System divides the module pool program into several include program. These are global field, PBO modules, and PAI modules. It is entirely users decision whether to use these modules or write directly into main program.
Creation of Module Pool Program
You can create module pool program either through
Object browser
System automatically creates the module pool program and for these program which are created through object browser, system creates the include modules.
Or
ABAP/4 editor
It is similar to normal program creation. Type of program should be given M and is not created by system.
Communication between Dynpro and Module Program
For each screen, the system executes the flow logic, which contains corresponding events. The control is passed to Module Pool Program. Module Pool Program handles the code for these events and again passes back control to the flow logic and finally to screen. Unlike on line program, in this case, the control remains with flow logic. The switching of control between flow logic and module pool program and back is common process when user executes transaction.
Creation of a Complete Transaction
Steps involved to create a complete transaction
Create module pool program.
From screen painter create screens.
Write flow logic for each screen.
Write code for all the events in module pool program.
Check for any error in screen and flow logic.
Generate each and every component of screen i.e. flow logic and screen.
Single screen can be tested using Screen Painter.
Create transaction code through object browser.
Generate the transaction code.
User can execute the transaction by entering the transaction code in the command field.
Handling Function Code
The function code or OKCODE is the last field of Field list. Function code can be handled as follows:
During the Designing of the screen, a function code is assigned to pushbutton.
In field list, developer needs to specify OKCODE as last field.
In module program it is a global field and can be evaluated in the PAI event.
A function code is treated in the same way, regardless it comes from pushbutton, menu item or any other GUI element.
When the user clicks on the Display button, you want to display details of sflight, with corresponding carrid and connid (which is entered by the user).
Module pool program to handle this particular screen is as follows:
Program YVTEST7.
TABLES: SFLIGHT.
DATA: OKCODE (4).
MODULE INPUT1 INPUT,
CASE OKCODE.
WHEN DISP.
SELECT * FROM SFLIGHT
WHERE CARRID = SFLIGHT CARRID AND
CONNID = SFLIGHT CONNID.
ENDSELECT.
LEAVE TO SCREEN 200.
WHEN EXIT. LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. INPUT1 INPUT
MODULE USER_COMMAND_0200 INPUT.
CASE OKCODE.
WHEN BACK. LEAVE TO SCREEN 100.
ENDCASE.
ENDMODULE. USER_COMMAND_0200 INPUT
When the user clicks on display, control is transferred to screen no. 200 on which you display sflight details & on the same screen, when user clicks on BACK button, he comes back to main screen.
Flow logic for screen 100 is as follows:
PROCESS AFTER INPUT.
MODULE INPUT.
Flow logic for screen 200
PROCESS AFTER INPUT.
USER_COMMAND_0200.
MODULES: Modules are handled in module pool program.
You need to write flow logic for screen 200 and design screen 200.
In case of transaction transfer of data from program to screen is automatic i.e. you need not transfer the data from program to screen explicitly. The fields, which you define in the screen receives the data from program and displays the same.
The Field Checks
As already mentioned Transaction is the only method, which SAP recommends to update the database tables. Data entered in the database table should be valid and correct. Data entered is validated at each and every point. ABAP/4 offers various methods to validate data and those are as follows:
Automatic field checks
Checks performed in the flow logic
Checks performed in the ABAP/4 module pool program
Automatic Field Checks
These checks are based on the field information stored in the dictionary. These checks are performed by the system automatically when the user enters the data for the screen field. System performs these checks before PAI event is triggered. Types of field checks performed by system are as follows:
Required input
While designing the screen, for particular screen field if you click the Req. Entry checkbox, the field becomes mandatory. When the transaction is executed if user leaves this particular field blank, the system displays error message. User cannot proceed until the user enters some data.
Proper Data Format
Each field has its own data format whether it is table field or screen field. Whenever data is entered, system checks for the proper format of the data. For example date. Each user has its own format for date, which is defined in the user master record. If the date defined in the user master record is in the format DD/MM/YYYY, if the user enters the date, say, in YY/DD/MM, the user displays the error message. System also checks for the value of month or days. For example if month entered is greater than twelve then the error message is displayed.
Valid Value for the Field
In data dictionary two tables are related by Primary key-Foreign key relationship. Whenever the user enters the data, the system checks for the check table values. Also in Domain, if you have fixed values, then the system checks for these values.
Automatic field checks are repeated each time the user enters the data.
About at Exit Command
Automatic field checks can be avoided by AT EXIT-COMMAND, which works exactly the same way as Cancel works on application tools bar. In the R/3 screen, if you want to quit the processing of that particular screen without entering the mandatory fields, user can click the Cancel button. Same functionality can be incorporated in the user-defined transaction by using AT EXIT-COMMAND. This module can be called before the system executes the automatic field checks and it goes without saying that before PAI event. Code for AT EXIT-COMMAND in flow logic and in module pool program can be written as follows:
In Flow Logic
Process After Input.
Module exit AT EXIT-COMMAND.
In module pool program.
Module exit.
Case okcode.
When Exit.
Leave to screen 0.
To achieve this kind of functionality a pushbutton or menu item should be assigned a function type E. It tells the system to process this particular module before carrying out any field checks.
Flow Logic Validations
Consider the case where you want user to enter only LH and SQ for sflight-carrid. In this case, you are restricting value of a screen field. This cannot be achieved by automatic field check. Hence there is a need of additional validation. It can be done in flow logic by using following statement:
Field -
Values
Syntax
PAI.
Field sflight-carrid values (LH).
For multiple values
PAI.
Field sflight-carrid values (LH SQ).
Field sflight-price values (between 1000 and 2000).
In this case when the user enters the value, PAI is triggered and field is checked for that particular value. If the value entered happens to be wrong, that field is enabled for user to enter. If you have multiple Field statements in your flow logic, it is sequential execution.
Consider the following case:
PAI.
Module assign.
Field sflight-carrid values (LH SQ).
In ABAP/4
Module assign.
Data: carrid1 like sflight-carrid.
Carrid1 = sflight-carrid.
Endmodule.
In this case, Sflight-carrid is used in the flow logic before the field statement. The system will give invalid value or some previous value as the field sflight-carrid is used in module before it is checked i.e., field statement is after the module in which sflight-carrid is being used. The field is not available to the system unless it executes the field statement. Field statement transfers the values to the program and is done only once. If you dont have Field statement in your flow logic, transfer of values takes place in PAI event.
Consider one more case where you have multiple field statement
PAI.
Field Sflight-carrid values (LH).
Field Sflight-connid values (0400 0500).
In this case if the user enters only carrid wrong, then this particular field is enabled and rest of the fields are disabled for user to input. Many times if the user enters wrong value for one field, then you might want to give option to user to enter all the fields, which is not possible by using Field statement only. This functionality can be achieved by CHAIN ENDCHAIN.
Syntax
Chain.
Field sflight-carrid value (LH).
Field sflight-connid values (between 200 and 500).
Endchain.
Field sflight-price values (100 1000).
In this case, if the user enters wrong value only for carrid, both the fields i.e. carrid and connid are enabled as they are grouped together in the Chain statement. The field price will be disabled for input. Usually, logically related fields are grouped together with Chain-Endchain statement.
Module Pool Program Validations
Checking fields ABAP/4 program includes
Field statement in flow logic.
Module statement in ABAP/4 module pool Program.
Syntax
PAI.
Field sflight-carrid module <name>.
This module can be handled in the main program i.e. module pool program.
In ABAP/4 program
Module Check.
Select single * from sflight where carrid = sflight-carrid.
If sy-subrc ne 0.
Message e001.
Endif.
In this case, field sflight-carrid is checked in the table for its existence.
Dynamically Calling the Screens
About Displaying Next Screen
Transaction is a sequence of screens, which are displayed one after the other. The next screen displayed depends upon the attributes of first screen. In attributes you need to give Next Screen number i.e. if next screen displayed should be 200 screen, then this number should be given in next Screen attributes. These are static attributes of the screen. By default, if nothing is specified in the program, the system branches out to the screen number, which is specified in the attribute screen.
In this case, if user selects MARA pushbutton, then fields from Mara table are displayed. When the user clicks on the MARD, then the fields from MARD table are displayed. Depending upon users selection, the screen is branched out and this has to be done during runtime. This functionality can be achieved by dynamically calling the screen in module pool program.
The screen can branch out to new screen depending upon user selection. Following command in module pool program can do this:
SET SCREEM
CALL SCREEN
LEAVE TO SCREEN <NUMBER>
All these commands override the specifications given in the attributes. This overriding is temporary. The values stored in the attribute are not changed.
Set Screen
Syntax
Set screen <number>.
In module pool program
Case okcode.
When DISP.
Set screen 200.
When LIST.
Set screen 300.
Endcase.
In this case, the entire processing of current screen takes place and then the system branches out to next screen. If you want to branch out to the next screen without processing the current screen, LEAVE SCREEN should be used along with the SET SCREEN.
For Example:
Case okcode..
When DISP.
Set screen 200.
Leave Screen.
When LIST.
Set screen 300.
Leave Screen.
Endcase.
When SET SCREEN is used, control cannot be transferred to the main screen or previous screen, unless you write code for the same.
Call Screen
Usually used for pop up screens. Many times, there is a need for user to enter additional information or secondary information on another screen or pop up screen. Once the user enters the data, he should be able to go back to main screen or to the screen where he started. This is not possible by using SET SCREEN. CALL SCREEN achieves this functionality.
Syntax
Call Screen 200.
Will simply call a screen number 200 from a main screen. Once the screen is displayed the user can enter all the data and return to the main screen by clicking BACK button.
To call screen as pop up screen the syntax is
Call screen starting at <col.no.> <line no>
Ending at <col no> <line no>.
In this case window will be popped as window and user can close it by using BACK button.
Leave to screen
To SET a new screen without processing current screen, you need to use the following two statements together:
SET SCREEN 200.
LEAVE SCREEN.
Or a Single statement
LEAVE TO SCREEN 200.
Maybe you are looking for
-
There seems to be a problem with the Apple Calendar. It crashes whenever I change to March 2013 in the monthly view. Have tried everyting, including shutting off everything. Am running the latest OS and have gone through all the updates. Anyone else
-
How do I copy the drum track from my iphone over to my mac
Hello - I just bought an iphone and downloaded Garageband. I noticed that my iphone version of GB has some really useful drum loops that are not present on my Mac. How can I copy the drum loops from my iphone to my mac, which is where I do most of my
-
Prevent batches from being changed in MB1A
Hi, I am looking to prevent batches from being changed by the material handler during the MB1A transaction. Does anyone know of any user exit or BADI in the MB1A tcode to acomplish this or any other way to do it ? The batches determined during pr
-
I am unable to clear my recent call list. Both the 'missed' and 'all' numbers appear even after deleting. It was happening on ios 7.0.4 and is present on 7.0.5. Any help.
-
Faulting application sapstartsrv.exe, MMC also throwing the same error
Hello friends, Recently I installed certain windows security updates, and after restarting I started getting this error and not able to start MMC. I possibly can restore with System point, but instead can I resolve this error by upgrading the Kernel.