Application Development 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: 

help needed in bapi _requistion _create

Former Member
0 Kudos

Hi all,

I want to assign a delivery address and unloading point to a purchase requistion i got the delvery address but iam not able to figure out the unloading point.

I want you guys to let me know from which table i have to retrieve the unloading point and assign to which part of BAPI.

Iam sending my code please take a look at it and let me know if iam wrong any where and what i need to add for unloading point.

data: begin of itab_bapiebkn occurs 100.

include structure bapiebkn.

data: end of itab_bapiebkn.

data : I_BAPIMERQADDRDELIVERY TYPE TABLE OF BAPIMERQADDRDELIVERY,

W_BAPIMERQADDRDELIVERY TYPE BAPIMERQADDRDELIVERY.

w_quantity = itab-multiple * itab-bstrf.

w_item_no = w_item_no + 1.

itab_bapiebanc-preq_item = w_item_no.

itab_bapiebanc-doc_type = c_doc_type.

itab_bapiebanc-created_by = sy-uname.

itab_bapiebanc-material = itab-matnr.

itab_bapiebanc-plant = itab-werks.

itab_bapiebanc-quantity = w_quantity.

itab_bapiebanc-deliv_date = sy-datum + 1.

itab_bapiebanc-trackingno = w_bednr.

append itab_bapiebanc.

w_bapimerqaddrdelivery-PREQ_ITEM = w_item_no.

IF S_GROUP = '2'.

SELECT SINGLE * FROM TVARV WHERE NAME EQ 'ZGRP1'.

IF SY-SUBRC EQ 0.

SELECT SINGLE ADDRNUMBER FROM ADRC INTO w_bapimerqaddrdelivery-ADDR_NO

WHERE ADDRNUMBER = TVARV-LOW.

ENDIF.

Thanks in advance

Suchitra

13 REPLIES 13

Former Member
0 Kudos

hi guys,

please let me know if you have any idea on this.

Thanks

0 Kudos

Hi,

Check the sample code.


REPORT  ZTEST_BAPI_PR                             .

DATA:WA_EBAN LIKE EBAN.
DATA: BEGIN OF ITAB OCCURS 0,
            BSART(4),
*            ."Purchase requisition document type
            WERKS(4),
*             Plant
            TXZ01(40),
*            ."Short text
            MENGE(13),
*            ."Purchase requisition quantity
            MEINS(3),
*            ."Purchase requisition unit of measure
            EEIND(10),
*            ."Item delivery date
            WGBEZ(9),
*            ."Material Group
            NAME1(4),
*            ."Plant
            EKGRP(3),
*            ."Purchasing Group
            AFNAM(12),
*            ."Name of requisitioner/requester
            BEDNR(10),
*            ."Requirement Tracking Number
            KNTTP(1),
*            ."Account assignment category
            SAKTO(10),
*            ."G/L Account Number
            PS_POSID(8),
*            ."Work Breakdown Structure Element (WBS Element)
            EDITOR(132),
*            ."Text line
      END OF ITAB.

DATA: ITAB_BAPIEBANC  LIKE BAPIEBANC  OCCURS 0 WITH HEADER LINE.
DATA: ITAB_BAPIEBKN   LIKE BAPIEBKN   OCCURS 0 WITH HEADER LINE.
DATA: ITAB_BAPIEBANTX LIKE BAPIEBANTX OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF ERRMSG OCCURS 10.
        INCLUDE STRUCTURE BAPIRET2.
DATA: END OF ERRMSG.
DATA: ERRFLAG.

SELECT SINGLE * FROM EBAN
                INTO WA_EBAN.

 IF SY-SUBRC = 0.

MOVE-CORRESPONDING WA_EBAN TO ITAB.
APPEND ITAB.
CLEAR ITAB.
ENDIF.
*CALL FUNCTION 'UPLOAD'
*  EXPORTING
*    filename = 'C:Documents and SettingssapDesktopNew Text Document (2).txt'
*    filetype = 'DAT'
*  TABLES
*    data_tab = itab.
*
*         .
*if sy-subrc <> 0.
*  message id sy-msgid type sy-msgty number sy-msgno
*          with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
*  exit.
*endif.

LOOP AT ITAB.
  ITAB_BAPIEBANC-DOC_TYPE       =    ITAB-BSART.
  ITAB_BAPIEBANC-SHORT_TEXT     =    ITAB-TXZ01.
  ITAB_BAPIEBANC-QUANTITY       =    ITAB-MENGE.
  ITAB_BAPIEBANC-UNIT           =    ITAB-MEINS.

  IF NOT ITAB-EEIND IS INITIAL.
    ITAB_BAPIEBANC-DELIV_DATE     =    ITAB-EEIND.
  ELSE.
    ITAB_BAPIEBANC-DELIV_DATE     =  SY-DATUM + 30.
  ENDIF.

  ITAB_BAPIEBANC-PLANT          =    ITAB-WERKS.
  ITAB_BAPIEBANC-PUR_GROUP      =    ITAB-EKGRP.
  ITAB_BAPIEBANC-PREQ_NAME      =    ITAB-AFNAM.
  ITAB_BAPIEBANC-TRACKINGNO     =    ITAB-BEDNR.
  ITAB_BAPIEBANC-MAT_GRP        =    ITAB-WGBEZ.
  ITAB_BAPIEBANC-ACCTASSCAT     =    ITAB-KNTTP.
    ITAB_BAPIEBANC-ACCTASSCAT     =    'A'.
  ITAB_BAPIEBKN-G_L_ACCT        =    ITAB-SAKTO.
  ITAB_BAPIEBKN-WBS_ELEM        =    ITAB-PS_POSID.
*  itab_bapiebantx-text_line     =    itab-editor.
 ITAB_BAPIEBANTX-TEXT_LINE     =    'Test for Purchase requisiton'.
  APPEND ITAB_BAPIEBKN.
  APPEND ITAB_BAPIEBANC.
  APPEND ITAB_BAPIEBANTX.
ENDLOOP.
*
CALL FUNCTION 'BAPI_REQUISITION_CREATE'
  TABLES
    REQUISITION_ITEMS              = ITAB_BAPIEBANC
    REQUISITION_ACCOUNT_ASSIGNMENT = ITAB_BAPIEBKN
    REQUISITION_ITEM_TEXT          = ITAB_BAPIEBANTX
    RETURN                         = ERRMSG.

LOOP AT ERRMSG.
  IF ERRMSG-TYPE EQ 'E'.
    WRITE:/'Error in function', ERRMSG-MESSAGE.
    ERRFLAG = 'X'.
  ELSEif ERRMSG-TYPE = 'S' .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    WRITE:/ ERRMSG-MESSAGE.
  ENDIF.
ENDLOOP.

Regards

vijay

former_member181966
Active Contributor
0 Kudos

See table ...<b>T663A</b>

Thanks

Saquib

ferry_lianto
Active Contributor
0 Kudos

Hi Suchitra,

Have you looked table <b>KNVA</b> or FM <b>KNVA_SINGLE_READ</b>?

Regards,

Ferry Lianto

Former Member
0 Kudos

Hi guys,

I have couple of questions regarding unloading point and delivery address.

The deklivery address was created in transaction mean i.e all the details regarding were given and saved so it generated a address number and everything the address number and the address details got stored in adrc table.

Now iam retrieving the delivery address from ADRC TABLE BASED ON ADDRESS NUMBER AND ASSIGNING IT TO BAPI.

My question is where do we Create the unloading point and its get populated in which table so that if can retrieve that data.

I don't see any unloading point field in my purchase requistion transaction .

I don't have any functional help in here.

Please let me know your ideas.

Thanks

Former Member
0 Kudos

Hi guys,

I have couple of questions regarding unloading point and delivery address.

The deklivery address was created in transaction mean i.e all the details regarding were given and saved so it generated a address number and everything the address number and the address details got stored in adrc table.

Now iam retrieving the delivery address from ADRC TABLE BASED ON ADDRESS NUMBER AND ASSIGNING IT TO BAPI.

My question is where do we Create the unloading point and its get populated in which table so that if can retrieve that data.

I don't see any unloading point field in my purchase requistion transaction .

I don't have any functional help in here.

Please let me know your ideas.

Thanks

0 Kudos

Do you see unloading points in ME51N when you create purchase requisition online? I don't think they are tied to a purchase requisition. Check with your functional/business person and request to show it online.

0 Kudos

hI SRINIVAS,

Can you tell me how do we assign a unloading point to purchase order.Can you send me your email id so that i can send you screen shoots of what i am looking at.

Thanks in advance

0 Kudos

Ok, I think I now found it. It is on the account assignment segment. You need to pass it to REQUISITION_ACCOUNT_ASSIGNMENT-UNLOAD_PT.

0 Kudos

Hi suchitra

in the Acount assingment Tab of the PR, if you click the tables icon which is at the top left hand corner that would enable you to enter multiple account assingment for the PR there the unloading point field is present

0 Kudos

Hi srinivas i came to know that i need to assign to REQUISITION_ACCOUNT_ASSIGNMENT-UNLOAD_PT.

but before that i need to retrieve the unloading point to assign it to bapi?

from what table i have retrieve so that i can move into internal table and assign it to bapi.

Thanks in advance

Suchitra

Former Member
0 Kudos

Unloading points are not created in the system as some master data. Actually, why are you not asking the functional or business contact for this? They will be able to tell you where the information is.

You have to gather the requirement from them and if there are any technical hurdles, then you can approach this forum. It will be difficult to give you any answers without knowing your system configuration or business process or requirement. They vary from place to place.

0 Kudos

Search help / F4 / drop down button on the Unloading Point field for non-stock components is NOT SAP standard - it is a development hence no standard table will be found to populate with values.

Hope this helps?

Lew.