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

ABAP code for reading a table entries in import parameters for BAPI

Former Member
0 Likes
2,111

Hello Experts,

We are having a table type as import parameter, where in we can send multiple rows as input to the BAPI, I need to read the entries and extract data related to them from R/3 Data base.

Ex: Multiple material as input and export as 3-4 fields from MARA table.

Please help with a simple code....

Thanks,

Suma

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,285

please clear ur doubt .......

its not clear .......like what i understood is u need to send multiple entries to bapi as import parameters and need to get data .....

if so take an internal table

write select quiry

and append individula line items to that table and pass that internal table to the import parameters ....

if u explain what exactly u want ....we can help..

Hello Experts,

We are having a table type as import parameter, where in we can send multiple rows as input to the BAPI, I need to read the entries and extract data related to them from R/3 Data base.

Ex: Multiple material as input and export as 3-4 fields from MARA table.

Please help with a simple code....

Thanks,

Suma

7 REPLIES 7
Read only

Former Member
0 Likes
1,286

please clear ur doubt .......

its not clear .......like what i understood is u need to send multiple entries to bapi as import parameters and need to get data .....

if so take an internal table

write select quiry

and append individula line items to that table and pass that internal table to the import parameters ....

if u explain what exactly u want ....we can help..

Read only

0 Likes
1,285

Hello Shailaja,

Sorry, if my question is not clear.

Our client wants a BAPI which has Table Type in Import Parameter, in the table there will be a structure assigned to it. At run time we need to get the multiple entries from the Import parameter and read data from database and send them out using Export parameter.

We can define a Table type and associated Structure in SE11, and use the same as Associated type in Import parameter.

Ex: MATNR as import parameter(Multiple)

Export 3-4 fields from MARA table will be ok.

so I need a code reading the entries in table type and fetch related data from MARA table.

I think its more clear now.

Thanks,

Suma

Read only

0 Likes
1,285

Hi,


  DATA: WA_IMPORT  TYPE LINE OF <ImportTable>.
  LOOP AT <ImportTable> INTO WA_IMPORT.
     SELECT SINGLE MATNR MTART MAKTL FROM MARA 
        INTO EXPORT_TABLE
        WHERE matnr EQ wa_import-matnr.
     IF sy-subrc EQ 0.
        APPEND EXPORT_TABLE.
     Endif.
  ENDLOOP.

Read only

0 Likes
1,285

Hello Alpesh,

With reference to the code you have provided i have changed it but still getting errors, can you please look into my code and fix it?

ZBAPI_TABLETYPE has MATNR in it, as import.

ZBAPI_OUTPUT has MATNR,MTART in it as export.

FUNCTION ZBAPI_TABLEIMPORT.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(IMPORT) TYPE ZBAPI_TABLETYPE OPTIONAL

*" EXPORTING

*" VALUE(OUTPUT) TYPE ZBAPI_OUTPUT

*" VALUE(RETURN) TYPE BAPIRETURN

*"----


DATA: WA_IMPORT TYPE LINE OF ZBAPI_TABLETYPE.

LOOP AT IMPORT INTO WA_IMPORT.

SELECT SINGLE MATNR MTART FROM MARA

INTO OUTPUT

WHERE matnr EQ wa_import-matnr.

IF sy-subrc EQ 0.

APPEND IMPORT.

Endif.

ENDLOOP.

ENDFUNCTION.

Error: OUTPUT is not an internal table the occurs N specification is missing.

Thanks in Advance,

Suma

Read only

Former Member
0 Likes
1,285

Hi Suma

This link gives you the step by step process

http://abaplovers.blogspot.com/2008/02/bapi-sales-order-create-code.html

Regards

Divya

Read only

Former Member
0 Likes
1,285

hi use this..

selection-screen :s_werks for WSRP_RANGESWERKS .

Read only

Former Member
0 Likes
1,285

Thanks for the help