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: 

doubt in bapi

Former Member
0 Kudos

Hi abapers,

I m trying to create a sales document using.....but i m able getting error report....could u suggest me how to correct the program

report zr_bapi_sales_order.

DATA : T_HEADER LIKE BAPISDHEAD OCCURS 0 WITH HEADER LINE,

T_ITEM LIKE BAPIITEMIN OCCURS 0 WITH HEADER LINE,

T_PARTNER LIKE BAPIPARTNR OCCURS 0 WITH HEADER LINE,

RETURN TYPE BAPIRETURN1 OCCURS 0 WITH HEADER LINE,

SALES_DOC LIKE BAPIVBELN-VBELN,

SOLD_TO_PARTY LIKE BAPISOLDTO-SOLD_TO,

SHIP_TO_PARTY LIKE BAPISHIPTO-SHIP_TO,

PAYER LIKE BAPIPAYER-PAYER.

*PARAMETER : SALES_DOC(10) TYPE C.

T_HEADER-DOC_NUMBER = '90000876'.

T_HEADER-DOC_TYPE = 'TA'.

T_HEADER-SALES_ORG = 'OG01'.

T_HEADER-DISTR_CHAN = 'DS'.

T_HEADER-DIVISION = '10'.

APPEND T_HEADER.

T_ITEM-MATERIAL = 'SIDDI'.

T_ITEM-REQ_QTY = '9000'.

APPEND T_ITEM.

T_PARTNER-PARTN_ROLE = 'PARTNER'.

T_PARTNER-PARTN_NUMB = '10009'.

APPEND T_PARTNER.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'

EXPORTING

ORDER_HEADER_IN = T_HEADER

  • WITHOUT_COMMIT = ' '

  • CONVERT_PARVW_AUART = ' '

IMPORTING

SALESDOCUMENT = SALES_DOC

  • SOLD_TO_PARTY = '000100111'

  • SHIP_TO_PARTY = '76854'

  • BILLING_PARTY =

RETURN = RETURN

TABLES

ORDER_ITEMS_IN = T_ITEM

ORDER_PARTNERS = T_PARTNER

  • ORDER_ITEMS_OUT =

  • ORDER_CFGS_REF =

  • ORDER_CFGS_INST =

  • ORDER_CFGS_PART_OF =

  • ORDER_CFGS_VALUE =

  • ORDER_CCARD =

  • ORDER_CFGS_BLOB =

  • ORDER_SCHEDULE_EX =

. ..

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

IF RETURN-TYPE = 'S'.

WRITE 😕 'SALES ORDER', SALES_DOC , 'CREATED SUCCESSFULLY'.

ENDIF.

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Are you getting a syntax error or a runtime error?

The previous answer should definitly solve one problem.

Regards,

Rich Heilman

7 REPLIES 7

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You are going to have to tell us what the error is.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi,

Check the declaration

<b>T_HEADER LIKE BAPISDHEAD OCCURS 0 WITH HEADER LINE.

change it to

DATA : T_HEADER type BAPISDHEAD .</b>

T_HEADER-DOC_NUMBER = '90000876'.

T_HEADER-DOC_TYPE = 'TA'.

T_HEADER-SALES_ORG = 'OG01'.

T_HEADER-DISTR_CHAN = 'DS'.

T_HEADER-DIVISION = '10'.

<b>* APPEND T_HEADER. " Remove this statement</b>

Please Confirm The same & Reward Point

MARK Helpful Answers

regards

Message was edited by: Manoj Gupta

Former Member
0 Kudos

Yes ....Im not able to find where is the error in this program.....

0 Kudos

Hi,

Please check my above post ; i think it will solve ur problem.

0 Kudos

Hi Manoj ,

I tried as u said but it is not working

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Are you getting a syntax error or a runtime error?

The previous answer should definitly solve one problem.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi Rich Heilman

Actually in starting i got some runtime errors but after some modifications its not coming.......While executing the program i got error message sales document not created .......Till now i didnt did any programs in bapi this is going to be my first program in bapi.....Thats y im not able recognise to problem in the program....