Application Development 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: 

Passing data between BADI and custom subscreen

Former Member
0 Kudos

I have implemented the BADI: BADI_WCM_WAPI_001, it is for making a subscreen for WCM.

I have created a subscreen in a Z program and added this to the BADI.

I now want to pass the data between the BADI and my Z program, searched on the internet but nothing found, only CMOD solutions...

Is there any best-practice for doing this?

1 ACCEPTED SOLUTION

former_member946717
Contributor
0 Kudos

Hi Jonas,

In SE37, create a FM with Importing,Exporting,Changing parameters. In your case, assuming from BADI->Program => Importing Parameters will be the parameters going from BADI to your program.

Exporting Parameters will be what you will extract in your Z program

Program->BADI=>

Importing Parameters will be the parameters going from  your Z program to BADI.

Exporting Parameters will be what you will extract in your BADI

Assuming BADI->Z program

In your BADI:

CALL FUNCTION <Z***>

EXPORTING

  parameter1_from_BADI

  parameter2_from_BADI

IMPORTING

 

In your program:

CALL FUNCTION <Z***>

EXPORTING

IMPORTING

  parameter1_from_BADI

  parameter2_from_BADI

do your logic

In your program:

CALL FUNCTION <Z***>

EXPORTING

  parameter1_from_Zprog

  parameter2_from_Zprog

IMPORTING

In your BADI:

CALL FUNCTION <Z***>

EXPORTING

IMPORTING

  parameter1_from_Zprog

  parameter2_from_Zprog

Based on your logic, you will have to build this FM which will be used just for transporting the parameters.

16 REPLIES 16

former_member946717
Contributor
0 Kudos

Hi Jonas,

From what I understand from your requirement is, you have created a sub-screen in a Z-program (something like a module pool program) and have called that in your BADI implementation? What does that Z program contain? What parameters does it contain on the selection-screen or is it not an executable program? Please provide these details.

You can use the statement SUBMIT and pass parameters to your Z program if you have defined a selection-screen for your Z program.

OR

You can use MEMORY,you can write this statement - > EXPORT <Field> from <Field> to <MEMORY ID> in your BADI and this statement -> IMPORT <Field> to <Field> from <MEMORY ID> in your Z program for the parameters you want to pass.

If you have to many parameters, you can create a small FM to store your data from your BADI and use that data in your sub-screen.

But also check if it is advisable to call a sub-screen in a BADI, a pop-up screen or so is ok but not sure about a sub-screen as BADI is generally a modification to a normal standard SAP processing.

Hope this helps!

0 Kudos

Hi A N

Thanks for you quick reply, but I don't want do it with the MEMORY.

The BADI I've implemented had those 4methods:

IF_EX_BADI_WCM_WAPI_001~SUBSCREEN_DATA_GET

IF_EX_BADI_WCM_WAPI_001~SUBSCREEN_DATA_SET

IF_EX_BADI_WCM_WAPI_001~SUBSCREEN_FCODE_EXECUTE

IF_EX_BADI_WCM_WAPI_001~TAB_PAGE_TITLE_GET

I created a Z program with a screen (just for testing it contains 2input fields, declared that in the TOP include), but I want to receive in my Z program some properties of an object from the BADI, to set some input fields grey or not.

Also, I want to receive in my BADI the values what are entered in the screen input fields from my z program...

In my Z program I made a screen from screentype: subscreen (BADI need a subscreen).

0 Kudos

Hi Jonas,

Then you can create a custom Function Module with changing parameters and work with that OR you can use SUBMIT statement with return.

0 Kudos

HI A N

Can you give me an example of the FM or SUBMIT ?

0 Kudos

Hi,

Well, what kind of Z program do you have? In any case, in the Z program, which contains and processes your dynpro, you have to program some kind of data access routines (Form routines if the Z program is report or Module pool, or Function Modules - if the Z program is Function group), which you then can call from BADI implementation...

cheers

Jānis

former_member946717
Contributor
0 Kudos

Hi Jonas,

In SE37, create a FM with Importing,Exporting,Changing parameters. In your case, assuming from BADI->Program => Importing Parameters will be the parameters going from BADI to your program.

Exporting Parameters will be what you will extract in your Z program

Program->BADI=>

Importing Parameters will be the parameters going from  your Z program to BADI.

Exporting Parameters will be what you will extract in your BADI

Assuming BADI->Z program

In your BADI:

CALL FUNCTION <Z***>

EXPORTING

  parameter1_from_BADI

  parameter2_from_BADI

IMPORTING

 

In your program:

CALL FUNCTION <Z***>

EXPORTING

IMPORTING

  parameter1_from_BADI

  parameter2_from_BADI

do your logic

In your program:

CALL FUNCTION <Z***>

EXPORTING

  parameter1_from_Zprog

  parameter2_from_Zprog

IMPORTING

In your BADI:

CALL FUNCTION <Z***>

EXPORTING

IMPORTING

  parameter1_from_Zprog

  parameter2_from_Zprog

Based on your logic, you will have to build this FM which will be used just for transporting the parameters.

0 Kudos

Hi A N

thank you for your detailed explanation, but that isn't what I am looking for.

I'm looking for a solution like this: http://all-sap-abap.blogspot.nl/2008/11/sap-badi-screen-enhancements.html but I can't accomplish this because I can't find my instances (  cl_exithandler=>get_instance_for_subscreens )

0 Kudos

Hi,

I think you are misunderstanding this badi a bit... But then maybe I'm the one misunderstanding it

The way I understand it from the description, SAP standard will be calling all the 4 interface interface methods, two of which you can use to pass the data to your Z program (method subscreen_DATA_SET()),  and get the data from your Z program, in order to return it to SAP (method SUBSCREEN_DATA_GET() via ES_WAPI).

How you transfer the tad back and forth between badi implementation class and z program/subscreen fields is entirely up to you, but it would need to involve some modularisation units of Z program, which you then can call from badi implementation methods...

The example implementation class is CL_IM_WCM_WAPI_001. It's somewhat confusing though, because there is no SAP implementation of the actual subscreen, which the class would interact with,

cheers

Jānis

0 Kudos

Hello Janis,


The way I understand it from the description, SAP standard will be calling all the 4 interface interface methods, two of which you can use to pass the data to your Z program (method subscreen_DATA_SET()),  and get the data from your Z program, in order to return it to SAP (method SUBSCREEN_DATA_GET() via ES_WAPI).

Finally someone talking some sense.

: Did you create the implementation of the BAdI in your system? You have to provide the name of your custom program/function group to the implementation and standard SAP will pick up the data from the table BADIIMPL_SCREEN. (Check the PBO module  D8300_SUBSCR_DATA_BEFORE  OUTPUT).

@Others: Atleast check the BAdI definition before posting your responses. Why do you think that SAP has provided the methods SUBSCREEN_DATA_GET( ) & SUBSCREEN_DATA_SET( )?

BR,

Suhas

0 Kudos

Hi Suhas

Yes I created an implementation of the BADI, add I added there my program and screennumber where you pictured it.

I have followed this guide provided by SAP, but it won't work. SAP Library - Changing the SAP Standard (BC)

The problem here is that I don't get an instance -> ?

0 Kudos

Hi Janis

Okay, that clear some thing up for me!

And yes that is now my problem, how I do the data transfer from badi implementation class and z program/subscreen fields, I followed this guide provided by Sap but it won't work, get dump after calling the get_instance method, doesn't know why ...

SAP Library - Changing the SAP Standard (BC)

0 Kudos

Hello Jonas,


The problem here is that I don't get an instance -> ?

But why do you need the instance?


how I do the data transfer from badi implementation class and z program/subscreen fields,

Read this documentation on how to implement a Kernel BAdI e.g., BADI_SORTER with screen enhancement.

In your case you have to enhance(include CI_WCAAP) & then utilise the structure WCSWAPI.

BR,

Suhas

0 Kudos

Hi Suhas

Is there maybe a way of adding a Function group with a subscreen to the BADI instead of the z program, because if I can connect it to my Function group I have the solution?

0 Kudos

Jonas VandeSteene wrote:

Hi Suhas

Is there maybe a way of adding a Function group with a subscreen to the BADI instead of the z program, because if I can connect it to my Function group I have the solution?

Hi Jonas,

I would have created a FuGr & created a sub-screen. Use this function-pool program (SAPL+<FuGr name>) & screen in the BAdI implementation.

Create GET & SET FMs to move the values between the custom sub-screen & the original application.

BR,

Suhas

0 Kudos

Hi Suhas

Thank you for the documentation, that's what I was looking for!

former_member202818
Active Contributor
0 Kudos

Possible ways to data transfer are...

1.IMPORT & EXPORT

2.Function group with two Function Module for data communication between main program and subscreen(in function group).

Define screen field(s) in top(global data) of function group,

Using 1st function module assign value to global data in function group,

using 2nd function module assign value from screen filed(global data in function group) to main program.

Regards

Sreekanth