Skip to Content
0
Former Member
May 10, 2004 at 10:08 AM

call a BAPI and set table ...

46 Views

Into my BPS application, I have to call a BAPI. I have to set two tables (Sales organisation and materialselection). If I test my ZBAPI with SE37 with the same parameter it works. But I call my BAPI by a BSP using a RFC, my table ZMATNRLST is empty ...

My code :

-


*Required Data Definition to set SALESORGANISATIONSELECTION INTO BAPI

*CALLING

data: ZSALESORG type SALESORGANISATIONSELECTION.

data: WA_ZSALESORG type BAPIMATRASO.

WA_ZSALESORG-SIGN = 'I'.

WA_ZSALESORG-OPTION = 'EQ'.

WA_ZSALESORG-SALESORG_LOW = '7002'.

APPEND WA_ZSALESORG TO ZSALESORG.

*Required Data Definition to set SALESORGANISATIONSELECTION INTO BAPI

*CALLING

data: ZMATSELECT type MATNRSELECTION.

data: WA_ZMATSELECT type BAPIMATRAM.

WA_ZMATSELECT-SIGN = 'I'.

WA_ZMATSELECT-OPTION = 'CP'.

WA_ZMATSELECT-MATNR_LOW = '*'.

APPEND WA_ZMATSELECT TO ZMATSELECT.

  • Call Example

CALL FUNCTION 'Z_B2B_BAPI_MATERIAL_GETLIST'

DESTINATION 'SD1CLNT140'

EXPORTING

MAXROWS = 100

TABLES

MATNRSELECTION = ZMATSELECT

  • MATERIALSHORTDESCSEL = MATERIALSHORTDESCSEL

  • MANUFACTURERPARTNUMB = MANUFACTURERPARTNUMB

  • PLANTSELECTION = PLANTSELECTION

  • STORAGELOCATIONSELECT = STORAGELOCATIONSELECT

SALESORGANISATIONSELECTION = ZSALESORG

  • DISTRIBUTIONCHANNELSELECTION = DISTRIBUTIONCHANNELSELECTION

MATNRLIST = ZMATNRLST.

  • RETURN = RETURN

data: nblines type N.

DESCRIBE TABLE ZMATNRLST LINES nblines.

if nblines = 0.

MESSAGELIST = 'EMPTY CATALOG'.

else.

MESSAGELIST = 'NUMBER OF MATERIAL = '.

CONCATENATE MESSAGELIST NBLINES INTO MESSAGELIST.

endif.

-