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

BAPI and report

Former Member
0 Likes
2,183

Dear Friends ,

I have selected the data in z report , then now I have passed this data in to BAPI , through exporting parameter .

Now I am executing this BAPI but I am no able to see the data at run time .Please help me.

Regards,

Rihan

18 REPLIES 18
Read only

Former Member
0 Likes
2,019

put your code

Read only

Former Member
0 Likes
2,019

HI Rihan ,

    What BAPI you are using . Display your code.

With Regards,

Sudhir S

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,019

but I am no able to see the data at run time

Can you explain (Do you want to trace the execution, to see the result ?)

Regards,

Raymond

Read only

ThomasZloch
Active Contributor
0 Likes
2,019

"Exporting" from which point of view, report or BAPI?

Please provide more technical information in your initial posts to reduce the number of return questions, saving everybody's time in the process.

Thomas

Read only

Former Member
0 Likes
2,019

Hello Mr reports program is ,

TABLES : KNA1.

DATA : ITAB1 LIKE KNA1 OCCURS 0 WITH HEADER LINE.

SELECT SINGLE * FROM KNA1 INTO CORRESPONDING FIELDS OF ITAB1 WHERE KUNNR EQ '0000010063'.

LOOP AT ITAB1.

CALL FUNCTION 'ZCUSTOMER_TEST'

TABLES

   ITAB          = itab1.

ENDLOOP.

now I have execute the BAPI : ZCUSTOMER_TEST

I have declared ITAB in table option , now I have execute the BAPI ,

so at run time i did not find the value in ITAB .

Read only

0 Likes
2,019

You are missing the word "TABLE" between "OF" and "ITAB1" in your SELECT statement.

This does not make sense, SELECT SINGLE into the work area of an internal table, then passing this as a table parameter. Rather use a work area and pass it via EXPORTING.

Please note that internal tables with header lines and TABLES parameter for function module calls are obsolete.

Thomas

P.S. question status removed due to basic nature

Read only

0 Likes
2,019

Hye Mr Thomas ,

As per you suggested  , I have done that,

DATA : BEGIN OF ITAB1 OCCURS 0,

       KUNNR LIKE KNA1-KUNNR,

       NAME1 LIKE KNA1-NAME1,

       END OF ITAB1.

SELECT  * FROM KNA1 INTO CORRESPONDING FIELDS OF TABLE ITAB1 WHERE KUNNR EQ '0000010063'.

CALL FUNCTION 'ZCUSTOMER_TEST'

  EXPORTING

    KUNNR         = ITAB1-KUNNR

    NAME1         = ITAB1-NAME1

          .

now I am executing the BAPI ZCUSTOMER_TEST, but i am not able to find the

data in the parameter KUNNR AND NAME1 .

how can I see the data in kuunr and name1 when I execute my BAPI and the

data in kunnr and name is passed by report program .

regards,

Rihan

Read only

0 Likes
2,019

Dear All ,

Please solve my query ,

I am currently involved in project which involves integration of JAVA portal intergration with SAP. So Any interaction made on portal can be updated to SAP databse with use of BAPI only as the ERP connector is the middle ware. So can any one throw light on whether BAPI can be used to fetch data generated from REPORTS on to the portal.

I would like add one more constrain on this requirment i.e. --> on the portal side we have some input paramter i.e in form of date, customer no or Sales Order and on the basis of these parameter, can reports be fetched from SAP and displyed on portal ?

As far i know reports are nothing but customs or Standard programs. So can BAPI execute these program and display the value on portal ?

I hope you will help me .

Regards,

rihan

Thanks

Read only

0 Likes
2,019

- First time you put the data in the header of the internal table, and pass the internal table (empty) to the FM

- Second time you put the data in the internal table and pass the header data (initial) to the FM

- Now read LOOP AT statement documentation and either use it before calling FM with values for on record, or in FM if called with an internal table type parameter

Regards,

Raymond

Read only

0 Likes
2,019

Dear Mr Raymond,

Could you please provide some code reference for that, how can I declare the

FM and how the fields are to be passed to the FM and vice versa

Please.

Regards

Rihan

Read only

0 Likes
2,019

Either

- declare FM parameter with an import internal table type parameter, call it with the internal tabkle filled in caller program and process every record in a loop in the FM

- declare FM parameter with some fields or a structure and call the FM for each record in a loop of the caller program.

Regards,

Raymond

Read only

0 Likes
2,019

Dear Raymond,

I did it as you said,

first of all I have selected the data from table and put it in to internal table

in report :

SELECT * FROM KNA1

           INTO CORRESPONDING FIELDS OF TABLE IKNA1

           WHERE KUNNR   EQ  '0000010063' .

then I have called a FM :

CALL FUNCTION 'ZCUSTOMER_TEST'

      EXPORTING

        CCC_CODE = IKNA1-KUNNR

        CCC_NAME = IKNA1-NAME1

        EXCEPTIONS

        OTHERS   = 1.

I have declared the field CCC_CODE, and CCC_NAME in import parameter of FM.

So here I have passed the data from internal table to FM,

now when i execute the FM through se37 , so I should get the

data on execution , But I am not getting the data ,

So where I am wrong and this is the requirement,

Hope you have got me.

Rihan

Read only

0 Likes
2,019

- You forgot the LOOP/ENDLOOP wrapping the FM call.

- Why do you use an internal table if you want only one record ?

Regards,

Raymond

Read only

0 Likes
2,019

I have used loop/end loop statement , but still when I am executing the FM

then I am not able to see the data in run time of FM,

Could you please provide me some code , Please.

Rihan

Read only

0 Likes
2,019

Hi Rihan,

Looking at the first snippet of code you posted, firstly it looks odd that you are selecting a single record into a table; why not select straight into a structure. Secondly, when you parse a table with a header line you need to ensure you refer to the table of data rather than the header e.g. ITAB1[]. Parsing ITAB1 will send a structure containing the current record which is probably what you want to do but you are passing it to a table rather than a structure. what you want is either:

LOOP AT ITAB1.

   CALL FUNCTION 'ZCUSTOMER_TEST'

        TABLES EXPORTING

            ITAB          = itab1.

ENDLOOP.

or

    CALL FUNCTION 'ZCUSTOMER_TEST'

       TABLES

          ITAB          = itab1[].

With the second code snippet you posted where you are passing the individual fields there was the comment about not having the LOOP / ENDLOOP. I trust you have specified the table IKNA1 with a header line... if so the loop/endloop and function call should be:

LOOP AT IKNA1.

  CALL FUNCTION 'ZCUSTOMER_TEST'

        EXPORTING

          CCC_CODE = IKNA1-KUNNR

          CCC_NAME = IKNA1-NAME1

        EXCEPTIONS

          OTHERS   = 1.

ENDLOOP.

Finally, have you tried running the report in debug mode and checked the values in the tables and other variables as the code progresses? When you get to the function call you should see the values you want in the parameters being passed to the function module.

John.

Read only

0 Likes
2,019

To close the thread

TYPES : BEGIN OF lcl_kna1,

       kunnr TYPE kna1-kunnr,

       name1 TYPE kna1-name1,

       END OF lcl_kna1.

DATA: gt_kna1 TYPE TABLE OF lcl_kna1,

      ls_kna1 LIKE LINE OF gt_kna1. " or TYOE lcl_kna1

SELECT-OPTIONS so_kunnr FOR ls_kna1-kunnr DEFAULT '0000010063'.

START-OF-SELECTION.

  SELECT  * INTO CORRESPONDING FIELDS OF TABLE gt_kna1

    FROM kna1

    WHERE kunnr IN so_kunnr.

  IF sy-subrc NE 0.

    MESSAGE e196(63).

  ENDIF.

END-OF-SELECTION.

  LOOP AT gt_kna1 INTO ls_kna1.

    CALL FUNCTION 'ZCUSTOMER_TEST'

      EXPORTING

        kunnr = ls_kna1-kunnr

        name1 = ls_kna1-name1.

  ENDLOOP.

But take a look at Introduction to ABAP Development  

Regards,

Raymond

Read only

0 Likes
2,019

Dear Mr John ,

this is my code ,

DATA : ITAB1 LIKE KNA1 OCCURS 0 WITH HEADER LINE.

SELECT  * FROM KNA1 INTO CORRESPONDING FIELDS OF TABLE ITAB1 .

I have tried this one

LOOP AT ITAB1.

CALL FUNCTION 'ZCUSTOMER_TEST'

  TABLES

ITAB = ITAB1[]

          .

ENDLOOP.

and I have tried this also.

LOOP AT ITAB1.

CALL FUNCTION 'ZCUSTOMER_TEST'

  exporting

ITAB = ITAB1

          .

ENDLOOP.

In the FM (ZCUSTOMER_TEST) i have declared

ITAB in table parameter like,

ITAB LIKE KNA1

AND in second case I have declared itab in import parameter like

ITAB LIKE KNA1.

I have checked the data in debuging mode in report that the

data is coming to the internal table itab1 , but

when I am executing my FM through se37 then the data is not coming

in the field itab .This is my query

where I am wrong in the code, I have checked everything Please suggest

rihan

Read only

0 Likes
2,019

Dear Raymond,

Thank you very much for providing me the code , i have run this

code and the data is coming ls_kna1 in this internal table in debugging

mode , but dear when I am executing this FM( ZCUSTOMER_TEST) through

se37 then data is not showing in the fields KUNNR and NAME1

that is my question ?.

For more clearance I have declared the ZCUSTOMER_TEST through se37

In importing parameter ,

KUNNR LIKE KNA1-KUNNR  and tick on pass value.

NAME1 LIKE KNA1-NAME1 and tick on pass value.

when i am executing this by F8 then data is not coming in the fields

KUNNR AND NAME1 which data you have passed through ls_kna1

internal table .

Where I am wrong and how can see the values in the fields of FM (ZCUSTOMER_TEST)

rihan