Module pool programming - supressing display of some fields
Moderator message: better to start a new thread.
Hi i have similar requirement to this. module pool programming - supressing display of some fields
suppose i am displying
BUKRS 0001
Sales org 0001
KUNNR 1000
i dont want todisplay if the field is blank.
suppose if sales org is blank
expected result is liek this
BUKRS 0001
KUNNR 1000
i tried through loop at screen by uisng that
i am getting output like below.
BUKRS 0001
KUNNR 1000
hello subbarao, could you tell if your problem solved.
Hi Naidu,
In PBO put
DATA: FLAG TYPE I VALUE 0.
IF SALESORG = SPACE.
FLAG = 1.
ENDIF.
LOOP AT SCREEN.
IF FLAG = 1.
IF SCREEN-NAME = 'SALESORG'.
SCREEN-INVISIBLE = 'X'.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
Thanks,
Chidanand
Similar Messages
-
IS it Possiblity of BDC in Module pool programming
Hi All,
i have design 2 screens with module pool program.in one screen some input fields are there,once enter input and press buttoon,it will go to 2nd screen in this data is displayed in table control .once selected some rows in table control, that rows are captured(selected rows are storing in serperate internal table), now once he selected some rows and press save button, it should do BDC for VF21 transaction.
It means in 2nd screen of PAI module some function code(save) is executed,at that point BDC code is written.
Is it possible to handle the BDC in 2 nd screen of PAI Module.
If we write code in 2nd scren of PAI module through some function code,again when PBO of 2nd scren is loaded,it will refresh table control but not go to Do BDC forVF21 transaction.
so How can we handle this?
Useful Answers will be rewarded
RegardsHi,
It is absolutely possible to perform a BDC operation in a module pool program irrespective any screen you are.
In the PAI, after capturing the appropriate ok_code (sy-ucomm), you branch to the SAVE option. There you call out a subrotuine. say PERFORM bdc_save_VF21.
Inside this subroutine write your logic. What happens is the transaction VF21 gets updated with your bdc code with the help of CALL TRANSACTION. Check out in debugging.
Also you can see by making the mode in call transaction to All screen mode 'A'.
Please let me know if you can succeed in this.
Award me if this is helpful to you!
If you require further help, please send me your mail id.. i'll send some code to you.
Regards,
Ananth
Edited by: Anantharamakrishnan Venkatesan on Jan 9, 2008 5:31 PM -
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. -
F4 help in module pool programming
Hi All,
I have a requirement in module pool programming.
I have two fields on the screen. When I press F4 help on one field, it should fill both the fields with the respective values.
For example, I have G/L account and cost center for a Plant. when I click F4 for G/L, both G/L and cost center should be filled with the respective values.
Thanks in advance.Hi,
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'Zxxx'-------secondfield
PVALKEY = ' '
DYNPPROG = ' '
DYNPNR = ' '
DYNPROFIELD = ' '
STEPL = 0
WINDOW_TITLE = 'abcdef'
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
TABLES
VALUE_TAB = itab_details-zfirst----main field
FIELD_TAB =
RETURN_TAB = it_return
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
if sy-subrc = 0.
clear itab_details.
read table it_return index 1.
itab_details-zxxx = it_return-fieldval.
read table itab_details with key zxxx = itab_details-zxxx.
itab-zxxx = itab_details-zxxx.
itab-zabc = itab_details-zabc.
endif.
let me know if you need anything
Thanks
Venki -
Calling search helps dynamically in module pool program
Hi Experts,
I have created two search helps. I need to call these search helps in my module pool program dynamically for a single field (i.e ZMATNR).
you might be known... if it is a single search help, we can assign that in field attributes.
But here... I need to call different search helps for a single field based on the condition.
Pls help me.
Thanks
RaghuHi,
Use the below function module and pass the search help created in search help field according to the condition.
Process on Value-request.
if condition = A.
call function " F4IF_FIELD_VALUE_REQUEST"
TABNAME =
FIELDNAME =
SEARCHHELP = "Mention search help created
Elseif Conditon =B.
call function " F4IF_FIELD_VALUE_REQUEST"
TABNAME =
FIELDNAME =
SEARCHHELP = "Mention search help created
Endif.
Regards,
Prabhudas -
Data insert through module pool programming
hi
I want to insert the data into the data base through module pool programming.I am taking the fields from different tables, I need sample code ,please help meHi Dhanunjay,
REPORT zpe_str_le .
TABLES : zpe_str , zprd_mis1 , mseg , t001l.
*DATA : STR TYPE C VALUE '50'.
data : text(100) VALUE 'DELETED STORAGE LOCATION NO '.
SELECTION-SCREEN : BEGIN OF SCREEN 123 AS WINDOW TITLE TEXT-005.
SELECT-OPTIONS : S_ZSLOC FOR ZPE_STR-ZSLOC,
S_ZMACD FOR ZPE_STR-ZMACD,
S_ZPGRP FOR ZPE_STR-ZPGRP.
SELECTION-SCREEN : END OF SCREEN 123.
DATA : flag(1) TYPE c,
flag1 TYPE c ,
flag3 TYPE c VALUE '1'.
DATA : etab LIKE t001l OCCURS 0 WITH HEADER LINE.
SELECT * FROM T001L INTO TABLE ETAB.
DATA : ihead LIKE thead.
DATA : prevtab LIKE tline OCCURS 0 WITH HEADER LINE.
data : Jtab like TLINE occurs 0 with header line.
DATA : jtab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : itab LIKE zprd_mis1 OCCURS 0 WITH HEADER LINE.
*SELECT * FROM zprd_mis1 INTO TABLE itab.
DATA : BEGIN OF itab_sloc OCCURS 0,
werks LIKE t001l-werks,
lgort LIKE t001l-lgort,
lgobe LIKE t001l-lgobe,
END OF itab_sloc.
*FLAG = 0.
CALL SCREEN 100.
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'RET'.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 100.
*PERFORM PREVIEW.
LOOP AT prevtab.
WRITE : / prevtab.
ENDLOOP.
LOOP AT JTAB[] INTO ZPRD_MIS1.
WRITE : Jtab-TDFORMAT.
WRITE : Jtab-TDLINE .
*********ZPRD_MIS1-MANDT = Jtab-TDLINE .
*********ZPRD_MIS1-SLOC = Jtab-TDLINE .
*********ZPRD_MIS1-MCODE = Jtab-TDLINE .
*********ZPRD_MIS1-GCODE = Jtab-TDLINE .
*********ZPRD_MIS1-DESCR = Jtab-TDLINE .
*********INSERT ZPRD_MIS1.
ENDLOOP.
WRITE : JTAB-ZSLOC.
*********CALL TRANSACTION 'SO10'.
SET CURSOR 2 2.
WHEN 'DET'.
SELECT * FROM ZPRD_MIS1 INTO CORRESPONDING FIELDS OF TABLE ITAB.
CALL SCREEN 123 STARTING AT 10 5.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
SKIP 2 .
WRITE :/1(8) 'STR.LOC' ,10(15) 'MRP. CTLR',27(10) 'P.GRP' ,39(40) 'DESCRIPTION OF PRODUCT'.
SELECT SLOC MCODE GCODE DESCR FROM zprd_mis1 INTO ZPRD_MIS1 WHERE SLOC IN S_ZSLOC AND
MCODE IN S_ZMACD AND
GCODE IN S_ZPGRP.
WRITE :/1(8) zprd_mis1-SLOC ,10(15) zprd_mis1-MCODE ,27(10) zprd_mis1-GCODE ,39(40) zprd_mis1-DESCR .
ENDSELECT.
WHEN 'CLEAR'.
flag = 4.
IF zpe_str-zsloc NE ' '.
CLEAR zpe_str.
ELSE.
MESSAGE 'ALREADY CLEARED' TYPE 'S'.
ENDIF.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'SAVE'.
IF zpe_str-zdesc NE ' '.
IF zpe_str-zsloc NE ' '.
LOOP AT itab.
READ TABLE itab WITH KEY sloc = zpe_str-zsloc .
IF sy-subrc = 0 AND flag = 5.
zprd_mis1-mandt = sy-mandt.
zprd_mis1-sloc = zpe_str-zsloc .
zprd_mis1-mcode = zpe_str-zmacd .
zprd_mis1-gcode = zpe_str-zpgrp.
zprd_mis1-descr = zpe_str-zdesc .
MODIFY zprd_mis1.
flag1 = 7.
MESSAGE 'STORAGE LOCATION MODIFIED' TYPE 'S'.
EXIT.
ELSE.
zprd_mis1-mandt = sy-mandt.
zprd_mis1-sloc = zpe_str-zsloc .
zprd_mis1-mcode = zpe_str-zmacd .
zprd_mis1-gcode = zpe_str-zpgrp.
zprd_mis1-descr = zpe_str-zdesc .
INSERT zprd_mis1.
APPEND itab.
flag = 5.
flag1 = 7.
MESSAGE 'STORAGE LOCATION CREATED' TYPE 'S'.
*MESSAGE 'DATA ALREADY SAVED' TYPE 'S'.
EXIT.
*ENDIF.
ENDIF.
ENDLOOP.
ELSE.
flag = 3.
MESSAGE 'PLEASE ENTER THE STORAGE LOCATION' TYPE 'S'.
ENDIF.
ELSE.
LOOP AT itab.
READ TABLE itab WITH KEY sloc = zpe_str-zsloc .
IF sy-subrc = 0.
MESSAGE 'ALREADY SAVED' TYPE 'S'.
ELSE.
MESSAGE 'ENTRIES FOR OTHER FIELDS REQUIRED' TYPE 'S'.
ENDIF.
ENDLOOP.
ENDIF.
WHEN 'CHECK'.
SELECT * FROM zprd_mis1 INTO TABLE itab.
IF zpe_str-zsloc NE ' '.
LOOP AT itab.
READ TABLE itab WITH KEY sloc = zpe_str-zsloc .
IF sy-subrc = 0.
zpe_str-zmandt = itab-mandt.
zpe_str-zsloc = itab-sloc.
zpe_str-zmacd = itab-mcode.
zpe_str-zpgrp = itab-gcode.
zpe_str-zdesc = itab-descr.
flag = 7.
flag1 = 7.
ELSE.
MESSAGE 'NO SUCH STORAGE LOCATION AVAILABLE' TYPE 'S'.
EXIT.
ENDIF.
ENDLOOP.
ELSE.
flag = 3.
MESSAGE 'PLEASE ENTER THE STORAGE LOCATION' TYPE 'S'.
EXIT.
ENDIF.
WHEN 'DELETE'.
IF zpe_str-zsloc EQ ' '.
flag = 3.
MESSAGE 'NOSUCH LOCATION AVAILABLE' TYPE 'S'.
ELSE.
READ TABLE itab WITH KEY sloc = zpe_str-zsloc .
IF sy-subrc = 0.
zpe_str-zmandt = itab-mandt.
zpe_str-zsloc = itab-sloc.
zpe_str-zmacd = itab-mcode.
zpe_str-zpgrp = itab-gcode.
zpe_str-zdesc = itab-descr.
IF zpe_str-zsloc NE ' '.
CALL FUNCTION 'G_CHECK_PASSWORD'
EXPORTING
password = 'PLANT1'
EXCEPTIONS
not_authorized = 1
canceled = 2
OTHERS = 3.
IF sy-subrc = 0.
PERFORM PREVIEW.
DELETE FROM zprd_mis1 WHERE SLOC = zpe_str-zSLOC.
UPDATE zprd_mis1.
APPEND itab.
MESSAGE 'STORAGE LOCATION DELETED' TYPE 'S'.
ELSEIF SY-SUBRC = 2.
MESSAGE 'OPRATION CANCELLED' TYPE 'E'.
ELSEIF SY-SUBRC = 3.
MESSAGE 'UNAUTHORIZED' TYPE 'E'.
ENDIF.
ELSE.
MESSAGE 'STORAGE LOCATION CONTAINS NO DATA' TYPE 'S'.
ENDIF.
ELSE.
MESSAGE 'STORAGE LOCATION CONTAINS NO DATA' TYPE 'S'.
ENDIF.
ENDIF.
WHEN 'CREATE'.
FLAG3 = 12.
IF zpe_str-zsloc EQ ' '.
MESSAGE 'ENTER THE STORAGE LOCATION' TYPE 'S'.
EXIT.
ELSE.
LOOP AT etab.
READ TABLE etab WITH KEY lgort = zpe_str-zsloc .
IF sy-subrc = 0.
read table itab with key sloc = zpe_str-zsloc .
if sy-subrc = 0.
zpe_str-zmandt = itab-mandt.
zpe_str-zsloc = itab-sloc.
zpe_str-zmacd = itab-mcode.
zpe_str-zpgrp = itab-gcode.
zpe_str-zdesc = itab-descr.
flag = 7.
flag1 = 7.
clear flag .
clear flag1.
message 'storage location alredy exist' type 'S'.
ELSE.
FLAG = 2.
MESSAGE 'STORAGE LOCATION ENTIRES DOESNOT EXIST' TYPE 'S'.
ENDIF.
else.
message 'no such storage location exist' type 'S'.
endif.
endloop.
FLAG = 2.
exit.
endif.
WHEN 'CHANGE'.
SELECT * FROM zprd_mis1 INTO TABLE itab.
IF zpe_str-zsloc NE ' '.
LOOP AT itab.
READ TABLE itab WITH KEY sloc = zpe_str-zsloc .
IF sy-subrc = 0.
flag = 5.
flag1 = 6.
zpe_str-zmandt = itab-mandt.
zpe_str-zsloc = itab-sloc.
zpe_str-zmacd = itab-mcode.
zpe_str-zpgrp = itab-gcode.
zpe_str-zdesc = itab-descr.
ELSE.
MESSAGE 'NO STORAGE LOCATION AVAILABLE' TYPE 'S'.
ENDIF.
ENDLOOP.
ELSE.
flag = 3.
MESSAGE 'PLEASE ENTER THE STORAGE LOCATION' TYPE 'S'.
ENDIF.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'AAA'.
SET TITLEBAR 'aaa'.
IF flag3 = '1'.
CALL FUNCTION 'G_CHECK_PASSWORD'
EXPORTING
password = 'PLANT1'
EXCEPTIONS
not_authorized = 1
canceled = 2
OTHERS = 3.
IF sy-subrc 0.
MESSAGE 'un authorized' TYPE 'S'(001).
LEAVE TO SCREEN 0.
ELSEIF SY-SUBRC = 2.
MESSAGE ' OPERATION CANCELLED' TYPE 'S'(001).
LEAVE TO SCREEN 0.
ELSEIF SY-SUBRC = 3.
LEAVE TO SCREEN 0.
MESSAGE 'RESTRICTED' TYPE 'S'(001).
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR flag3.
ENDIF.
SELECT * FROM zprd_mis1 INTO TABLE itab.
LOOP AT SCREEN.
IF screen-name = 'ZPE_STR-ZDESC' OR screen-name = 'ZPE_STR-ZPGRP' OR screen-name = 'ZPE_STR-ZMACD'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
IF flag = 5 AND flag1 EQ 6.
LOOP AT SCREEN.
IF screen-name = 'ZPE_STR-ZDESC' OR screen-name = 'ZPE_STR-ZPGRP' OR screen-name = 'ZPE_STR-ZMACD'.
screen-input = 1.
MODIFY SCREEN.
ENDIF.
IF screen-name = 'CREATE' OR screen-name = 'DELETE' OR screen-name = 'CHANGE' OR screen-name = 'CHECK'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
EXIT.
ENDIF.
IF flag = 2.
LOOP AT SCREEN.
IF screen-name = 'ZPE_STR-ZDESC' OR screen-name = 'ZPE_STR-ZPGRP' OR screen-name = 'ZPE_STR-ZMACD'.
screen-input = 1.
MODIFY SCREEN.
ENDIF.
IF screen-name = 'CREATE' OR screen-name = 'DELETE' OR screen-name = 'CHANGE' OR screen-name = 'CHECK'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
EXIT.
ENDIF.
IF flag3 = 12.
LOOP AT SCREEN.
IF screen-name = 'ZPE_STR-ZDESC' OR screen-name = 'ZPE_STR-ZPGRP' OR screen-name = 'ZPE_STR-ZMACD'.
screen-input = 1.
MODIFY SCREEN.
ENDIF.
IF screen-name = 'CREATE' OR screen-name = 'DELETE' OR screen-name = 'CHANGE' OR screen-name = 'RET' OR screen-name = 'CHECK'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
EXIT.
CLEAR FLAG3.
ENDIF.
IF flag = 4.
IF screen-name CP 'ZPE_*'.
screen-input = 1.
ENDIF.
ENDIF.
IF flag1 = 7 AND flag = 5.
LOOP AT SCREEN.
IF screen-name = 'ZPE_STR-ZDESC' OR screen-name = 'ZPE_STR-ZSLOC' OR screen-name = 'ZPE_STR-ZPGRP' OR screen-name = 'ZPE_STR-ZMACD'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
IF screen-name = 'CREATE' OR screen-name = 'DELETE' OR screen-name = 'CHECK' OR screen-name = 'SAVE'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF flag1 = 7 AND flag = 7.
LOOP AT SCREEN.
IF screen-name = 'ZPE_STR-ZDESC' OR screen-name = 'ZPE_STR-ZSLOC' OR screen-name = 'ZPE_STR-ZPGRP' OR screen-name = 'ZPE_STR-ZMACD'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
IF screen-name = 'CREATE' OR screen-name = 'CHECK' OR screen-name = 'SAVE'." OR screen-name = 'DELETE'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF flag1 = 4 AND flag = 3.
LOOP AT SCREEN.
IF screen-name = 'ZPE_STR-ZDESC' OR screen-name = 'ZPE_STR-ZSLOC' OR screen-name = 'ZPE_STR-ZPGRP' OR screen-name = 'ZPE_STR-ZMACD'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
IF screen-name = 'CREATE' OR screen-name = 'SAVE' OR screen-name = 'DELETE' OR screen-name = 'CHANGE' OR screen-name = 'CHECK'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
DATA: BEGIN OF r1 OCCURS 1.
INCLUDE STRUCTURE ddshretval.
DATA: END OF r1.
*& Module VALUE_SLOC INPUT
text
MODULE value_sloc INPUT.
SELECT lgort werks lgobe FROM t001l INTO CORRESPONDING FIELDS OF TABLE itab_sloc.
DELETE ADJACENT DUPLICATES FROM itab_sloc COMPARING lgort.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'LGORT'
value_org = 'S'
TABLES
value_tab = itab_sloc
return_tab = r1
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc EQ 0.
IF r1-fieldval IS NOT INITIAL.
zpe_str-zsloc = r1-fieldval.
ENDIF.
ENDIF.
EXIT.
*ENDSELECT.
ENDMODULE. " VALUE_SLOC INPUT
FORM PREVIEW.
*TABLES : ZPE_STR , ZPRD_MIS1 , MSEG.
data : ihead like thead.
DATA : prevtab like TLINE occurs 0 with header line.
data : Jtab like TLINE occurs 0 with header line.
*data : Jtab like thead occurs 0 with header line.
*data : text(100).
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'ST'
LANGUAGE = sy-langu
NAME = 'ZSLDEL'
OBJECT = 'TEXT'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
LINES = prevtab[]
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
if not prevtab[] is initial.
append lines of prevtab to jtab.
endif.
*IHEAD-TDFDATE = SY-DATUM.
*IHEAD-TDFTIME = SY-UZEIT.
ihead-TDOBJECT = 'TEXT'.
ihead-TDNAME = 'ZSLDEL'.
ihead-TDID = 'ST'.
ihead-TDSPRAS = sy-langu.
type-pools : slis.
Jtab-TDFORMAT = ''.
*Jtab-TDLINE = 'SLOCATION'.
*append Jtab.
*Jtab-TDFORMAT = ''.
Jtab-TDFORMAT = '*'.
Jtab-TDLINE = ZPE_STR-ZSLOC.
append Jtab.
Jtab-TDFORMAT = ''.
*Jtab-TDLINE = 'DATE'.
*append Jtab.
Jtab-TDFORMAT = ''.
*Jtab-TDLINE = SY-DATUM.
*append Jtab.
Jtab-TDFORMAT = ''.
*Jtab-TDLINE = 'TIME'.
*append Jtab.
Jtab-TDFORMAT = ''.
*Jtab-TDLINE = SY-UZEIT.
*Jtab-TDFORMAT = ''.
*append Jtab.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = ihead
INSERT = 'X'
SAVEMODE_DIRECT = ' '
OWNER_SPECIFIED = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
TABLES
LINES = Jtab
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
OBJECT = '*'
NAME = '*'
ID = '*'
LANGUAGE = '*'
SAVEMODE_DIRECT = ' '
KEEP = ' '
LOCAL_CAT = ' '
IMPORTING
COMMIT_COUNT =
TABLES
T_OBJECT =
T_NAME =
T_ID =
T_LANGUAGE =
ENDFORM.
*&spwizard: declaration of tablecontrol 'TBLECTL' itself
controls: TBLECTL type tableview using screen 0100.
*&spwizard: lines of tablecontrol 'TBLECTL'
data: g_TBLECTL_lines like sy-loopc.
data: OK_CODE like sy-ucomm.
*&spwizard: output module for tc 'TBLECTL'. do not change this line!
*&spwizard: update lines for equivalent scrollbar
module TBLECTL_change_tc_attr output.
describe table ITAB lines TBLECTL-lines.
endmodule.
*&spwizard: output module for tc 'TBLECTL'. do not change this line!
*&spwizard: get lines of tablecontrol
module TBLECTL_get_lines output.
g_TBLECTL_lines = sy-loopc.
endmodule.
*&spwizard: input module for tc 'TBLECTL'. do not change this line!
*&spwizard: process user command
module TBLECTL_user_command input.
OK_CODE = sy-ucomm.
perform user_ok_tc using 'TBLECTL'
'ITAB'
changing OK_CODE.
sy-ucomm = OK_CODE.
endmodule.
INCLUDE TABLECONTROL_FORMS *
*& Form USER_OK_TC *
FORM USER_OK_TC USING P_TC_NAME TYPE DYNFNAM
P_TABLE_NAME
P_MARK_NAME
CHANGING P_OK LIKE SY-UCOMM.
&SPWIZARD: BEGIN OF LOCAL DATA----
DATA: L_OK TYPE SY-UCOMM,
L_OFFSET TYPE I.
&SPWIZARD: END OF LOCAL DATA----
*&SPWIZARD: Table control specific operations *
*&SPWIZARD: evaluate TC name and operations *
SEARCH P_OK FOR P_TC_NAME.
IF SY-SUBRC 0.
EXIT.
ENDIF.
L_OFFSET = STRLEN( P_TC_NAME ) + 1.
L_OK = P_OK+L_OFFSET.
*&SPWIZARD: execute general and TC specific operations *
CASE L_OK.
WHEN 'INSR'. "insert row
PERFORM FCODE_INSERT_ROW USING P_TC_NAME
P_TABLE_NAME.
CLEAR P_OK.
WHEN 'DELE'. "delete row
PERFORM FCODE_DELETE_ROW USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME.
CLEAR P_OK.
WHEN 'P--' OR "top of list
'P-' OR "previous page
'P+' OR "next page
'P++'. "bottom of list
PERFORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME
L_OK.
CLEAR P_OK.
WHEN 'L--'. "total left
PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME.
WHEN 'L-'. "column left
PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME.
WHEN 'R+'. "column right
PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME.
WHEN 'R++'. "total right
PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME.
WHEN 'MARK'. "mark all filled lines
PERFORM FCODE_TC_MARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME .
CLEAR P_OK.
WHEN 'DMRK'. "demark all filled lines
PERFORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME .
CLEAR P_OK.
WHEN 'SASCEND' OR
'SDESCEND'. "sort column
PERFORM FCODE_SORT_TC USING P_TC_NAME
l_ok.
ENDCASE.
ENDFORM. " USER_OK_TC
*& Form FCODE_INSERT_ROW *
FORM fcode_insert_row
USING P_TC_NAME TYPE DYNFNAM
P_TABLE_NAME .
&SPWIZARD: BEGIN OF LOCAL DATA----
DATA L_LINES_NAME LIKE FELD-NAME.
DATA L_SELLINE LIKE SY-STEPL.
DATA L_LASTLINE TYPE I.
DATA L_LINE TYPE I.
DATA L_TABLE_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE CXTAB_CONTROL.
FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.
FIELD-SYMBOLS <LINES> TYPE I.
&SPWIZARD: END OF LOCAL DATA----
ASSIGN (P_TC_NAME) TO <TC>.
*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline
*&SPWIZARD: get looplines of TableControl *
CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_LINES_NAME.
ASSIGN (L_LINES_NAME) TO <LINES>.
*&SPWIZARD: get current line *
GET CURSOR LINE L_SELLINE.
if sy-subrc 0. " append line to table
l_selline = <tc>-lines + 1.
*&SPWIZARD: set top line *
if l_selline > <lines>.
<tc>-top_line = l_selline - <lines> + 1 .
else.
<tc>-top_line = 1.
endif.
else. " insert line into table
l_selline = <tc>-top_line + l_selline - 1.
l_lastline = <tc>-top_line + <lines> - 1.
endif.
*&SPWIZARD: set new cursor line *
l_line = l_selline - <tc>-top_line + 1.
*&SPWIZARD: insert initial line *
INSERT INITIAL LINE INTO <TABLE> INDEX L_SELLINE.
<TC>-LINES = <TC>-LINES + 1.
*&SPWIZARD: set cursor *
SET CURSOR LINE L_LINE.
ENDFORM. " FCODE_INSERT_ROW
*& Form FCODE_DELETE_ROW *
FORM fcode_delete_row
USING P_TC_NAME TYPE DYNFNAM
P_TABLE_NAME
P_MARK_NAME .
&SPWIZARD: BEGIN OF LOCAL DATA----
DATA L_TABLE_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE cxtab_control.
FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.
FIELD-SYMBOLS <WA>.
FIELD-SYMBOLS <MARK_FIELD>.
&SPWIZARD: END OF LOCAL DATA----
ASSIGN (P_TC_NAME) TO <TC>.
*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline
*&SPWIZARD: delete marked lines *
DESCRIBE TABLE <TABLE> LINES <TC>-LINES.
LOOP AT <TABLE> ASSIGNING <WA>.
*&SPWIZARD: access to the component 'FLAG' of the table header *
ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
IF <MARK_FIELD> = 'X'.
DELETE <TABLE> INDEX SYST-TABIX.
IF SY-SUBRC = 0.
<TC>-LINES = <TC>-LINES - 1.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " FCODE_DELETE_ROW
*& Form COMPUTE_SCROLLING_IN_TC
text
-->P_TC_NAME name of tablecontrol
-->P_OK ok code
FORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME
P_OK.
&SPWIZARD: BEGIN OF LOCAL DATA----
DATA L_TC_NEW_TOP_LINE TYPE I.
DATA L_TC_NAME LIKE FELD-NAME.
DATA L_TC_LINES_NAME LIKE FELD-NAME.
DATA L_TC_FIELD_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE cxtab_control.
FIELD-SYMBOLS <LINES> TYPE I.
&SPWIZARD: END OF LOCAL DATA----
ASSIGN (P_TC_NAME) TO <TC>.
*&SPWIZARD: get looplines of TableControl *
CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_TC_LINES_NAME.
ASSIGN (L_TC_LINES_NAME) TO <LINES>.
*&SPWIZARD: is no line filled? *
IF <TC>-LINES = 0.
*&SPWIZARD: yes, ... *
L_TC_NEW_TOP_LINE = 1.
ELSE.
*&SPWIZARD: no, ... *
CALL FUNCTION 'SCROLLING_IN_TABLE'
EXPORTING
ENTRY_ACT = <TC>-TOP_LINE
ENTRY_FROM = 1
ENTRY_TO = <TC>-LINES
LAST_PAGE_FULL = 'X'
LOOPS = <LINES>
OK_CODE = P_OK
OVERLAPPING = 'X'
IMPORTING
ENTRY_NEW = L_TC_NEW_TOP_LINE
EXCEPTIONS
NO_ENTRY_OR_PAGE_ACT = 01
NO_ENTRY_TO = 02
NO_OK_CODE_OR_PAGE_GO = 03
OTHERS = 0.
ENDIF.
*&SPWIZARD: get actual tc and column *
GET CURSOR FIELD L_TC_FIELD_NAME
AREA L_TC_NAME.
IF SYST-SUBRC = 0.
IF L_TC_NAME = P_TC_NAME.
*&SPWIZARD: et actual column *
SET CURSOR FIELD L_TC_FIELD_NAME LINE 1.
ENDIF.
ENDIF.
*&SPWIZARD: set the new top line *
<TC>-TOP_LINE = L_TC_NEW_TOP_LINE.
ENDFORM. " COMPUTE_SCROLLING_IN_TC
*& Form FCODE_TC_MARK_LINES
marks all TableControl lines
-->P_TC_NAME name of tablecontrol
FORM FCODE_TC_MARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME.
&SPWIZARD: EGIN OF LOCAL DATA----
DATA L_TABLE_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE cxtab_control.
FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.
FIELD-SYMBOLS <WA>.
FIELD-SYMBOLS <MARK_FIELD>.
&SPWIZARD: END OF LOCAL DATA----
ASSIGN (P_TC_NAME) TO <TC>.
*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline
*&SPWIZARD: mark all filled lines *
LOOP AT <TABLE> ASSIGNING <WA>.
*&SPWIZARD: access to the component 'FLAG' of the table header *
ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
<MARK_FIELD> = 'X'.
ENDLOOP.
ENDFORM. "fcode_tc_mark_lines
*& Form FCODE_TC_DEMARK_LINES
demarks all TableControl lines
-->P_TC_NAME name of tablecontrol
FORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
P_TABLE_NAME
P_MARK_NAME .
&SPWIZARD: BEGIN OF LOCAL DATA----
DATA L_TABLE_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE cxtab_control.
FIELD-SYMBOLS <TABLE> TYPE STANDARD TABLE.
FIELD-SYMBOLS <WA>.
FIELD-SYMBOLS <MARK_FIELD>.
&SPWIZARD: END OF LOCAL DATA----
ASSIGN (P_TC_NAME) TO <TC>.
*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
ASSIGN (L_TABLE_NAME) TO <TABLE>. "not headerline
*&SPWIZARD: demark all filled lines *
LOOP AT <TABLE> ASSIGNING <WA>.
*&SPWIZARD: access to the component 'FLAG' of the table header *
ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
<MARK_FIELD> = SPACE.
ENDLOOP.
ENDFORM. "fcode_tc_mark_lines
Source : https://forums.sdn.sap.com/click.jspa?searchID=15092700&messageID=5654151
Have A Good Day
Chaitanya. -
Current time in module pool programming in text field
Hello Friends,
In module pool programming ther is a input output field for time i want the current system time should be displayed in that field and when user press saves tht time should get saved in the database tables.
regards,
SunnyHi, sunny,
If I understand your question correctly than I think that the following code will help you, you will have to write this code in the called program means where you are calling your screens.
data: tf_rec_no(10). u201Ctf_rec_nou201D is the field name on your screen
initialization.
write: sy-uzeit to tf_rec_no.
after this you can update db using this field.
Replay if any problem or you have some different query.
Kind Regards,
Faisal. -
How to delete the row in table control with respect to one field in module pool programming?
Hi,
Can I know the way to delete the row in table control with respect to one field in module pool programming
Regards
Darshan MSHI,
I want to delete the row after the display of table control. I have created push button as delete row. If I click on this push button, the selected row should get deleted.
I have written this code,
module USER_COMMAND_9000 input.
DATA OK_CODE TYPE SY-UCOMM.
OK_CODE = SY-UCOMM.
CASE OK_CODE.
WHEN 'DELETE'.
LOOP AT lt_source INTO ls_source WHERE mark = 'X'.
APPEND LS_SOURCE TO LT_RESTORE.
DELETE TABLE LT_SOURCE FROM LS_SOURCE.
SOURCE-LINES = SOURCE-LINES - 1.
ENDLOOP.
But I'm unable to delete the selected rows, It is getting deleted the last rows eventhough I select the other row.
So I thought of doing with respect to the field. -
How to make the field as mandatory in module pool program.
Hi Experts,
Could you please advice me in making a screen field as mandatory input field in module pool programming.
Thanks in advance.Or you could add a check in a PAI module to check if there is some value, if not give error message.
module check_value.
if lv_value is initial.
message e001(00) with 'Enter a value'.
endif.
endmodule
In the PAI screen flow logic...
Process after input.
field lv_value module check_value.
Regards,
Rich Heilman -
F1 help on a field in module pool programming
I want to create f1 help on a field in module pool programming. How to use POH event. where should i write the help documentation. Before using this f1 help on a field i have to set some properties on GUI interface Editor. Please clearly mention the steps i have to follow.
PROCESS ON HELP-REQUEST.
FIELD P_LFA1 MODULE HELP_F1_LIFNR.
MODULE HELP_F1_LIFNR INPUT.
PERFORM SHOW_HELP_F1 USING 'ZFAG_DOC1'.
ENDMODULE. " help_f1_lifnr INPUT
FORM SHOW_HELP_F1 USING P_OBJECT.
Dati testo help
DATA: T_LINE LIKE TLINE OCCURS 0,
XHEAD LIKE THEAD,
HELP_INFO LIKE HELP_INFO,
TEXC LIKE SY-UCOMM OCCURS 0,
V_OBJECT LIKE DOKHL-OBJECT.
Costante
DATA: PREF_SIMG(4) VALUE 'SIMG',
DOCID_HY LIKE DOKHL-ID VALUE 'HY'.
Testo
CONCATENATE PREF_SIMG P_OBJECT INTO V_OBJECT.
Estrazione testo
CALL FUNCTION 'DOCU_GET_FOR_F1HELP'
EXPORTING
ID = DOCID_HY
LANGU = SY-LANGU
OBJECT = V_OBJECT
IMPORTING
HEAD = XHEAD
TABLES
LINE = T_LINE
EXCEPTIONS
RET_CODE = 1
OTHERS = 2.
CASE SY-SUBRC .
WHEN 0.
Visualizzazione testo
GET CURSOR FIELD HELP_INFO-DYNPROFLD.
HELP_INFO-DOCUID = DOCID_HY.
HELP_INFO-DOCUOBJECT = V_OBJECT.
HELP_INFO-SPRAS = SY-LANGU.
HELP_INFO-PROGRAM = SY-REPID.
HELP_INFO-DYNPRO = SY-DYNNR.
HELP_INFO-DYNPPROG = SY-REPID.
HELP_INFO-PFKEY = SY-PFKEY.
HELP_INFO-FIELDNAME = HELP_INFO-DYNPROFLD.
CALL FUNCTION 'HELP_DOCULINES_SHOW'
EXPORTING
HELP_INFOS = HELP_INFO
OVERLAY_HEADER = XHEAD
TABLES
EXCLUDEFUN = TEXC
HELPLINES = T_LINE.
WHEN OTHERS. MESSAGE S720(SH).
ENDCASE.
ENDFORM. " SHOW_HELP_F1 -
Display the list in module pool program
Hi All,
I want to display the list of material like report after some user command in module pool.
How can I achive the same.
Regards
SagarHi,
If you want to display in ALV, you can use REUSE_ALV_GRID_DISPLAY FM also, which will call standard program from module pool and will display the list.
If you use module pool, it is not mandatory that you have to use only OO ALV.
You can create list output also from module pool. For that in user command you can write like
IF sy-ucomm = '.....'.
leave to list processing and return.
write :/ '..............'.
Endif.
Thanks and regards,
Venkat -
How to deactivate the screen fields dynamically in Module Pool Program?
Hi guys,
How to <b>activate & deactivate the screen fields</b> of a <b>module pool program</b>
<b>dynamically</b> through program. Like Change mode and display mode in a single
screen.Hi,
Make use of a Variable,say gv_flag, for both Activate and Deactivate functionalities. As many times you hit the same button, change this variable value. For example, let us say first time you hit this button, assign value 'X' to this variable. Second time you hit this button, assign value ' ' to this variable. In PBO based the variable value you have to Activate and Deactivate.
PBO.
if gv_flag = 'X'. " Activate
loop at screen.
if screen-fname = 'ITAB1-MATNR'.
screen-input = '1'.
modify screen.
endif.
endloop.
elseif gv_flag = ' '. " Deactivate
if screen-fname = 'ITAB1-MATNR'.
screen-input = '0'.
modify screen.
endif.
endloop.
endif.
PAI.
case sy-ucomm.
when 'ACDC'. " Activate/Deactivate
if gv_flag = 'X'.
gv_flag = ' '.
else.
gv_flag = 'X'.
endif.
endcase.
thanks,
sksingh -
How to validate the field values in module pool program?
Hi Guys
I am working with module pool programming.
Here I want to validate the fields like below.
with out filling all the fields if I click SAVE option it has to show a message that all fields has to be filled. This can be done by checking all the fields individually.
I think it can be done through <b>LOOP AT SCREEN ......ENDLOOP</b>. sequence.
If it is possible, can anyone help me?You need to write the Module in between the CHAIN and ENDCHAIN statment in SE51
If you send a warning or error message from a module <mod> that you called using a FIELD statement as follows:
CHAIN.
FIELD: <f1>, <f 2>,...
MODULE <mod1>.
FIELD: <g1>, <g 2>,...
MODULE <mod2>.
ENDCHAIN.
all of the fields on the screen that belong to the processing chain (all of the fields listed in the field statements) are made ready for input again. Other fields are not ready for input. Whenever the MODULE statement appears within a processing chain, even if there is only one FIELD attached to it, all of the fields in the chain (not only the affected field) are made ready for input again, allowing the user to enter new values. If the fields in the processing chain are only checked once, the PAI processing continues directly after the FIELD statement, and the preceding modules are not called again.
Look at the DEMO program DEMO_DYNPRO_FIELD_CHAIN.
ashish -
F4 help for the screen fields in module pool program
Hi All,
I have a requirement that, i want to provide F4 help for the 2 fields in module pool program. the fields are document number and fiscal year from rbkp table.
i could provide search help for two fields.
but how to select matching fiscal year for that document number.
problem: i am getting fiscal year as first four digits of document number.
please help me to solve this problem.
Thanks & Regards,
Namratha.VHi,
If your requirement is after selecting the document no from f4 help then the corresponding year should be updated in the document year field then use FM --> DYNP_VALUES_UPDATE
In this function module pass the screen no program & field for which u want to update value -
How to create selections-screens to display PO using module pool program
All,
I'm new to module pool programming. Can any one please provide me where to create selections screens to display existing purchase orders using the below selection criteria in thr module pool program.,
SELECT-OPTIONS : S_LIFNR FOR EKKO-LIFNR,
S_BSART FOR EKKO-BSART,
S_BUKRS FOR EKKO-BUKRS,
S_WERKS FOR EKPO-WERKS OBLIGATORY,
S_BEDAT FOR SY-DATUM,
S_EINDT FOR EKET-EINDT,
S_EBELN FOR EKKO-EBELN,
S_MATNR FOR EKPO-MATNR.
provide me step by step to do this.Hi,
Thanks for the reply can you please let me know.
How can I create the ranges
like low and high in the selection.
Using se51 i was able to do only one i,e
example I need
purchase order number----
f4 -
f4
Can please tell me how to do this
Maybe you are looking for
-
Calculate time difference in Labview from excel file
I am reading in values from a excel files, the file contains date and time data in one cell, then either an On or Off value in the cell next to it. I would like to find the time difference between the on and the off cycles. The VI I have so far bring
-
Error TaskServerIP tag not found in Task XML - 11.3.1 FTF 1
Hi, I created long ago a preboot bundle which install a VHD folder. It was created under 11.2.3a if I remember correctly. It always works until now. Now, under ZENworks 11.3.1 FTF 1 when I configure my workstation to use this preboot bundle all I get
-
Date Filter via Query Variable
Hi, I have a DSO with the following entries. Document Number. Approval Stage. Approved Date. Approved Time. Approved By. A2000. 1. 20.06.2011
-
Adjust audio BitRate for a Quicktime .MOV export
I am trying to export a >MOV file. Settings are Quicktime > H.264 codec. Everything looks and sounds fine, but I am uploading to a TV station and they are saying that the audio BitRate is too low. I can't seem to find anywhere to adjust the audio bit
-
Can someone recommend.......
an inexpensive but good interface for an analog mic, I just need it for a mic, does anyone have any feedback on the blue icicle or something like a mic mate...I have an audio technica at493 microphone...any input would be appreciated...thanks.