Sales Order Text Lines in SAP Query

I have a requirement to output several text lines into a SAP query based around sales orders.
I have included some code to read the details into my query and get no syntax errors, however the report gives a blank output for each of the text fields included, despite there definitely being some text with the specified attribute ID and text object in the table STXL.
Where am I going wrong?
Please find the coding below for one of the text field I'm trying to extract:
TABLES:STXL.
DATA:
    VBELN LIKE VBAP-VBELN,
    POSNR LIKE VBAP-POSNR,
    TDNAME LIKE STXL-TDNAME,
    MYLINE LIKE TLINE-TDLINE,
    ZE18_LINE(1200) TYPE C.
DATA:BEGIN OF LINES OCCURS 0.
        INCLUDE STRUCTURE TLINE.
DATA:END OF LINES.
DATA:BEGIN OF MYHEADER.
        INCLUDE STRUCTURE THEAD.
DATA:END OF MYHEADER.
CLEAR TDNAME.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
  INPUT = VBAP-VBELN
IMPORTING
  OUTPUT = VBELN.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
  INPUT = VBAP-POSNR
IMPORTING
  OUTPUT = POSNR.
  CONCATENATE VBELN POSNR INTO TDNAME.
CALL FUNCTION 'READ_TEXT'
    EXPORTING
        ID = 'ZAT2'
        LANGUAGE = SY-LANGU
        NAME = TDNAME
        OBJECT = 'VBBP'
     IMPORTING
        HEADER = MYHEADER
     TABLES
        LINES  = LINES
EXCEPTIONS
        ID = 1
        LANGUAGE = 2
        NAME = 3
        NOT FOUND = 4
        OBJECT= 5
        REFERENCE_CHECK = 6
        WRONG_ACCESS_TO_ARCHIVE = 7
        OTHERS = 8.
IF SY-SUBRC = 0.
  LOOP AT LINES.
    MOVE LINES-TDLINE TO TEXT.
    ENDLOOP.
ENDIF.

Hi -
Please check in debuging.
check the value of TDNAME correctly populated with sales order no and sales order item.
You can cross check with the table STXH with TDNAME and see if any entries is available for TDID 'ZAT2' as your case.
Here are sample code.
DATA :    lv_tdname TYPE tdobname,
                 lw_line TYPE tline,
                li_line TYPE STANDARD TABLE OF tline.
CLEAR : lv_tdname , li_line[],
cocatenate w_vbak-vbeln w_vbap-posnr into lv_tdname.
CALL FUNCTION 'READ_TEXT'
  EXPORTING
    id                      = 'ZAT2'
    language                = 'E'
    name                    = lv_tdname
    object                  = 'VBBP'
  TABLES
    lines                   = li_line
  EXCEPTIONS
    id                      = 1
    language                = 2
    name                    = 3
    not_found               = 4
    object                  = 5
    reference_check         = 6
    wrong_access_to_archive = 7
    OTHERS                  = 8.
IF sy-subrc = 0.
  CLEAR lw_line.
  loop at li_line INTO lw_line .
* Put your logic
  endloop.
ENDIF.

Similar Messages

  • Sales order Text Line (Type)  Add

    Hi,
    I look into
    ..\Program Files\SAP\SAP Business One SDK\Samples\COM DI\CSharp\19.SpecialLines
    But it Update SpecialLines into existing order.
    I am building Order Line and SpecialLines, Order Line and SpecialLines, etc.
    So I used Add instead of update, without success.
    I write my Order Line = OK, then not OK
    oDocument_SalesOrder.SpecialLines.LineType = SAPbobsCOM.BoDocSpecialLineType.dslt_Text;
    oDocument_SalesOrder.SpecialLines.LineText = "My Text Here" ;
    oDocument_SalesOrder.SpecialLines.Add();
    In SDK Help Center
    oDocument_SalesOrder.SpecialLines.Add();
    oDocument_SalesOrder.SpecialLines.LineType = SAPbobsCOM.BoDocSpecialLineType.dslt_Text;
    oDocument_SalesOrder.SpecialLines.LineText = "No Text here...Hello?? ";
    I manage to add SpecialLines after I had created my Sales Order:
    oDocument_SalesOrder.SpecialLines.LineType = SAPbobsCOM.BoDocSpecialLineType.dslt_Text;
    oDocument_SalesOrder.SpecialLines.LineText = "Hello 2";
    oDocument_SalesOrder.SpecialLines.AfterLineNumber = 0;
    resultMessage = oDocument_SalesOrderP3.Update();
    if ( resultMessage != 0 ) // Check the result
    oCompany.GetLastError(out resultMessage, out ErrMsg);
    But I did not manage to add more then 1 SpecialLines:
    I tried to Add, Update, change AfterLineNumber, etc without success.
    I need Help Here...
    (David, where are you? don't tell me yo open the bottle you bought...:)
    Thank you,
    Rune
    Edited by: Rune Brattas on May 8, 2008 5:01 PM

    Hi
    The code below create 1 Special Line.
    I like to create 1,2,...,n Special Lines.
    You are right I do not manage to create Special Lines when I create the Sales Order. I have to create special line after the Sales Order is created.
    I have repeated the same code twice without success of creating the second Special Line...
    I cannot be the first person to create Special Line in SDK?
    Thank you,
    Rune
    CODE - Add a Special Line to existing Sales Order
    oDocument_SalesOrder.SpecialLines.LineType = SAPbobsCOM.BoDocSpecialLineType.dslt_Text;
    oDocument_SalesOrder.SpecialLines.LineText = "Specual Line YES :)) ";
    oDocument_SalesOrder.SpecialLines.AfterLineNumber = 0; // Sales Order Line 0
    resultMessage = oDocument_SalesOrder.Update();
    if ( resultMessage != 0 )          // Check the result
    oCompany.GetLastError(out resultMessage, out ErrMsg);
    If I repeat the code:
    oDocument_SalesOrder.SpecialLines.LineType = SAPbobsCOM.BoDocSpecialLineType.dslt_Text;
    oDocument_SalesOrder.SpecialLines.LineText = "Specual Line YES, but I lose my first Special Line:)) ";
    oDocument_SalesOrder.SpecialLines.AfterLineNumber = 1; // Sales Order Line 1; I lose my Special Line 0; I only get 1 Special Line
    resultMessage = oDocument_SalesOrder.Update();
    if ( resultMessage != 0 )          // Check the result
    oCompany.GetLastError(out resultMessage, out ErrMsg);
    Edited by: Rune Brattas on May 12, 2008 7:03 AM

  • Sales order Text Line (Type)

    Hi,
    How do I add Text Line by selecting the field "Type" in Form Settings in my DI Add-On?
    Here is the code for adding a regulare Sales Order line:
    CODE
    oDocument_SalesOrder.Lines.FreeText = "This is not the Text I want to have...It is a Drop Down List and you can select Regular, text, sun-total in Type Column";
    oDocument_SalesOrder.Lines.Add();
    Thank you,
    Rune

    Rune,
    You need to use the Document_SpecialLines Object which is new to SAP Business One 2007A.  You can find more detail on this in the 2007A SDK Help Center documentation as well as sample code with the SDK at ...
    ..\Program Files\SAP\SAP Business One SDK\Samples\COM DI\CSharp\19.SpecialLines
    Eddy

  • How 2 read all the line of a sales order text ID plz

    Dear all
    I have the following to read sales order text of single line of limited char(40)
      TIDNO = '0003'.
        CONCATENATE SSORD
                    LIPS-POSNR
        INTO        TNAME.
        TOBJT = 'VBBP'.
        PERFORM FINDTEXT.
        LOOP AT MSLINES.
          WA_ITEM-PACKTYP = mslines-tdline(40).
          EXIT.
        ENDLOOP.
      How do i read mutiple lines plz tell me ?
    Thnx
    Moni
    Message was edited by: md monirujjaman

    Hi Md,
    sorry I don't understand your question, can you explain more ?
    Regards
    Frédéric

  • Retrieve Sale Order Text

    Hi,
      How can i retrieve the sale order text?? Any FM / BAPI available?? OR which table should  i use??  I want to display the fields in the delivery sap script.
    Regards,
    Kit

    Hello Kit,
    There is a function Module called READ_TEXT to get the sales order text.
    you can see the example program in the folowing thread given by Anji Reddy Vangala.
    https://forums.sdn.sap.com/click.jspa?searchID=6591847&messageID=3274740
    He wrote like:
    You have to fetch it useing the fun module READ_TEXT
    double click on that text in SO, it goes to text editor,
    from the menu GOTO -> header
    displays the OBJECT, ID< OBJECT NAME and the Language
    pass them to the fun module and fetch it
    CALL FUNCTION 'READ_TEXT'
    EXPORTING
    CLIENT = SY-MANDT
    ID = TEXT_ID
    LANGUAGE = SY-LANGU
    NAME = Same as TDNAME in Save_text
    OBJECT = TEXT_OBJECT
    TABLES
    LINES = LI_LINE
    EXCEPTIONS
    ID = 1
    LANGUAGE = 2
    NAME = 3
    NOT_FOUND = 4
    OBJECT = 5
    REFERENCE_CHECK = 6
    WRONG_ACCESS_TO_ARCHIVE = 7
    OTHERS = 8.
    Genrally text are stored in STXH tables.
    Regards
    Sasidhar Reddy Matli.
    Message was edited by:
            Sasidhar Reddy Matli

  • Creating Outbound deliveries based on the sales order schedule lines

    Dear all.
    Is it possible to create outbound delivery documents based on the sales order schedule lines?
    Eg:
    Let's say I have sales order line item 10 with below mentioned requested delivery dates in its schedule line level.
    30.07.2009
    10.08.2009
    20.08.2009
    30.08.2009
    Will it possible for me to create different deliveries for those 4 schedule lines individually? I should be able to create 10.08.2009 delivery without clubbing 30.07.2009 delivery with it.
    Appreciate your help!

    I'm not sure because I'm not before SAP but try transaction VL10E that is to create delivery for schedule lines. I'm not sure what are the split criterias.
    Please check OSS note 113411 tha has many OSS note reference in this subject.
    Regards,
    Csaba
    Edited by: Csaba Szommer on Jul 29, 2009 2:38 PM

  • Sales Order Schedule Lines getting updated

    Hi,
    In my system when I am changing the delivery date of  'AB' confirmation in the Purchase order Item level confirmations, the corresponding  Sales Order' schedule line is also getting updated with the delivery date.
    So, my question is is this a standard SAP functionality or this fuctionality has been implemented through BADI, Exits etc.
    Regards,
    Rachit

    Rachit,
    This is standard SAP behavior. In 3rd party sale process, the changes done to PO (qty, dates) are updated automatically in the sales order.
    TW

  • Mass Update for Purchase Order & Sales Order Text

    Hi,
    Can be change the Purchase Order & Sales Order Text using MASS.
    Regards,

    Hi,
    I am also surprised by the behaviour of the BDC.
    This is first time when I am facing the problem since I have been using SAP.
    I am able to update the PO Text manually , but BDC is giving the problem for only few Materials.
    It does sound stupid, but this is the fact here with me.
    Regards,
    Edited by: PK on Nov 5, 2009 12:58 PM

  • Bdc sales order multiple line items

    hi friends,
    i prepare multiple sales orders multiple line items through  single flat file
    in bdc program.
    i know information about ...
    H
    I
    I
    I
    BUT my problem is
    H
    I
    I
    H1
    I
    I
    H2
    I
    I
    how will develop this code?

    George Bush,
    Answer fir this question is, you need to do basic ABAP Training.
    Search for SAP ABAP Training Courses.
    You need to build logic in you program by defining appropriate internal table and use loop events to build BDC.   BDC is old style of programming. I would advice you to use BAPI with immediate order processing.
    If you want BDC, you can also try to use LSMW by defining appropriate inbound data structures.
    If you need help let me know.
    Thanks & Regards,
    Mahesh Apte

  • Sales order Text need to copy in to PR or PO

    Hi All
    I am trying to copy Sales orde header text and item text in to Purshase Requisition or Purchase order. I have configured settings in VOTXN. But still i am unable to copy sale order text in to PR or PO. plz help on these.  (this is Third party scenario i am copying text.)

    Hi,
    You can use the functuion READ_TEXT to read the SO Text.
    Then refer to function SAVE_TEXT, you need to fill the structure THEAD with all PO Values and the fill lines directly.
    The text will be updated.

  • Migrate all Open Sales Orders From Legacy System (SAP) To SAP System using

    Hi Experts,
                 I've to Migrate all Open Sales Orders From Legacy System (SAP) To SAP System using Business Objects with a new SALES ORDER DOCUMENT NUMBER referencing the older one.
               I'll get all the required data with field in an excel file.
                 Does any standard transaction exist for it ? Or how to go ahead with it ?
    Thanks and regards,
    Jyoti Shankar

    Hi
    If you are checking for CREATE option then Sales Doc Type
    For more Info goto SWO1 transaction -> BUS2032 --> DIsplay --> Execute --> There SELECT the method which you want to perform... There you can fine the MANDATORY parameters also....
    Or in DISPLAY mode PLACE Cursor on the Required Method and CLick the PARAMETERS button on toolbar...
    That will show the MANDATORY parameters...
    Reward if helpful....
    Message was edited by:
            Enter the Dragon

  • Interesting and an  imporatant issue at sales order schedule line.

    hi all,
    interesting and an  imporatant issue at sales order schedule line.
    i created a sales order with 10 qty.and the system proposed a two schedule lines.
    let's say to order created date is 27.11.2008.and the requested delivery date is 27.11.2008.
    but the stock is not available today then the system proposed two more schedule lines apart from the 27.11.2008.so now there are three schedule lines like below.
    schedule line date                      Material availabilyt date   delivery date                   
    27.10.2008 with zero quantity.     
    28.10.2008 with 5 qty.                28.10.2008                     29.10.2008
    02.10.2008 with 5 qty.                02.10.2008                     03.10.2008
    now the delivery and pgi already for the schedule line 28.10.2008.
    then when i run the availability check on 01.11.2008 system is over writing the material vailability date as today at the scheduleline number two.
    now i can able to view only two schedule lines only.
    schedule line date                      Material availabilyt date   delivery date                   
    28.10.2008 with 5 qty.                01.11.2008                     29.10.2008
    02.10.2008 with 5 qty.                01.11.2008                     02.11.2008
    now my concern when we reschedule the avalability check it should notchange the Material availability date of the schedule line which i already delivered.
    Regards,
    sheshukumar

    can any one repsond for this.....

  • Migrating Open Sales Order From Legacy System (SAP) To SAP System

    Hi Experts,
                 I've to Migrate all Open Sales Orders From Legacy System (SAP) To SAP System using Business Objects with a new SALES ORDER DOCUMENT NUMBER referencing the older one.
               I'll get all the required data with field in an excel file.
                 Does any standard transaction exist for it ? Or how to go ahead with it ?
    Thanks and regards,
    Jyoti Shankar

    hi jyothi ,
       there are lot of ways of doing it depending on data upload volume it will be decided .
    1) thru abap bdc program which directly uses XL sheet data and creates SO using bapi/FMs.
    2) using scat.functional consultant should be good enough to use this.
    3)lsmw-laborious procedure but achievable.
      reward if helps !!!!!

  • Sales Order Schedule line not populating in the Production order

    Queation: Is there a way to tell the system to look at the sales order, line item AND schedule line. It is displayed in MD04 but it doesn't carry over to the Production Order. We are a MTO and this information is relevant in a number of ways. 
    Please Help.

    Vickie,
    If you are using MTO scenario then when you run the MRP for the material, it will create a planned order for that sales order based on the dates calculated from the sales order schedule line (Shipping tab)...
    So now when you convert the planned order to production order, all the sales order details will get copied.
    try and revert back.
    Swapnil

  • Sales order schedule line quantities in decimals

    Gurus - Required your help to resolve the following scenario.
    I'm facing with the problem where schedule lines of a sales order allocated with decimal quantities even though materials with UOM as EA(Each). For example Material A of sales qty 13 has the schedule lines allocated as 11.960 and 2.040. The delivery has been created as per the schedule lines with qty 11.960 and 2.040 and it has been pick/packed and delivered to the customer. Now, while issuing goods for the delivery, received the error message as <b>"Serial number management only allows whole numbers".</b>
    Can anyone provide what are the possible ways to round the delivered qty and issue the goods, when the delivery is complete?

    Sree - Question 1 - Why would you deliver the product and then try goods issue it (In general ;)...anyway....I know, a lot of companies do that way....
    Question 2 - How much exactly did you ship out, surely must not have shipped products in decimals, since you've EACHES defined and not KGs....or LBs...
    I would suggest finding out the correct quantities shipped out and then cancelling this delivery document....you can then go on to modify sales order schedule line accordingly and then process it again..."WHAT ABOUT PICK PACK DETAILS"....before cancelling this delivery doc out..capture the packing details (HUs) and then apply them to the new delivery doc... if you are using external system for packing HUs.....process the IDOC (or file etc) using the new delivery doc number....
    Hope you got the direction )
    Thanks
    Nikhil

Maybe you are looking for