Application Development and Automation 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: 
Read only

SO Creation

Former Member
0 Likes
2,474

Hi experts,

We have that existing ABAP customized program creating an SO from a text file and its working fine..until such an additional requirement need to be included on that program; The scenario is like this ; in the text file (source of info such us Customer No., Material code, Ordered Qty and so on..) there is the Header text and line item Txt that should be included in the SO itself (currently we are editing the SO created by the program and copy paste Header Txt and Line Item Txt from the txt file into SO. How can we posssibly do this thru the existing program the fact that where we paste in the SO is not a "field" of a SAP table.. Please help...

Thanks,

D.Pasion

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,962

Deo,

READ_TEXT will not retrieve anything as you have yet to create the sales order. My advice would be to create the sales order then call the FM CREATE_TEXT.

Cheers,

Neil.

15 REPLIES 15
Read only

Former Member
0 Likes
1,962

I dont hv much idea.........but, u can search this forum on the below FMs,

CREATE_TEXT

EDIT_TEXT

SAVE_TEXT

use the above FMs after creating the SOs.

U hv to pass the Text ID, Language, Key(SO number) etc. to these FMs

thanq

Read only

Former Member
0 Likes
1,962

Hi Deo Pasion,

I guess You are creating SO Using Recording, if so, try to do recording when you enter item text and Header text.

Add that particular recording in your program. Try to paste of existing code that could help to resolve the issue soon.

Regards,

Suneel G

Read only

0 Likes
1,962

Hi,

Thanks for your immediate response, how can I perform recording?

Read only

0 Likes
1,962

Hi Deo Pasion,

Could plz paste a row of your Flat File with Header and Piece of existing Code.

So, that it could be easy for any one to understand Up to what extent it is ? and wht need to be done.

Regards,

Suneel G

Read only

0 Likes
1,962

>

> Hi Deo Pasion,

>

> Could plz paste a row of your Flat File with Header and Piece of existing Code.

>

> So, that it could be easy for any one to understand Up to what extent it is ? and wht need to be done.

>

> Regards,

> Suneel G

Hi,

Source TXT file:

HDR 10486810486820090505 5/5/2009 5/8/2009 MDC 563 SOLANO-GADDANG get copy of memo stating d downgrade solution of apo muriatic acid & attach to inv.ask grace 0.000 Y

DTL10 11000806Marquee White Henna 12g 36.000 PCSTAN 0.000 5/5/2009

DTL20 11000840APO Azufre 50g 36.000 PCSTAN 0.000 5/5/2009 serve with batch 2009

NOTE : My objective ==> header TXT "get copy ......." Item detail TXT "serve with batch..."

should be written in SO created by existing program (sample code below).

Thank You so Much...

PROGRAM CODE:

  • Run batch input program

LOOP AT it_ordhdr.

CLEAR dc_kunnr. "aza 01Nov 2008

CONCATENATE '0000' it_ordhdr-kunnr INTO dc_kunnr. "aza 01Nov 2008

REFRESH it_bdc.

*Check if PO exists

READ TABLE it_po WITH KEY bstnk = it_ordhdr-bstkd "Order Date

kunnr = dc_kunnr. "Sold To Customer "aza 01Nov 2008

IF sy-subrc NE 0.

PERFORM gen_bdc_rec USING:

'X' 'SAPMV45A' '0101',

' ' 'VBAK-AUART' it_ordhdr-auart,

' ' 'VBAK-VKORG' it_ordhdr-vkorg,

' ' 'VBAK-VTWEG' it_ordhdr-vtweg,

' ' 'VBAK-SPART' it_ordhdr-spart,

' ' 'BDC_OKCODE' '/00'.

CLEAR di_ctr. "aza 29Oct 2008

PERFORM generate_bdcdata.

PERFORM gen_bdc_rec USING:

'X' 'SAPMV45A' '4001',

' ' 'BDC_OKCODE' '=SICH'.

CALL TRANSACTION 'VA01' USING it_bdc MODE dismode

UPDATE updmode

MESSAGES INTO it_msg.

MOVE-CORRESPONDING it_ordhdr TO it_hdrpro.

APPEND it_hdrpro.

CLEAR it_hdrpro.

Read only

0 Likes
1,962

Hi Deo Pasion,

You mean this is Header Text from Flat File rite ??? get copy of memo stating d downgrade solution of apo muriatic acid & attach to inv.ask grace

From your code I am unable to find how they are Creating Header Text for Header in your Program.

But Once we create the Header Text Read it as Follows and Create a Item text by passing SOnumber+Itemno.

This will Solve the Problem, just check your code were we need to paste this. look below:

Data : TD_LINES TYPE TABLE OF TLINE.

CALL FUNCTION 'READ_TEXT'
  EXPORTING
    CLIENT                        = SY-MANDT
    ID                            = '0001'
    LANGUAGE                      = 'E'
    NAME                          = '0060000049'  " SO Number with Preceeding Zeros
    OBJECT                        = 'VBBK'
  TABLES
    LINES                         = TD_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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

" Copying the Text in Header Text to Item Text
CALL FUNCTION 'CREATE_TEXT'
  EXPORTING
    FID               = '0001'
    FLANGUAGE         = 'E'
    FNAME             = '0060000049000010'  " SO Number + Item no Preceeding Zeros
    FOBJECT           = 'VBBP'
  TABLES
    FLINES            = TD_LINES
 EXCEPTIONS
   NO_INIT           = 1
   NO_SAVE           = 2
   OTHERS            = 3.

IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Regards,

Suneel G

Read only

0 Likes
1,962

Hi,

Thank you very much, definitely I will include this function module on my program code... I've been in some other forums and it point me to use create_text function module... But since this is my first time to use this function module, I hope that you can still guide me once I encounter some problem in using it...

God Bless....

Read only

0 Likes
1,962

Hi ,

Mean while try post total code, so that it will be easy for me and tell you where and how to change.

Other than issue Try to use Meaning ful Subject from Here after.

Regards,

Suneel G

Read only

0 Likes
1,962

Hi,

I tried to use the code you've sent to me (FM READ_TEXT and CREATE_TEXT) but if I tried to debug the program, it has no value at all..How could I possibly send you the total code (as it exceeds the allowed number of character when pasted here) can you post your email address please for me to send my program code?

Thanks in advance

Read only

0 Likes
1,962

Hi Deo Pasion,

Which FM is not having values either READ_TEXT or CREATE_TEXT.

How did you code it.

Regards,

Suneel G

Read only

Former Member
0 Likes
1,963

Deo,

READ_TEXT will not retrieve anything as you have yet to create the sales order. My advice would be to create the sales order then call the FM CREATE_TEXT.

Cheers,

Neil.

Read only

0 Likes
1,962

Hi,

Thanks for your quick reply.. Before the line calling the FM CREATE_TEXT, SO has already been created (earlier part of my program)... supplied ID='0001'; LANG='EN'; NAME=SO number created; OBJECT='VBK'.

Best regards,

Read only

0 Likes
1,962

Deo,

I am not too sure what you mean. Can you send me a snippet of your code where you are creating the text for the SO?

Thanks,

Neil.

Read only

0 Likes
1,962

Hi Neil,

Below is my source code calling TCODE VA01 before it calls FM CREATE_TEXT..If you'll notice I also used hardcode for TABLES FLINES just fo testing purposes..

Thank you so much and God Bless.

  • Run batch input program

LOOP AT it_ordhdr.

CLEAR dc_kunnr. "aza 01Nov 2008

CONCATENATE '0000' it_ordhdr-kunnr INTO dc_kunnr. "aza 01Nov 2008

REFRESH it_bdc.

*Check if PO exists

READ TABLE it_po WITH KEY bstnk = it_ordhdr-bstkd "Order Date

kunnr = dc_kunnr. "Sold To Customer "aza 01Nov 2008

IF sy-subrc NE 0.

PERFORM gen_bdc_rec USING:

'X' 'SAPMV45A' '0101',

' ' 'VBAK-AUART' it_ordhdr-auart,

' ' 'VBAK-VKORG' it_ordhdr-vkorg,

' ' 'VBAK-VTWEG' it_ordhdr-vtweg,

' ' 'VBAK-SPART' it_ordhdr-spart,

' ' 'BDC_OKCODE' '/00'.

CLEAR di_ctr. "aza 29Oct 2008

PERFORM generate_bdcdata.

PERFORM gen_bdc_rec USING:

'X' 'SAPMV45A' '4001',

' ' 'BDC_OKCODE' '=SICH'.

CALL TRANSACTION 'VA01' USING it_bdc MODE dismode

UPDATE updmode

MESSAGES INTO it_msg.

MOVE-CORRESPONDING it_ordhdr TO it_hdrpro.

APPEND it_hdrpro.

CLEAR it_hdrpro.

  • Create filename for download

  • dc_path = 'C:\PIDO_GATEWAY\GATEWAY\DATAS\PROCESSED\'. "dvp 08June 2009

dc_path = '
192.168.1.103\EXPORT\PROCESSED\'. "dvp 08June 2009

CONCATENATE dc_path it_dtl-file INTO sofile.

PERFORM create_filename.

ENDIF.

ENDLOOP.

  • WRITE: / it_dtl-file, it_dtl-result.

ENDIF.

ENDLOOP.

  • Get sales orders create today

PERFORM get_so.

  • Check if there are records

DESCRIBE TABLE it_vbak LINES di_recrd.

IF di_recrd < 1.

EXIT.

ELSE.

  • Get picklist created today

PERFORM get_picklist.

  • Process data

PERFORM process_data.

*Update internal table for ALV

REFRESH it_lips.

CLEAR it_lips.

PERFORM get_picklist.

LOOP AT it_lips.

SELECT vbeln "Picklist No

posnr "Item No

matnr "Material No

lfimg "Delivery Qty

vgbel "S.O. no

  • INTO CORRESPONDING FIELDS OF it_lips1 "dvp 08June 2009

INTO TABLE it_lips1 "dvp 08June 2009

FROM lips

WHERE lips~vbeln EQ it_lips-vbeln.

APPEND it_lips1.

  • ENDSELECT. "dvp 08June 2009

ENDLOOP.

LOOP AT it_ordpro.

CLEAR dc_kunnr. "aza 01Nov 2008

CONCATENATE '0000' it_ordpro-kunnr INTO dc_kunnr. "aza 01Nov 2008

READ TABLE it_vbak WITH KEY bstnk = it_ordpro-bstkd

kunnr = dc_kunnr. "aza 01Nov 2008

IF sy-subrc EQ 0.

it_ordpro-sonum = it_vbak-vbeln. "aza 01Nov 2008

READ TABLE it_lips1 WITH KEY vgbel = it_vbak-vbeln.

IF sy-subrc EQ 0.

it_ordpro-vbeln = it_lips1-vbeln.

  • MODIFY it_ordpro. "aza 01Nov 2008

  • CLEAR it_ordpro. "aza 01Nov 2008

ENDIF.

MODIFY it_ordpro. "aza 01Nov 2008

CLEAR it_ordpro. "aza 01Nov 2008

ENDIF.

ENDLOOP.

  • Update picklist instructions

DATA dc_header LIKE thead-tdname. "aza 03Nov 2008

DATA dc_header1 LIKE thead. "dvp 10June 2009

DATA: FHEADER LIKE THEAD.

DATA: BEGIN OF TLINETAB OCCURS 10.

INCLUDE STRUCTURE TLINE.

DATA: END OF TLINETAB.

CLEAR dc_header.

LOOP AT it_ordpro WHERE sonum IS NOT INITIAL "aza 03Nov 2008

AND pkins IS NOT INITIAL. "dvp 10June 2009

  • CONCATENATE it_ordpro-sonum it_ordpro-posnr INTO dc_header. "(SO No; Line No.)

dc_header = it_ordpro-sonum.

  • tlinetab-tdline = it_ordpro-pkins.

tlinetab-tdline = 'testing text lang to'.

tlinetab-tdformat = '10'.

APPEND tlinetab.

CLEAR tlinetab.

CALL FUNCTION 'CREATE_TEXT'

EXPORTING

FID = '0001'

FLANGUAGE = 'E'

FNAME = 'dc_header'

FOBJECT = 'VBBK'

SAVE_DIRECT = 'X'

  • FFORMAT = '*'

TABLES

FLINES = tlinetab

EXCEPTIONS

NO_INIT = 1

NO_SAVE = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Read only

0 Likes
1,962

Hi Deo,

CALL FUNCTION 'CREATE_TEXT'
                EXPORTING
                  FID               = '0001'
                  FLANGUAGE         = 'E'
                  FNAME             = 'dc_header'  "----> Remove '' and Check ... Pass it like dc_header
                  FOBJECT           = 'VBBK'
                  SAVE_DIRECT       = 'X'
*                  FFORMAT           = '*'
                TABLES
                  FLINES            = tlinetab
                EXCEPTIONS
                   NO_INIT           = 1
                   NO_SAVE           = 2
                   OTHERS            = 3
          .
              IF SY-SUBRC <> 0.
*                     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*                             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
              ENDIF.

Regards,

Suneel G