2008 Dec 04 12:05 PM
PROGRAM 1
report ZPROGRAM01
no standard page heading line-size 255.
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
start-of-selection.
perform bdc_dynpro using 'ZDF052_TEST_09' '9000'.
perform bdc_field using 'BDC_CURSOR'
'TEXT2'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'TEXT1'
'TEXT1'.
perform bdc_field using 'TEXT2'
'TEXT2'.
perform bdc_dynpro using 'ZDF052_TEST_09' '9000'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
CALL TRANSACTION 'ZMPPTEST' USING BDCDATA
MODE 'A'.
*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDFORM.
PROGRAM 2
*&---------------------------------------------------------------------*
*& Report ZPROGRAM_02
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZPROGRAM_02.
DATA : TEXT1 TYPE CHAR10,
TEXT2 TYPE CHAR10.
DATA : GT_ITAB TYPE STANDARD TABLE OF DYNPREAD,
GW_ITAB TYPE DYNPREAD.
*&---------------------------------------------------------------------*
*& Module STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_9000 OUTPUT.
SET PF-STATUS 'ZMENU'.
PERFORM F_SET_SCREEN.
ENDMODULE. " STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_9000 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_9000 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*&---------------------------------------------------------------------*
*& Form F_SET_SCREEN
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM F_SET_SCREEN .
LOOP AT SCREEN.
IF SCREEN-NAME CS 'TEXT2'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDFORM. " F_SET_SCREEN
Scenario
Here i have one module pool program having two text boxes. Another program i am using CALL TRANSACTION to load values to that screen at the same time i have to disable the TEXT2 field.
Problem
Now the problem is, i cant get the value on the screen but the field is disabled.
i need the value as well as the field should be non-editable. Help to fix it up.
Thanks in advance.
Florian
PROGRAM 1
report ZPROGRAM01
no standard page heading line-size 255.
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
start-of-selection.
perform bdc_dynpro using 'ZDF052_TEST_09' '9000'.
perform bdc_field using 'BDC_CURSOR'
'TEXT2'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'TEXT1'
'TEXT1'.
perform bdc_field using 'TEXT2'
'TEXT2'.
perform bdc_dynpro using 'ZDF052_TEST_09' '9000'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
CALL TRANSACTION 'ZMPPTEST' USING BDCDATA
MODE 'A'.
*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDFORM.
PROGRAM 2
*&---------------------------------------------------------------------*
*& Report ZPROGRAM_02
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZPROGRAM_02.
DATA : TEXT1 TYPE CHAR10,
TEXT2 TYPE CHAR10.
DATA : GT_ITAB TYPE STANDARD TABLE OF DYNPREAD,
GW_ITAB TYPE DYNPREAD.
*&---------------------------------------------------------------------*
*& Module STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_9000 OUTPUT.
SET PF-STATUS 'ZMENU'.
PERFORM F_SET_SCREEN.
ENDMODULE. " STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_9000 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_9000 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*&---------------------------------------------------------------------*
*& Form F_SET_SCREEN
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM F_SET_SCREEN .
LOOP AT SCREEN.
IF SCREEN-NAME CS 'TEXT2'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDFORM. " F_SET_SCREEN
Scenario
Here i have one module pool program having two text boxes. Another program i am using CALL TRANSACTION to load values to that screen at the same time i have to disable the TEXT2 field.
Problem
Now the problem is, i cant get the value on the screen but the field is disabled.
i need the value as well as the field should be non-editable. Help to fix it up.
Thanks in advance.
Florian
2008 Dec 04 12:09 PM
Hi,
When your desiginig the screen with that field then in the field attributes screen make that field as output only...so it will make that field in non-editable mode and also get the value for it...then i think there is no necessary to write that loop at screen logic for that field.
Hope this will help.
Regards,
Rohan.
2008 Dec 04 12:21 PM
Hi,
Goto the module pool screen painter of your program . Select the 'ELEMENT LIST' tab and make a tick mark against the field which you want to make it as output field only. there wil be a tab OUTPUT ONLY.
Thanks,
Uma.
2008 Dec 04 3:34 PM
Hi ,
Actually my problem is not making output only field... the problem is i cant get the value which i am sending thru CALL Transaction.
Program 1
perform bdc_field using 'TEXT2'
'TEXT2'.
i am using this line of code..but this value is not reflected there.
Program 2
LOOP AT SCREEN.
IF SCREEN-NAME CS 'TEXT2'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDFORM.
if i commented these lines i can able to get.
I need value as well as the field sholud be non editable one
Please run my code then only you can understand my problem.
2008 Dec 04 3:44 PM
That is your problem, the fact that the field is an input field which is disabled is causing the value NOT to be passed from your BDC. The reason is that BDC is a screen sequence automation tool, and it will try to process the screens as if you are doing them yourself using the SAPgui. Can you put a value in a field which has been disabled? Nop. This is your issue, so you must do what you want another way. There are several ways to get around it. Not sure that what others have suggested will work either, making it output only(for the reason stated above). You might want to try to pass the value through memory id instead. This way you can keep your field as disabled, and simply fill the value from the memory id before throwing the screen.
So in program 1, before calling the transactions. Export the text to memory.
export text2 = text2 to memory id 'ZTEXT2'.In program 2, before in the PBO.
if text2 is intial.
import text2 = text2 from memory id 'ZTEXT2'.
endif.Regards,
Rich Heilman
Edited by: Rich Heilman on Dec 4, 2008 10:44 AM
2008 Dec 04 3:45 PM
Hi
You use the attribute active to make it a display field.
sorry... it doesnt work!
Rich, yours in an excellent solution !
Regards
Raj
Edited by: Rajasekhar Dinavahi on Dec 4, 2008 9:15 PM
Edited by: Rajasekhar Dinavahi on Dec 4, 2008 9:18 PM
Edited by: Rajasekhar Dinavahi on Dec 4, 2008 9:20 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |