Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

call sepecific dynpro from z program

Former Member
2,102

Hallo Abapers,

I need to call a screen from an old ZProgram to a new ZProgram.

This screen name 0400 called by clicking on a push button in the selection screen of the old program this button called 'PB_01'....

Now back my new zprogram I have created a new Push button which called PB_02 and wrote the below coding in trying to call the dynpro '0400'.

DATA: l_f_bdcdata TYPE bdcdata,
l_t_bdcdata_tab TYPE TABLE OF bdcdata.
  IF sy-ucomm = 'PB_02 '.
CLEAR l_f_bdcdata.
l_f_bdcdata-program = '/EDEL/R_DD_RPRT_MGMT'.
l_f_bdcdata-dynpro = '0400'.
l_f_bdcdata-dynbegin = 'X'.
APPEND l_f_bdcdata TO l_t_bdcdata_tab.
CALL TRANSACTION 'altprogram'  using  l_t_bdcdata_tab.

The internal table type is a sorted table and not a BDCDATA......

so the code is not working.....

could some one guid how this can be done...?

Best Regards

Jenie

Hallo Abapers,

I need to call a screen from an old ZProgram to a new ZProgram.

This screen name 0400 called by clicking on a push button in the selection screen of the old program this button called 'PB_01'....

Now back my new zprogram I have created a new Push button which called PB_02 and wrote the below coding in trying to call the dynpro '0400'.

DATA: l_f_bdcdata TYPE bdcdata,
l_t_bdcdata_tab TYPE TABLE OF bdcdata.
  IF sy-ucomm = 'PB_02 '.
CLEAR l_f_bdcdata.
l_f_bdcdata-program = '/EDEL/R_DD_RPRT_MGMT'.
l_f_bdcdata-dynpro = '0400'.
l_f_bdcdata-dynbegin = 'X'.
APPEND l_f_bdcdata TO l_t_bdcdata_tab.
CALL TRANSACTION 'altprogram'  using  l_t_bdcdata_tab.

The internal table type is a sorted table and not a BDCDATA......

so the code is not working.....

could some one guid how this can be done...?

Best Regards

Jenie

8 REPLIES 8
Read only

srikanthnalluri
Active Participant
0 Likes
1,967

If you want to call screen, use CALL SCREEN (link), Why are you using BDCDATA. Sorry i didn't understand the whole picture of what you're doing

Read only

Former Member
0 Likes
1,967

thanks for your reply, but this is not my requirement I have two different programs ...let me say program A and program B
in program A we have 5 screens ( 100 ,200,300,400,500) each of them will be called based on a separate push button....

now I have a new Program which called B in this Program I want to call the screen 400 with all the functionalities which it has to display the ALV the generated when we click on its button.....

based on the above

call transaction 'TCODE' and skip first screen will not work cause we have many screens.

submit program not working to

do you have something else to achieve this??

Best Regards

Jenie

Read only

franois_henrotte
Active Contributor
0 Likes
1,967

This is not possible like this. What is possible:

- create a dynpro in program B and include screen 400 from program A as a subscreen of the dynpro

- in program B, call transaction linked to program A providing the ok-code that triggers the right button leading to screen 400

- in program B, call a function from function-group A and this function will execute statement CALL SCREEN 400.

The second solution is the one which is the most close to your attempt. The third one is good too. If program A is not a function group, it can still be done with a PERFORM but this is not following best practices (external call of a routine).

Read only

Former Member
0 Likes
1,967

Hallo François,

many thanks for tyour informative reply,

I totally agree with you the second solution if it possible it will the best practice.

But could you more explain how can it be implemented as the SY-UCOMM of the push Butoon is PB_02 and call screen statement that I only know is call screen and skip the first one?

could please write a piece of coding

Best Regards

Jenie

Read only

franois_henrotte
Active Contributor
0 Likes
1,967

it is just a normal "CALL TRANSACTION USING bdcdata" where you put the ok-code PB_02 in the bdcdata...

(yeah batch input is not dead)

Read only

Former Member
0 Likes
1,967

I have already did but it is not working please a look to my code below

 DATA: l_f_bdcdata TYPE bdcdata,
 l_t_bdcdata_tab TYPE TABLE OF bdcdata.
 IF sy-ucomm = 'PB_01'. the new push button in the new program
 CLEAR l_f_bdcdata.
 l_f_bdcdata-program = 'the old program'.
 l_f_bdcdata-dynpro = '0400'.
 l_f_bdcdata-dynbegin = 'X'.
 l_f_bdcdata-fnam = 'PB_02'.
 * l_f_bdcdata-FVAL = 'PB_02'. hier did not work too
 APPEND l_f_bdcdata TO l_t_bdcdata_tab.
 CALL TRANSACTION 'TCODE of the old program' using l_t_bdcdata_tab.
 ENDIF.

regards

Read only

DoanManhQuynh
Active Contributor
0 Likes
1,967

First of all, i think you cant call a screen from another program like that, if you want to do like that you should define it in function group.

Now, since you are using bdcdata i suggest you to try fm: ABAP4_CALL_TRANSACTION and pass all the bdcdata to check if it work. Maybe you need to record old program with sm36 first ( to be able to call screen 0400 from old program, it should have other logic behind that maybe you missing in your BDC).

one more way i think could be used is add a subscreen area and call ( if screen 0400 defined as subscreen 😞

CALL SUBSCREEN: SUB1 INCLUDING OLD_PROGRAM_ID '0400'.
Read only

franois_henrotte
Active Contributor
0 Likes
1,967

it depends if the PB_02 is on screen 0400 or not... I did understand that you have to click on button PB_02 in order to get to screen 0400 : then you have to generate ok-code PB_02 on the previous screen of course

sorry, but I cannot do a whole BDC training here, in worst case you can use transaction SHDB in order to register the actions to be put in the BDCDATA.