10-10-2008 9:05 AM
Helo All,
I have declared a variable outside the badi say
data: phead like STRUCTURE_head occurs 0 with HEADER LINE.
suppose this phead contains say 4 rows .
calling the method of the badi .
.
CALL METHOD user_exit->method1
CHANGING
thead = phead .
Here the parameter thead is of the type structure , so only the header line is passed . How do i pass all the four rows to the badi ?
Thanks in advance
regards,
swetha
10-10-2008 9:09 AM
Use square brackets to indicate you are passing the contents of the table, i.e. itab[] instead of just itab.
10-10-2008 9:16 AM
Hello Steve higton,
This doesn't seem to work , it displays an error thead is not an inetrnal table -"the occurs n" specification is missing .
Best Regards,
Swetha
10-10-2008 9:17 AM
Hi Shwetha,
As you are trying to pass in internal table to a structure in changing parameters, it would end up in error.
If the BADI that you are using has CHANGING parameter of TYPE STRUCTURE, you cannot pass an internal table to the same.
You can loop in the internal table and call the BADI inside the loop, passing the WORK AREA.
Best Regards,
Ram.
10-10-2008 9:24 AM
Hi Swetha,
call that method in a loop... endloop, and pass parameters.. like changing parameters with your structure and outside badi update it.
Regards,
Dhanunjaya Reddy.
10-10-2008 10:03 AM
my question is , if I loop at say phead aand call the badi for every row ,
will thead take the just header line value ( which is intial )or will with take the value of each row ?
10-10-2008 10:13 AM
Hi Swetha,
Let say, we have an internal table phead.
You will be declaring a work area, lets say whead.
now,
LOOP AT phead into whead.
BADI CALL.
changing
thead = whead.
ENDLOOP.
So, whead wil be passed as changing parameter to the badi...
to be precise, you will be passing the structure to the badi.
Best Regards,
Ram.
10-10-2008 9:44 AM
Hi,
We can not pass internal table to a structure type parameter. If you wish to pass 4 rows of data, you may need to use loop at the intenal table and call the BADI for 4 times.
Hope this helps,
Pragya
12-21-2022 1:09 PM
You can pass internal tables to a BADI. For the parameter type of the BADI interface, you have to declare a DDIC table type with the line type of the structure (or look for an existing table type with a fitting line type), if you are defining a new BADI interface.
Once it is all set up, you pass the entire internal table (i.e. the structure parameter) to the respective BADI parameter. Be sure not to forget the square brackets, or the compiler will assume that you are passing the work area only. Your code might look similar to this:
CALL BADI lr_badi->exit_sapln2la_001
EXPORTING
ss_okcode = ss_okcode
ss_form = ss_form
ss_n2labor001_vorher = ss_n2labor001_ai[]
ss_n2labor001_nachher = ss_n2labor001_bi[].