‎2012 Jun 11 10:04 AM
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
‎2012 Jun 11 10:08 AM
‎2012 Jun 11 10:10 AM
HI Rihan ,
What BAPI you are using . Display your code.
With Regards,
Sudhir S
‎2012 Jun 11 10:11 AM
‎2012 Jun 11 10:27 AM
"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
‎2012 Jun 11 11:26 AM
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 .
‎2012 Jun 11 12:19 PM
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
‎2012 Jun 11 12:42 PM
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
‎2012 Jun 12 7:24 AM
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
‎2012 Jun 12 7:37 AM
- 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
‎2012 Jun 12 7:49 AM
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
‎2012 Jun 12 7:55 AM
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
‎2012 Jun 12 8:10 AM
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
‎2012 Jun 12 8:13 AM
‎2012 Jun 12 9:15 AM
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
‎2012 Jun 12 9:38 AM
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.
‎2012 Jun 12 9:52 AM
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
‎2012 Jun 12 10:14 AM
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
‎2012 Jun 12 10:37 AM
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