Skip to Content
author's profile photo Former Member
Former Member

Passing Item data to BAPI BAPI_REQUIREMENTS_CREATE

Hello Experts,

Requirement to upload data from xcel sheet to SAP. Upload of Planned independent requirement(PIR) in the Plant

Please help as i am not able to pass values into BAPI EXPORT PARAMETER "requirements_item" and TABLE PARAMETER "requirements_schedule_in"

my test data is:

COKE1 2012-2013 20120201 10 TON

20120301 35 TON

COKE2 2012-2013 20120201 10 TO

20120301 35 TO

..CODE

form BAPI_REQUIREMENTS_CREATE.

LOOP AT lt_export_data INTO wa_export_data.

CLEAR wa_t5.

CLEAR wa_t4.

wa_t5-MATERIAL = wa_export_data-MATERIAL.

wa_t5-PLANT = 'ES01'.

wa_t5-REQU_TYPE = 'VSF'.

wa_t5-VERSION = 'AB'.

wa_t5-REQ_NUMBER = wa_export_data-Req_Num.

APPEND wa_t5 to lt_t5.

wa_t4-DATE_TYPE = '3'. "Monthly

wa_t4-REQ_DATE = wa_export_data-Date.

wa_t4-REQ_QTY = wa_export_data-Quantity.

wa_t4-UNIT = wa_export_data-UNIT.

APPEND wa_t4 to lt_t4.

CLEAR wa_export_data.

ENDLOOP.

CALL FUNCTION 'BAPI_REQUIREMENTS_CREATE'

EXPORTING

requirements_item = wa_t5

TABLES

requirements_schedule_in = lt_t4

return = lt_return.

I have the values in lt_t5 and lt_t4, now how to pass them to get desired result.

Regards.

Puneet Jham

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 04, 2012 at 09:46 AM

    null

    Edited by: puneet jham on Feb 4, 2012 11:26 AM

    Edited by: puneet jham on Feb 4, 2012 11:27 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 04, 2012 at 12:01 PM

    Try this.

    i got the sucess result as i want.

    DATA: I_BAPISITEMR TYPE STANDARD TABLE OF BAPISITEMR WITH HEADER LINE.

    " Item data

    DATA: I_CM60R TYPE STANDARD TABLE OF CM60R WITH HEADER LINE.

    " Requirements parameters

    DATA: I_BAPISSHDIN TYPE STANDARD TABLE OF BAPISSHDIN WITH HEADER LINE.

    " Schedule line data input

    DATA: I_BAPIRETURN1 TYPE STANDARD TABLE OF BAPIRETURN1 WITH HEADER LINE.

    " Return parameter

    DATA: I_MRP_AREA TYPE STANDARD TABLE OF BAPISITEMR WITH HEADER LINE.

    **If requirement already Exist then UPDATE those Req.

    DATA: U_REQUIREMENTS_SCHEDULE_IN TYPE STANDARD TABLE OF BAPISSHDIN WITH HEADER LINE.

    DATA: U_BAPIRETURN1 TYPE STANDARD TABLE OF BAPIRETURN1 WITH HEADER LINE.

    **If requirement already Exist then UPDATE those Req.

    **********************************************************************

    *local data declaration

    DATA: ZREQ_DATE TYPE SY-DATUM .

    DATA: ZREQ_NUM TYPE STRING.

    **********************************************************************

    DATA: ZYEAR_DATA TYPE STRING ,

    ZMONTH_DATA TYPE STRING .

    ZYEAR_DATA = ZYEAR.

    ZMONTH_DATA = ZMONTH.

    DATA: I_MATERIAL TYPE MARA-MATNR ,

    I_IN_ME1 TYPE MARA-MEINS ,

    I_OUT_ME1 TYPE MARA-MEINS ,

    I_MENGE1 TYPE EKPO-MENGE .

    DATA: OUT_E_MENGE TYPE EKPO-MENGE .

    DATA: W_SINGLE TYPE MEINS .

    CONCATENATE ZYEAR_DATA ZMONTH_DATA INTO ZREQ_NUM SEPARATED BY '-' .

    LOOP AT IT_FINAL INTO WA_FINAL.

    I_MATERIAL = WA_FINAL-ZMATERIAL. "Read from internal table

    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

    EXPORTING

    INPUT = I_MATERIAL

    IMPORTING

    OUTPUT = I_MATERIAL.

    SELECT SINGLE MEINS FROM MARA INTO W_SINGLE WHERE MATNR EQ I_MATERIAL .

    I_IN_ME1 = WA_FINAL-ZQTY_UNIT . " read from internal table

    I_OUT_ME1 = W_SINGLE . "fetch from query

    I_MENGE1 = WA_FINAL-ZPL_QTY . "read from internal table

    CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'

    EXPORTING

    I_MATNR = I_MATERIAL

    I_IN_ME = I_IN_ME1

    I_OUT_ME = I_OUT_ME1

    I_MENGE = I_MENGE1

    IMPORTING

    E_MENGE = OUT_E_MENGE

    EXCEPTIONS

    ERROR_IN_APPLICATION = 1

    ERROR = 2

    OTHERS = 3.

    IF SY-SUBRC <> 0.

    CONTINUE.

    ENDIF.

    I_BAPISITEMR-MATERIAL = WA_FINAL-ZMATERIAL .

    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

    EXPORTING

    INPUT = I_BAPISITEMR-MATERIAL

    IMPORTING

    OUTPUT = I_BAPISITEMR-MATERIAL.

    I_BAPISITEMR-PLANT = WA_FINAL-ZPLANT.

    I_BAPISITEMR-MATERIAL_VERSION = '00' .

    I_BAPISITEMR-REQ_NUMBER = ZREQ_NUM.

    I_BAPISITEMR-VERSION = '00'.

    I_BAPISITEMR-REQU_TYPE = 'LSF' .

    I_BAPISITEMR-VERS_ACTIV = 'X'.

    *I_BAPISITEMR-MRP_AREA = '1110' .

    • I_BAPISITEMR-VERS_ACTIV = ''.

    APPEND I_BAPISITEMR.

    I_BAPISSHDIN-REQ_QTY = OUT_E_MENGE.

    I_BAPISSHDIN-DATE_TYPE = '3'. "Date type (day, week, month, interval) 3 = Month

    CONCATENATE ZYEAR_DATA ZMONTH_DATA '01' INTO ZREQ_DATE.

    I_BAPISSHDIN-REQ_DATE = ZREQ_DATE. "Schedule line date

    I_BAPISSHDIN-UNIT = W_SINGLE.

    APPEND I_BAPISSHDIN.

    CALL FUNCTION 'BAPI_REQUIREMENTS_CREATE'

    EXPORTING

    REQUIREMENTS_ITEM = I_BAPISITEMR

    • REQUIREMENT_PARAM = I_CM60R

    DO_COMMIT = 'X'

    • UPDATE_MODE = ''

    • REFER_TYPE = ''

    • PROFILID = ''

    • IMPORTING

    • MATERIAL = I_BAPISITEMR-MATERIAL

    • PLANT = I_BAPISITEMR-PLANT

    • REQUIREMENTSTYPE = I_BAPISITEMR-REQU_TYPE

    • VERSION = I_BAPISITEMR-VERSION

    • REQMTSPLANNUMBER = I_BAPISITEMR-REQ_NUMBER

    • MRP_AREA = I_BAPISITEMR-MRP_AREA

    TABLES

    REQUIREMENTS_SCHEDULE_IN = I_BAPISSHDIN

    • REQUIREMENTS_CHAR_IN =

    RETURN = I_BAPIRETURN1

    .

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Kaushik,

      Issue with my code is, its only taking 1 Material from test data , ie from below data its only taking all values related to COKE3, but not for COKE2, if i remove COKE2 from test data on temp. basis just for testing code.

      Test Data:

      COKE3 2012-2013 20120201 10 TO

      20120301 20 TO

      20120401 30 TO

      20120501 40 TO

      COKE2 2012-2013 20120201 50 TO

      20120301 60 TO

      Can you help in that part?

      Regards.

      Puneet

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.